Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | Test that calling setVisible('false') on two iframes causes the former one's priority with background LRU to |
michael@0 | 5 | change. |
michael@0 | 6 | --> |
michael@0 | 7 | <head> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="../browserElementTestHelpers.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript;version=1.7"> |
michael@0 | 15 | "use strict"; |
michael@0 | 16 | |
michael@0 | 17 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 18 | browserElementTestHelpers.setEnabledPref(true); |
michael@0 | 19 | browserElementTestHelpers.addPermission(); |
michael@0 | 20 | browserElementTestHelpers.enableProcessPriorityManager(); |
michael@0 | 21 | SpecialPowers.addPermission("embed-apps", true, document); |
michael@0 | 22 | |
michael@0 | 23 | function runTest() { |
michael@0 | 24 | var iframe1 = document.createElement('iframe'); |
michael@0 | 25 | iframe1.setAttribute('mozbrowser', true); |
michael@0 | 26 | iframe1.src = 'file_MultipleFrames.html'; |
michael@0 | 27 | |
michael@0 | 28 | var iframe2 = null; |
michael@0 | 29 | var childID = null; |
michael@0 | 30 | |
michael@0 | 31 | expectProcessCreated().then(function(chid) { |
michael@0 | 32 | childID = chid; |
michael@0 | 33 | return expectPriorityChange(childID, 'FOREGROUND'); |
michael@0 | 34 | }).then(function() { |
michael@0 | 35 | return expectMozbrowserEvent(iframe1, 'openwindow'); |
michael@0 | 36 | }).then(function() { |
michael@0 | 37 | var p = expectPriorityChange(childID, 'BACKGROUND'); |
michael@0 | 38 | iframe1.setVisible(false); |
michael@0 | 39 | return p; |
michael@0 | 40 | }).then(function() { |
michael@0 | 41 | iframe2 = document.createElement('iframe'); |
michael@0 | 42 | iframe2.setAttribute('mozbrowser', true); |
michael@0 | 43 | iframe2.setAttribute('mozapp', 'http://example.org/manifest.webapp'); |
michael@0 | 44 | iframe2.src = browserElementTestHelpers.emptyPage1; |
michael@0 | 45 | |
michael@0 | 46 | document.body.appendChild(iframe2); |
michael@0 | 47 | |
michael@0 | 48 | // At this point, we should have iframe1 in background already. |
michael@0 | 49 | // We wait until another one is set to background, too. |
michael@0 | 50 | // Once there are two in background, the first one (LRU order) |
michael@0 | 51 | // should have 'backgroundLRU' equals 1 |
michael@0 | 52 | var p = expectPriorityWithBackgroundLRUSet(childID, '1'); |
michael@0 | 53 | iframe2.setVisible(false); |
michael@0 | 54 | document.body.removeChild(iframe2); |
michael@0 | 55 | |
michael@0 | 56 | return p; |
michael@0 | 57 | |
michael@0 | 58 | }).then(SimpleTest.finish); |
michael@0 | 59 | |
michael@0 | 60 | document.body.appendChild(iframe1); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | addEventListener('testready', runTest); |
michael@0 | 64 | |
michael@0 | 65 | </script> |
michael@0 | 66 | </body> |
michael@0 | 67 | </html> |