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 when we remove one of a process's frames from the DOM, the process's |
michael@0 | 5 | priority is recomputed. |
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 | |
michael@0 | 22 | function runTest() { |
michael@0 | 23 | var iframe = document.createElement('iframe'); |
michael@0 | 24 | iframe.setAttribute('mozbrowser', true); |
michael@0 | 25 | iframe.src = 'file_MultipleFrames.html'; |
michael@0 | 26 | |
michael@0 | 27 | var childID = null; |
michael@0 | 28 | var iframe2; |
michael@0 | 29 | expectProcessCreated().then(function(chid) { |
michael@0 | 30 | childID = chid; |
michael@0 | 31 | return expectPriorityChange(childID, 'FOREGROUND'); |
michael@0 | 32 | }).then(function() { |
michael@0 | 33 | return expectMozbrowserEvent(iframe, 'openwindow'); |
michael@0 | 34 | }).then(function(e) { |
michael@0 | 35 | iframe2 = e.detail.frameElement; |
michael@0 | 36 | document.body.appendChild(iframe2); |
michael@0 | 37 | return expectMozbrowserEvent(iframe2, 'loadend'); |
michael@0 | 38 | }).then(function() { |
michael@0 | 39 | // At this point, the child process has been set to FOREGROUND, and the popup |
michael@0 | 40 | // opened by file_MultipleFrames has finished loading. |
michael@0 | 41 | // |
michael@0 | 42 | // Now setVisible(false) the popup frame and remove the popup frame from the |
michael@0 | 43 | // DOM. This should cause the process to take on BACKGROUND priority. |
michael@0 | 44 | var p = expectPriorityChange(childID, 'BACKGROUND'); |
michael@0 | 45 | iframe.setVisible(false); |
michael@0 | 46 | document.body.removeChild(iframe2); |
michael@0 | 47 | return p; |
michael@0 | 48 | }).then(SimpleTest.finish); |
michael@0 | 49 | |
michael@0 | 50 | document.body.appendChild(iframe); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | addEventListener('testready', runTest); |
michael@0 | 54 | </script> |
michael@0 | 55 | </body> |
michael@0 | 56 | </html> |