Bug 1513681 - part5 : remove event 'AudibleAutoplayMediaOccurred'. r=jaws
☠☠ backed out by 0c02d1f0db78 ☠ ☠
authoralwu <alwu@mozilla.com>
Fri, 21 Dec 2018 19:01:10 +0000
changeset 452108 d24ddb803761f36c05030455c1144bcce9f2a5b2
parent 452107 6f52b229d9537e4ecd5eba6a8f93dff55c0e0852
child 452109 05288089adb4b9be69bc58680730fe96b0278047
push id75321
push useralwu@mozilla.com
push dateSat, 29 Dec 2018 00:24:14 +0000
treeherderautoland@d24ddb803761 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1513681
milestone66.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 1513681 - part5 : remove event 'AudibleAutoplayMediaOccurred'. r=jaws This event is used for shield-study which has finished, so we could remove it. Differential Revision: https://phabricator.services.mozilla.com/D14810
browser/base/content/tabbrowser.js
dom/base/nsDocument.cpp
toolkit/actors/AutoplayChild.jsm
toolkit/content/tests/browser/browser.ini
toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
toolkit/content/widgets/browser.xml
toolkit/modules/ActorManagerParent.jsm
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -4758,26 +4758,16 @@ window._gBrowser = {
         tab.removeAttribute("activemedia-blocked");
         this._tabAttrModified(tab, ["activemedia-blocked"]);
         let hist = Services.telemetry.getHistogramById("TAB_AUDIO_INDICATOR_USED");
         hist.add(2 /* unblockByVisitingTab */ );
         tab.finishMediaBlockTimer();
       }
     });
 
