Bug 1596800 - Remove document.getAnonymousNodes as well. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 18 Nov 2019 19:15:16 +0000
changeset 502476 ba115d212e18bad5168af1ae0541c44de1a20089
parent 502475 26d109ef85da49b7f113e65c61908dbb5d7ea846
child 502477 91697065e99f5b88ceaaf92af99ebdbbfc1dda88
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1596800
milestone72.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 1596800 - Remove document.getAnonymousNodes as well. r=smaug As it always returns null. Depends on D53342 Differential Revision: https://phabricator.services.mozilla.com/D53343
browser/components/preferences/in-content/findInPage.js
devtools/server/actors/inspector/node.js
dom/base/Document.cpp
dom/base/Document.h
dom/base/crashtests/308120-1.xul
dom/base/crashtests/330925-1.xhtml
dom/base/crashtests/crashtests.list
dom/webidl/Document.webidl
dom/xul/crashtests/384740-1.xul
dom/xul/crashtests/crashtests.list
dom/xul/nsXULPopupListener.cpp
js/xpconnect/crashtests/471366-1.html
js/xpconnect/crashtests/crashtests.list
js/xpconnect/tests/mochitest/test_bug912322.html
layout/xul/crashtests/328135-1.xhtml
layout/xul/crashtests/crashtests.list
--- a/browser/components/preferences/in-content/findInPage.js
+++ b/browser/components/preferences/in-content/findInPage.js
@@ -389,22 +389,16 @@ var gSearchResultsPane = {
       }
 
       // Collecting data from anonymous content / label / description
       let nodeSizes = [];
       let allNodeText = "";
       let runningSize = 0;
 
       let accessKeyTextNodes = [];
-      let anons = document.getAnonymousNodes(nodeObject);
-      if (anons) {
-        for (let anon of anons) {
-          accessKeyTextNodes.push(...this.textNodeDescendants(anon));
-        }
-      }
 
       if (
         nodeObject.tagName == "label" ||
         nodeObject.tagName == "description"
       ) {
         accessKeyTextNodes.push(...simpleTextNodes);
       }
 
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -333,35 +333,30 @@ const NodeActor = protocol.ActorClassWit
       isBeforePseudoElement(this.rawNode) ||
       isAfterPseudoElement(this.rawNode)
     ) {
       return 0;
     }
 
     const rawNode = this.rawNode;
     let numChildren = rawNode.childNodes.length;
-    const hasAnonChildren =
-      rawNode.nodeType === Node.ELEMENT_NODE &&
-      rawNode.ownerDocument.getAnonymousNodes(rawNode);
-
     const hasContentDocument = rawNode.contentDocument;
     const hasSVGDocument = rawNode.getSVGDocument && rawNode.getSVGDocument();
     if (numChildren === 0 && (hasContentDocument || hasSVGDocument)) {
       // This might be an iframe with virtual children.
       numChildren = 1;
     }
 
     // Normal counting misses ::before/::after.  Also, some anonymous children
     // may ultimately be skipped, so we have to consult with the walker.
     //
     // FIXME: We should be able to just check <slot> rather than
     // containingShadowRoot.
     if (
       numChildren === 0 ||
-      hasAnonChildren ||
       isShadowHost(this.rawNode) ||
       this.rawNode.containingShadowRoot
     ) {
       numChildren = this.walker.countChildren(this);
     }
 
     return numChildren;
   },
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -7796,18 +7796,16 @@ already_AddRefed<nsINode> Document::Impo
       NS_WARNING("Don't know how to clone this nodetype for importNode.");
     }
   }
 
   rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
   return nullptr;
 }
 
