зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1502360 - [marionette] Check for valid prompt type in "Send Alert Text". r=ato
Depends on D20000 Differential Revision: https://phabricator.services.mozilla.com/D20002 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f5c6c6ad4a
Коммит
7bf46d394a
|
@ -267,7 +267,7 @@ browser.Context = class {
|
|||
* Retrieves the current tabmodal UI object. According to the browser
|
||||
* associated with the currently selected tab.
|
||||
*/
|
||||
getTabModalUI() {
|
||||
getTabModal() {
|
||||
let br = this.contentBrowser;
|
||||
if (!br.hasAttribute("tabmodalPromptShowing")) {
|
||||
return null;
|
||||
|
@ -278,7 +278,7 @@ browser.Context = class {
|
|||
let modalElements = br.parentNode.getElementsByTagNameNS(
|
||||
XUL_NS, "tabmodalprompt");
|
||||
|
||||
return br.tabModalPromptBox.prompts.get(modalElements[0]).ui;
|
||||
return br.tabModalPromptBox.prompts.get(modalElements[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,7 @@ const {
|
|||
WebElement,
|
||||
} = ChromeUtils.import("chrome://marionette/content/element.js");
|
||||
const {
|
||||
ElementNotInteractableError,
|
||||
InsecureCertificateError,
|
||||
InvalidArgumentError,
|
||||
InvalidCookieDomainError,
|
||||
|
@ -3226,6 +3227,19 @@ GeckoDriver.prototype.sendKeysToDialog = async function(cmd) {
|
|||
this._checkIfAlertIsPresent();
|
||||
|
||||
let text = assert.string(cmd.parameters.text);
|
||||
let promptType = this.dialog.args.promptType;
|
||||
|
||||
switch (promptType) {
|
||||
case "alert":
|
||||
case "confirm":
|
||||
throw new ElementNotInteractableError(
|
||||
`User prompt of type ${promptType} is not interactable`);
|
||||
case "prompt":
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationError(
|
||||
`User prompt of type ${promptType} is not supported`);
|
||||
}
|
||||
|
||||
// see toolkit/components/prompts/content/commonDialog.js
|
||||
let {loginTextbox} = this.dialog.ui;
|
||||
|
|
|
@ -143,11 +143,19 @@ modal.Dialog = class {
|
|||
return null;
|
||||
}
|
||||
|
||||
get ui() {
|
||||
get tabModal() {
|
||||
let win = this.window;
|
||||
if (win) {
|
||||
return win.Dialog.ui;
|
||||
return win.Dialog;
|
||||
}
|
||||
return this.curBrowser_.getTabModalUI();
|
||||
return this.curBrowser_.getTabModal();
|
||||
}
|
||||
|
||||
get args() {
|
||||
return this.tabModal.args;
|
||||
}
|
||||
|
||||
get ui() {
|
||||
return this.tabModal.ui;
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче