|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 Test that when we remove one of a process's frames from the DOM, the process's |
|
5 priority is recomputed. |
|
6 --> |
|
7 <head> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" src="../browserElementTestHelpers.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 |
|
14 <script type="application/javascript;version=1.7"> |
|
15 "use strict"; |
|
16 |
|
17 SimpleTest.waitForExplicitFinish(); |
|
18 browserElementTestHelpers.setEnabledPref(true); |
|
19 browserElementTestHelpers.addPermission(); |
|
20 browserElementTestHelpers.enableProcessPriorityManager(); |
|
21 |
|
22 function runTest() { |
|
23 var iframe = document.createElement('iframe'); |
|
24 iframe.setAttribute('mozbrowser', true); |
|
25 iframe.src = 'file_MultipleFrames.html'; |
|
26 |
|
27 var childID = null; |
|
28 var iframe2; |
|
29 expectProcessCreated().then(function(chid) { |
|
30 childID = chid; |
|
31 return expectPriorityChange(childID, 'FOREGROUND'); |
|
32 }).then(function() { |
|
33 return expectMozbrowserEvent(iframe, 'openwindow'); |
|
34 }).then(function(e) { |
|
35 iframe2 = e.detail.frameElement; |
|
36 document.body.appendChild(iframe2); |
|
37 return expectMozbrowserEvent(iframe2, 'loadend'); |
|
38 }).then(function() { |
|
39 // At this point, the child process has been set to FOREGROUND, and the popup |
|
40 // opened by file_MultipleFrames has finished loading. |
|
41 // |
|
42 // Now setVisible(false) the popup frame and remove the popup frame from the |
|
43 // DOM. This should cause the process to take on BACKGROUND priority. |
|
44 var p = expectPriorityChange(childID, 'BACKGROUND'); |
|
45 iframe.setVisible(false); |
|
46 document.body.removeChild(iframe2); |
|
47 return p; |
|
48 }).then(SimpleTest.finish); |
|
49 |
|
50 document.body.appendChild(iframe); |
|
51 } |
|
52 |
|
53 addEventListener('testready', runTest); |
|
54 </script> |
|
55 </body> |
|
56 </html> |