tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

storage-extension.js (989B)


      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 {
      8  TYPES: { EXTENSION_STORAGE },
      9 } = require("resource://devtools/shared/commands/resource/resource-command.js");
     10 
     11 const { Front, types } = require("resource://devtools/shared/protocol.js");
     12 
     13 module.exports = function ({ resource, watcherFront }) {
     14  if (!(resource instanceof Front) && watcherFront) {
     15    // The extension storage actor is instantiated once for the whole toolbox lifecycle,
     16    // so that it isn't bound to any particular WindowGlobal target and should
     17    // rather be bound to the Watcher actor.
     18    resource = types.getType("extensionStorage").read(resource, watcherFront);
     19    resource.resourceType = EXTENSION_STORAGE;
     20    resource.resourceId = EXTENSION_STORAGE;
     21    resource.resourceKey = "extensionStorage";
     22  }
     23 
     24  return resource;
     25 };