зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368712 - Get rid of nsIBrowserElementAPI.{set,get}Visible, r=kanru
This commit is contained in:
Родитель
0944826c8a
Коммит
da7aba03b1
|
@ -178,7 +178,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, nsPIDOMWindowOuter* aOpener, bool
|
|||
, mClipSubdocument(true)
|
||||
, mClampScrollPosition(true)
|
||||
, mObservingOwnerContent(false)
|
||||
, mVisible(true)
|
||||
{
|
||||
mRemoteFrame = ShouldUseRemoteProcess();
|
||||
MOZ_ASSERT(!mRemoteFrame || !aOpener,
|
||||
|
@ -3495,29 +3494,6 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsFrameLoader::SetVisible(bool aVisible)
|
||||
{
|
||||
if (mVisible == aVisible) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mVisible = aVisible;
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"frameloader-visible-changed", nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsFrameLoader::GetVisible(bool* aVisible)
|
||||
{
|
||||
*aVisible = mVisible;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
|
||||
{
|
||||
|
|
|
@ -375,10 +375,6 @@ private:
|
|||
bool mClampScrollPosition : 1;
|
||||
bool mObservingOwnerContent : 1;
|
||||
|
||||
// Backs nsIFrameLoader::{Get,Set}Visible. Visibility state here relates to
|
||||
// whether this frameloader's <iframe mozbrowser> is setVisible(true)'ed, and
|
||||
// doesn't necessarily correlate with docshell/document visibility.
|
||||
bool mVisible : 1;
|
||||
bool mFreshProcess : 1;
|
||||
};
|
||||
|
||||
|
|
|
@ -222,15 +222,6 @@ interface nsIFrameLoader : nsISupports
|
|||
*/
|
||||
readonly attribute unsigned long long childID;
|
||||
|
||||
/**
|
||||
* Get or set this frame loader's visibility.
|
||||
*
|
||||
* The notion of "visibility" here is separate from the notion of a
|
||||
* window/docshell's visibility. This field is mostly here so that we can
|
||||
* have a notion of visibility in the parent process when frames are OOP.
|
||||
*/
|
||||
[infallible] attribute boolean visible;
|
||||
|
||||
/**
|
||||
* Find out whether the owner content really is a mozbrowser. <xul:browser>
|
||||
* is not considered to be a mozbrowser frame.
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
const FRAME_URL = "http://example.org/";
|
||||
|
||||
const METHODS = {
|
||||
setVisible: {},
|
||||
getVisible: {},
|
||||
setActive: {},
|
||||
getActive: {},
|
||||
addNextPaintListener: {},
|
||||
removeNextPaintListener: {},
|
||||
sendMouseEvent: {},
|
||||
|
|
|
@ -116,15 +116,6 @@ function BrowserElementChild() {
|
|||
// Maps outer window id --> weak ref to window. Used by modal dialog code.
|
||||
this._windowIDDict = {};
|
||||
|
||||
// _forcedVisible corresponds to the visibility state our owner has set on us
|
||||
// (via iframe.setVisible). ownerVisible corresponds to whether the docShell
|
||||
// whose window owns this element is visible.
|
||||
//
|
||||
// Our docShell is visible iff _forcedVisible and _ownerVisible are both
|
||||
// true.
|
||||
this._forcedVisible = true;
|
||||
this._ownerVisible = true;
|
||||
|
||||
this._nextPaintHandler = null;
|
||||
|
||||
this._isContentWindowCreated = false;
|
||||
|
@ -286,8 +277,6 @@ BrowserElementChild.prototype = {
|
|||
"purge-history": this._recvPurgeHistory,
|
||||
"get-screenshot": this._recvGetScreenshot,
|
||||
"get-contentdimensions": this._recvGetContentDimensions,
|
||||
"set-visible": this._recvSetVisible,
|
||||
"get-visible": this._recvVisible,
|
||||
"send-mouse-event": this._recvSendMouseEvent,
|
||||
"send-touch-event": this._recvSendTouchEvent,
|
||||
"get-can-go-back": this._recvCanGoBack,
|
||||
|
@ -1231,35 +1220,13 @@ BrowserElementChild.prototype = {
|
|||
return menuObj;
|
||||
},
|
||||
|
||||
_recvSetVisible: function(data) {
|
||||
debug("Received setVisible message: (" + data.json.visible + ")");
|
||||
if (this._forcedVisible == data.json.visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._forcedVisible = data.json.visible;
|
||||
this._updateVisibility();
|
||||
},
|
||||
|
||||
_recvVisible: function(data) {
|
||||
sendAsyncMsg('got-visible', {
|
||||
id: data.json.id,
|
||||
successRv: docShell.isActive
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the window which contains this iframe becomes hidden or
|
||||
* visible.
|
||||
*/
|
||||
_recvOwnerVisibilityChange: function(data) {
|
||||
debug("Received ownerVisibilityChange: (" + data.json.visible + ")");
|
||||
this._ownerVisible = data.json.visible;
|
||||
this._updateVisibility();
|
||||
},
|
||||
|
||||
_updateVisibility: function() {
|
||||
var visible = this._forcedVisible && this._ownerVisible;
|
||||
var visible = data.json.visible;
|
||||
if (docShell && docShell.isActive !== visible) {
|
||||
docShell.isActive = visible;
|
||||
sendAsyncMsg('visibilitychange', {visible: visible});
|
||||
|
|
|
@ -528,26 +528,6 @@ BrowserElementParent.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
setVisible: defineNoReturnMethod(function(visible) {
|
||||
this._sendAsyncMsg('set-visible', {visible: visible});
|
||||
this._frameLoader.visible = visible;
|
||||
}),
|
||||
|
||||
getVisible: defineDOMRequestMethod('get-visible'),
|
||||
|
||||
setActive: defineNoReturnMethod(function(active) {
|
||||
this._frameLoader.visible = active;
|
||||
}),
|
||||
|
||||
getActive: function() {
|
||||
if (!this._isAlive()) {
|
||||
throw Components.Exception("Dead content process",
|
||||
Cr.NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
|
||||
return this._frameLoader.visible;
|
||||
},
|
||||
|
||||
getChildProcessOffset: function() {
|
||||
let offset = { x: 0, y: 0 };
|
||||
let tabParent = this._frameLoader.tabParent;
|
||||
|
@ -884,11 +864,6 @@ BrowserElementParent.prototype = {
|
|||
|
||||
/*
|
||||
* Called when the child notices that its visibility has changed.
|
||||
*
|
||||
* This is sometimes redundant; for example, the child's visibility may
|
||||
* change in response to a setVisible request that we made here! But it's
|
||||
* not always redundant; for example, the child's visibility may change in
|
||||
* response to its parent docshell being hidden.
|
||||
*/
|
||||
_childVisibilityChange: function(data) {
|
||||
debug("_childVisibilityChange(" + data.json.visible + ")");
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test the setVisible property for mozbrowser
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
|
||||
var iframeScript = function() {
|
||||
content.document.addEventListener("visibilitychange", function() {
|
||||
sendAsyncMessage('test:visibilitychange', {
|
||||
hidden: content.document.hidden
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var mm;
|
||||
var numEvents = 0;
|
||||
var iframe1 = document.createElement('iframe');
|
||||
iframe1.setAttribute('mozbrowser', 'true');
|
||||
iframe1.src = 'data:text/html,1';
|
||||
|
||||
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, 'hidden attribute correctly set');
|
||||
iframe1.setVisible(false);
|
||||
iframe1.setVisible(true);
|
||||
} else if (numEvents === 2) {
|
||||
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 visibilitychange events');
|
||||
}
|
||||
}
|
||||
|
||||
function iframeLoaded() {
|
||||
testGetVisible();
|
||||
}
|
||||
|
||||
function testGetVisible() {
|
||||
iframe1.setVisible(false);
|
||||
iframe1.getVisible().onsuccess = function(evt) {
|
||||
ok(evt.target.result === false, 'getVisible() responds false after setVisible(false)');
|
||||
|
||||
iframe1.setVisible(true);
|
||||
iframe1.getVisible().onsuccess = function(evt) {
|
||||
ok(evt.target.result === true, 'getVisible() responds true after setVisible(true)');
|
||||
testVisibilityChanges();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function testVisibilityChanges() {
|
||||
mm = SpecialPowers.getBrowserFrameMessageManager(iframe1);
|
||||
mm.addMessageListener('test:visibilitychange', recvVisibilityChanged);
|
||||
mm.loadFrameScript('data:,(' + iframeScript.toString() + ')();', false);
|
||||
iframe1.setVisible(false);
|
||||
}
|
||||
|
||||
iframe1.addEventListener('mozbrowserloadend', iframeLoaded);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
|
@ -1,89 +0,0 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 762939 - Test that visibility propagates down properly through
|
||||
// hierarchies of <iframe mozbrowser>.
|
||||
//
|
||||
// In this test, we modify the parent's visibility and check that the child's
|
||||
// visibility is changed as appopriate. We test modifying the child's
|
||||
// visibility in a separate testcase.
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
|
||||
var iframe;
|
||||
|
||||
function runTest() {
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
|
||||
// Our test involves three <iframe mozbrowser>'s, parent, child1, and child2.
|
||||
// child1 and child2 are contained inside parent. child1 is visibile, and
|
||||
// child2 is not.
|
||||
//
|
||||
// For the purposes of this test, we want there to be a process barrier
|
||||
// between child{1,2} and parent. Therefore parent must be a non-remote
|
||||
// <iframe mozbrowser>, until bug 761935 is resolved and we can have nested
|
||||
// content processes.
|
||||
iframe.remote = false;
|
||||
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', checkMessage);
|
||||
expectMessage('parent:ready', test1);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = 'file_browserElement_SetVisibleFrames_Outer.html';
|
||||
}
|
||||
|
||||
function test1() {
|
||||
expectMessage('child1:hidden', getVisibleTest1);
|
||||
iframe.setVisible(false);
|
||||
}
|
||||
|
||||
function getVisibleTest1() {
|
||||
iframe.getVisible().onsuccess = function(evt) {
|
||||
ok(evt.target.result === false, 'getVisible shows a hidden frame');
|
||||
test2();
|
||||
};
|
||||
}
|
||||
|
||||
function test2() {
|
||||
expectMessage('child1:visible', getVisibleTest2);
|
||||
iframe.setVisible(true);
|
||||
}
|
||||
|
||||
function getVisibleTest2() {
|
||||
iframe.getVisible().onsuccess = function(evt) {
|
||||
ok(evt.target.result === true, 'getVisible shows a displayed frame');
|
||||
finish();
|
||||
};
|
||||
}
|
||||
|
||||
function finish() {
|
||||
// We need to remove this listener because when this test finishes and the
|
||||
// iframe containing this document is navigated, we'll fire a
|
||||
// visibilitychange(false) event on all child iframes. That's OK and
|
||||
// expected, but if we don't remove our listener, then we'll end up causing
|
||||
// the /next/ test to fail!
|
||||
iframe.removeEventListener('mozbrowsershowmodalprompt', checkMessage);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var expectedMsg = null;
|
||||
var expectedMsgCallback = null;
|
||||
function expectMessage(msg, next) {
|
||||
expectedMsg = msg;
|
||||
expectedMsgCallback = next;
|
||||
}
|
||||
|
||||
function checkMessage(e) {
|
||||
var msg = e.detail.message;
|
||||
is(msg, expectedMsg);
|
||||
if (msg == expectedMsg) {
|
||||
expectedMsg = null;
|
||||
SimpleTest.executeSoon(function() { expectedMsgCallback() });
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
|
@ -1,54 +0,0 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 762939 - Test that setting a <iframe mozbrowser> to invisible / visible
|
||||
// inside an invisible <iframe mozbrowser> doesn't trigger any events.
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
|
||||
// We need remote = false here until bug 761935 is fixed; see
|
||||
// SetVisibleFrames.js for an explanation.
|
||||
iframe.remote = false;
|
||||
|
||||
iframe.addEventListener('mozbrowserloadend', function(e) {
|
||||
iframe.setVisible(false);
|
||||
iframe.src = 'file_browserElement_SetVisibleFrames2_Outer.html';
|
||||
}, {once: true});
|
||||
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
if (e.detail.message == 'parent:finish') {
|
||||
ok(true, "Got parent:finish");
|
||||
|
||||
// Give any extra events a chance to fire, then end the test.
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
ok(false, "Got unexpected message: " + e.detail.message);
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
|
@ -1,42 +0,0 @@
|
|||
/* 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);
|
||||
|
||||
var iframe1 = null;
|
||||
function runTest() {
|
||||
iframe1 = document.createElement('iframe');
|
||||
iframe1.setAttribute('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);
|
|
@ -20,17 +20,10 @@ support-files =
|
|||
browserElement_PurgeHistory.js
|
||||
browserElement_ReloadPostRequest.js
|
||||
browserElement_SendEvent.js
|
||||
browserElement_SetVisible.js
|
||||
browserElement_SetVisibleFrames.js
|
||||
browserElement_SetVisibleFrames2.js
|
||||
browserElement_Stop.js
|
||||
browserElement_VisibilityChange.js
|
||||
file_browserElement_ExecuteScript.html
|
||||
file_browserElement_NextPaint.html
|
||||
file_browserElement_SendEvent.html
|
||||
file_browserElement_SetVisibleFrames2_Outer.html
|
||||
file_browserElement_SetVisibleFrames_Inner.html
|
||||
file_browserElement_SetVisibleFrames_Outer.html
|
||||
file_bug709759.sjs
|
||||
file_empty.html
|
||||
file_post_request.html
|
||||
|
@ -55,8 +48,4 @@ skip-if = true # bug 1332850, bug 1332862
|
|||
[test_browserElement_inproc_ReloadPostRequest.html]
|
||||
disabled = no modal prompt on POST reload for chrome window
|
||||
[test_browserElement_inproc_SendEvent.html]
|
||||
[test_browserElement_inproc_SetVisible.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames2.html]
|
||||
[test_browserElement_inproc_Stop.html]
|
||||
[test_browserElement_inproc_VisibilityChange.html]
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute("mozbrowser", "true");
|
||||
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
if (e.detail.message == 'child:ready') {
|
||||
setTimeout(function() {
|
||||
iframe.setVisible(false);
|
||||
iframe.setVisible(true);
|
||||
setTimeout(function() {
|
||||
alert('parent:finish');
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = 'file_browserElement_SetVisibleFrames_Inner.html?child';
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,45 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
|
||||
var numPrompts = 0;
|
||||
function handlePrompt(e) {
|
||||
numPrompts++;
|
||||
|
||||
// The first two prompts should be "child1:ready" and "child2:ready". Once
|
||||
// we get both of these, forward the child's prompt up to our parent.
|
||||
if (numPrompts == 2) {
|
||||
// This has to happen here, because setVisibile doesn't exist on the iframe
|
||||
// until BrowserElementChild.js is loaded in it. (That's pretty broken...)
|
||||
iframe2.setVisible(false);
|
||||
}
|
||||
else if (numPrompts == 3) {
|
||||
if (e.detail.message != 'child2:hidden') {
|
||||
alert("parent:fail Didn't get expected 'child2:hidden'.");
|
||||
}
|
||||
|
||||
alert('parent:ready');
|
||||
}
|
||||
else if (numPrompts == 4 || numPrompts == 5) {
|
||||
alert(e.detail.message);
|
||||
}
|
||||
}
|
||||
|
||||
var iframe1 = document.createElement('iframe');
|
||||
iframe1.setAttribute("mozbrowser", "true");
|
||||
iframe1.addEventListener('mozbrowsershowmodalprompt', handlePrompt);
|
||||
|
||||
var iframe2 = document.createElement('iframe');
|
||||
iframe2.setAttribute("mozbrowser", "true");
|
||||
iframe2.addEventListener('mozbrowsershowmodalprompt', handlePrompt);
|
||||
|
||||
iframe1.src = 'file_browserElement_SetVisibleFrames_Inner.html?child1';
|
||||
iframe2.src = 'file_browserElement_SetVisibleFrames_Inner.html?child2';
|
||||
document.body.appendChild(iframe1);
|
||||
document.body.appendChild(iframe2);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -80,20 +80,12 @@ disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re
|
|||
skip-if = toolkit == 'android' #TIMED_OUT, bug 766586
|
||||
[test_browserElement_oop_SendEvent.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_SetVisible.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_SetVisibleFrames.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_SetVisibleFrames2.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_Stop.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_TargetBlank.html]
|
||||
[test_browserElement_oop_TargetTop.html]
|
||||
[test_browserElement_oop_Titlechange.html]
|
||||
[test_browserElement_oop_TopBarrier.html]
|
||||
[test_browserElement_oop_VisibilityChange.html]
|
||||
disabled = Disabling some OOP tests for WebIDL scope changes (bug 1310706 for re-enabling)
|
||||
[test_browserElement_oop_XFrameOptions.html]
|
||||
[test_browserElement_oop_XFrameOptionsAllowFrom.html]
|
||||
#skip-if = asan # bug 1189592 - should be OK when ASAN mochitests are on Ubuntu 16.04
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
[DEFAULT]
|
||||
# Good luck running these tests on anything but desktop Linux.
|
||||
run-if = os == 'linux' && buildapp == 'browser' && !e10s
|
||||
support-files =
|
||||
file_MultipleFrames.html
|
||||
file_NestedFramesOuter.html
|
||||
file_WebGLContextLost.html
|
||||
silence.ogg
|
||||
!/dom/browser-element/mochitest/browserElementTestHelpers.js
|
||||
!/dom/browser-element/mochitest/file_empty.html
|
||||
|
||||
[test_Activity.html]
|
||||
[test_Background.html]
|
||||
[test_MultipleFrames.html]
|
||||
[test_NestedFrames.html]
|
||||
[test_Visibility.html]
|
|
@ -1,14 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<p>file_MultipleFrames.html</p>
|
||||
|
||||
<script>
|
||||
addEventListener('load', function() {
|
||||
setTimeout(function() {
|
||||
window.open('../file_empty.html');
|
||||
}, 0);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,20 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<p>file_NestedFramesOuter.html</p>
|
||||
<script>
|
||||
|
||||
addEventListener('load', function() {
|
||||
setTimeout(createIframe, 0);
|
||||
});
|
||||
|
||||
function createIframe()
|
||||
{
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.src = location.hash.substr(1);
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
file_WebGLContextLost.html
|
||||
<canvas id='canvas'></canvas>
|
||||
|
||||
<script>
|
||||
function runTest()
|
||||
{
|
||||
var canvas = document.getElementById('canvas');
|
||||
canvas.addEventListener('webglcontextlost', function() {
|
||||
alert('webglcontextlost');
|
||||
});
|
||||
|
||||
var context = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
||||
context.viewport(0, 0, 10, 10);
|
||||
alert('ready');
|
||||
}
|
||||
|
||||
addEventListener('load', function() { setTimeout(runTest, 0) });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
[DEFAULT]
|
||||
# Good luck running these tests on anything but desktop Linux.
|
||||
run-if = os == 'linux' && buildapp == 'browser' && !e10s
|
||||
support-files =
|
||||
silence.ogg
|
||||
!/dom/browser-element/mochitest/browserElementTestHelpers.js
|
||||
!/dom/browser-element/mochitest/file_empty.html
|
||||
|
||||
# Note: ../browserElementTestHelpers.js makes all tests in this directory OOP,
|
||||
# because testing the process-priority manager without OOP frames does not make
|
||||
# much sense.
|
||||
|
||||
[test_Simple.html]
|
||||
[test_WebGLContextLost.html]
|
||||
disabled = bug 865844
|
Двоичные данные
dom/browser-element/mochitest/priority/silence.ogg
Двоичные данные
dom/browser-element/mochitest/priority/silence.ogg
Двоичный файл не отображается.
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that calling setVisible('false') on an iframe causes its visibility to
|
||||
change.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
|
||||
iframe.src = browserElementTestHelpers.emptyPage1;
|
||||
|
||||
var childID = null;
|
||||
Promise.all([
|
||||
expectOnlyOneProcessCreated('FOREGROUND').then(function(chid) {
|
||||
childID = chid;
|
||||
}),
|
||||
expectMozbrowserEvent(iframe, 'loadend')
|
||||
]).then(function() {
|
||||
var p = expectPriorityChange(childID, 'BACKGROUND');
|
||||
|
||||
// We wait until mozbrowserloadend before calling setVisible, because
|
||||
// setVisible isn't available until mozbrowser has loaded. In practice, that
|
||||
// means we can call setVisible once we've gotten /any/ mozbrowser event.
|
||||
iframe.setVisible(false);
|
||||
return p;
|
||||
}).then(function() {
|
||||
var p = expectPriorityChange(childID, 'FOREGROUND');
|
||||
iframe.setVisible(true);
|
||||
}).then(SimpleTest.finish);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that when we remove one of a process's frames from the DOM, the process's
|
||||
priority is recomputed.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.src = 'file_MultipleFrames.html';
|
||||
|
||||
var childID = null;
|
||||
var iframe2;
|
||||
Promise.all([
|
||||
expectProcessCreated('FOREGROUND').then(function(chid) {
|
||||
childID = chid;
|
||||
}),
|
||||
new Promise(function(resolve, reject) {
|
||||
iframe.addEventListener('mozbrowseropenwindow', function(e) {
|
||||
iframe2 = e.detail.frameElement;
|
||||
var p = expectMozbrowserEvent(iframe2, 'loadend');
|
||||
document.body.appendChild(iframe2);
|
||||
resolve(p);
|
||||
});
|
||||
})
|
||||
]).then(function() {
|
||||
// At this point, the child process has been set to FOREGROUND, and the popup
|
||||
// opened by file_MultipleFrames has finished loading.
|
||||
//
|
||||
// Now setVisible(false) the popup frame and remove the popup frame from the
|
||||
// DOM. This should cause the process to take on BACKGROUND priority.
|
||||
var p = expectPriorityChange(childID, 'BACKGROUND');
|
||||
iframe.setVisible(false);
|
||||
document.body.removeChild(iframe2);
|
||||
return p;
|
||||
}).then(SimpleTest.finish);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,62 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test changing the visibility of an <iframe mozbrowser> changes the visibility
|
||||
(and thus the priority) of any <iframe mozbrowser>s it contains.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
function runTest() {
|
||||
// Set up the following hierarchy of frames:
|
||||
//
|
||||
// <iframe mozbrowser remote=false src='file_NestedFramesOuter.html'>
|
||||
// <iframe mozbrowser remote=true src='file_empty.html'>
|
||||
//
|
||||
// When we change the visibility of the outer iframe, it should change the
|
||||
// priority of the inner one.
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.setAttribute('remote', false);
|
||||
iframe.src = 'file_NestedFramesOuter.html#' + browserElementTestHelpers.emptyPage1;
|
||||
|
||||
// Note that this is the process corresponding to the /inner/ iframe. The
|
||||
// outer iframe runs in-process (because it has remote=false).
|
||||
var childID = null;
|
||||
Promise.all(
|
||||
[expectOnlyOneProcessCreated('FOREGROUND').then(function(child) {
|
||||
childID = child;
|
||||
}),
|
||||
expectMozbrowserEvent(iframe, 'loadend')]
|
||||
).then(function() {
|
||||
// Send the outer iframe into the background. This should change the
|
||||
// priority of the inner frame's process to BACKGROUND.
|
||||
var p = expectPriorityChange(childID, 'BACKGROUND');
|
||||
iframe.setVisible(false);
|
||||
return p;
|
||||
}).then(function() {
|
||||
var p = expectPriorityChange(childID, 'FOREGROUND');
|
||||
iframe.setVisible(true);
|
||||
return p;
|
||||
}).then(SimpleTest.finish);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,59 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
A simple test of the process priority manager.
|
||||
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=844323
|
||||
|
||||
Note: If you run this test alone (i.e. not as part of the larger mochitest
|
||||
suite), you may see some IPC assertions, e.g. "Can't allocate graphics
|
||||
resources."
|
||||
|
||||
What appears to be happening is that we close the Firefox window before the
|
||||
frame we create in this tab finishes starting up. Then the frame finishes
|
||||
loading, and it tries to show itself. But it's too late to show a remote frame
|
||||
at that point, so we kill the child process.
|
||||
|
||||
In other words, I think these errors are nothing to worry about.
|
||||
-->
|
||||
<head>
|
||||
<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>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
var allCompleted = 0;
|
||||
var allExpected = 2;
|
||||
function finish() {
|
||||
allCompleted++;
|
||||
if (allCompleted === allExpected) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var iframeLoaded = false;
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.src = browserElementTestHelpers.emptyPage1;
|
||||
|
||||
iframe.addEventListener('mozbrowserloadend', finish);
|
||||
expectProcessCreated('FOREGROUND').then(finish);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,51 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that setVisible() changes a process's priority.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.src = browserElementTestHelpers.emptyPage1;
|
||||
|
||||
var childID = null;
|
||||
Promise.all([
|
||||
expectOnlyOneProcessCreated('FOREGROUND').then(function(chid) {
|
||||
childID = chid;
|
||||
}),
|
||||
expectMozbrowserEvent(iframe, 'loadend')
|
||||
]).then(function() {
|
||||
// Mark the frame as not visible. This should cause its priority to drop
|
||||
// to BACKGROUND.
|
||||
var p = expectPriorityChange(childID, 'BACKGROUND');
|
||||
iframe.setVisible(false);
|
||||
return p;
|
||||
}).then(function() {
|
||||
// Mark the frame as visible again. This should cause its priority change
|
||||
// back to FOREGROUND.
|
||||
var p = expectPriorityChange(childID, 'FOREGROUND');
|
||||
iframe.setVisible(true);
|
||||
return p;
|
||||
}).then(SimpleTest.finish);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', runTest);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,99 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that calling setVisible('false') and then sending a low-memory
|
||||
notification causes a WebGL context loss event.
|
||||
-->
|
||||
<head>
|
||||
<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>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
iframe.src = 'file_WebGLContextLost.html';
|
||||
|
||||
// We use this to ensure that we don't call SimpleTest.finish() twice.
|
||||
var finished = false;
|
||||
function finishOnce() {
|
||||
if (!finished) {
|
||||
SimpleTest.finish();
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
expectMozbrowserEvent(iframe, 'error').then(function(e) {
|
||||
if (finished) {
|
||||
// We don't care if the frame dies after the test finishes.
|
||||
return;
|
||||
}
|
||||
todo(false, "child process is crashing; this probably indicates that " +
|
||||
"something is wrong with WebGL in child processes on your machine.");
|
||||
is(e.detail.type, 'fatal');
|
||||
}).then(finishOnce);
|
||||
|
||||
var childID = null;
|
||||
Promise.all([
|
||||
expectOnlyOneProcessCreated('FOREGROUND').then(function(chid) {
|
||||
childID = chid;
|
||||
}),
|
||||
expectMozbrowserEvent(iframe, 'loadend'),
|
||||
expectMozbrowserEvent(iframe, 'showmodalprompt').then(function(e) {
|
||||
is(e.detail.message, 'ready');
|
||||
})
|
||||
]).then(function() {
|
||||
// Fire a low-memory notification once the process goes into the background
|
||||
// due to the setVisible(false) call below.
|
||||
expectPriorityChange(childID, 'BACKGROUND').then(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
os.notifyObservers(null, "memory-pressure", "low-memory");
|
||||
ok(true, 'Successfully notified observers.');
|
||||
});
|
||||
});
|
||||
|
||||
// This test isn't the only possible source of a low-memory notification; the
|
||||
// browser can fire one whenever it likes. So it's fine if we lose the
|
||||
// WebGL context before we fire the low-memory notification ourself.
|
||||
|
||||
var p = expectMozbrowserEvent(iframe, 'showmodalprompt').then(function(e) {
|
||||
is(e.detail.message, 'webglcontextlost');
|
||||
});
|
||||
|
||||
iframe.setVisible(false);
|
||||
return p;
|
||||
}).then(finishOnce);
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener('testready', function() {
|
||||
// At the time this test was written, webgl was blocklisted inside child
|
||||
// processes on desktop Linux. The issue is that we spawn a child process to
|
||||
// read driver info, but we only did this on the main prrocess. Child
|
||||
// processes never read the driver info themselves, nor do they get it from
|
||||
// their parent, so they refuse to start up WebGL.
|
||||
//
|
||||
// This isn't a problem on B2G because we force WebGL on there. But it
|
||||
// obviously makes this test difficult. bjacob says forcing WebGL on here
|
||||
// shouldn't hurt things, and anyway this setting mirrors what we do on B2G,
|
||||
// which is what we're trying to test!
|
||||
SpecialPowers.pushPrefEnv({set: [["webgl.force-enabled", true]]},
|
||||
runTest);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=702880
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 702880</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=753595">Mozilla Bug 702880</a>
|
||||
|
||||
<script type="application/javascript" src='browserElement_SetVisible.js'>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 762939</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript" src="browserElement_SetVisibleFrames.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 762939</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript" src="browserElement_SetVisibleFrames2.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=868816
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 868816</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/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" src='browserElement_VisibilityChange.js'>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=702880
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 702880</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=753595">Mozilla Bug 702880</a>
|
||||
|
||||
<script type="application/javascript" src='browserElement_SetVisible.js'>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 762939</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>
|
||||
<script type="application/javascript" src="browserElement_SetVisibleFrames.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 762939</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>
|
||||
<script type="application/javascript" src="browserElement_SetVisibleFrames2.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!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" src='browserElement_VisibilityChange.js'>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -47,10 +47,8 @@ LOCAL_INCLUDES += [
|
|||
MOCHITEST_MANIFESTS += [
|
||||
'mochitest/mochitest-oop.ini',
|
||||
'mochitest/mochitest.ini',
|
||||
'mochitest/priority/mochitest.ini',
|
||||
]
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += [
|
||||
'mochitest/chrome.ini',
|
||||
'mochitest/priority/chrome.ini',
|
||||
]
|
||||
|
|
|
@ -42,11 +42,6 @@ interface nsIBrowserElementAPI : nsISupports
|
|||
|
||||
void setFrameLoader(in nsIFrameLoader frameLoader);
|
||||
|
||||
void setVisible(in boolean visible);
|
||||
nsIDOMDOMRequest getVisible();
|
||||
void setActive(in boolean active);
|
||||
boolean getActive();
|
||||
|
||||
void sendMouseEvent(in DOMString type,
|
||||
in uint32_t x,
|
||||
in uint32_t y,
|
||||
|
|
|
@ -66,62 +66,6 @@ nsBrowserElement::DestroyBrowserElementFrameScripts()
|
|||
mBrowserElementAPI->DestroyFrameScripts();
|
||||
}
|
||||
|
||||
void
|
||||
nsBrowserElement::SetVisible(bool aVisible, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->SetVisible(aVisible);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetVisible(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetVisible(getter_AddRefs(req));
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return req.forget().downcast<DOMRequest>();
|
||||
}
|
||||
|
||||
void
|
||||
nsBrowserElement::SetActive(bool aVisible, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->SetActive(aVisible);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsBrowserElement::GetActive(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), false);
|
||||
|
||||
bool isActive;
|
||||
nsresult rv = mBrowserElementAPI->GetActive(&isActive);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return isActive;
|
||||
}
|
||||
|
||||
void
|
||||
nsBrowserElement::SendMouseEvent(const nsAString& aType,
|
||||
uint32_t aX,
|
||||
|
|
|
@ -36,11 +36,6 @@ public:
|
|||
nsBrowserElement() {}
|
||||
virtual ~nsBrowserElement() {}
|
||||
|
||||
void SetVisible(bool aVisible, ErrorResult& aRv);
|
||||
already_AddRefed<dom::DOMRequest> GetVisible(ErrorResult& aRv);
|
||||
void SetActive(bool aActive, ErrorResult& aRv);
|
||||
bool GetActive(ErrorResult& aRv);
|
||||
|
||||
void SendMouseEvent(const nsAString& aType,
|
||||
uint32_t aX,
|
||||
uint32_t aY,
|
||||
|
|
|
@ -261,7 +261,6 @@ public:
|
|||
|
||||
void OnRemoteBrowserFrameShown(nsISupports* aSubject);
|
||||
void OnTabParentDestroyed(nsISupports* aSubject);
|
||||
void OnFrameloaderVisibleChanged(nsISupports* aSubject);
|
||||
void OnActivityOpened(const char16_t* aData);
|
||||
void OnActivityClosed(const char16_t* aData);
|
||||
|
||||
|
@ -592,7 +591,6 @@ ParticularProcessPriorityManager::Init()
|
|||
if (os) {
|
||||
os->AddObserver(this, "remote-browser-shown", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "ipc:browser-destroyed", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "frameloader-visible-changed", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "activity-opened", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "activity-closed", /* ownsWeak */ true);
|
||||
}
|
||||
|
@ -666,8 +664,6 @@ ParticularProcessPriorityManager::Observe(nsISupports* aSubject,
|
|||
OnRemoteBrowserFrameShown(aSubject);
|
||||
} else if (topic.EqualsLiteral("ipc:browser-destroyed")) {
|
||||
OnTabParentDestroyed(aSubject);
|
||||
} else if (topic.EqualsLiteral("frameloader-visible-changed")) {
|
||||
OnFrameloaderVisibleChanged(aSubject);
|
||||
} else if (topic.EqualsLiteral("activity-opened")) {
|
||||
OnActivityOpened(aData);
|
||||
} else if (topic.EqualsLiteral("activity-closed")) {
|
||||
|
@ -755,38 +751,6 @@ ParticularProcessPriorityManager::OnTabParentDestroyed(nsISupports* aSubject)
|
|||
ResetPriority();
|
||||
}
|
||||
|
||||
void
|
||||
ParticularProcessPriorityManager::OnFrameloaderVisibleChanged(nsISupports* aSubject)
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoader> fl = do_QueryInterface(aSubject);
|
||||
NS_ENSURE_TRUE_VOID(fl);
|
||||
|
||||
TabParent* tp = TabParent::GetFrom(fl);
|
||||
if (!tp) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
if (tp->Manager() != mContentParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Most of the time when something changes in a process we call
|
||||
// ResetPriority(), giving a grace period before downgrading its priority.
|
||||
// But notice that here don't give a grace period: We call ResetPriorityNow()
|
||||
// instead.
|
||||
//
|
||||
// We do this because we're reacting here to a setVisibility() call, which is
|
||||
// an explicit signal from the process embedder that we should re-prioritize
|
||||
// a process. If we gave a grace period in response to setVisibility()
|
||||
// calls, it would be impossible for the embedder to explicitly prioritize
|
||||
// processes and prevent e.g. the case where we switch which process is in
|
||||
// the foreground and, during the old fg processs's grace period, it OOMs the
|
||||
// new fg process.
|
||||
|
||||
ResetPriorityNow();
|
||||
}
|
||||
|
||||
void
|
||||
ParticularProcessPriorityManager::OnActivityOpened(const char16_t* aData)
|
||||
{
|
||||
|
@ -899,19 +863,8 @@ ParticularProcessPriorityManager::CurrentPriority()
|
|||
ProcessPriority
|
||||
ParticularProcessPriorityManager::ComputePriority()
|
||||
{
|
||||
bool isVisible = false;
|
||||
const ManagedContainer<PBrowserParent>& browsers =
|
||||
mContentParent->ManagedPBrowserParent();
|
||||
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
if (TabParent::GetFrom(iter.Get()->GetKey())->IsVisible()) {
|
||||
isVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isVisible) {
|
||||
return PROCESS_PRIORITY_FOREGROUND;
|
||||
}
|
||||
// TODO...
|
||||
return PROCESS_PRIORITY_FOREGROUND;
|
||||
|
||||
if ((mHoldsCPUWakeLock || mHoldsHighPriorityWakeLock) &&
|
||||
IsExpectingSystemMessage()) {
|
||||
|
|
|
@ -320,17 +320,6 @@ TabParent::RemoveWindowListeners()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::IsVisible() const
|
||||
{
|
||||
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return frameLoader->GetVisible();
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::DestroyInternal()
|
||||
{
|
||||
|
|
|
@ -118,14 +118,6 @@ public:
|
|||
|
||||
void CacheFrameLoader(nsFrameLoader* aFrameLoader);
|
||||
|
||||
/**
|
||||
* Returns true iff this TabParent's nsIFrameLoader is visible.
|
||||
*
|
||||
* The frameloader's visibility can be independent of e.g. its docshell's
|
||||
* visibility.
|
||||
*/
|
||||
bool IsVisible() const;
|
||||
|
||||
nsIBrowserDOMWindow *GetBrowserDOMWindow() const { return mBrowserDOMWindow; }
|
||||
|
||||
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow)
|
||||
|
|
|
@ -28,26 +28,6 @@ BrowserElement implements BrowserElementPrivileged;
|
|||
|
||||
[NoInterfaceObject]
|
||||
interface BrowserElementCommon {
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
void setVisible(boolean visible);
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
DOMRequest getVisible();
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
void setActive(boolean active);
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
boolean getActive();
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
|
|
Загрузка…
Ссылка в новой задаче