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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     5 "use strict";
     7 function test() {
     8   waitForExplicitFinish();
     9   runTests();
    10 }
    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);
    18     let browser = getBrowser();
    19     let dialogOpened = false;
    21     Task.spawn(function() {
    22       yield waitForEvent(browser, "DOMWillOpenModalDialog");
    23       dialogOpened = true;
    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");
    30       let dialog = dialogs[0];
    31       let okButton = dialog.ui.button0;
    32       okButton.click();
    33     });
    35     prompter.alert("Test", "test");
    37     ok(dialogOpened, "Dialog was opened");
    38   }
    39 });

mercurial