summaryrefslogtreecommitdiffstats
path: root/dom/media/webaudio/test/browser_bug1181073.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/webaudio/test/browser_bug1181073.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/webaudio/test/browser_bug1181073.js')
-rw-r--r--dom/media/webaudio/test/browser_bug1181073.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/dom/media/webaudio/test/browser_bug1181073.js b/dom/media/webaudio/test/browser_bug1181073.js
new file mode 100644
index 000000000..6ee48144c
--- /dev/null
+++ b/dom/media/webaudio/test/browser_bug1181073.js
@@ -0,0 +1,40 @@
+add_task(function*() {
+ // Make the min_background_timeout_value very high to avoid problems on slow machines
+ yield new Promise(resolve => SpecialPowers.pushPrefEnv({
+ 'set': [['dom.min_background_timeout_value', 3000]]
+ }, resolve));
+
+ // Make a new tab, and put it in the background
+ yield BrowserTestUtils.withNewTab("about:blank", function*(browser) {
+ yield BrowserTestUtils.withNewTab("about:blank", function*() {
+ let time = yield ContentTask.spawn(browser, null, function () {
+ return new Promise(resolve => {
+ let start = content.performance.now();
+ let id = content.window.setInterval(function() {
+ let end = content.performance.now();
+ content.window.clearInterval(id);
+ resolve(end - start);
+ }, 0);
+ });
+ });
+
+ ok(time > 2000, "Interval is throttled with no webaudio (" + time + " ms)");
+
+ time = yield ContentTask.spawn(browser, null, function () {
+ return new Promise(resolve => {
+ // Create an audio context, and save it on the window so it doesn't get GCed
+ content.window._audioCtx = new content.window.AudioContext();
+
+ let start = content.performance.now();
+ let id = content.window.setInterval(function() {
+ let end = content.performance.now();
+ content.window.clearInterval(id);
+ resolve(end - start);
+ }, 0);
+ });
+ });
+
+ ok(time < 1000, "Interval is not throttled with an audio context present (" + time + " ms)");
+ });
+ });
+});