Bug 1482170 - Remove <Add/Remove>BroadcastListenerFor on XULDocument webidl. r=bz
authorBrendan Dahl <bdahl@mozilla.com>
Thu, 09 Aug 2018 09:18:40 -0700
changeset 486804 0097284827171bc1214caecd658832f393cb8bde
parent 486803 7915b80eca091d53838f20594e84ed543b1752f3
child 486805 3b64da67805357c5515858c37aceb7f2224a5bcf
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1482170, 445177
milestone63.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 1482170 - Remove <Add/Remove>BroadcastListenerFor on XULDocument webidl. r=bz These methods are only ever used in tests and no longer need to be exposed. In test_bug445177.xul I tried to preserve more of the test, but everything after the call to addBroadcastListenerFor is dependent on that. MozReview-Commit-ID: C4vAxNir4O8
devtools/shared/webconsole/test/test_bug819670_getter_throws.html
dom/webidl/XULDocument.webidl
dom/xul/XULDocument.h
dom/xul/test/test_bug445177.xul
--- a/devtools/shared/webconsole/test/test_bug819670_getter_throws.html
+++ b/devtools/shared/webconsole/test/test_bug819670_getter_throws.html
@@ -45,24 +45,24 @@ function onEvaluate(aState, aResponse)
   client.getPrototypeAndProperties(onInspect);
 }
 
 function onInspect(aState, aResponse)
 {
   ok(!aResponse.error, "no response error");
 
   let expectedProps = {
-    "addBroadcastListenerFor": { value: { type: "object" } },
+    "constructor": { value: { type: "object" } },
   };
 
   let props = aResponse.ownProperties;
   ok(props, "response properties available");
 
   if (props) {
-    ok(Object.keys(props).length > Object.keys(expectedProps).length,
+    ok(Object.keys(props).length == Object.keys(expectedProps).length,
        "number of enumerable properties");
     checkObject(props, expectedProps);
   }
 
   closeDebugger(aState, function() {
     SimpleTest.finish();
   });
 }
--- a/dom/webidl/XULDocument.webidl
+++ b/dom/webidl/XULDocument.webidl
@@ -5,14 +5,9 @@
  */
 
 interface XULCommandDispatcher;
 interface MozObserver;
 
 [Func="IsChromeOrXBL"]
 interface XULDocument : Document {
 
-  [Throws]
-  void addBroadcastListenerFor(Element broadcaster, Element observer,
-                               DOMString attr);
-  void removeBroadcastListenerFor(Element broadcaster, Element observer,
-                                  DOMString attr);
 };
--- a/dom/xul/XULDocument.h
+++ b/dom/xul/XULDocument.h
@@ -129,19 +129,16 @@ public:
     void ResetDocumentLWTheme() { mDocLWTheme = Doc_Theme_Uninitialized; }
 
     NS_IMETHOD OnScriptCompileComplete(JSScript* aScript, nsresult aStatus) override;
 
     NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULDocument, XMLDocument)
 
     void TraceProtos(JSTracer* aTrc);
 
-    // WebIDL API
-    void AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
-                                 const nsAString& aAttr, ErrorResult& aRv);
     void RemoveBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
                                     const nsAString& aAttr);
 
 protected:
     virtual ~XULDocument();
 
     // Implementation methods
     friend nsresult
@@ -168,16 +165,19 @@ protected:
                                                  nsCOMArray<Element>& aElements);
 
     nsresult
     AddElementToDocumentPre(Element* aElement);
 
     nsresult
     AddElementToDocumentPost(Element* aElement);
 
+    void AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
+                                 const nsAString& aAttr, ErrorResult& aRv);
+
     nsresult
     ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
                                  Element* aListener,
                                  nsAtom* aAttr);
 
     static void DirectionChanged(const char* aPrefName, XULDocument* aData);
 
     // pseudo constants
--- a/dom/xul/test/test_bug445177.xul
+++ b/dom/xul/test/test_bug445177.xul
@@ -50,35 +50,16 @@ https://bugzilla.mozilla.org/show_bug.cg
     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (7)");
 
     o1.remove();
     o1.removeAttribute("observes");
     o1.removeAttribute("value");
     b1.parentNode.appendChild(o1);
     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (8)");
 
-    document.addBroadcastListenerFor(b1, o1, "value");
-    is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (9)");
-
-    o1.remove();
-    b1.setAttribute("value", "foobar");
-    is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (10)");
-
-    b1.parentNode.appendChild(o1);
-    is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (11)");
-
-    o1.setAttribute("observes", "b1");
-    is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (12)");
-
-    // When broadcaster isn't in document, changes to its attributes aren't
-    // reflected to listener.
-    b1.remove();
-    b1.setAttribute("value", "foo");
-    isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (13)");
-
     SimpleTest.finish();
   }
 
   addLoadEvent(do_test);
 ]]>
   </script>
 </pre>
 </body>