aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/performanceobserver.rs
diff options
context:
space:
mode:
authorPatrick Shaughnessy <pshaughn@comcast.net>2020-02-05 18:32:42 -0500
committerPatrick Shaughnessy <pshaughn@comcast.net>2020-02-14 11:34:51 -0500
commite0b768c6cc409e14cd81a749c64ce4a3711aeb75 (patch)
tree7831d1018aa447ceccda5ee717fcc27ad975d3fa /components/script/dom/performanceobserver.rs
parent4f36472b6fed75568c651cbbeecc6678791018a9 (diff)
downloadservo-e0b768c6cc409e14cd81a749c64ce4a3711aeb75.tar.gz
servo-e0b768c6cc409e14cd81a749c64ce4a3711aeb75.zip
alphabetized frozen supported entry types on the global, avoid moving Heap into Option
Diffstat (limited to 'components/script/dom/performanceobserver.rs')
-rw-r--r--components/script/dom/performanceobserver.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs
index e107c4a08d9..2b52c86e4f2 100644
--- a/components/script/dom/performanceobserver.rs
+++ b/components/script/dom/performanceobserver.rs
@@ -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 {