/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; // This is loaded into all XUL windows. Wrap in a block to prevent // leaking to window scope. { const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); class MozDialog extends MozXULElement { #subDialogObserver = null; constructor() { super(); } static get observedAttributes() { return super.observedAttributes.concat( "subdialog", "extra1-is-secondary" ); } #onSubDialogEnabled() { console.assert( document.documentElement.hasAttribute("subdialog"), `Turning off subdialog style is not supported` ); this.shadowRoot.appendChild( MozXULElement.parseXULToFragment(this.inContentStyle) ); } attributeChangedCallback(name, oldValue, newValue) { // Only move the button on UNIX, since it's already in the correct spot on Windows if (name === "extra1-is-secondary" && AppConstants.XP_UNIX) { this.getButton("cancel").after(this.getButton("extra1")); } super.attributeChangedCallback(name, oldValue, newValue); } static get inheritedAttributes() { return { ".dialog-button-box": "pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient", "[dlgtype='accept']": "disabled=buttondisabledaccept", }; } get inContentStyle() { return ` `; } get _markup() { let buttons = AppConstants.XP_UNIX ? `