diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 8055425976a..966662ba1d6 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2887,19 +2887,16 @@ impl NodeMethods for Node { /// fn GetRootNode(&self, options: &GetRootNodeOptions) -> DomRoot { - if let Some(shadow_root) = self.containing_shadow_root() { - return if options.composed { - // shadow-including root. - shadow_root.Host().upcast::().GetRootNode(options) - } else { - DomRoot::from_ref(shadow_root.upcast::()) - }; + if !options.composed { + if let Some(shadow_root) = self.containing_shadow_root() { + return DomRoot::upcast(shadow_root); + } } - if self.is_in_a_document_tree() { + if self.is_connected() { DomRoot::from_ref(self.owner_doc().upcast::()) } else { - self.inclusive_ancestors(ShadowIncluding::No) + self.inclusive_ancestors(ShadowIncluding::Yes) .last() .unwrap() } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3e5e5a9f27c..71e1069c16c 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -13496,14 +13496,14 @@ ] ], "interfaces.https.html": [ - "6c48986beea5c8aca4e54c6da0fb8f3b7a4390e0", + "81f4d942f94366d8f9ecf22cfc3e1e22fe4ab8f1", [ null, {} ] ], "interfaces.worker.js": [ - "4ac5c822dcc6fbb021050ac2ab2ba4d04452d945", + "06eb8d3ba2334951cb1e0f791527ba118d4f13ec", [ "mozilla/interfaces.worker.html", {} @@ -14337,6 +14337,15 @@ ] ] }, + "shadow-dom": { + "getrootnode-in-deeply-nested-shadow.html": [ + "355cc270e6020f40176afac26c49a14a59b67169", + [ + null, + {} + ] + ] + }, "webxr": { "create_session.https.html": [ "5b5d485b372bfffb22204bc162c9e182306395cb", diff --git a/tests/wpt/mozilla/meta/__dir__.ini b/tests/wpt/mozilla/meta/__dir__.ini new file mode 100644 index 00000000000..f69cd94922b --- /dev/null +++ b/tests/wpt/mozilla/meta/__dir__.ini @@ -0,0 +1 @@ +prefs: ["dom_imagebitmap_enabled:true", "dom_offscreen_canvas_enabled:true", "dom_shadowdom_enabled:true", "dom_xpath_enabled:true", "dom_intersection_observer_enabled:true", "dom_resize_observer_enabled:true", "dom_notification_enabled:true", "dom_fontface_enabled:true"] diff --git a/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom_layout_style.html.ini b/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom_layout_style.html.ini deleted file mode 100644 index 41cb9e4f9b0..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom_layout_style.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[partial_shadow_dom_layout_style.html] - expected: FAIL diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.https.html b/tests/wpt/mozilla/tests/mozilla/interfaces.https.html index 6c48986beea..81f4d942f94 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.https.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.https.html @@ -92,6 +92,7 @@ test_interfaces([ "FileList", "FileReader", "FocusEvent", + "FontFace", "FontFaceSet", "FormData", "FormDataEvent", @@ -181,7 +182,10 @@ test_interfaces([ "IIRFilterNode", "ImageData", "Image", + "ImageBitmap", "InputEvent", + "IntersectionObserver", + "IntersectionObserverEntry", "KeyboardEvent", "Location", "MediaElementAudioSourceNode", @@ -213,6 +217,8 @@ test_interfaces([ "Notification", "OfflineAudioCompletionEvent", "OfflineAudioContext", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", "Option", "OscillatorNode", "PageTransitionEvent", @@ -242,6 +248,9 @@ test_interfaces([ "ReadableByteStreamController", "ReadableStreamBYOBRequest", "Request", + "ResizeObserver", + "ResizeObserverEntry", + "ResizeObserverSize", "Response", "Screen", "SecurityPolicyViolationEvent", @@ -303,6 +312,9 @@ test_interfaces([ "XMLHttpRequestEventTarget", "XMLHttpRequestUpload", "XMLSerializer", + "XPathEvaluator", + "XPathExpression", + "XPathResult", "XRBoundedReferenceSpace", "XRFrame", "XRHand", diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js b/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js index 4ac5c822dcc..06eb8d3ba23 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js @@ -37,11 +37,14 @@ test_interfaces([ "FormData", "Headers", "History", + "ImageBitmap", "ImageData", "MessageChannel", "MessageEvent", "MessagePort", "Notification", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", "Performance", "PerformanceEntry", "PerformanceMark", diff --git a/tests/wpt/mozilla/tests/shadow-dom/getrootnode-in-deeply-nested-shadow.html b/tests/wpt/mozilla/tests/shadow-dom/getrootnode-in-deeply-nested-shadow.html new file mode 100644 index 00000000000..355cc270e60 --- /dev/null +++ b/tests/wpt/mozilla/tests/shadow-dom/getrootnode-in-deeply-nested-shadow.html @@ -0,0 +1,26 @@ + + + + + + + + + +