Bug 812086 part 2. Convert internal consumers of mozvisibilitychange events to the unprefixed version. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 16 Nov 2012 14:22:56 -0800
changeset 113584 b29bb769336aa42a03189f8ad099fcf063a6da57
parent 113583 62ed3f6211059b11c8afbb1a54154539626f7e11
child 113585 8b68a81be38ad9d14b0310cd721e0db534eac0c6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmaug
bugs812086
milestone19.0a1
Bug 812086 part 2. Convert internal consumers of mozvisibilitychange events to the unprefixed version. r=smaug
docshell/test/chrome/bug690056_window.xul
dom/base/Navigator.cpp
dom/browser-element/BrowserElementParent.js
dom/browser-element/mochitest/browserElement_SetVisible.js
dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
dom/ipc/ProcessPriorityManager.cpp
dom/power/WakeLock.cpp
dom/power/test/browser_bug697132.js
--- a/docshell/test/chrome/bug690056_window.xul
+++ b/docshell/test/chrome/bug690056_window.xul
@@ -27,68 +27,68 @@
         uri: 'data:text/html,<title>initial load</title>',
         onNavComplete: nextTest
       });
       yield;
 
       // Now load a new page
       doPageNavigation({
         uri: 'data:text/html,<title>new load</title>',
-        eventsToListenFor: [ "pageshow", "pagehide", "mozvisibilitychange" ],
+        eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
         expectedEvents: [ { type: "pagehide",
                             title: "initial load",
                             persisted: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "initial load",
                             visibilityState: "hidden",
                             hidden: true },
                           // No visibilitychange events fired for initial pageload
                           { type: "pageshow",
                             title: "new load",
                             persisted: false }, // false on initial load
                         ],
         onNavComplete: nextTest
       });
       yield;
 
       // Now go back
       doPageNavigation({
         back: true,
-        eventsToListenFor: [ "pageshow", "pagehide", "mozvisibilitychange" ],
+        eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
         expectedEvents: [ { type: "pagehide",
                             title: "new load",
                             persisted: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "new load",
                             visibilityState: "hidden",
                             hidden: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "initial load",
                             visibilityState: "visible",
                             hidden: false },
                           { type: "pageshow",
                             title: "initial load",
                             persisted: true },
                         ],
         onNavComplete: nextTest
       });
       yield;
 
       // And forward
       doPageNavigation({
         forward: true,
-        eventsToListenFor: [ "pageshow", "pagehide", "mozvisibilitychange" ],
+        eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
         expectedEvents: [ { type: "pagehide",
                             title: "initial load",
                             persisted: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "initial load",
                             visibilityState: "hidden",
                             hidden: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "new load",
                             visibilityState: "visible",
                             hidden: false },
                           { type: "pageshow",
                             title: "new load",
                             persisted: true },
                         ],
         onNavComplete: nextTest
@@ -99,66 +99,66 @@
         var detector = function (event) {
           is(event.target.mozHidden, hidden,
              name + " hidden value does not match");
           is(event.target.mozVisibilityState, state,
              name + " state value does not match");
           is(event.target.title, title,
              name + " title value does not match");
           document.getElementById("content")
-                  .removeEventListener("mozvisibilitychange",
+                  .removeEventListener("visibilitychange",
                                        detector,
                                        true);
           nextTest();
         }
 
         document.getElementById("content")
-                .addEventListener("mozvisibilitychange", detector, true);
+                .addEventListener("visibilitychange", detector, true);
       }
       
       generateDetector("hidden", true, "new load", "Going hidden");
         
       // Now flip our docshell to not active
       document.getElementById("content").docShellIsActive = false;
       yield;
 
       // And navigate back; there should be no visibility state transitions
       doPageNavigation({
         back: true,
-        eventsToListenFor: [ "pageshow", "pagehide", "mozvisibilitychange" ],
+        eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
         expectedEvents: [ { type: "pagehide",
                             title: "new load",
                             persisted: true },
                           { type: "pageshow",
                             title: "initial load",
                             persisted: true },
                         ],
-        unexpectedEvents: [ "mozvisibilitychange" ],
+        unexpectedEvents: [ "visibilitychange" ],
         onNavComplete: nextTest
       });
       yield;
 
       generateDetector("visible", false, "initial load", "Going visible");
 
       // Now set the docshell active again
       document.getElementById("content").docShellIsActive = true;
       yield;
 
       // And forward
       doPageNavigation({
         forward: true,
-        eventsToListenFor: [ "pageshow", "pagehide", "mozvisibilitychange" ],
+        eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
         expectedEvents: [ { type: "pagehide",
                             title: "initial load",
                             persisted: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "initial load",
                             visibilityState: "hidden",
                             hidden: true },
-                          { type: "mozvisibilitychange",
+                          { type: "visibilitychange",
                             title: "new load",
                             visibilityState: "visible",
                             hidden: false },
                           { type: "pageshow",
                             title: "new load",
                             persisted: true },
                         ],
         onNavComplete: nextTest
@@ -168,9 +168,9 @@
       // Tell the framework the test is finished.  Include the final 'yield' 
       // statement to prevent a StopIteration exception from being thrown.
       finish();
       yield;      
     }
   ]]></script>
 
   <browser type="content-primary" flex="1" id="content" src="about:blank"/>
-</window>
\ No newline at end of file
+</window>
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -600,17 +600,17 @@ class VibrateWindowListener : public nsI
 {
 public:
   VibrateWindowListener(nsIDOMWindow *aWindow, nsIDOMDocument *aDocument)
   {
     mWindow = do_GetWeakReference(aWindow);
     mDocument = do_GetWeakReference(aDocument);
 
     nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aDocument);
-    NS_NAMED_LITERAL_STRING(visibilitychange, "mozvisibilitychange");
+    NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
     target->AddSystemEventListener(visibilitychange,
                                    this, /* listener */
                                    true, /* use capture */
                                    false /* wants untrusted */);
   }
 
   virtual ~VibrateWindowListener()
   {
@@ -659,17 +659,17 @@ VibrateWindowListener::HandleEvent(nsIDO
 
 void
 VibrateWindowListener::RemoveListener()
 {
   nsCOMPtr<nsIDOMEventTarget> target = do_QueryReferent(mDocument);
   if (!target) {
     return;
   }
-  NS_NAMED_LITERAL_STRING(visibilitychange, "mozvisibilitychange");
+  NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
   target->RemoveSystemEventListener(visibilitychange, this,
                                     true /* use capture */);
 }
 
 /**
  * Converts a jsval into a vibration duration, checking that the duration is in
  * bounds (non-negative and not larger than sMaxVibrateMS).
  *
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -255,19 +255,19 @@ function BrowserElementParent(frameLoade
   defineMethod('goForward', this._goForward);
   defineMethod('reload', this._reload);
   defineMethod('stop', this._stop);
   defineMethod('purgeHistory', this._purgeHistory);
   defineMethod('getScreenshot', this._getScreenshot);
   defineDOMRequestMethod('getCanGoBack', 'get-can-go-back');
   defineDOMRequestMethod('getCanGoForward', 'get-can-go-forward');
 
-  // Listen to mozvisibilitychange on the iframe's owner window, and forward it
+  // Listen to visibilitychange on the iframe's owner window, and forward it
   // down to the child.
-  this._window.addEventListener('mozvisibilitychange',
+  this._window.addEventListener('visibilitychange',
                                 this._ownerVisibilityChange.bind(this),
                                 /* useCapture = */ false,
                                 /* wantsUntrusted = */ false);
 
   // Insert ourself into the prompt service.
   BrowserElementPromptService.mapFrameToBrowserElementParent(this._frameElement, this);
 
   // If this browser represents an app then let the Webapps module register for
--- a/dom/browser-element/mochitest/browserElement_SetVisible.js
+++ b/dom/browser-element/mochitest/browserElement_SetVisible.js
@@ -2,17 +2,17 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test the setVisible property for mozbrowser
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 var iframeScript = function() {
-  content.document.addEventListener("mozvisibilitychange", function() {
+  content.document.addEventListener("visibilitychange", function() {
     sendAsyncMessage('test:visibilitychange', {
       hidden: content.document.mozHidden
     });
   }, false);
 }
 
 function runTest() {
 
--- a/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
@@ -4,15 +4,15 @@
 
 var name = location.search.substring(1);
 addEventListener('load', function() {
   setTimeout(function() {
     alert(name + ':ready');
   }, 0);
 });
 
-addEventListener('mozvisibilitychange', function() {
+addEventListener('visibilitychange', function() {
   alert(name + ':' + (document.mozHidden ? 'hidden' : 'visible'));
 });
 
 </script>
 </body>
 </html>
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -189,17 +189,17 @@ ProcessPriorityManager::OnContentDocumen
 
   nsWeakPtr weakWin = do_GetWeakReference(innerWindow);
   NS_ENSURE_TRUE_VOID(weakWin);
 
   if (mWindows.Contains(weakWin)) {
     return;
   }
 
-  target->AddSystemEventListener(NS_LITERAL_STRING("mozvisibilitychange"),
+  target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
                                  this,
                                  /* useCapture = */ false,
                                  /* wantsUntrusted = */ false);
 
   mWindows.AppendElement(weakWin);
   RecomputeNumVisibleWindows();
 }
 
--- a/dom/power/WakeLock.cpp
+++ b/dom/power/WakeLock.cpp
@@ -95,17 +95,17 @@ void
 WakeLock::AttachEventListener()
 {
   nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
   
   if (window) {
     nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
     if (domDoc) {
       nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(domDoc);
-      target->AddSystemEventListener(NS_LITERAL_STRING("mozvisibilitychange"),
+      target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
                                      this,
                                      /* useCapture = */ true,
                                      /* wantsUntrusted = */ false);
 
       target = do_QueryInterface(window);
       target->AddSystemEventListener(NS_LITERAL_STRING("pagehide"),
                                      this,
                                      /* useCapture = */ true,
@@ -122,17 +122,17 @@ void
 WakeLock::DetachEventListener()
 {
   nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
 
   if (window) {
     nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
     if (domDoc) {
       nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(domDoc);
-      target->RemoveSystemEventListener(NS_LITERAL_STRING("mozvisibilitychange"),
+      target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
                                         this,
                                         /* useCapture = */ true);
       target = do_QueryInterface(window);
       target->RemoveSystemEventListener(NS_LITERAL_STRING("pagehide"),
                                         this,
                                         /* useCapture = */ true);
       target->RemoveSystemEventListener(NS_LITERAL_STRING("pageshow"),
                                         this,
@@ -165,17 +165,17 @@ WakeLock::GetTopic(nsAString &aTopic)
 }
 
 NS_IMETHODIMP
 WakeLock::HandleEvent(nsIDOMEvent *aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
 
-  if (type.EqualsLiteral("mozvisibilitychange")) {
+  if (type.EqualsLiteral("visibilitychange")) {
     nsCOMPtr<nsIDOMEventTarget> target;
     aEvent->GetTarget(getter_AddRefs(target));
     nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(target);
     NS_ENSURE_STATE(domDoc);
     bool oldHidden = mHidden;
     domDoc->GetMozHidden(&mHidden);
 
     if (mLocked && oldHidden != mHidden) {
--- a/dom/power/test/browser_bug697132.js
+++ b/dom/power/test/browser_bug697132.js
@@ -114,19 +114,19 @@ let gSteps = [
     browser.addEventListener("load", function onLoad(e) {
       browser.removeEventListener("load", onLoad, true);
       gLock2 = gWin2.navigator.requestWakeLock("test");
       is(gWin2.document.mozHidden, true,
          "window is background")
       is(gWin2.navigator.mozPower.getWakeLockState("test"), "locked-background",
          "wake lock is background");
       let doc2 = gWin2.document;
-      doc2.addEventListener("mozvisibilitychange", function onVisibilityChange(e) {
+      doc2.addEventListener("visibilitychange", function onVisibilityChange(e) {
         if (!doc2.mozHidden) {
-          doc2.removeEventListener("mozvisibilitychange", onVisibilityChange);
+          doc2.removeEventListener("visibilitychange", onVisibilityChange);
           executeSoon(runNextStep);
         }
       });
       gBrowser.selectedTab = gTab2;
     }, true);
   },
   function crossTabWakeLock2() {
     is(gWin2.document.mozHidden, false,