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.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Test that high-priority processes downgrade the CPU priority of regular
5 processes.
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>
14 <script type="application/javascript;version=1.7">
15 "use strict";
17 SimpleTest.waitForExplicitFinish();
18 browserElementTestHelpers.setEnabledPref(true);
19 browserElementTestHelpers.addPermission();
20 browserElementTestHelpers.enableProcessPriorityManager();
21 SpecialPowers.addPermission("embed-apps", true, document);
23 var iframe = null;
24 var childID = null;
26 function runTest() {
27 var iframe = document.createElement('iframe');
28 iframe.setAttribute('mozbrowser', true);
30 iframe.src = browserElementTestHelpers.emptyPage1;
32 var highPriorityIframe = null;
33 var childID = null;
35 expectProcessCreated().then(function(chid) {
36 childID = chid;
37 return expectPriorityChange(childID, 'FOREGROUND', 'CPU_NORMAL');
38 }).then(function() {
39 // Create a new, high-priority iframe.
40 highPriorityIframe = document.createElement('iframe');
41 highPriorityIframe.setAttribute('mozbrowser', true);
42 highPriorityIframe.setAttribute('expecting-system-message', true);
43 highPriorityIframe.setAttribute('mozapptype', 'critical');
44 highPriorityIframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
45 highPriorityIframe.src = browserElementTestHelpers.emptyPage2;
47 var p = expectPriorityChange(childID, 'FOREGROUND', 'CPU_LOW');
49 document.body.appendChild(highPriorityIframe);
51 return p;
52 }).then(function() {
53 return expectPriorityChange(childID, 'FOREGROUND', 'CPU_NORMAL');
54 }).then(SimpleTest.finish);
56 document.body.appendChild(iframe);
57 }
59 addEventListener('testready', function() {
60 // Cause the CPU wake lock taken on behalf of the high-priority process to
61 // time out after 1s.
62 SpecialPowers.pushPrefEnv(
63 {set: [["dom.ipc.systemMessageCPULockTimeoutSec", 1]]},
64 runTest);
65 });
67 </script>
68 </body>
69 </html>