Bug 812086 part 3. Convert internal consumers of mozHidden and mozVisibilityState to the unprefixed versions. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 16 Nov 2012 14:22:56 -0800
changeset 113584 8b68a81be38ad9d14b0310cd721e0db534eac0c6
parent 113583 b29bb769336aa42a03189f8ad099fcf063a6da57
child 113585 4e314111b45a931efdf6e907eb1b1d2456797b55
push id18245
push userbzbarsky@mozilla.com
push dateSat, 17 Nov 2012 01:40:52 +0000
treeherdermozilla-inbound@4e314111b45a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs812086
milestone19.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 812086 part 3. Convert internal consumers of mozHidden and mozVisibilityState to the unprefixed versions. r=smaug
content/base/test/test_bug690056.html
docshell/test/chrome/bug690056_window.xul
docshell/test/chrome/docshell_helpers.js
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
hal/Hal.cpp
--- a/content/base/test/test_bug690056.html
+++ b/content/base/test/test_bug690056.html
@@ -17,36 +17,36 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 690056 **/
 SimpleTest.waitForExplicitFinish();
-is(document.mozHidden, false, "Document should not be hidden during load");
-is(document.mozVisibilityState, "visible",
+is(document.hidden, false, "Document should not be hidden during load");
+is(document.visibilityState, "visible",
    "Document should be visible during load");
 
 addLoadEvent(function() {
   var doc = document.implementation.createDocument("", "", null);
-  is(doc.mozHidden, true, "Data documents should be hidden");
-  is(doc.mozVisibilityState, "hidden", "Data documents really should be hidden");
+  is(doc.hidden, true, "Data documents should be hidden");
+  is(doc.visibilityState, "hidden", "Data documents really should be hidden");
 
-  is(document.mozHidden, false, "Document should not be hidden onload");
-  is(document.mozVisibilityState, "visible",
+  is(document.hidden, false, "Document should not be hidden onload");
+  is(document.visibilityState, "visible",
      "Document should be visible onload");
 
-  is($("x").contentDocument.mozHidden, false,
+  is($("x").contentDocument.hidden, false,
      "Subframe document should not be hidden onload");
-  is($("x").contentDocument.mozVisibilityState, "visible",
+  is($("x").contentDocument.visibilityState, "visible",
      "Subframe document should be visible onload");
-  is($("y").contentDocument.mozHidden, false,
+  is($("y").contentDocument.hidden, false,
      "display:none subframe document should not be hidden onload");
-  is($("y").contentDocument.mozVisibilityState, "visible",
+  is($("y").contentDocument.visibilityState, "visible",
      "display:none subframe document should be visible onload");
   
   SimpleTest.finish();
 });
 
 
 </script>
 </pre>
--- a/docshell/test/chrome/bug690056_window.xul
+++ b/docshell/test/chrome/bug690056_window.xul
@@ -92,19 +92,19 @@
                             persisted: true },
                         ],
         onNavComplete: nextTest
       });
       yield;
 
       function generateDetector(state, hidden, title, name) {
         var detector = function (event) {
-          is(event.target.mozHidden, hidden,
+          is(event.target.hidden, hidden,
              name + " hidden value does not match");
-          is(event.target.mozVisibilityState, state,
+          is(event.target.visibilityState, state,
              name + " state value does not match");
           is(event.target.title, title,
              name + " title value does not match");
           document.getElementById("content")
                   .removeEventListener("visibilitychange",
                                        detector,
                                        true);
           nextTest();
--- a/docshell/test/chrome/docshell_helpers.js
+++ b/docshell/test/chrome/docshell_helpers.js
@@ -310,23 +310,23 @@ function pageEventListener(event) {
   
   if (typeof(expected.persisted) != "undefined") {
     is(event.persisted, expected.persisted, 
       "The persisted property of the " + event.type + " event on page " +
       event.originalTarget.location + " had an unexpected value"); 
   }
 
   if ("visibilityState" in expected) {
-    is(event.originalTarget.mozVisibilityState, expected.visibilityState,
+    is(event.originalTarget.visibilityState, expected.visibilityState,
        "The visibilityState property of the document on page " +
        event.originalTarget.location + " had an unexpected value");
   }
 
   if ("hidden" in expected) {
-    is(event.originalTarget.mozHidden, expected.hidden,
+    is(event.originalTarget.hidden, expected.hidden,
        "The hidden property of the document on page " +
        event.originalTarget.location + " had an unexpected value");
   }
 
   // If we're out of expected events, let doPageNavigation() return.
   if (gExpectedEvents.length == 0)
     setTimeout(function() { gFinalEvent = true; }, 0);
 }
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -634,17 +634,17 @@ NS_IMETHODIMP
 VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMEventTarget> target;
   aEvent->GetTarget(getter_AddRefs(target));
   nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(target);
 
   bool hidden = true;
   if (doc) {
-    doc->GetMozHidden(&hidden);
+    doc->GetHidden(&hidden);
   }
 
   if (hidden) {
     // It's important that we call CancelVibrate(), not Vibrate() with an
     // empty list, because Vibrate() will fail if we're no longer focused, but
     // CancelVibrate() will succeed, so long as nobody else has started a new
     // vibration pattern.
     nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
@@ -732,17 +732,17 @@ Navigator::Vibrate(const jsval& aPattern
 {
   nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
   NS_ENSURE_TRUE(win, NS_OK);
 
   nsIDOMDocument* domDoc = win->GetExtantDocument();
   NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
 
   bool hidden = true;
-  domDoc->GetMozHidden(&hidden);
+  domDoc->GetHidden(&hidden);
   if (hidden) {
     // Hidden documents cannot start or stop a vibration.
     return NS_OK;
   }
 
   nsAutoTArray<uint32_t, 8> pattern;
 
   // null or undefined pattern is an error.
@@ -782,17 +782,17 @@ Navigator::Vibrate(const jsval& aPattern
 
   // The spec says we check sVibratorEnabled after we've done the sanity
   // checking on the pattern.
   if (!sVibratorEnabled) {
     return NS_OK;
   }
 
   // Add a listener to cancel the vibration if the document becomes hidden,
-  // and remove the old mozvisibility listener, if there was one.
+  // and remove the old visibility listener, if there was one.
 
   if (!gVibrateWindowListener) {
     // If gVibrateWindowListener is null, this is the first time we've vibrated,
     // and we need to register a listener to clear gVibrateWindowListener on
     // shutdown.
     ClearOnShutdown(&gVibrateWindowListener);
   }
   else {
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -360,17 +360,17 @@ BrowserElementParent.prototype = {
 
   _recvHello: function(data) {
     debug("recvHello");
 
     // Inform our child if our owner element's document is invisible.  Note
     // that we must do so here, rather than in the BrowserElementParent
     // constructor, because the BrowserElementChild may not be initialized when
     // we run our constructor.
-    if (this._window.document.mozHidden) {
+    if (this._window.document.hidden) {
       this._ownerVisibilityChange();
     }
   },
 
   _recvGetName: function(data) {
     return this._frameElement.getAttribute('name');
   },
 
@@ -604,17 +604,17 @@ BrowserElementParent.prototype = {
     this._frameElement.dispatchEvent(evt);
   },
 
   /**
    * Called when the visibility of the window which owns this iframe changes.
    */
   _ownerVisibilityChange: function() {
     this._sendAsyncMsg('owner-visibility-change',
-                       {visible: !this._window.document.mozHidden});
+                       {visible: !this._window.document.hidden});
   },
 
   _exitFullscreen: function() {
     this._windowUtils.exitFullscreen();
   },
 
   _remoteFullscreenOriginChange: function(data) {
     let origin = data.json;
--- a/dom/browser-element/mochitest/browserElement_SetVisible.js
+++ b/dom/browser-element/mochitest/browserElement_SetVisible.js
@@ -4,17 +4,17 @@
 // Test the setVisible property for mozbrowser
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 var iframeScript = function() {
   content.document.addEventListener("visibilitychange", function() {
     sendAsyncMessage('test:visibilitychange', {
-      hidden: content.document.mozHidden
+      hidden: content.document.hidden
     });
   }, false);
 }
 
 function runTest() {
 
   browserElementTestHelpers.setEnabledPref(true);
   browserElementTestHelpers.addPermission();
@@ -27,28 +27,28 @@ function runTest() {
 
   document.body.appendChild(iframe1);
 
   function recvVisibilityChanged(msg) {
     msg = SpecialPowers.wrap(msg);
     numEvents++;
     if (numEvents === 1) {
       ok(true, 'iframe recieved visibility changed');
-      ok(msg.json.hidden === true, 'mozHidden attribute correctly set');
+      ok(msg.json.hidden === true, 'hidden attribute correctly set');
       iframe1.setVisible(false);
       iframe1.setVisible(true);
     } else if (numEvents === 2) {
-      ok(msg.json.hidden === false, 'mozHidden attribute correctly set');
+      ok(msg.json.hidden === false, 'hidden attribute correctly set');
       // Allow some time in case we generate too many events
       setTimeout(function() {
         mm.removeMessageListener('test:visibilitychange', recvVisibilityChanged);
         SimpleTest.finish();
       }, 100);
     } else {
-      ok(false, 'Too many mozhidden events');
+      ok(false, 'Too many visibilitychange events');
     }
   }
 
   function iframeLoaded() {
     mm = SpecialPowers.getBrowserFrameMessageManager(iframe1);
     mm.addMessageListener('test:visibilitychange', recvVisibilityChanged);
     mm.loadFrameScript('data:,(' + iframeScript.toString() + ')();', false);
     iframe1.setVisible(false);
--- a/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
@@ -5,14 +5,14 @@
 var name = location.search.substring(1);
 addEventListener('load', function() {
   setTimeout(function() {
     alert(name + ':ready');
   }, 0);
 });
 
 addEventListener('visibilitychange', function() {
-  alert(name + ':' + (document.mozHidden ? 'hidden' : 'visible'));
+  alert(name + ':' + (document.hidden ? 'hidden' : 'visible'));
 });
 
 </script>
 </body>
 </html>
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -230,17 +230,17 @@ ProcessPriorityManager::RecomputeNumVisi
 
     nsCOMPtr<nsIDOMDocument> doc;
     window->GetDocument(getter_AddRefs(doc));
     if (!doc) {
       continue;
     }
 
     bool hidden = false;
-    doc->GetMozHidden(&hidden);
+    doc->GetHidden(&hidden);
 #ifdef DEBUG
     nsAutoString spec;
     doc->GetDocumentURI(spec);
     LOG("Document at %s has visibility %d.", NS_ConvertUTF16toUTF8(spec).get(), !hidden);
 #endif
 
     allHidden = allHidden && hidden;
 
--- a/dom/power/WakeLock.cpp
+++ b/dom/power/WakeLock.cpp
@@ -53,17 +53,17 @@ WakeLock::Init(const nsAString &aTopic, 
 
   /**
    * Null windows are allowed. A wake lock without associated window
    * is always considered invisible.
    */
   if (window) {
     nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
     NS_ENSURE_STATE(domDoc);
-    domDoc->GetMozHidden(&mHidden);
+    domDoc->GetHidden(&mHidden);
   }
 
   AttachEventListener();
   DoLock();
 
   return NS_OK;
 }
 
@@ -171,17 +171,17 @@ WakeLock::HandleEvent(nsIDOMEvent *aEven
   aEvent->GetType(type);
 
   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);
+    domDoc->GetHidden(&mHidden);
 
     if (mLocked && oldHidden != mHidden) {
       hal::ModifyWakeLock(mTopic,
                           hal::WAKE_LOCK_NO_CHANGE,
                           mHidden ? hal::WAKE_LOCK_ADD_ONE : hal::WAKE_LOCK_REMOVE_ONE);
     }
 
     return NS_OK;
--- a/dom/power/test/browser_bug697132.js
+++ b/dom/power/test/browser_bug697132.js
@@ -109,32 +109,32 @@ let gSteps = [
     gWin2 = gBrowser.getBrowserForTab(gTab2).contentWindow;
 
     gBrowser.selectedTab = gTab1;
     let browser = gBrowser.getBrowserForTab(gTab2);
 
     browser.addEventListener("load", function onLoad(e) {
       browser.removeEventListener("load", onLoad, true);
       gLock2 = gWin2.navigator.requestWakeLock("test");
-      is(gWin2.document.mozHidden, true,
+      is(gWin2.document.hidden, true,
          "window is background")
       is(gWin2.navigator.mozPower.getWakeLockState("test"), "locked-background",
          "wake lock is background");
       let doc2 = gWin2.document;
       doc2.addEventListener("visibilitychange", function onVisibilityChange(e) {
-        if (!doc2.mozHidden) {
+        if (!doc2.hidden) {
           doc2.removeEventListener("visibilitychange", onVisibilityChange);
           executeSoon(runNextStep);
         }
       });
       gBrowser.selectedTab = gTab2;
     }, true);
   },
   function crossTabWakeLock2() {
-    is(gWin2.document.mozHidden, false,
+    is(gWin2.document.hidden, false,
        "window is foreground")
     is(gWin2.navigator.mozPower.getWakeLockState("test"), "locked-foreground",
       "wake lock is foreground");
     gWin2.addEventListener("pagehide", function onPageHide(e) {
       gWin2.removeEventListener("pagehide", onPageHide, true);
       executeSoon(runNextStep);
     }, true);
     gWin2.addEventListener("pageshow", function onPageShow(e) {
@@ -152,17 +152,17 @@ let gSteps = [
   function crossTabWakeLock4() {
     is(gWin1.navigator.mozPower.getWakeLockState("test"), "locked-foreground",
        "wake lock should auto-reacquire when page is available again");
     gBrowser.selectedTab = gTab1;
     executeSoon(runNextStep);
   },
   function crossTabWakeLock5() {
     // Test again in background tab
-    is(gWin2.document.mozHidden, true,
+    is(gWin2.document.hidden, true,
        "window is background")
     is(gWin2.navigator.mozPower.getWakeLockState("test"), "locked-background",
       "wake lock is background");
     gWin2.addEventListener("pagehide", function onPageHide(e) {
       gWin2.removeEventListener("pagehide", onPageHide, true);
       executeSoon(runNextStep);
     }, true);
     gWin2.addEventListener("pageshow", function onPageShow(e) {
@@ -180,19 +180,19 @@ let gSteps = [
   function crossTabWakeLock7() {
     is(gWin1.navigator.mozPower.getWakeLockState("test"), "locked-background",
        "wake lock should auto-reacquire when page is available again");
     gLock2.unlock();
     gBrowser.selectedTab = gTab2;
     executeSoon(runNextStep);
   },
   function crossTabWakeLock8() {
-    is(gWin1.document.mozHidden, true,
+    is(gWin1.document.hidden, true,
        "gWin1 is background");
-    is(gWin2.document.mozHidden, false,
+    is(gWin2.document.hidden, false,
        "gWin2 is foreground");
 
     gLock1 = gWin1.navigator.requestWakeLock("test");
     gLock2 = gWin2.navigator.requestWakeLock("test");
 
     is(gWin1.navigator.mozPower.getWakeLockState("test"), "locked-foreground",
        "topic is locked-foreground when one page is foreground and one is background");
 
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -90,17 +90,17 @@ WindowIsActive(nsIDOMWindow *window)
 {
   NS_ENSURE_TRUE(window, false);
 
   nsCOMPtr<nsIDOMDocument> doc;
   window->GetDocument(getter_AddRefs(doc));
   NS_ENSURE_TRUE(doc, false);
 
   bool hidden = true;
-  doc->GetMozHidden(&hidden);
+  doc->GetHidden(&hidden);
   return !hidden;
 }
 
 StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate;
 
 void InitLastIDToVibrate()
 {
   gLastIDToVibrate = new WindowIdentifier::IDArrayType();