tor-browser

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

target-configuration.js (1131B)


      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 module.exports = {
      8  async addOrSetSessionDataEntry(targetActor, entries, isDocumentCreation) {
      9    // Only WindowGlobalTargetActor implements updateTargetConfiguration,
     10    // skip targetActor data entry update for other targets.
     11    if (typeof targetActor.updateTargetConfiguration == "function") {
     12      const options = {};
     13      for (const { key, value } of entries) {
     14        options[key] = value;
     15      }
     16      // Regarding `updateType`, `entries` is always a partial set of configurations.
     17      // We will acknowledge the passed attribute, but if we had set some other attributes
     18      // before this call, they will stay as-is.
     19      // So it is as if this session data was also using "add" updateType.
     20      targetActor.updateTargetConfiguration(options, isDocumentCreation);
     21    }
     22  },
     23 
     24  removeSessionDataEntry() {
     25    // configuration data entries are always added/updated, never removed.
     26  },
     27 };