SessionDataReader.sys.mjs (973B)
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 const lazy = {}; 6 7 ChromeUtils.defineESModuleGetters(lazy, { 8 SESSION_DATA_SHARED_DATA_KEY: 9 "chrome://remote/content/shared/messagehandler/sessiondata/SessionData.sys.mjs", 10 }); 11 12 ChromeUtils.defineLazyGetter(lazy, "sharedData", () => { 13 const isInParent = 14 Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; 15 16 return isInParent ? Services.ppmm.sharedData : Services.cpmm.sharedData; 17 }); 18 19 /** 20 * Returns a snapshot of the session data map, which is cloned from the 21 * sessionDataMap singleton of SessionData.sys.mjs. 22 * 23 * @returns {Map.<string, Array<SessionDataItem>>} 24 * Map of session id to arrays of SessionDataItems. 25 */ 26 export const readSessionData = () => 27 lazy.sharedData.get(lazy.SESSION_DATA_SHARED_DATA_KEY) || new Map();