michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: runTests(); michael@0: } michael@0: michael@0: gTests.push({ michael@0: desc: "Test getPrompt with null domWindow (bug 949333)", michael@0: run: function () { michael@0: let factory = Cc["@mozilla.org/prompter;1"].getService(Ci.nsIPromptFactory); michael@0: let prompter = factory.getPrompt(null, Ci.nsIPrompt); michael@0: michael@0: let browser = getBrowser(); michael@0: let dialogOpened = false; michael@0: michael@0: Task.spawn(function() { michael@0: yield waitForEvent(browser, "DOMWillOpenModalDialog"); michael@0: dialogOpened = true; michael@0: michael@0: yield waitForMs(0); michael@0: let stack = browser.parentNode; michael@0: let dialogs = stack.getElementsByTagNameNS(XUL_NS, "tabmodalprompt"); michael@0: is(dialogs.length, 1, "one tab-modal dialog showing"); michael@0: michael@0: let dialog = dialogs[0]; michael@0: let okButton = dialog.ui.button0; michael@0: okButton.click(); michael@0: }); michael@0: michael@0: prompter.alert("Test", "test"); michael@0: michael@0: ok(dialogOpened, "Dialog was opened"); michael@0: } michael@0: });