Bug 812086 part 3. Convert internal consumers of mozHidden and mozVisibilityState to the unprefixed versions. r=smaug
This commit is contained in:
@@ -22,26 +22,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=690056
|
||||
|
||||
/** 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();
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
|
||||
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");
|
||||
|
||||
@@ -315,13 +315,13 @@ function pageEventListener(event) {
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
|
||||
bool hidden = true;
|
||||
if (doc) {
|
||||
doc->GetMozHidden(&hidden);
|
||||
doc->GetHidden(&hidden);
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
@@ -737,7 +737,7 @@ Navigator::Vibrate(const jsval& aPattern, JSContext* cx)
|
||||
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;
|
||||
@@ -787,7 +787,7 @@ Navigator::Vibrate(const jsval& aPattern, JSContext* cx)
|
||||
}
|
||||
|
||||
// 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,
|
||||
|
||||
@@ -365,7 +365,7 @@ BrowserElementParent.prototype = {
|
||||
// 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();
|
||||
}
|
||||
},
|
||||
@@ -609,7 +609,7 @@ BrowserElementParent.prototype = {
|
||||
*/
|
||||
_ownerVisibilityChange: function() {
|
||||
this._sendAsyncMsg('owner-visibility-change',
|
||||
{visible: !this._window.document.mozHidden});
|
||||
{visible: !this._window.document.hidden});
|
||||
},
|
||||
|
||||
_exitFullscreen: function() {
|
||||
|
||||
@@ -9,7 +9,7 @@ SimpleTest.waitForExplicitFinish();
|
||||
var iframeScript = function() {
|
||||
content.document.addEventListener("visibilitychange", function() {
|
||||
sendAsyncMessage('test:visibilitychange', {
|
||||
hidden: content.document.mozHidden
|
||||
hidden: content.document.hidden
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
@@ -32,18 +32,18 @@ function runTest() {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ addEventListener('load', function() {
|
||||
});
|
||||
|
||||
addEventListener('visibilitychange', function() {
|
||||
alert(name + ':' + (document.mozHidden ? 'hidden' : 'visible'));
|
||||
alert(name + ':' + (document.hidden ? 'hidden' : 'visible'));
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -235,7 +235,7 @@ ProcessPriorityManager::RecomputeNumVisibleWindows()
|
||||
}
|
||||
|
||||
bool hidden = false;
|
||||
doc->GetMozHidden(&hidden);
|
||||
doc->GetHidden(&hidden);
|
||||
#ifdef DEBUG
|
||||
nsAutoString spec;
|
||||
doc->GetDocumentURI(spec);
|
||||
|
||||
@@ -58,7 +58,7 @@ WakeLock::Init(const nsAString &aTopic, nsIDOMWindow *aWindow)
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
|
||||
NS_ENSURE_STATE(domDoc);
|
||||
domDoc->GetMozHidden(&mHidden);
|
||||
domDoc->GetHidden(&mHidden);
|
||||
}
|
||||
|
||||
AttachEventListener();
|
||||
@@ -176,7 +176,7 @@ WakeLock::HandleEvent(nsIDOMEvent *aEvent)
|
||||
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,
|
||||
|
||||
@@ -114,13 +114,13 @@ let gSteps = [
|
||||
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);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ let gSteps = [
|
||||
}, 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");
|
||||
@@ -157,7 +157,7 @@ let gSteps = [
|
||||
},
|
||||
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");
|
||||
@@ -185,9 +185,9 @@ let gSteps = [
|
||||
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");
|
||||
|
||||
@@ -95,7 +95,7 @@ WindowIsActive(nsIDOMWindow *window)
|
||||
NS_ENSURE_TRUE(doc, false);
|
||||
|
||||
bool hidden = true;
|
||||
doc->GetMozHidden(&hidden);
|
||||
doc->GetHidden(&hidden);
|
||||
return !hidden;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user