blob: 57d9563e738a890e87b6dc708d4ab02d6da3953c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<!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;version=1.7">
"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>
|