-nsINodeList* Document::GetAnonymousNodes(Element& aElement) { return nullptr; }
-
 already_AddRefed<nsRange> Document::CreateRange(ErrorResult& rv) {
   RefPtr<nsRange> range = new nsRange(this);
   nsresult res = range->CollapseTo(this, 0);
   if (NS_FAILED(res)) {
     rv.Throw(res);
     return nullptr;
   }
 
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -3699,17 +3699,16 @@ class Document : public nsINode,
   Element* GetScrollingElement();
   // A way to check whether a given element is what would get returned from
   // GetScrollingElement.  It can be faster than comparing to the return value
   // of GetScrollingElement() due to being able to avoid flushes in various
   // cases.  This method assumes that null is NOT passed.
   bool IsScrollingElement(Element* aElement);
 
   // QuerySelector and QuerySelectorAll already defined on nsINode
-  nsINodeList* GetAnonymousNodes(Element& aElement);
 
   XPathExpression* CreateExpression(const nsAString& aExpression,
                                     XPathNSResolver* aResolver,
                                     ErrorResult& rv);
   nsINode* CreateNSResolver(nsINode& aNodeResolver);
   already_AddRefed<XPathResult> Evaluate(
       JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
       XPathNSResolver* aResolver, uint16_t aType, JS::Handle<JSObject*> aResult,
deleted file mode 100644
--- a/dom/base/crashtests/308120-1.xul
+++ /dev/null
@@ -1,3 +0,0 @@
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="var button=document.getElementsByTagName('button')[0]; try { button.appendChild(SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(button))[0]); } catch(e) { }">
-  <button/>
-</window>
deleted file mode 100644
--- a/dom/base/crashtests/330925-1.xhtml
+++ /dev/null
@@ -1,35 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
-
-<head>
-
-<script>
-
-function init()
-{
-  var foopy = document.getElementById("foopy");
-  var emb = document.getElementById("emb");
-
-  try {  
-    foopy.appendChild(SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(emb))[0]);
-    emb.parentNode.removeChild(emb);
-    foopy.parentNode.removeChild(foopy);
-  } catch (e) {
-  }
-  
-  document.documentElement.removeAttribute("class");
-}
-
-
-window.addEventListener("load", function() { setTimeout(init, 30); }, false);
-
-</script>
-
-</head>
-<body> 
-
-<div id="foopy"/>
-
-<embed src="data:foo/bar,baz" id="emb" />
-
-</body>
-</html>
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -2,26 +2,24 @@ load 43040-1.html
 load 90613-1.html
 load 116848-1.html
 load 149320-1.html
 load 205225-1.html
 load 231475-1.html
 load 244933-1.html
 load 275912-1.html
 load 293388-1.html
-load chrome://reftest/content/crashtests/dom/base/crashtests/308120-1.xul
 load 325730-1.html
 load 326618-1.html
 load 326646-1.html
 load 326865-1.html
 load 327571-1.html
 load 327694.html
 load 327695-1.html
 load 329481-1.xhtml
-load 330925-1.xhtml
 load 336381-1.xhtml
 load 336715-1.xhtml
 load 338391-1.xhtml
 load 338674-1.xhtml
 load 340733-1.html
 load 343730-1.xhtml
 load 343850-1.xhtml
 load 343889-1.html
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -372,19 +372,16 @@ partial interface Document {
 // https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions
 partial interface Document {
   [BinaryName="SVGRootElement"]
   readonly attribute SVGSVGElement? rootElement;
 };
 
 //  Mozilla extensions of various sorts
 partial interface Document {
-  // XBL support.
-  [Func="IsChromeOrXBL"]
-  NodeList? getAnonymousNodes(Element elt);
   // Creates a new XUL element regardless of the document's default type.
   [CEReactions, NewObject, Throws, Func="IsChromeOrXBL"]
   Element createXULElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});
   // Wether the document was loaded using a nsXULPrototypeDocument.
   [ChromeOnly]
   readonly attribute boolean loadedFromPrototype;
 
   // The principal to use for the storage area of this document
deleted file mode 100644
--- a/dom/xul/crashtests/384740-1.xul
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="boom()">
-
-<script>
-
-function boom()
-{
-  var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
-  var scrollbar = document.createElementNS(XUL_NS, 'scrollbar');
-  document.documentElement.appendChild(scrollbar);
-  var sbb = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(scrollbar))[0];
-  var action = document.createElementNS(XUL_NS, 'action');
-  action.setAttribute('datasources', "");
-  sbb.appendChild(action);
-}
-
-</script>
-
-</window>
--- a/dom/xul/crashtests/crashtests.list
+++ b/dom/xul/crashtests/crashtests.list
@@ -4,15 +4,14 @@ load chrome://reftest/content/crashtests
 load chrome://reftest/content/crashtests/dom/xul/crashtests/326204-1.xul
 load 326644-1.html
 load chrome://reftest/content/crashtests/dom/xul/crashtests/326875-1.xul
 load 329982-1.xhtml
 load 336096-1.xhtml
 load chrome://reftest/content/crashtests/dom/xul/crashtests/344215-1.xul
 load 354611-1.html
 load chrome://reftest/content/crashtests/dom/xul/crashtests/363791-1.xul
-load chrome://reftest/content/crashtests/dom/xul/crashtests/384740-1.xul
 load 384877-1.html
 load 386914-1.html
 load chrome://reftest/content/crashtests/dom/xul/crashtests/425821-1.xul
 load chrome://reftest/content/crashtests/dom/xul/crashtests/428951-1.xul
 load 431906-1.html
 load 461917-1.xhtml
