alphabetized frozen supported entry types on the global, avoid moving Heap into Option

This commit is contained in:
Patrick Shaughnessy 2020-02-05 18:32:42 -05:00
parent 4f36472b6f
commit e0b768c6cc
9 changed files with 66 additions and 49 deletions

View file

@ -18,19 +18,21 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::performance::PerformanceEntryList;
use crate::dom::performanceentry::PerformanceEntry;
use crate::dom::performanceobserverentrylist::PerformanceObserverEntryList;
use crate::script_runtime::JSContext;
use dom_struct::dom_struct;
use js::jsval::JSVal;
use std::cell::Cell;
use std::rc::Rc;
/// List of allowed performance entry types.
const VALID_ENTRY_TYPES: &'static [&'static str] = &[
/// List of allowed performance entry types, in alphabetical order.
pub const VALID_ENTRY_TYPES: &'static [&'static str] = &[
// "frame", //TODO Frame Timing API
"mark", // User Timing API
"measure", // User Timing API
"resource", // Resource Timing API
"navigation", // Navigation Timing API
// "frame", //TODO Frame Timing API
// "server", XXX Server Timing API
"paint", // Paint Timing API
"paint", // Paint Timing API
"resource", // Resource Timing API
// "server", XXX Server Timing API
];
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
@ -110,6 +112,14 @@ impl PerformanceObserver {
pub fn set_entries(&self, entries: DOMPerformanceEntryList) {
*self.entries.borrow_mut() = entries;
}
// https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute
#[allow(non_snake_case)]
pub fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope) -> JSVal {
// While this is exposed through a method of PerformanceObserver,
// it is specified as associated with the global scope.
global.supported_performance_entry_types(cx)
}
}
impl PerformanceObserverMethods for PerformanceObserver {