Bug 1254956 - Implement Node.rootNode. r=Ms2ger,smaug
authorJocelyn Liu <joliu@mozilla.com>
Wed, 16 Mar 2016 09:49:10 +0800
changeset 289644 3bc53f14f51ed89084925e091c90673c42a50a05
parent 289643 6eadbc6c9876326c3814ccc8c089c13de88eeeec
child 289645 de0a178499e2d31d885c4ab72ee8457f325b9e2f
push id30108
push usercbook@mozilla.com
push dateTue, 22 Mar 2016 11:14:31 +0000
treeherdermozilla-central@ea6298e1b4f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger, smaug
bugs1254956
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1254956 - Implement Node.rootNode. r=Ms2ger,smaug MozReview-Commit-ID: HeV3qnngbTx
dom/base/nsINode.h
dom/webidl/Node.webidl
testing/web-platform/meta/dom/interfaces.html.ini
testing/web-platform/meta/dom/nodes/rootNode.html.ini
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -938,16 +938,21 @@ public:
 
   /**
    * Get the root of the subtree this node belongs to.  This never returns
    * null.  It may return 'this' (e.g. for document nodes, and nodes that
    * are the roots of disconnected subtrees).
    */
   nsINode* SubtreeRoot() const;
 
+  nsINode* RootNode() const
+  {
+    return SubtreeRoot();
+  }
+
   /**
    * See nsIDOMEventTarget
    */
   NS_DECL_NSIDOMEVENTTARGET
 
   virtual mozilla::EventListenerManager*
     GetExistingListenerManager() const override;
   virtual mozilla::EventListenerManager*
--- a/dom/webidl/Node.webidl
+++ b/dom/webidl/Node.webidl
@@ -32,16 +32,18 @@ interface Node : EventTarget {
   readonly attribute DOMString nodeName;
 
   [Pure]
   readonly attribute DOMString? baseURI;
 
   [Pure]
   readonly attribute Document? ownerDocument;
   [Pure]
+  readonly attribute Node rootNode;
+  [Pure]
   readonly attribute Node? parentNode;
   [Pure]
   readonly attribute Element? parentElement;
   [Pure]
   boolean hasChildNodes();
   [SameObject]
   readonly attribute NodeList childNodes;
   [Pure]
--- a/testing/web-platform/meta/dom/interfaces.html.ini
+++ b/testing/web-platform/meta/dom/interfaces.html.ini
@@ -286,28 +286,16 @@
     expected: FAIL
 
   [DOMTokenList interface: document.body.classList must inherit property "supports" with the proper type (7)]
     expected: FAIL
 
   [DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError]
     expected: FAIL
 
-  [Node interface: attribute rootNode]
-    expected: FAIL
-
-  [Node interface: xmlDoc must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
-  [Node interface: document.createDocumentFragment() must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
-  [Node interface: document.doctype must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
   [Element interface: element must inherit property "prepend" with the proper type (32)]
     expected: FAIL
 
   [Element interface: element must inherit property "append" with the proper type (33)]
     expected: FAIL
 
   [Element interface: element must inherit property "query" with the proper type (34)]
     expected: FAIL
@@ -319,20 +307,8 @@
     expected: FAIL
 
   [Element interface: element must inherit property "after" with the proper type (41)]
     expected: FAIL
 
   [Element interface: element must inherit property "replaceWith" with the proper type (42)]
     expected: FAIL
 
-  [Node interface: element must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
-  [Node interface: document.createTextNode("abc") must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
-  [Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
-  [Node interface: document.createComment("abc") must inherit property "rootNode" with the proper type (16)]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/dom/nodes/rootNode.html.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[rootNode.html]
-  type: testharness
-  [rootNode attribute must return the context object when it does not have any parent]
-    expected: FAIL
-
-  [rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document]
-    expected: FAIL
-
-  [rootNode attribute must return the document when a node is in document]
-    expected: FAIL
-
-  [rootNode attribute must return a document fragment when a node is in the fragment]
-    expected: FAIL
-