windowglobaltoroot.sys.mjs (777B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs"; 6 7 class WindowGlobalToRootModule extends Module { 8 destroy() {} 9 10 /** 11 * Commands 12 */ 13 14 getValueFromRoot() { 15 this.#assertParentProcess(); 16 return "root-value-called-from-windowglobal"; 17 } 18 19 #assertParentProcess() { 20 const isParent = 21 Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT; 22 23 if (!isParent) { 24 throw new Error("Can only run in the parent process"); 25 } 26 } 27 } 28 29 export const windowglobaltoroot = WindowGlobalToRootModule;