Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | Test that a regular (not mozapptype=critical) frame that's expecting a system |
michael@0 | 5 | message gets priority BACKGROUND_PERCEIVABLE when it's in the background. |
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 | // Give our origin permission to open browsers, and remove it when the test is complete. |
michael@0 | 24 | var principal = SpecialPowers.wrap(document).nodePrincipal; |
michael@0 | 25 | SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec, |
michael@0 | 26 | appId: principal.appId, |
michael@0 | 27 | isInBrowserElement: true }); |
michael@0 | 28 | |
michael@0 | 29 | addEventListener('unload', function() { |
michael@0 | 30 | var principal = SpecialPowers.wrap(document).nodePrincipal; |
michael@0 | 31 | SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec, |
michael@0 | 32 | appId: principal.appId, |
michael@0 | 33 | isInBrowserElement: true }); |
michael@0 | 34 | }); |
michael@0 | 35 | |
michael@0 | 36 | function runTest() { |
michael@0 | 37 | var iframe = document.createElement('iframe'); |
michael@0 | 38 | iframe.setAttribute('mozbrowser', true); |
michael@0 | 39 | iframe.setAttribute('expecting-system-message', true); |
michael@0 | 40 | iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp'); |
michael@0 | 41 | |
michael@0 | 42 | iframe.src = browserElementTestHelpers.emptyPage1; |
michael@0 | 43 | |
michael@0 | 44 | var childID = null; |
michael@0 | 45 | expectOnlyOneProcessCreated().then(function(chid) { |
michael@0 | 46 | childID = chid; |
michael@0 | 47 | return Promise.all( |
michael@0 | 48 | [expectPriorityChange(childID, 'FOREGROUND'), |
michael@0 | 49 | expectMozbrowserEvent(iframe, 'loadend')]); |
michael@0 | 50 | }).then(function() { |
michael@0 | 51 | var p = expectPriorityChange(childID, 'BACKGROUND_PERCEIVABLE'); |
michael@0 | 52 | iframe.setVisible(false); |
michael@0 | 53 | return p; |
michael@0 | 54 | }).then(SimpleTest.finish); |
michael@0 | 55 | |
michael@0 | 56 | document.body.appendChild(iframe); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | addEventListener('testready', function() { |
michael@0 | 60 | // We don't want this wake lock to time out during the test; if it did, then |
michael@0 | 61 | // we might see BACKGROUND priority instead of BACKGROUND_PERCEIVABLE. So |
michael@0 | 62 | // set the timeout to a large value. |
michael@0 | 63 | SpecialPowers.pushPrefEnv( |
michael@0 | 64 | {set: [["dom.ipc.systemMessageCPULockTimeoutSec", 99999]]}, |
michael@0 | 65 | runTest); |
michael@0 | 66 | }); |
michael@0 | 67 | |
michael@0 | 68 | </script> |
michael@0 | 69 | </body> |
michael@0 | 70 | </html> |