tor-browser

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

LayoutDebugChild.sys.mjs (1046B)


      1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 const NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID =
      7  "@mozilla.org/layout-debug/layout-debuggingtools;1";
      8 
      9 export class LayoutDebugChild extends JSWindowActorChild {
     10  receiveMessage(msg) {
     11    if (!this._debuggingTools) {
     12      this._debuggingTools = Cc[
     13        NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID
     14      ].createInstance(Ci.nsILayoutDebuggingTools);
     15      this._debuggingTools.init(this.contentWindow);
     16    }
     17    switch (msg.name) {
     18      case "LayoutDebug:Call": {
     19        let pid = Services.appinfo.processID;
     20        dump(`[${pid} ${this.contentWindow.location}]\n`);
     21        this._debuggingTools[msg.data.name](msg.data.arg);
     22        dump("\n");
     23        break;
     24      }
     25      default:
     26        throw `unknown message ${msg.name} sent to LayoutDebugChild`;
     27    }
     28    return Promise.resolve(true);
     29  }
     30 }