tor-browser

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

style-rule.js (1832B)


      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 // Load the shared types for style actors
     14 require("resource://devtools/shared/specs/style/style-types.js");
     15 
     16 types.addDictType("domstylerule.queryContainerForNodeReturn", {
     17  node: "nullable:domnode",
     18  containerType: "nullable:string",
     19  blockSize: "nullable:string",
     20  inlineSize: "nullable:string",
     21 });
     22 
     23 const styleRuleSpec = generateActorSpec({
     24  typeName: "domstylerule",
     25 
     26  events: {
     27    "location-changed": {
     28      type: "locationChanged",
     29      line: Arg(0, "number"),
     30      column: Arg(1, "number"),
     31    },
     32    "rule-updated": {
     33      type: "ruleUpdated",
     34      rule: Arg(0, "domstylerule"),
     35    },
     36  },
     37 
     38  methods: {
     39    getRuleText: {
     40      response: {
     41        text: RetVal("string"),
     42      },
     43    },
     44    setRuleText: {
     45      request: {
     46        newText: Arg(0, "string"),
     47        modifications: Arg(1, "array:json"),
     48      },
     49      response: { rule: RetVal("domstylerule") },
     50    },
     51    modifyProperties: {
     52      request: { modifications: Arg(0, "array:json") },
     53      response: { rule: RetVal("domstylerule") },
     54    },
     55    modifySelector: {
     56      request: {
     57        node: Arg(0, "domnode"),
     58        value: Arg(1, "string"),
     59        editAuthored: Arg(2, "boolean"),
     60      },
     61      response: RetVal("modifiedStylesReturn"),
     62    },
     63    getQueryContainerForNode: {
     64      request: {
     65        ancestorRuleIndex: Arg(0, "number"),
     66        node: Arg(1, "domnode"),
     67      },
     68      response: RetVal("domstylerule.queryContainerForNodeReturn"),
     69    },
     70  },
     71 });
     72 
     73 exports.styleRuleSpec = styleRuleSpec;