|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 Test that calling setVisible('false') on two iframes causes the former one's priority with background LRU to |
|
5 change. |
|
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 SpecialPowers.addPermission("embed-apps", true, document); |
|
22 |
|
23 function runTest() { |
|
24 var iframe1 = document.createElement('iframe'); |
|
25 iframe1.setAttribute('mozbrowser', true); |
|
26 iframe1.src = 'file_MultipleFrames.html'; |
|
27 |
|
28 var iframe2 = null; |
|
29 var childID = null; |
|
30 |
|
31 expectProcessCreated().then(function(chid) { |
|
32 childID = chid; |
|
33 return expectPriorityChange(childID, 'FOREGROUND'); |
|
34 }).then(function() { |
|
35 return expectMozbrowserEvent(iframe1, 'openwindow'); |
|
36 }).then(function() { |
|
37 var p = expectPriorityChange(childID, 'BACKGROUND'); |
|
38 iframe1.setVisible(false); |
|
39 return p; |
|
40 }).then(function() { |
|
41 iframe2 = document.createElement('iframe'); |
|
42 iframe2.setAttribute('mozbrowser', true); |
|
43 iframe2.setAttribute('mozapp', 'http://example.org/manifest.webapp'); |
|
44 iframe2.src = browserElementTestHelpers.emptyPage1; |
|
45 |
|
46 document.body.appendChild(iframe2); |
|
47 |
|
48 // At this point, we should have iframe1 in background already. |
|
49 // We wait until another one is set to background, too. |
|
50 // Once there are two in background, the first one (LRU order) |
|
51 // should have 'backgroundLRU' equals 1 |
|
52 var p = expectPriorityWithBackgroundLRUSet(childID, '1'); |
|
53 iframe2.setVisible(false); |
|
54 document.body.removeChild(iframe2); |
|
55 |
|
56 return p; |
|
57 |
|
58 }).then(SimpleTest.finish); |
|
59 |
|
60 document.body.appendChild(iframe1); |
|
61 } |
|
62 |
|
63 addEventListener('testready', runTest); |
|
64 |
|
65 </script> |
|
66 </body> |
|
67 </html> |