зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770550 - Add logging to investigate the timeout issue. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D149193
This commit is contained in:
Родитель
170625616e
Коммит
fb9efcf2e2
|
@ -30,15 +30,20 @@ Services.scriptloader.loadSubScript(
|
|||
);
|
||||
|
||||
addMessageListener("handlePrompt", msg => {
|
||||
info("Received handlePrompt message");
|
||||
handlePromptWhenItAppears(msg.action, msg.modalType, msg.isSelect);
|
||||
});
|
||||
|
||||
async function handlePromptWhenItAppears(action, modalType, isSelect) {
|
||||
if (!(await handlePrompt(action, modalType, isSelect))) {
|
||||
setTimeout(
|
||||
() => this.handlePromptWhenItAppears(action, modalType, isSelect),
|
||||
100
|
||||
);
|
||||
try {
|
||||
if (!(await handlePrompt(action, modalType, isSelect))) {
|
||||
setTimeout(
|
||||
() => this.handlePromptWhenItAppears(action, modalType, isSelect),
|
||||
100
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
info(`handlePromptWhenItAppears: exception: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +94,8 @@ function checkTabModal(prompt, browser) {
|
|||
}
|
||||
|
||||
async function handlePrompt(action, modalType, isSelect) {
|
||||
info(`handlePrompt: modalType=${modalType}`);
|
||||
|
||||
let ui;
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
|
@ -101,6 +108,7 @@ async function handlePrompt(action, modalType, isSelect) {
|
|||
let promptManager = gBrowser.getTabModalPromptBox(gBrowser.selectedBrowser);
|
||||
let prompts = promptManager.listPrompts();
|
||||
if (!prompts.length) {
|
||||
info("handlePrompt: no prompt found. retrying...");
|
||||
return false; // try again in a bit
|
||||
}
|
||||
|
||||
|
@ -109,6 +117,7 @@ async function handlePrompt(action, modalType, isSelect) {
|
|||
} else {
|
||||
let doc = getDialogDoc();
|
||||
if (!doc) {
|
||||
info("handlePrompt: no document found. retrying...");
|
||||
return false; // try again in a bit
|
||||
}
|
||||
|
||||
|
@ -136,9 +145,11 @@ async function handlePrompt(action, modalType, isSelect) {
|
|||
// Wait until the prompt has been closed before sending callback msg.
|
||||
// Unless the test explicitly doesn't request a button click.
|
||||
if (action.buttonClick !== "none") {
|
||||
info(`handlePrompt: wait for dialogClosed`);
|
||||
await dialogClosed;
|
||||
}
|
||||
|
||||
info(`handlePrompt: send promptHandled`);
|
||||
sendAsyncMessage("promptHandled", { promptState });
|
||||
return true;
|
||||
}
|
||||
|
@ -253,6 +264,7 @@ function dismissSelect(ui, action) {
|
|||
}
|
||||
|
||||
function dismissPrompt(ui, action) {
|
||||
info(`dismissPrompt: action=${JSON.stringify(action)}`);
|
||||
if (action.setCheckbox) {
|
||||
// Annoyingly, the prompt code is driven by oncommand.
|
||||
ui.checkbox.checked = true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче