blob: e7ebc2a616ef347622b0e6609f057e058b29426d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
function burnCPOW(msg) {
dump(`Addon: content burnCPU start ${Math.sin(Math.random())}\n`);
let start = content.performance.now();
let ignored = [];
while (content.performance.now() - start < 5000) {
ignored[ignored.length % 2] = ignored.length;
}
dump(`Addon: content burnCPU done: ${content.performance.now() - start}\n`);
}
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
sendAsyncMessage("test-addonwatcher-cpow:init", {}, {burnCPOW});
}
addMessageListener("test-addonwatcher-burn-some-content-cpu", burnCPOW);
|