Bug 1367081 - 3. Include window when using Prompt.jsm; r=droeh

Include the window when using Prompt.jsm in JS so that the prompts can
be directed to the correct Activity.

MozReview-Commit-ID: CrPqf9gnDho
This commit is contained in:
Jim Chen 2017-06-02 16:16:11 -04:00
Родитель 4230e5eacd
Коммит 1507e819e9
4 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -572,7 +572,7 @@ var CastingApps = {
}
},
prompt: function(aCallback, aFilterFunc) {
prompt: function(aWindow, aCallback, aFilterFunc) {
let items = [];
let filteredServices = [];
SimpleServiceDiscovery.services.forEach(function(aService) {
@ -591,6 +591,7 @@ var CastingApps = {
}
let prompt = new Prompt({
window: aWindow,
title: Strings.browser.GetStringFromName("casting.sendToDevice")
}).setSingleChoiceItems(items).show(function(data) {
let selected = data.button;
@ -620,7 +621,7 @@ var CastingApps = {
return this.allowableExtension(aVideo.sourceURI, aService.extensions) || this.allowableMimeType(aVideo.type, aService.types);
}
this.prompt(aService => {
this.prompt(aVideo.element.ownerGlobal, aService => {
if (!aService)
return;

Просмотреть файл

@ -5374,6 +5374,7 @@ var XPInstallObserver = {
}
new Prompt({
window: window,
title: Strings.browser.GetStringFromName("addonError.titleError"),
message: message,
buttons: buttons
@ -5408,6 +5409,7 @@ var XPInstallObserver = {
strings.GetStringFromName("unsignedAddonsDisabled.dismiss")
];
new Prompt({
window: window,
title: Strings.browser.GetStringFromName("addonError.titleBlocked"),
message: message,
buttons: buttons
@ -5424,6 +5426,7 @@ var XPInstallObserver = {
return;
new Prompt({
window: window,
title: Strings.browser.GetStringFromName("addonError.titleBlocked"),
message: strings.formatStringFromName("xpinstallPromptWarningDirect", [brandShortName], 1),
buttons: [strings.GetStringFromName("unsignedAddonsDisabled.dismiss")]
@ -6649,6 +6652,7 @@ var ExternalApps = {
if (apps.length > 1) {
// Use the HelperApps prompt here to filter out any Http handlers
HelperApps.prompt(apps, {
window: window,
title: Strings.browser.GetStringFromName("openInApp.pageAction"),
buttons: [
Strings.browser.GetStringFromName("openInApp.ok"),

Просмотреть файл

@ -34,11 +34,14 @@ ColorPicker.prototype = {
},
open: function(aCallback) {
let p = new Prompt({ title: this._title,
let p = new Prompt({
window: this._domWin,
title: this._title,
buttons: [
this.strings.GetStringFromName("inputWidgetHelper.set"),
this.strings.GetStringFromName("inputWidgetHelper.cancel")
] })
this.strings.GetStringFromName("inputWidgetHelper.set"),
this.strings.GetStringFromName("inputWidgetHelper.cancel"),
],
})
.addColorPicker({ value: this._initial })
.show((data) => {
if (data.button == 0)

Просмотреть файл

@ -212,7 +212,7 @@ FilePicker.prototype = {
// Other consumers of the file picker may have to either wait for Android
// to clean up the temp dir (not guaranteed) or clean up after themselves.
let win = Services.wm.getMostRecentWindow('navigator:browser');
let tab = win.BrowserApp.getTabForWindow(this._domWin.top)
let tab = win && win.BrowserApp.getTabForWindow(this._domWin.top)
if (tab) {
msg.tabId = tab.id;
}