mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 949333 - Make Metro prompt service work for Master Password [r=TimAbraldes]
This commit is contained in:
parent
eecc1db9a4
commit
ddfe4b7904
39
browser/metro/base/tests/mochitest/browser_prompt.js
Normal file
39
browser/metro/base/tests/mochitest/browser_prompt.js
Normal file
@ -0,0 +1,39 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
runTests();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
desc: "Test getPrompt with null domWindow (bug 949333)",
|
||||
run: function () {
|
||||
let factory = Cc["@mozilla.org/prompter;1"].getService(Ci.nsIPromptFactory);
|
||||
let prompter = factory.getPrompt(null, Ci.nsIPrompt);
|
||||
|
||||
let browser = getBrowser();
|
||||
let dialogOpened = false;
|
||||
|
||||
Task.spawn(function() {
|
||||
yield waitForEvent(browser, "DOMWillOpenModalDialog");
|
||||
dialogOpened = true;
|
||||
|
||||
yield waitForMs(0);
|
||||
let stack = browser.parentNode;
|
||||
let dialogs = stack.getElementsByTagNameNS(XUL_NS, "tabmodalprompt");
|
||||
is(dialogs.length, 1, "one tab-modal dialog showing");
|
||||
|
||||
let dialog = dialogs[0];
|
||||
let okButton = dialog.ui.button0;
|
||||
okButton.click();
|
||||
});
|
||||
|
||||
prompter.alert("Test", "test");
|
||||
|
||||
ok(dialogOpened, "Dialog was opened");
|
||||
}
|
||||
});
|
@ -47,6 +47,7 @@ support-files =
|
||||
[browser_link_click.js]
|
||||
[browser_onscreen_keyboard.js]
|
||||
[browser_prefs_ui.js]
|
||||
[browser_prompt.js]
|
||||
[browser_remotetabs.js]
|
||||
[browser_snappedState.js]
|
||||
[browser_tabs.js]
|
||||
|
@ -22,6 +22,16 @@ PromptService.prototype = {
|
||||
/* ---------- nsIPromptFactory ---------- */
|
||||
|
||||
getPrompt: function getPrompt(domWin, iid) {
|
||||
if (!domWin) {
|
||||
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!chromeWin) {
|
||||
let msg = "PromptService.js: Attempted create a prompt but no DOM Window specified and failed to find one";
|
||||
Cu.reportError(msg);
|
||||
throw(msg);
|
||||
}
|
||||
domWin = chromeWin.getBrowser().contentWindow;
|
||||
}
|
||||
|
||||
let factory =
|
||||
Components.classesByID["{1c978d25-b37f-43a8-a2d6-0c7a239ead87}"]
|
||||
.createInstance(Ci.nsIPromptFactory);
|
||||
@ -39,16 +49,6 @@ PromptService.prototype = {
|
||||
|
||||
callProxy: function(aName, aArgs) {
|
||||
let domWin = aArgs[0];
|
||||
if (!domWin) {
|
||||
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!chromeWin) {
|
||||
let msg = "PromptService.js: Attempted create a prompt but no DOM Window specified and failed to find one";
|
||||
Cu.reportError(msg);
|
||||
throw(msg);
|
||||
}
|
||||
domWin = chromeWin.getBrowser().contentWindow;
|
||||
}
|
||||
|
||||
let prompt = this.getPrompt(domWin, Ci.nsIPrompt);
|
||||
if (aName == 'promptAuth' || aName == 'promptAuthAsync') {
|
||||
let adapterFactory =
|
||||
|
Loading…
Reference in New Issue
Block a user