} sendPickerValueChanged() { let detail = this.sendPickerValueChangedImpl(this.#type, this.#pickerState); this.#element.dispatchEvent( new CustomEvent(`InputPickerValueChanged`, { detail, }) ); } /** * Input element state updater function called when the picker value is changed * * @param {string} _type * @param {object} _pickerState */ sendPickerValueChangedImpl(_type, _pickerState) { throw new Error("Not implemented"); } handleEvent(aEvent) { switch (aEvent.type) { case "load": { this.initPicker(this.#detail); this.#popupFrame.contentWindow.addEventListener("message", this, { signal: this.#abortController.signal, }); break; } case "message": { this.handleMessage(aEvent); break; } } } handleMessage(aEvent) { if (!this.#popupFrame.contentDocument.nodePrincipal.isSystemPrincipal) { return; } switch (aEvent.data.name) { case "PickerPopupChanged": { this.#pickerState = aEvent.data.detail; this.sendPickerValueChanged(); break; } case "ClosePopup": { this.closePicker(aEvent.data.detail); break; } } } postMessageToPicker(data) { if (this.#popupFrame.contentDocument.nodePrincipal.isSystemPrincipal) { this.#popupFrame.contentWindow.postMessage(data, "*"); } } } PK