зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539757 - fix trying to initialize XBL bindings while the prompt is still hidden, r=bgrins
Differential Revision: https://phabricator.services.mozilla.com/D25390 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f7a8b4c054
Коммит
4ffc2ff028
|
@ -8369,6 +8369,8 @@ TabModalPromptBox.prototype = {
|
||||||
if (prompts.length) {
|
if (prompts.length) {
|
||||||
let prompt = prompts[prompts.length - 1];
|
let prompt = prompts[prompts.length - 1];
|
||||||
prompt.element.hidden = false;
|
prompt.element.hidden = false;
|
||||||
|
// Because we were hidden before, this won't have been possible, so do it now:
|
||||||
|
prompt.ensureXBLBindingAttached();
|
||||||
prompt.Dialog.setDefaultFocus();
|
prompt.Dialog.setDefaultFocus();
|
||||||
} else {
|
} else {
|
||||||
browser.removeAttribute("tabmodalPromptShowing");
|
browser.removeAttribute("tabmodalPromptShowing");
|
||||||
|
|
|
@ -8,20 +8,21 @@
|
||||||
* the oldest one.
|
* the oldest one.
|
||||||
*/
|
*/
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const PROMPTCOUNT = 5;
|
const PROMPTCOUNT = 9;
|
||||||
|
|
||||||
let contentScript = function() {
|
let contentScript = function(MAX_PROMPT) {
|
||||||
var i = 5; // contentScript has no access to PROMPTCOUNT.
|
var i = MAX_PROMPT;
|
||||||
|
let fns = ["alert", "prompt", "confirm"];
|
||||||
window.addEventListener("message", function() {
|
window.addEventListener("message", function() {
|
||||||
i--;
|
i--;
|
||||||
if (i) {
|
if (i) {
|
||||||
window.postMessage("ping", "*");
|
window.postMessage("ping", "*");
|
||||||
}
|
}
|
||||||
alert("Alert countdown #" + i);
|
window[fns[i % 3]](fns[i % 3] + " countdown #" + i);
|
||||||
});
|
});
|
||||||
window.postMessage("ping", "*");
|
window.postMessage("ping", "*");
|
||||||
};
|
};
|
||||||
let url = "data:text/html,<script>(" + encodeURIComponent(contentScript.toSource()) + ")();</script>";
|
let url = "data:text/html,<script>(" + encodeURIComponent(contentScript.toSource()) + ")(" + PROMPTCOUNT + ");</script>";
|
||||||
|
|
||||||
let promptsOpenedPromise = new Promise(function(resolve) {
|
let promptsOpenedPromise = new Promise(function(resolve) {
|
||||||
let unopenedPromptCount = PROMPTCOUNT;
|
let unopenedPromptCount = PROMPTCOUNT;
|
||||||
|
@ -48,7 +49,8 @@ add_task(async function() {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (let promptElement of promptElements) {
|
for (let promptElement of promptElements) {
|
||||||
let prompt = tab.linkedBrowser.tabModalPromptBox.prompts.get(promptElement);
|
let prompt = tab.linkedBrowser.tabModalPromptBox.prompts.get(promptElement);
|
||||||
is(prompt.Dialog.args.text, "Alert countdown #" + i, "The #" + i + " alert should be labelled as such.");
|
let expectedType = ["alert", "prompt", "confirm"][i % 3];
|
||||||
|
is(prompt.Dialog.args.text, expectedType + " countdown #" + i, "The #" + i + " alert should be labelled as such.");
|
||||||
if (i !== promptElementsCount) {
|
if (i !== promptElementsCount) {
|
||||||
is(prompt.element.hidden, true, "This prompt should be hidden.");
|
is(prompt.element.hidden, true, "This prompt should be hidden.");
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -80,6 +80,7 @@ var RemotePrompt = {
|
||||||
// there's other stuff in nsWindowWatcher::OpenWindowInternal
|
// there's other stuff in nsWindowWatcher::OpenWindowInternal
|
||||||
// that we might need to do here as well.
|
// that we might need to do here as well.
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
Cu.reportError(ex);
|
||||||
onPromptClose(true);
|
onPromptClose(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -162,6 +162,7 @@ CommonDialog.prototype = {
|
||||||
else
|
else
|
||||||
button.setAttribute("default", "true");
|
button.setAttribute("default", "true");
|
||||||
|
|
||||||
|
if (!this.ui.promptContainer.hidden) {
|
||||||
// For tab prompts, we will need to ensure its content bindings are attached.
|
// For tab prompts, we will need to ensure its content bindings are attached.
|
||||||
if (!xulDialog) {
|
if (!xulDialog) {
|
||||||
this.ui.prompt.ensureXBLBindingAttached();
|
this.ui.prompt.ensureXBLBindingAttached();
|
||||||
|
@ -169,6 +170,7 @@ CommonDialog.prototype = {
|
||||||
|
|
||||||
// Set default focus / selection.
|
// Set default focus / selection.
|
||||||
this.setDefaultFocus(true);
|
this.setDefaultFocus(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.args.enableDelay) {
|
if (this.args.enableDelay) {
|
||||||
this.delayHelper = new EnableDelayHelper({
|
this.delayHelper = new EnableDelayHelper({
|
||||||
|
|
Загрузка…
Ссылка в новой задаче