Bug 868816 - Remove the notifications for the displayed app when we go out of the lock screen. r=jlebar

This commit is contained in:
Vivien Nicolas 2013-05-24 11:33:46 +02:00
parent 8d70ccdda9
commit dea3562c47
6 changed files with 88 additions and 2 deletions

View File

@ -769,7 +769,7 @@ BrowserElementChild.prototype = {
var visible = this._forcedVisible && this._ownerVisible;
if (docShell.isActive !== visible) {
docShell.isActive = visible;
sendAsyncMsg('visibility-change', {visible: visible});
sendAsyncMsg('visibilitychange', {visible: visible});
}
},

View File

@ -119,7 +119,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
"rollback-fullscreen": this._remoteFrameFullscreenReverted,
"exit-fullscreen": this._exitFullscreen,
"got-visible": this._gotDOMRequestResult,
"visibility-change": this._childVisibilityChange,
"visibilitychange": this._childVisibilityChange,
}
this._mm.addMessageListener('browser-element-api:call', function(aMsg) {
@ -576,6 +576,8 @@ BrowserElementParent.prototype = {
_childVisibilityChange: function(data) {
debug("_childVisibilityChange(" + data.json.visible + ")");
this._frameLoader.visible = data.json.visible;
this._fireEventFromMsg(data);
},
_exitFullscreen: function() {

View File

@ -160,6 +160,8 @@ MOCHITEST_FILES = \
test_browserElement_inproc_PurgeHistory.html \
browserElement_DocumentFirstPaint.js \
test_browserElement_inproc_DocumentFirstPaint.html \
browserElement_VisibilityChange.js \
test_browserElement_inproc_VisibilityChange.html \
$(NULL)
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
@ -233,6 +235,7 @@ MOCHITEST_FILES += \
test_browserElement_oop_ReloadPostRequest.html \
test_browserElement_oop_PurgeHistory.html \
test_browserElement_oop_DocumentFirstPaint.html \
test_browserElement_oop_VisibilityChange.html \
$(NULL)
endif #}

View File

@ -0,0 +1,43 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that the onmozbrowservisibilitychange event works.
'use strict';
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
var iframe1 = null;
function runTest() {
iframe1 = document.createElement('iframe');
SpecialPowers.wrap(iframe1).mozbrowser = true;
document.body.appendChild(iframe1);
iframe1.src = 'data:text/html,<html><head><title>Title</title></head><body></body></html>';
checkVisibilityFalse();
}
function checkVisibilityFalse() {
iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
iframe1.removeEventListener(e.type, onvisibilitychange);
is(e.detail.visible, false, 'Visibility should be false');
checkVisibilityTrue();
});
iframe1.setVisible(false);
}
function checkVisibilityTrue() {
iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
iframe1.removeEventListener(e.type, onvisibilitychange);
is(e.detail.visible, true, 'Visibility should be true');
SimpleTest.finish();
});
iframe1.setVisible(true);
}
addEventListener('testready', runTest);

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=868816
-->
<head>
<title>Test for Bug 868816</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=868816">Mozilla Bug 868816</a>
<script type="application/javascript;version=1.7" src='browserElement_VisibilityChange.js'>
</script>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=868816
-->
<head>
<title>Test for Bug 868816</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=868816">Mozilla Bug 868816</a>
<script type="application/javascript;version=1.7" src='browserElement_VisibilityChange.js'>
</script>
</body>
</html>