summaryrefslogtreecommitdiffstats
path: root/devtools/shared/specs/inspector.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/shared/specs/inspector.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/shared/specs/inspector.js')
-rw-r--r--devtools/shared/specs/inspector.js445
1 files changed, 445 insertions, 0 deletions
diff --git a/devtools/shared/specs/inspector.js b/devtools/shared/specs/inspector.js
new file mode 100644
index 000000000..28736ed34
--- /dev/null
+++ b/devtools/shared/specs/inspector.js
@@ -0,0 +1,445 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const {
+ Arg,
+ Option,
+ RetVal,
+ generateActorSpec,
+ types
+} = require("devtools/shared/protocol");
+const { nodeSpec } = require("devtools/shared/specs/node");
+require("devtools/shared/specs/styles");
+require("devtools/shared/specs/highlighters");
+require("devtools/shared/specs/layout");
+
+exports.nodeSpec = nodeSpec;
+
+/**
+ * Returned from any call that might return a node that isn't connected to root
+ * by nodes the child has seen, such as querySelector.
+ */
+types.addDictType("disconnectedNode", {
+ // The actual node to return
+ node: "domnode",
+
+ // Nodes that are needed to connect the node to a node the client has already
+ // seen
+ newParents: "array:domnode"
+});
+
+types.addDictType("disconnectedNodeArray", {
+ // The actual node list to return
+ nodes: "array:domnode",
+
+ // Nodes that are needed to connect those nodes to the root.
+ newParents: "array:domnode"
+});
+
+types.addDictType("dommutation", {});
+
+types.addDictType("searchresult", {
+ list: "domnodelist",
+ // Right now there is isn't anything required for metadata,
+ // but it's json so it can be extended with extra data.
+ metadata: "array:json"
+});
+
+const nodeListSpec = generateActorSpec({
+ typeName: "domnodelist",
+
+ methods: {
+ item: {
+ request: { item: Arg(0) },
+ response: RetVal("disconnectedNode")
+ },
+ items: {
+ request: {
+ start: Arg(0, "nullable:number"),
+ end: Arg(1, "nullable:number")
+ },
+ response: RetVal("disconnectedNodeArray")
+ },
+ release: {
+ release: true
+ }
+ }
+});
+
+exports.nodeListSpec = nodeListSpec;
+
+// Some common request/response templates for the dom walker
+
+var nodeArrayMethod = {
+ request: {
+ node: Arg(0, "domnode"),
+ maxNodes: Option(1),
+ center: Option(1, "domnode"),
+ start: Option(1, "domnode"),
+ whatToShow: Option(1)
+ },
+ response: RetVal(types.addDictType("domtraversalarray", {
+ nodes: "array:domnode"
+ }))
+};
+
+var traversalMethod = {
+ request: {
+ node: Arg(0, "domnode"),
+ whatToShow: Option(1)
+ },
+ response: {
+ node: RetVal("nullable:domnode")
+ }
+};
+
+const walkerSpec = generateActorSpec({
+ typeName: "domwalker",
+
+ events: {
+ "new-mutations": {
+ type: "newMutations"
+ },
+ "picker-node-picked": {
+ type: "pickerNodePicked",
+ node: Arg(0, "disconnectedNode")
+ },
+ "picker-node-previewed": {
+ type: "pickerNodePreviewed",
+ node: Arg(0, "disconnectedNode")
+ },
+ "picker-node-hovered": {
+ type: "pickerNodeHovered",
+ node: Arg(0, "disconnectedNode")
+ },
+ "picker-node-canceled": {
+ type: "pickerNodeCanceled"
+ },
+ "highlighter-ready": {
+ type: "highlighter-ready"
+ },
+ "highlighter-hide": {
+ type: "highlighter-hide"
+ },
+ "display-change": {
+ type: "display-change",
+ nodes: Arg(0, "array:domnode")
+ },
+ // The walker actor emits a useful "resize" event to its front to let
+ // clients know when the browser window gets resized. This may be useful
+ // for refreshing a DOM node's styles for example, since those may depend on
+ // media-queries.
+ "resize": {
+ type: "resize"
+ }
+ },
+
+ methods: {
+ release: {
+ release: true
+ },
+ pick: {
+ request: {},
+ response: RetVal("disconnectedNode")
+ },
+ cancelPick: {},
+ highlight: {
+ request: {node: Arg(0, "nullable:domnode")}
+ },
+ document: {
+ request: { node: Arg(0, "nullable:domnode") },
+ response: { node: RetVal("domnode") },
+ },
+ documentElement: {
+ request: { node: Arg(0, "nullable:domnode") },
+ response: { node: RetVal("domnode") },
+ },
+ parents: {
+ request: {
+ node: Arg(0, "domnode"),
+ sameDocument: Option(1),
+ sameTypeRootTreeItem: Option(1)
+ },
+ response: {
+ nodes: RetVal("array:domnode")
+ },
+ },
+ retainNode: {
+ request: { node: Arg(0, "domnode") },
+ response: {}
+ },
+ unretainNode: {
+ request: { node: Arg(0, "domnode") },
+ response: {},
+ },
+ releaseNode: {
+ request: {
+ node: Arg(0, "domnode"),
+ force: Option(1)
+ }
+ },
+ children: nodeArrayMethod,
+ siblings: nodeArrayMethod,
+ nextSibling: traversalMethod,
+ previousSibling: traversalMethod,
+ findInspectingNode: {
+ request: {},
+ response: RetVal("disconnectedNode")
+ },
+ querySelector: {
+ request: {
+ node: Arg(0, "domnode"),
+ selector: Arg(1)
+ },
+ response: RetVal("disconnectedNode")
+ },
+ querySelectorAll: {
+ request: {
+ node: Arg(0, "domnode"),
+ selector: Arg(1)
+ },
+ response: {
+ list: RetVal("domnodelist")
+ }
+ },
+ multiFrameQuerySelectorAll: {
+ request: {
+ selector: Arg(0)
+ },
+ response: {
+ list: RetVal("domnodelist")
+ }
+ },
+ search: {
+ request: {
+ query: Arg(0),
+ },
+ response: {
+ list: RetVal("searchresult"),
+ }
+ },
+ getSuggestionsForQuery: {
+ request: {
+ query: Arg(0),
+ completing: Arg(1),
+ selectorState: Arg(2)
+ },
+ response: {
+ list: RetVal("array:array:string")
+ }
+ },
+ addPseudoClassLock: {
+ request: {
+ node: Arg(0, "domnode"),
+ pseudoClass: Arg(1),
+ parents: Option(2)
+ },
+ response: {}
+ },
+ hideNode: {
+ request: { node: Arg(0, "domnode") }
+ },
+ unhideNode: {
+ request: { node: Arg(0, "domnode") }
+ },
+ removePseudoClassLock: {
+ request: {
+ node: Arg(0, "domnode"),
+ pseudoClass: Arg(1),
+ parents: Option(2)
+ },
+ response: {}
+ },
+ clearPseudoClassLocks: {
+ request: {
+ node: Arg(0, "nullable:domnode")
+ },
+ response: {}
+ },
+ innerHTML: {
+ request: {
+ node: Arg(0, "domnode")
+ },
+ response: {
+ value: RetVal("longstring")
+ }
+ },
+ setInnerHTML: {
+ request: {
+ node: Arg(0, "domnode"),
+ value: Arg(1, "string"),
+ },
+ response: {}
+ },
+ outerHTML: {
+ request: {
+ node: Arg(0, "domnode")
+ },
+ response: {
+ value: RetVal("longstring")
+ }
+ },
+ setOuterHTML: {
+ request: {
+ node: Arg(0, "domnode"),
+ value: Arg(1, "string"),
+ },
+ response: {}
+ },
+ insertAdjacentHTML: {
+ request: {
+ node: Arg(0, "domnode"),
+ position: Arg(1, "string"),
+ value: Arg(2, "string")
+ },
+ response: RetVal("disconnectedNodeArray")
+ },
+ duplicateNode: {
+ request: {
+ node: Arg(0, "domnode")
+ },
+ response: {}
+ },
+ removeNode: {
+ request: {
+ node: Arg(0, "domnode")
+ },
+ response: {
+ nextSibling: RetVal("nullable:domnode")
+ }
+ },
+ removeNodes: {
+ request: {
+ node: Arg(0, "array:domnode")
+ },
+ response: {}
+ },
+ insertBefore: {
+ request: {
+ node: Arg(0, "domnode"),
+ parent: Arg(1, "domnode"),
+ sibling: Arg(2, "nullable:domnode")
+ },
+ response: {}
+ },
+ editTagName: {
+ request: {
+ node: Arg(0, "domnode"),
+ tagName: Arg(1, "string")
+ },
+ response: {}
+ },
+ getMutations: {
+ request: {
+ cleanup: Option(0)
+ },
+ response: {
+ mutations: RetVal("array:dommutation")
+ }
+ },
+ isInDOMTree: {
+ request: { node: Arg(0, "domnode") },
+ response: { attached: RetVal("boolean") }
+ },
+ getNodeActorFromObjectActor: {
+ request: {
+ objectActorID: Arg(0, "string")
+ },
+ response: {
+ nodeFront: RetVal("nullable:disconnectedNode")
+ }
+ },
+ getStyleSheetOwnerNode: {
+ request: {
+ styleSheetActorID: Arg(0, "string")
+ },
+ response: {
+ ownerNode: RetVal("nullable:disconnectedNode")
+ }
+ },
+ getNodeFromActor: {
+ request: {
+ actorID: Arg(0, "string"),
+ path: Arg(1, "array:string")
+ },
+ response: {
+ node: RetVal("nullable:disconnectedNode")
+ }
+ },
+ getLayoutInspector: {
+ request: {},
+ response: {
+ actor: RetVal("layout")
+ }
+ }
+ }
+});
+
+exports.walkerSpec = walkerSpec;
+
+const inspectorSpec = generateActorSpec({
+ typeName: "inspector",
+
+ events: {
+ "color-picked": {
+ type: "colorPicked",
+ color: Arg(0, "string")
+ },
+ "color-pick-canceled": {
+ type: "colorPickCanceled"
+ }
+ },
+
+ methods: {
+ getWalker: {
+ request: {
+ options: Arg(0, "nullable:json")
+ },
+ response: {
+ walker: RetVal("domwalker")
+ }
+ },
+ getPageStyle: {
+ request: {},
+ response: {
+ pageStyle: RetVal("pagestyle")
+ }
+ },
+ getHighlighter: {
+ request: {
+ autohide: Arg(0, "boolean")
+ },
+ response: {
+ highligter: RetVal("highlighter")
+ }
+ },
+ getHighlighterByType: {
+ request: {
+ typeName: Arg(0)
+ },
+ response: {
+ highlighter: RetVal("nullable:customhighlighter")
+ }
+ },
+ getImageDataFromURL: {
+ request: {url: Arg(0), maxDim: Arg(1, "nullable:number")},
+ response: RetVal("imageData")
+ },
+ resolveRelativeURL: {
+ request: {url: Arg(0, "string"), node: Arg(1, "nullable:domnode")},
+ response: {value: RetVal("string")}
+ },
+ pickColorFromPage: {
+ request: {options: Arg(0, "nullable:json")},
+ response: {}
+ },
+ cancelPickColorFromPage: {
+ request: {},
+ response: {}
+ }
+ }
+});
+
+exports.inspectorSpec = inspectorSpec;