storage-extension.js (931B)
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 "use strict"; 6 7 const ParentProcessStorage = require("resource://devtools/server/actors/resources/utils/parent-process-storage.js"); 8 const { 9 ExtensionStorageActor, 10 } = require("resource://devtools/server/actors/resources/storage/extension-storage.js"); 11 12 class ExtensionStorageWatcher extends ParentProcessStorage { 13 constructor() { 14 super(ExtensionStorageActor, "extensionStorage"); 15 } 16 async watch(watcherActor, { onAvailable }) { 17 if (watcherActor.sessionContext.type != "webextension") { 18 throw new Error( 19 "EXTENSION_STORAGE should only be listened when debugging a webextension" 20 ); 21 } 22 return super.watch(watcherActor, { onAvailable }); 23 } 24 } 25 26 module.exports = ExtensionStorageWatcher;