Loading netwerk/base/nsIPrompt.idl +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ interface nsIPrompt : nsISupports const unsigned long BUTTON_POS_1_IS_SECONDARY = 1 << 29; const unsigned long BUTTON_DEFAULT_IS_DESTRUCTIVE = 1 << 30; const unsigned long STD_OK_CANCEL_BUTTONS = (BUTTON_TITLE_OK * BUTTON_POS_0) + (BUTTON_TITLE_CANCEL * BUTTON_POS_1); const unsigned long STD_YES_NO_BUTTONS = (BUTTON_TITLE_YES * BUTTON_POS_0) + Loading toolkit/components/prompts/content/commonDialog.js +5 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ function commonDialogOnLoad() { ["promptUserAndPass", "promptPassword"].includes(args.promptType) || args.headerIconCSSValue; let root = document.documentElement; if (needIconifiedHeader) { if (needIconifiedHeader && !args.noIcon) { root.setAttribute("neediconheader", "true"); } let title = { raw: args.title }; Loading Loading @@ -107,6 +107,10 @@ function commonDialogOnLoad() { dialog.setAttribute("extra1-is-secondary", true); } if (args.isDefaultDestructive) { dialog.setAttribute("default-is-destructive", true); } Dialog = new CommonDialog(args, ui); window.addEventListener("dialogclosing", function (aEvent) { if (aEvent.detail?.abort) { Loading toolkit/components/prompts/src/Prompter.sys.mjs +4 −0 Original line number Diff line number Diff line Loading @@ -1507,6 +1507,10 @@ class ModalPrompter { args.isExtra1Secondary = true; } if (flags & Ci.nsIPrompt.BUTTON_DEFAULT_IS_DESTRUCTIVE) { args.isDefaultDestructive = true; } if (flags & Ci.nsIPrompt.SHOW_SPINNER) { args.headerIconCSSValue = "url('chrome://global/skin/icons/loading.svg')"; } Loading toolkit/components/windowwatcher/nsIPromptService.idl +2 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ interface nsIPromptService : nsISupports */ const unsigned long BUTTON_POS_1_IS_SECONDARY = 1 << 29; const unsigned long BUTTON_DEFAULT_IS_DESTRUCTIVE = 1 << 30; /** * Selects the standard set of OK/Cancel buttons. */ Loading toolkit/content/widgets/dialog.js +23 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ static get observedAttributes() { return super.observedAttributes.concat( "subdialog", "extra1-is-secondary" "extra1-is-secondary", "default-is-destructive" ); } Loading @@ -40,6 +41,12 @@ if (name === "extra1-is-secondary" && AppConstants.XP_UNIX) { this.getButton("cancel").after(this.getButton("extra1")); } if (name === "default-is-destructive") { this.#setButtonIsDestructive( this.getButton(this.defaultButton), this.hasAttribute("default-is-destructive") ); } super.attributeChangedCallback(name, oldValue, newValue); } Loading Loading @@ -491,12 +498,17 @@ var oldDefaultButton = this.getButton(this.defaultButton); if (oldDefaultButton) { oldDefaultButton.removeAttribute("default"); this.#setButtonIsDestructive(oldDefaultButton, false); } var newDefaultButton = this.getButton(aNewDefault); if (newDefaultButton) { this.setAttribute("defaultButton", aNewDefault); newDefaultButton.setAttribute("default", "true"); this.#setButtonIsDestructive( newDefaultButton, this.hasAttribute("default-is-destructive") ); } else { this.setAttribute("defaultButton", "none"); if (aNewDefault != "none") { Loading @@ -507,6 +519,16 @@ } } /** * Mark or un-mark a button as a destructive action. * * @param {?Element} button - The button to mark. * @param {boolean} isDestructive - Whether the button is destructive. */ #setButtonIsDestructive(button, isDestructive) { button?.classList.toggle("danger-button", isDestructive); } _handleButtonCommand(aEvent) { return this._doButtonCommand(aEvent.target.getAttribute("dlgtype")); } Loading Loading
netwerk/base/nsIPrompt.idl +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ interface nsIPrompt : nsISupports const unsigned long BUTTON_POS_1_IS_SECONDARY = 1 << 29; const unsigned long BUTTON_DEFAULT_IS_DESTRUCTIVE = 1 << 30; const unsigned long STD_OK_CANCEL_BUTTONS = (BUTTON_TITLE_OK * BUTTON_POS_0) + (BUTTON_TITLE_CANCEL * BUTTON_POS_1); const unsigned long STD_YES_NO_BUTTONS = (BUTTON_TITLE_YES * BUTTON_POS_0) + Loading
toolkit/components/prompts/content/commonDialog.js +5 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ function commonDialogOnLoad() { ["promptUserAndPass", "promptPassword"].includes(args.promptType) || args.headerIconCSSValue; let root = document.documentElement; if (needIconifiedHeader) { if (needIconifiedHeader && !args.noIcon) { root.setAttribute("neediconheader", "true"); } let title = { raw: args.title }; Loading Loading @@ -107,6 +107,10 @@ function commonDialogOnLoad() { dialog.setAttribute("extra1-is-secondary", true); } if (args.isDefaultDestructive) { dialog.setAttribute("default-is-destructive", true); } Dialog = new CommonDialog(args, ui); window.addEventListener("dialogclosing", function (aEvent) { if (aEvent.detail?.abort) { Loading
toolkit/components/prompts/src/Prompter.sys.mjs +4 −0 Original line number Diff line number Diff line Loading @@ -1507,6 +1507,10 @@ class ModalPrompter { args.isExtra1Secondary = true; } if (flags & Ci.nsIPrompt.BUTTON_DEFAULT_IS_DESTRUCTIVE) { args.isDefaultDestructive = true; } if (flags & Ci.nsIPrompt.SHOW_SPINNER) { args.headerIconCSSValue = "url('chrome://global/skin/icons/loading.svg')"; } Loading
toolkit/components/windowwatcher/nsIPromptService.idl +2 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ interface nsIPromptService : nsISupports */ const unsigned long BUTTON_POS_1_IS_SECONDARY = 1 << 29; const unsigned long BUTTON_DEFAULT_IS_DESTRUCTIVE = 1 << 30; /** * Selects the standard set of OK/Cancel buttons. */ Loading
toolkit/content/widgets/dialog.js +23 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ static get observedAttributes() { return super.observedAttributes.concat( "subdialog", "extra1-is-secondary" "extra1-is-secondary", "default-is-destructive" ); } Loading @@ -40,6 +41,12 @@ if (name === "extra1-is-secondary" && AppConstants.XP_UNIX) { this.getButton("cancel").after(this.getButton("extra1")); } if (name === "default-is-destructive") { this.#setButtonIsDestructive( this.getButton(this.defaultButton), this.hasAttribute("default-is-destructive") ); } super.attributeChangedCallback(name, oldValue, newValue); } Loading Loading @@ -491,12 +498,17 @@ var oldDefaultButton = this.getButton(this.defaultButton); if (oldDefaultButton) { oldDefaultButton.removeAttribute("default"); this.#setButtonIsDestructive(oldDefaultButton, false); } var newDefaultButton = this.getButton(aNewDefault); if (newDefaultButton) { this.setAttribute("defaultButton", aNewDefault); newDefaultButton.setAttribute("default", "true"); this.#setButtonIsDestructive( newDefaultButton, this.hasAttribute("default-is-destructive") ); } else { this.setAttribute("defaultButton", "none"); if (aNewDefault != "none") { Loading @@ -507,6 +519,16 @@ } } /** * Mark or un-mark a button as a destructive action. * * @param {?Element} button - The button to mark. * @param {boolean} isDestructive - Whether the button is destructive. */ #setButtonIsDestructive(button, isDestructive) { button?.classList.toggle("danger-button", isDestructive); } _handleButtonCommand(aEvent) { return this._doButtonCommand(aEvent.target.getAttribute("dlgtype")); } Loading