tor-browser

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

node.js (3456B)


      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 "use strict";
      5 
      6 const {
      7  Arg,
      8  RetVal,
      9  generateActorSpec,
     10  types,
     11 } = require("resource://devtools/shared/protocol.js");
     12 
     13 types.addDictType("imageData", {
     14  // The image data
     15  data: "nullable:longstring",
     16  // The original image dimensions
     17  size: "json",
     18 });
     19 
     20 types.addDictType("windowDimensions", {
     21  // The window innerWidth
     22  innerWidth: "nullable:number",
     23  // The window innerHeight
     24  innerHeight: "nullable:number",
     25 });
     26 
     27 /**
     28 * Returned from any call that might return a node that isn't connected to root
     29 * by nodes the child has seen, such as querySelector.
     30 */
     31 types.addDictType("disconnectedNode", {
     32  // The actual node to return
     33  node: "domnode",
     34 
     35  // Nodes that are needed to connect the node to a node the client has already
     36  // seen
     37  newParents: "array:domnode",
     38 });
     39 
     40 types.addDictType("disconnectedNodeArray", {
     41  // The actual node list to return
     42  nodes: "array:domnode",
     43 
     44  // Nodes that are needed to connect those nodes to the root.
     45  newParents: "array:domnode",
     46 });
     47 
     48 const nodeListSpec = generateActorSpec({
     49  typeName: "domnodelist",
     50 
     51  methods: {
     52    item: {
     53      request: { item: Arg(0) },
     54      response: RetVal("disconnectedNode"),
     55    },
     56    items: {
     57      request: {
     58        start: Arg(0, "nullable:number"),
     59        end: Arg(1, "nullable:number"),
     60      },
     61      response: RetVal("disconnectedNodeArray"),
     62    },
     63    release: {
     64      release: true,
     65    },
     66  },
     67 });
     68 
     69 exports.nodeListSpec = nodeListSpec;
     70 
     71 const nodeSpec = generateActorSpec({
     72  typeName: "domnode",
     73 
     74  methods: {
     75    getNodeValue: {
     76      request: {},
     77      response: {
     78        value: RetVal("longstring"),
     79      },
     80    },
     81    setNodeValue: {
     82      request: { value: Arg(0) },
     83      response: {},
     84    },
     85    getUniqueSelector: {
     86      request: {},
     87      response: {
     88        value: RetVal("string"),
     89      },
     90    },
     91    getCssPath: {
     92      request: {},
     93      response: {
     94        value: RetVal("string"),
     95      },
     96    },
     97    getXPath: {
     98      request: {},
     99      response: {
    100        value: RetVal("string"),
    101      },
    102    },
    103    scrollIntoView: {
    104      request: {},
    105      response: {},
    106    },
    107    getImageData: {
    108      request: { maxDim: Arg(0, "nullable:number") },
    109      response: RetVal("imageData"),
    110    },
    111    getEventListenerInfo: {
    112      request: {},
    113      response: {
    114        events: RetVal("json"),
    115      },
    116    },
    117    enableEventListener: {
    118      request: {
    119        eventListenerInfoId: Arg(0),
    120      },
    121      response: {},
    122    },
    123    disableEventListener: {
    124      request: {
    125        eventListenerInfoId: Arg(0),
    126      },
    127      response: {},
    128    },
    129    modifyAttributes: {
    130      request: {
    131        modifications: Arg(0, "array:json"),
    132      },
    133      response: {},
    134    },
    135    getFontFamilyDataURL: {
    136      request: { font: Arg(0, "string"), fillStyle: Arg(1, "nullable:string") },
    137      response: RetVal("imageData"),
    138    },
    139    getClosestBackgroundColor: {
    140      request: {},
    141      response: {
    142        value: RetVal("string"),
    143      },
    144    },
    145    getBackgroundColor: {
    146      request: {},
    147      response: RetVal("json"),
    148    },
    149    getOwnerGlobalDimensions: {
    150      request: {},
    151      response: RetVal("windowDimensions"),
    152    },
    153    waitForFrameLoad: {
    154      request: {},
    155      response: {},
    156    },
    157  },
    158 });
    159 
    160 exports.nodeSpec = nodeSpec;