Bug 1272724 - Move nodeSpec into its own file;r=ejpbruel
authorEddy Bruel <ejpbruel@mozilla.com>
Thu, 02 Jun 2016 17:46:11 +0200
changeset 300107 fe57228e70aa503323bf177093e2cecb438a39cc
parent 300106 0979bb255f40483c20acd85843db49a4694f72f6
child 300108 c2f28446c94a222c145c436d6d9e78ec68b7e17a
push id19499
push userejpbruel@mozilla.com
push dateThu, 02 Jun 2016 15:46:26 +0000
treeherderfx-team@fe57228e70aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs1272724
milestone49.0a1
Bug 1272724 - Move nodeSpec into its own file;r=ejpbruel
devtools/shared/specs/inspector.js
devtools/shared/specs/moz.build
devtools/shared/specs/node.js
devtools/shared/specs/styles.js
--- a/devtools/shared/specs/inspector.js
+++ b/devtools/shared/specs/inspector.js
@@ -5,73 +5,20 @@
 
 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");
 
-types.addDictType("imageData", {
-  // The image data
-  data: "nullable:longstring",
-  // The original image dimensions
-  size: "json"
-});
-
-const nodeSpec = generateActorSpec({
-  typeName: "domnode",
-
-  methods: {
-    getNodeValue: {
-      request: {},
-      response: {
-        value: RetVal("longstring")
-      }
-    },
-    setNodeValue: {
-      request: { value: Arg(0) },
-      response: {}
-    },
-    getUniqueSelector: {
-      request: {},
-      response: {
-        value: RetVal("string")
-      }
-    },
-    scrollIntoView: {
-      request: {},
-      response: {}
-    },
-    getImageData: {
-      request: {maxDim: Arg(0, "nullable:number")},
-      response: RetVal("imageData")
-    },
-    getEventListenerInfo: {
-      request: {},
-      response: {
-        events: RetVal("json")
-      }
-    },
-    modifyAttributes: {
-      request: {
-        modifications: Arg(0, "array:json")
-      },
-      response: {}
-    },
-    getFontFamilyDataURL: {
-      request: {font: Arg(0, "string"), fillStyle: Arg(1, "nullable:string")},
-      response: RetVal("imageData")
-    }
-  }
-});
-
 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
--- a/devtools/shared/specs/moz.build
+++ b/devtools/shared/specs/moz.build
@@ -5,13 +5,14 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DevToolsModules(
     'addons.js',
     'animation.js',
     'css-properties.js',
     'highlighters.js',
     'inspector.js',
+    'node.js',
     'storage.js',
     'styleeditor.js',
     'styles.js',
     'stylesheets.js'
 )
new file mode 100644
--- /dev/null
+++ b/devtools/shared/specs/node.js
@@ -0,0 +1,67 @@
+/* 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,
+  RetVal,
+  generateActorSpec,
+  types
+} = require("devtools/shared/protocol.js");
+
+types.addDictType("imageData", {
+  // The image data
+  data: "nullable:longstring",
+  // The original image dimensions
+  size: "json"
+});
+
+const nodeSpec = generateActorSpec({
+  typeName: "domnode",
+
+  methods: {
+    getNodeValue: {
+      request: {},
+      response: {
+        value: RetVal("longstring")
+      }
+    },
+    setNodeValue: {
+      request: { value: Arg(0) },
+      response: {}
+    },
+    getUniqueSelector: {
+      request: {},
+      response: {
+        value: RetVal("string")
+      }
+    },
+    scrollIntoView: {
+      request: {},
+      response: {}
+    },
+    getImageData: {
+      request: {maxDim: Arg(0, "nullable:number")},
+      response: RetVal("imageData")
+    },
+    getEventListenerInfo: {
+      request: {},
+      response: {
+        events: RetVal("json")
+      }
+    },
+    modifyAttributes: {
+      request: {
+        modifications: Arg(0, "array:json")
+      },
+      response: {}
+    },
+    getFontFamilyDataURL: {
+      request: {font: Arg(0, "string"), fillStyle: Arg(1, "nullable:string")},
+      response: RetVal("imageData")
+    }
+  }
+});
+
+exports.nodeSpec = nodeSpec;
--- a/devtools/shared/specs/styles.js
+++ b/devtools/shared/specs/styles.js
@@ -5,21 +5,19 @@
 
 const {
   Arg,
   Option,
   RetVal,
   generateActorSpec,
   types
 } = require("devtools/shared/protocol");
+require("devtools/shared/specs/node");
 require("devtools/shared/specs/stylesheets");
 
-// Predeclare the domnode actor type for use in requests.
-types.addActorType("domnode");
-
 // Predeclare the domstylerule actor type
 types.addActorType("domstylerule");
 
 /**
  * DOM Nodes returned by the style actor will be owned by the DOM walker
  * for the connection.
   */
 types.addLifetime("walker", "walker");