--- a/dom/xul/nsXULPopupListener.cpp
+++ b/dom/xul/nsXULPopupListener.cpp
@@ -306,30 +306,16 @@ nsresult nsXULPopupListener::LaunchPopup
     NS_WARNING("No document!");
     return NS_ERROR_FAILURE;
   }
 
   // Handle the _child case for popups and context menus
   RefPtr<Element> popup;
   if (identifier.EqualsLiteral("_child")) {
     popup = GetImmediateChild(mElement, nsGkAtoms::menupopup);
-    if (!popup) {
-      nsINodeList* list = document->GetAnonymousNodes(*mElement);
-      if (list) {
-        uint32_t listLength = list->Length();
-        for (uint32_t ctr = 0; ctr < listLength; ctr++) {
-          nsIContent* childContent = list->Item(ctr);
-          if (childContent->NodeInfo()->Equals(nsGkAtoms::menupopup,
-                                               kNameSpaceID_XUL)) {
-            popup = childContent->AsElement();
-            break;
-          }
-        }
-      }
-    }
   } else if (!mElement->IsInUncomposedDoc() ||
              !(popup = document->GetElementById(identifier))) {
     // XXXsmaug Should we try to use ShadowRoot::GetElementById in case
     //          mElement is in shadow DOM?
     //
     // Use getElementById to obtain the popup content and gracefully fail if
     // we didn't find any popup content in the document.
     NS_WARNING("GetElementById had some kind of spasm.");
deleted file mode 100644
--- a/js/xpconnect/crashtests/471366-1.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script type="text/javascript">
-
-SpecialPowers.wrap(document).getAnonymousNodes({__proto__: XPCNativeWrapper.prototype});
-
-</script>
-</head>
-<body>
-</body>
-</html>
--- a/js/xpconnect/crashtests/crashtests.list
+++ b/js/xpconnect/crashtests/crashtests.list
@@ -10,17 +10,16 @@ load 386680-1.html
 load 394810-1.html
 load 400349-1.html
 load 403356-1.html
 load 418139-1.svg
 load 420513-1.html
 load 453935-1.html
 load 467693-1.html
 load 468552-1.html
-load 471366-1.html
 load 475185-1.html
 load 475291-1.html
 load 503286-1.html
 load 504000-1.html
 load 509075-1.html
 load 512815-1.html
 load 515726-1.html
 load 545291-1.html
--- a/js/xpconnect/tests/mochitest/test_bug912322.html
+++ b/js/xpconnect/tests/mochitest/test_bug912322.html
@@ -5,23 +5,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 912322</title>
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
-  /** Test that XBL functions aren't exposed to the web. **/
-  funs = ['getAnonymousNodes'];
-  for (var f of funs) {
-    ok(!(f in document), f + " should not be available to content");
-    ok(f in SpecialPowers.wrap(document), f + " should be available to chrome via Xray");
-  }
-
   var {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
   // Test window.controllers.
   if (AppConstants.RELEASE_OR_BETA) {
     is(typeof window.controllers, 'object', "shimmed controllers should be available to content in beta and release");
   } else {
     is(typeof window.controllers, 'undefined', "controllers should not be available to content in Nightly");
   }
   is(typeof SpecialPowers.wrap(window).controllers, 'object', "controllers should be available over Xray");
deleted file mode 100644
--- a/layout/xul/crashtests/328135-1.xhtml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-
-
-<script>
-
-function init() { 
-  var pop = document.getElementsByTagName("popup")[0];
-  SpecialPowers.wrap(document).getAnonymousNodes(pop)[0];
-  eval.eee = document.documentElement;
-};
-
-
-window.addEventListener("load", init, false);
-
-</script>
-
-<popup/>
-
-
-<tabbox/>
-
-
-</window>
--- a/layout/xul/crashtests/crashtests.list
+++ b/layout/xul/crashtests/crashtests.list
@@ -10,17 +10,16 @@ load chrome://reftest/content/crashtests
 load chrome://reftest/content/crashtests/layout/xul/crashtests/291702-2.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/291702-3.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/294371-1.xhtml
 load 311457-1.html
 load 321056-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/322786-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/325377.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/326879-1.xhtml
-load chrome://reftest/content/crashtests/layout/xul/crashtests/328135-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/329327-1.xhtml
 load 329407-1.xml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/336962-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/344228-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/350460.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/365151.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/366112-1.xhtml
 load chrome://reftest/content/crashtests/layout/xul/crashtests/366203-1.xhtml