Bug 812086 part 2. Convert internal consumers of mozvisibilitychange events to the unprefixed version. r=smaug

This commit is contained in:
Boris Zbarsky 2012-11-16 14:22:56 -08:00
Родитель 5f2608a0a4
Коммит 6d9ddce866
8 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -32,11 +32,11 @@
// 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 },
@ -52,15 +52,15 @@
// 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 },
@ -75,15 +75,15 @@
// 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 },
@ -104,14 +104,14 @@
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");
@ -123,7 +123,7 @@
// 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 },
@ -131,7 +131,7 @@
title: "initial load",
persisted: true },
],
unexpectedEvents: [ "mozvisibilitychange" ],
unexpectedEvents: [ "visibilitychange" ],
onNavComplete: nextTest
});
yield;
@ -145,15 +145,15 @@
// 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 },
@ -173,4 +173,4 @@
]]></script>
<browser type="content-primary" flex="1" id="content" src="about:blank"/>
</window>
</window>

Просмотреть файл

@ -605,7 +605,7 @@ public:
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 */
@ -664,7 +664,7 @@ VibrateWindowListener::RemoveListener()
if (!target) {
return;
}
NS_NAMED_LITERAL_STRING(visibilitychange, "mozvisibilitychange");
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
target->RemoveSystemEventListener(visibilitychange, this,
true /* use capture */);
}

Просмотреть файл

@ -260,9 +260,9 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
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);

Просмотреть файл

@ -7,7 +7,7 @@
SimpleTest.waitForExplicitFinish();
var iframeScript = function() {
content.document.addEventListener("mozvisibilitychange", function() {
content.document.addEventListener("visibilitychange", function() {
sendAsyncMessage('test:visibilitychange', {
hidden: content.document.mozHidden
});

Просмотреть файл

@ -9,7 +9,7 @@ addEventListener('load', function() {
}, 0);
});
addEventListener('mozvisibilitychange', function() {
addEventListener('visibilitychange', function() {
alert(name + ':' + (document.mozHidden ? 'hidden' : 'visible'));
});

Просмотреть файл

@ -194,7 +194,7 @@ ProcessPriorityManager::OnContentDocumentGlobalCreated(
return;
}
target->AddSystemEventListener(NS_LITERAL_STRING("mozvisibilitychange"),
target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
this,
/* useCapture = */ false,
/* wantsUntrusted = */ false);

Просмотреть файл

@ -100,7 +100,7 @@ WakeLock::AttachEventListener()
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);
@ -127,7 +127,7 @@ WakeLock::DetachEventListener()
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);
@ -170,7 +170,7 @@ 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);

Просмотреть файл

@ -119,9 +119,9 @@ let gSteps = [
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);
}
});