browser/metro/base/tests/mochitest/browser_prompt.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:5cf57f167509
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 "use strict";
6
7 function test() {
8 waitForExplicitFinish();
9 runTests();
10 }
11
12 gTests.push({
13 desc: "Test getPrompt with null domWindow (bug 949333)",
14 run: function () {
15 let factory = Cc["@mozilla.org/prompter;1"].getService(Ci.nsIPromptFactory);
16 let prompter = factory.getPrompt(null, Ci.nsIPrompt);
17
18 let browser = getBrowser();
19 let dialogOpened = false;
20
21 Task.spawn(function() {
22 yield waitForEvent(browser, "DOMWillOpenModalDialog");
23 dialogOpened = true;
24
25 yield waitForMs(0);
26 let stack = browser.parentNode;
27 let dialogs = stack.getElementsByTagNameNS(XUL_NS, "tabmodalprompt");
28 is(dialogs.length, 1, "one tab-modal dialog showing");
29
30 let dialog = dialogs[0];
31 let okButton = dialog.ui.button0;
32 okButton.click();
33 });
34
35 prompter.alert("Test", "test");
36
37 ok(dialogOpened, "Dialog was opened");
38 }
39 });

mercurial