summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabPrompts/browser_multiplePrompts.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/base/content/test/tabPrompts/browser_multiplePrompts.js
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/base/content/test/tabPrompts/browser_multiplePrompts.js')
-rw-r--r--browser/base/content/test/tabPrompts/browser_multiplePrompts.js72
1 files changed, 0 insertions, 72 deletions
diff --git a/browser/base/content/test/tabPrompts/browser_multiplePrompts.js b/browser/base/content/test/tabPrompts/browser_multiplePrompts.js
deleted file mode 100644
index c548429ea..000000000
--- a/browser/base/content/test/tabPrompts/browser_multiplePrompts.js
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-
-/*
- * This test triggers multiple alerts on one single tab, because it"s possible
- * for web content to do so. The behavior is described in bug 1266353.
- *
- * We assert the presentation of the multiple alerts, ensuring we show only
- * the oldest one.
- */
-add_task(function*() {
- const PROMPTCOUNT = 5;
-
- let contentScript = function() {
- var i = 5; // contentScript has no access to PROMPTCOUNT.
- window.addEventListener("message", function() {
- i--;
- if (i) {
- window.postMessage("ping", "*");
- }
- alert("Alert countdown #" + i);
- });
- window.postMessage("ping", "*");
- };
- let url = "data:text/html,<script>(" + encodeURIComponent(contentScript.toSource()) + ")();</script>"
-
- let promptsOpenedPromise = new Promise(function(resolve) {
- let unopenedPromptCount = PROMPTCOUNT;
- Services.obs.addObserver(function observer() {
- unopenedPromptCount--;
- if (!unopenedPromptCount) {
- Services.obs.removeObserver(observer, "tabmodal-dialog-loaded");
- info("Prompts opened.");
- resolve();
- }
- }, "tabmodal-dialog-loaded", false);
- });
-
- let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url, true);
- info("Tab loaded");
-
- yield promptsOpenedPromise;
-
- let promptsCount = PROMPTCOUNT;
- while (promptsCount--) {
- let prompts = tab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
- is(prompts.length, promptsCount + 1, "There should be " + (promptsCount + 1) + " prompt(s).");
- // The oldest should be the first.
- let i = 0;
- for (let prompt of prompts) {
- is(prompt.Dialog.args.text, "Alert countdown #" + i, "The #" + i + " alert should be labelled as such.");
- if (i !== promptsCount) {
- is(prompt.hidden, true, "This prompt should be hidden.");
- i++;
- continue;
- }
-
- is(prompt.hidden, false, "The last prompt should not be hidden.");
- prompt.onButtonClick(0);
-
- // The click is handled async; wait for an event loop turn for that to
- // happen.
- yield new Promise(function(resolve) {
- Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
- });
- }
- }
-
- let prompts = tab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
- is(prompts.length, 0, "Prompts should all be dismissed.");
-
- yield BrowserTestUtils.removeTab(tab);
-});