diff options
Diffstat (limited to 'toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content')
-rw-r--r-- | toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js new file mode 100644 index 000000000..e7ebc2a61 --- /dev/null +++ b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js @@ -0,0 +1,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); |