tor-browser

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

AboutDevToolsToolboxRegistration.sys.mjs (1167B)


      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 { nsIAboutModule } = Ci;
      6 
      7 /**
      8 * Register about:devtools-toolbox which allows to open a devtools toolbox
      9 * in a Firefox tab or a custom html iframe in browser.html
     10 */
     11 export class AboutDevtoolsToolbox {
     12  uri = Services.io.newURI("chrome://devtools/content/framework/toolbox.xhtml");
     13  classDescription = "about:devtools-toolbox";
     14  classID = Components.ID("11342911-3135-45a8-8d71-737a2b0ad469");
     15  contractID = "@mozilla.org/network/protocol/about;1?what=devtools-toolbox";
     16 
     17  QueryInterface = ChromeUtils.generateQI([nsIAboutModule]);
     18 
     19  newChannel(uri, loadInfo) {
     20    const chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, loadInfo);
     21    chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
     22    return chan;
     23  }
     24 
     25  getURIFlags() {
     26    return (
     27      nsIAboutModule.ALLOW_SCRIPT |
     28      nsIAboutModule.ENABLE_INDEXED_DB |
     29      nsIAboutModule.HIDE_FROM_ABOUTABOUT
     30    );
     31  }
     32 
     33  getChromeURI(_uri) {
     34    return this.uri;
     35  }
     36 }