diff options
13 files changed, 218 insertions, 104 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 4a8cc573416..d5b70f6c3d7 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2049,9 +2049,10 @@ class CGImports(CGWrapper): if name != 'GlobalScope': extras += [descriptor.path] parentName = descriptor.getParentName() - if parentName: + while parentName: descriptor = descriptorProvider.getDescriptor(parentName) extras += [descriptor.path, descriptor.bindingPath] + parentName = descriptor.getParentName() elif t.isType() and t.isRecord(): extras += ['crate::dom::bindings::mozmap::MozMap'] elif isinstance(t, IDLPromiseType): @@ -3662,6 +3663,7 @@ class CGDefaultToJSONMethod(CGSpecializedMethod): def definition_body(self): ret = dedent(""" + use crate::dom::bindings::inheritance::HasParent; rooted!(in(*cx) let result = JS_NewPlainObject(*cx)); if result.is_null() { return false; @@ -3676,16 +3678,19 @@ class CGDefaultToJSONMethod(CGSpecializedMethod): jsonDescriptors.append(descriptor) interface = interface.parent + parents = len(jsonDescriptors) - 1 form = """ - if !${parentclass}CollectJSONAttributes(cx, _obj, this, &result) { + if !${parentclass}CollectJSONAttributes(cx, _obj, this${asparent}, &result) { return false; } """ # Iterate the array in reverse: oldest ancestor first for descriptor in jsonDescriptors[:0:-1]: - ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::") - ret += fill(form, parentclass="") + ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::", + asparent=".as_ref().unwrap()" + ".as_parent()" * parents) + parents -= 1 + ret += fill(form, parentclass="", asparent="") ret += ('(*args).rval().set(ObjectValue(*result));\n' 'return true;\n') return CGGeneric(ret) diff --git a/components/script/dom/webidls/Performance.webidl b/components/script/dom/webidls/Performance.webidl index 77bca4392e7..0e2f7a960d5 100644 --- a/components/script/dom/webidls/Performance.webidl +++ b/components/script/dom/webidls/Performance.webidl @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /* * The origin of this IDL file is - * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#sec-window.performance-attribute + * https://w3c.github.io/hr-time/#sec-performance */ typedef double DOMHighResTimeStamp; @@ -13,7 +13,7 @@ typedef sequence<PerformanceEntry> PerformanceEntryList; interface Performance : EventTarget { DOMHighResTimeStamp now(); readonly attribute DOMHighResTimeStamp timeOrigin; - // [Default] object toJSON(); + [Default] object toJSON(); }; // https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface diff --git a/components/script/dom/webidls/PerformanceEntry.webidl b/components/script/dom/webidls/PerformanceEntry.webidl index 23f2f9c155a..5f6fee1cabd 100644 --- a/components/script/dom/webidls/PerformanceEntry.webidl +++ b/components/script/dom/webidls/PerformanceEntry.webidl @@ -12,6 +12,5 @@ interface PerformanceEntry { readonly attribute DOMString entryType; readonly attribute DOMHighResTimeStamp startTime; readonly attribute DOMHighResTimeStamp duration; - - // [Default] object toJSON(); + [Default] object toJSON(); }; diff --git a/components/script/dom/webidls/PerformanceNavigation.webidl b/components/script/dom/webidls/PerformanceNavigation.webidl index 5a1ccba61f1..3e5cba196f6 100644 --- a/components/script/dom/webidls/PerformanceNavigation.webidl +++ b/components/script/dom/webidls/PerformanceNavigation.webidl @@ -14,5 +14,5 @@ interface PerformanceNavigation { const unsigned short TYPE_RESERVED = 255; readonly attribute unsigned short type; readonly attribute unsigned short redirectCount; - // [Default] object toJSON(); + [Default] object toJSON(); }; diff --git a/components/script/dom/webidls/PerformanceNavigationTiming.webidl b/components/script/dom/webidls/PerformanceNavigationTiming.webidl index 0d2c808105b..5e369b4eb91 100644 --- a/components/script/dom/webidls/PerformanceNavigationTiming.webidl +++ b/components/script/dom/webidls/PerformanceNavigationTiming.webidl @@ -25,7 +25,7 @@ interface PerformanceNavigationTiming : PerformanceResourceTiming { readonly attribute DOMHighResTimeStamp loadEventEnd; readonly attribute NavigationType type; readonly attribute unsigned short redirectCount; - // [Default] object toJSON(); + [Default] object toJSON(); /* Servo-only attribute for measuring when the top-level document (not iframes) is complete. */ [Pref="dom.testperf.enabled"] readonly attribute DOMHighResTimeStamp topLevelDomComplete; diff --git a/components/script/dom/webidls/PerformanceResourceTiming.webidl b/components/script/dom/webidls/PerformanceResourceTiming.webidl index acf1682e800..e4f73197a8c 100644 --- a/components/script/dom/webidls/PerformanceResourceTiming.webidl +++ b/components/script/dom/webidls/PerformanceResourceTiming.webidl @@ -26,5 +26,5 @@ interface PerformanceResourceTiming : PerformanceEntry { /// readonly attribute unsigned long long transferSize; /// readonly attribute unsigned long long encodedBodySize; /// readonly attribute unsigned long long decodedBodySize; - // [Default] object toJSON(); + [Default] object toJSON(); }; diff --git a/tests/wpt/metadata/hr-time/idlharness.any.js.ini b/tests/wpt/metadata/hr-time/idlharness.any.js.ini index baed1c98c0b..154f6beb894 100644 --- a/tests/wpt/metadata/hr-time/idlharness.any.js.ini +++ b/tests/wpt/metadata/hr-time/idlharness.any.js.ini @@ -1,20 +1,3 @@ -[idlharness.any.html] - [idlharness] - expected: FAIL - - [Performance interface: operation toJSON()] - expected: FAIL - - [Performance interface: performance must inherit property "toJSON()" with the proper type] - expected: FAIL - - [Test default toJSON operation of Performance] - expected: FAIL - - [Performance interface: default toJSON operation on performance] - expected: FAIL - - [idlharness.any.serviceworker.html] [idlharness] expected: FAIL @@ -30,20 +13,3 @@ [idlharness] expected: FAIL - -[idlharness.any.worker.html] - [idlharness] - expected: FAIL - - [Performance interface: operation toJSON()] - expected: FAIL - - [Performance interface: performance must inherit property "toJSON()" with the proper type] - expected: FAIL - - [Test default toJSON operation of Performance] - expected: FAIL - - [Performance interface: default toJSON operation on performance] - expected: FAIL - diff --git a/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini b/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini index 8788f435cb6..8dd01ef19fa 100644 --- a/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini +++ b/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini @@ -1,2 +1,204 @@ [idlharness.window.html] - disabled: https://github.com/servo/servo/issues/21274
\ No newline at end of file + [PerformanceNavigationTiming must be primary interface of performance.getEntriesByType("navigation")[0\]] + expected: FAIL + + [Stringification of performance.getEntriesByType("navigation")[0\]] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "unloadEventStart" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "unloadEventEnd" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domInteractive" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domContentLoadedEventStart" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domContentLoadedEventEnd" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domComplete" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "loadEventStart" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "loadEventEnd" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "type" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "redirectCount" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "toJSON()" with the proper type] + expected: FAIL + + [PerformanceNavigationTiming interface: default toJSON operation on performance.getEntriesByType("navigation")[0\]] + expected: FAIL + + [PerformanceTiming interface: existence and properties of interface object] + expected: FAIL + + [PerformanceTiming interface object length] + expected: FAIL + + [PerformanceTiming interface object name] + expected: FAIL + + [PerformanceTiming interface: existence and properties of interface prototype object] + expected: FAIL + + [PerformanceTiming interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [PerformanceTiming interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [PerformanceTiming interface: attribute navigationStart] + expected: FAIL + + [PerformanceTiming interface: attribute unloadEventStart] + expected: FAIL + + [PerformanceTiming interface: attribute unloadEventEnd] + expected: FAIL + + [PerformanceTiming interface: attribute redirectStart] + expected: FAIL + + [PerformanceTiming interface: attribute redirectEnd] + expected: FAIL + + [PerformanceTiming interface: attribute fetchStart] + expected: FAIL + + [PerformanceTiming interface: attribute domainLookupStart] + expected: FAIL + + [PerformanceTiming interface: attribute domainLookupEnd] + expected: FAIL + + [PerformanceTiming interface: attribute connectStart] + expected: FAIL + + [PerformanceTiming interface: attribute connectEnd] + expected: FAIL + + [PerformanceTiming interface: attribute secureConnectionStart] + expected: FAIL + + [PerformanceTiming interface: attribute requestStart] + expected: FAIL + + [PerformanceTiming interface: attribute responseStart] + expected: FAIL + + [PerformanceTiming interface: attribute responseEnd] + expected: FAIL + + [PerformanceTiming interface: attribute domLoading] + expected: FAIL + + [PerformanceTiming interface: attribute domInteractive] + expected: FAIL + + [PerformanceTiming interface: attribute domContentLoadedEventStart] + expected: FAIL + + [PerformanceTiming interface: attribute domContentLoadedEventEnd] + expected: FAIL + + [PerformanceTiming interface: attribute domComplete] + expected: FAIL + + [PerformanceTiming interface: attribute loadEventStart] + expected: FAIL + + [PerformanceTiming interface: attribute loadEventEnd] + expected: FAIL + + [PerformanceTiming interface: operation toJSON()] + expected: FAIL + + [PerformanceTiming must be primary interface of performance.timing] + expected: FAIL + + [Stringification of performance.timing] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "navigationStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "unloadEventStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "unloadEventEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "redirectStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "redirectEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "fetchStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domainLookupStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domainLookupEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "connectStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "connectEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "secureConnectionStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "requestStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "responseStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "responseEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domLoading" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domInteractive" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domContentLoadedEventStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domContentLoadedEventEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "domComplete" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "loadEventStart" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "loadEventEnd" with the proper type] + expected: FAIL + + [PerformanceTiming interface: performance.timing must inherit property "toJSON()" with the proper type] + expected: FAIL + + [PerformanceTiming interface: default toJSON operation on performance.timing] + expected: FAIL + + [Performance interface: attribute timing] + expected: FAIL diff --git a/tests/wpt/metadata/performance-timeline/idlharness.any.js.ini b/tests/wpt/metadata/performance-timeline/idlharness.any.js.ini index fada08d8be5..98ad19e3cc8 100644 --- a/tests/wpt/metadata/performance-timeline/idlharness.any.js.ini +++ b/tests/wpt/metadata/performance-timeline/idlharness.any.js.ini @@ -7,18 +7,12 @@ [idlharness.any.worker.html] - [PerformanceEntry interface: operation toJSON()] - expected: FAIL - [PerformanceObserver interface: operation takeRecords()] expected: FAIL [PerformanceObserver interface: observer must inherit property "takeRecords()" with the proper type] expected: FAIL - [PerformanceEntry interface: mark must inherit property "toJSON()" with the proper type] - expected: FAIL - [Test default toJSON operation of PerformanceMark] expected: FAIL @@ -34,9 +28,6 @@ [PerformanceMark interface object length] expected: FAIL - [PerformanceEntry interface: default toJSON operation on mark] - expected: FAIL - [PerformanceObserver interface: operation observe(PerformanceObserverInit)] expected: FAIL @@ -45,18 +36,12 @@ [Untitled] expected: FAIL - [PerformanceEntry interface: operation toJSON()] - expected: FAIL - [PerformanceObserver interface: operation takeRecords()] expected: FAIL [PerformanceObserver interface: observer must inherit property "takeRecords()" with the proper type] expected: FAIL - [PerformanceEntry interface: mark must inherit property "toJSON()" with the proper type] - expected: FAIL - [Test default toJSON operation of PerformanceMark] expected: FAIL @@ -72,9 +57,6 @@ [PerformanceMark interface object length] expected: FAIL - [PerformanceEntry interface: default toJSON operation on mark] - expected: FAIL - [PerformanceObserver interface: operation observe(PerformanceObserverInit)] expected: FAIL diff --git a/tests/wpt/metadata/performance-timeline/performanceentry-tojson.any.js.ini b/tests/wpt/metadata/performance-timeline/performanceentry-tojson.any.js.ini deleted file mode 100644 index bcac23d42fd..00000000000 --- a/tests/wpt/metadata/performance-timeline/performanceentry-tojson.any.js.ini +++ /dev/null @@ -1,12 +0,0 @@ -[performanceentry-tojson.any.html] - [performanceentry-tojson] - expected: FAIL - [Test toJSON() in PerformanceEntry] - expected: FAIL - -[performanceentry-tojson.any.worker.html] - [performanceentry-tojson] - expected: FAIL - [Test toJSON() in PerformanceEntry] - expected: FAIL - diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini index 2145ca938b4..7b28dbebd4e 100644 --- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini +++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini @@ -11,12 +11,6 @@ [Stringification of resource] expected: FAIL - [Test default toJSON operation of PerformanceNavigationTiming] - expected: FAIL - - [PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type] - expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type] expected: FAIL @@ -26,9 +20,6 @@ [PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type] expected: FAIL - [PerformanceResourceTiming interface: operation toJSON()] - expected: FAIL - [PerformanceResourceTiming must be primary interface of resource] expected: FAIL @@ -61,9 +52,6 @@ [PerformanceResourceTiming interface: attribute transferSize] expected: FAIL - [Test default toJSON operation of toJSON object] - expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "secureConnectionStart" with the proper type] expected: FAIL @@ -73,9 +61,6 @@ [PerformanceResourceTiming interface: attribute decodedBodySize] expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type] - expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "domainLookupEnd" with the proper type] expected: FAIL @@ -88,9 +73,6 @@ [PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type] expected: FAIL - [PerformanceResourceTiming interface: operation toJSON()] - expected: FAIL - [PerformanceResourceTiming interface: attribute secureConnectionStart] expected: FAIL diff --git a/tests/wpt/metadata/resource-timing/resource-timing-tojson.html.ini b/tests/wpt/metadata/resource-timing/resource-timing-tojson.html.ini deleted file mode 100644 index 402fec6118d..00000000000 --- a/tests/wpt/metadata/resource-timing/resource-timing-tojson.html.ini +++ /dev/null @@ -1,7 +0,0 @@ -[resource-timing-tojson.html] - [Untitled] - expected: FAIL - - [Test toJSON() in PerformanceResourceTiming] - expected: FAIL - diff --git a/tests/wpt/metadata/workers/worker-performance.worker.js.ini b/tests/wpt/metadata/workers/worker-performance.worker.js.ini index 0b39b36c761..bbacc75018a 100644 --- a/tests/wpt/metadata/workers/worker-performance.worker.js.ini +++ b/tests/wpt/metadata/workers/worker-performance.worker.js.ini @@ -12,9 +12,6 @@ [Resource timing seems to work in workers] expected: FAIL - [performance.toJSON is available in workers] - expected: FAIL - [performance.clearResourceTimings in workers] expected: FAIL |