-    this.addEventListener("AudibleAutoplayMediaOccurred", (event) => {
-      let browser = event.originalTarget;
-      let tab = this.getTabForBrowser(browser);
-      if (!tab) {
-        return;
-      }
-
-      Services.obs.notifyObservers(tab, "AudibleAutoplayMediaOccurred");
-    });
-
     this.addEventListener("GloballyAutoplayBlocked", (event) => {
       let browser = event.originalTarget;
       let tab = this.getTabForBrowser(browser);
       if (!tab) {
         return;
       }
 
       SitePermissions.set(event.detail.url, "autoplay-media",
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11767,22 +11767,16 @@ void nsIDocument::MaybeNotifyAutoplayBlo
 }
 
 void nsIDocument::SetDocTreeHadAudibleMedia() {
   nsIDocument* topLevelDoc = GetTopLevelContentDocument();
   if (!topLevelDoc) {
     return;
   }
 
-  if (!topLevelDoc->mDocTreeHadAudibleMedia) {
-    RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
-        topLevelDoc, NS_LITERAL_STRING("AudibleAutoplayMediaOccurred"),
-        CanBubble::eYes, ChromeOnlyDispatch::eYes);
-    asyncDispatcher->PostDOMEvent();
-  }
   topLevelDoc->mDocTreeHadAudibleMedia = true;
 }
 
 void nsIDocument::SetDocTreeHadPlayRevoked() {
   nsIDocument* topLevelDoc = GetTopLevelContentDocument();
   if (topLevelDoc) {
     topLevelDoc->mDocTreeHadPlayRevoked = true;
   }
--- a/toolkit/actors/AutoplayChild.jsm
+++ b/toolkit/actors/AutoplayChild.jsm
@@ -5,18 +5,11 @@
 "use strict";
 
 var EXPORTED_SYMBOLS = ["AutoplayChild"];
 
 ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
 
 class AutoplayChild extends ActorChild {
   handleEvent(event) {
-    if (event.type == "AudibleAutoplayMediaOccurred") {
-      this.mm.sendAsyncMessage("AudibleAutoplayMediaOccurred");
-      return;
-    }
-    if (event.type == "GloballyAutoplayBlocked") {
-      this.mm.sendAsyncMessage("GloballyAutoplayBlocked");
-      return;
-    }
+    this.mm.sendAsyncMessage("GloballyAutoplayBlocked");
   }
 }
--- a/toolkit/content/tests/browser/browser.ini
+++ b/toolkit/content/tests/browser/browser.ini
@@ -25,17 +25,16 @@ support-files =
   silentAudioTrack.webm
   doggy.png
   firebird.png
 
 [browser_audioCompeting.js]
 tags = audiochannel
 [browser_audioCompeting_onlyForActiveAgent.js]
 tags = audiochannel
-[browser_autoplay_audibleMediaOccurred.js]
 [browser_autoplay_policy_iframe_hierarchy.js]
 support-files =
   file_autoplay_three_layers_frame1.html
   file_autoplay_three_layers_frame2.html
   file_autoplay_two_layers_frame1.html
   file_autoplay_two_layers_frame2.html
   file_video.html
   gizmo.mp4
deleted file mode 100644
--- a/toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * This test is used to test whether the topic 'AudibleAutoplayMediaOccurred'
- * is sent correctly when the autoplay audible media tries to start.
- */
-"use strict";
-
-const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback.html";
-
-add_task(async function testAudibleAutoplayMedia() {
-  info("- open new tab  -");
-  let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
-                                                        "about:blank");
-  let browser = tab.linkedBrowser;
-
-  // start observing the topic before loading the page to ensure we can get it.
-  let audibleAutoplayOccurred = TestUtils.topicObserved("AudibleAutoplayMediaOccurred");
-  browser.loadURI(PAGE, {
-    triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
-  });
-
-  await BrowserTestUtils.browserLoaded(browser);
-  await audibleAutoplayOccurred;
-  ok(true, "Got the topic 'AudibleAutoplayMediaOccurred'.");
-
-  info("- remove tab -");
-  BrowserTestUtils.removeTab(tab);
-});
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -757,26 +757,16 @@
           <![CDATA[
             let event = document.createEvent("Events");
             event.initEvent("DOMAudioPlaybackStopped", true, false);
             this.dispatchEvent(event);
           ]]>
         </body>
       </method>
 
-      <method name="notifyAudibleAutoplayMediaOccurred">
-        <body>
-          <![CDATA[
-            let event = document.createEvent("Events");
-            event.initEvent("AudibleAutoplayMediaOccurred", true, false);
-            this.dispatchEvent(event);
-          ]]>
-        </body>
-      </method>
-
       <method name="notifyGloballyAutoplayBlocked">
         <body>
           <![CDATA[
             let event = document.createEvent("CustomEvent");
             event.initCustomEvent("GloballyAutoplayBlocked", true, false,
               {
                 url: this.documentURI,
               });
@@ -1116,17 +1106,16 @@
             this.messageManager.addMessageListener("PopupBlocking:UpdateBlockedPopups", this);
             this.messageManager.addMessageListener("Autoscroll:Start", this);
             this.messageManager.addMessageListener("Autoscroll:Cancel", this);
             this.messageManager.addMessageListener("AudioPlayback:Start", this);
             this.messageManager.addMessageListener("AudioPlayback:Stop", this);
             this.messageManager.addMessageListener("AudioPlayback:ActiveMediaBlockStart", this);
             this.messageManager.addMessageListener("AudioPlayback:ActiveMediaBlockStop", this);
             this.messageManager.addMessageListener("UnselectedTabHover:Toggle", this);
-            this.messageManager.addMessageListener("AudibleAutoplayMediaOccurred", this);
             this.messageManager.addMessageListener("GloballyAutoplayBlocked", this);
 
             if (this.hasAttribute("selectmenulist")) {
               this.messageManager.addMessageListener("Forms:ShowDropDown", this);
               this.messageManager.addMessageListener("Forms:HideDropDown", this);
             }
 
           }
@@ -1259,19 +1248,16 @@
             case "AudioPlayback:ActiveMediaBlockStop":
               this.activeMediaBlockStopped();
               break;
             case "UnselectedTabHover:Toggle":
               this._shouldSendUnselectedTabHover = data.enable ?
                 ++this._unselectedTabHoverMessageListenerCount > 0 :
                 --this._unselectedTabHoverMessageListenerCount == 0;
               break;
-            case "AudibleAutoplayMediaOccurred":
-              this.notifyAudibleAutoplayMediaOccurred();
-              break;
             case "GloballyAutoplayBlocked":
               this.notifyGloballyAutoplayBlocked();
               break;
             case "Forms:ShowDropDown": {
               if (!this._selectParentHelper) {
                 this._selectParentHelper =
                   ChromeUtils.import("resource://gre/modules/SelectParentHelper.jsm", {}).SelectParentHelper;
               }
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -113,17 +113,16 @@ let ACTORS = {
       ],
     },
   },
 
   Autoplay: {
     child: {
       module: "resource://gre/actors/AutoplayChild.jsm",
       events: {
-        "AudibleAutoplayMediaOccurred": {},
         "GloballyAutoplayBlocked": {},
       },
     },
   },
 
   Browser: {
     child: {
       module: "resource://gre/actors/BrowserChild.jsm",