fix types in tab.js draft
authoryulia <ystartsev@mozilla.com>
Tue, 24 Apr 2018 15:30:38 +0200
changeset 787199 51ec5ffe1e42c0cc09aa8e89d1acd58b97078023
parent 787176 f22365df3a4fa8f5d9986d5559ae80d6c8310079
push id107682
push userbmo:ystartsev@mozilla.com
push dateTue, 24 Apr 2018 14:37:29 +0000
milestone61.0a1
fix types in tab.js MozReview-Commit-ID: 2PAU8IeEKDV
devtools/server/actors/tab.js
devtools/shared/protocol.js
devtools/shared/specs/tab.js
--- a/devtools/server/actors/tab.js
+++ b/devtools/server/actors/tab.js
@@ -1126,19 +1126,17 @@ TabActor.prototype = {
 
   /**
    * Return JS allowed status.
    */
   _getJavascriptEnabled() {
     if (!this.docShell) {
       // The tab is already closed.
       return null;
-    }
-
-    return this.docShell.allowJavascript;
+    } return this.docShell.allowJavascript;
   },
 
   /**
    * Disable or enable the service workers testing features.
    */
   _setServiceWorkersTestingEnabled(enabled) {
     let windowUtils = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindowUtils);
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -1105,20 +1105,16 @@ var generateActorSpec = function(actorDe
 };
 exports.generateActorSpec = generateActorSpec;
 
 /**
  * Generates request handlers as described by the given actor specification on
  * the given actor prototype. Returns the actor prototype.
  */
 var generateRequestHandlers = function(actorSpec, actorProto) {
-  if (actorProto._actorSpec) {
-    throw new Error("actorProto called twice on the same actor prototype!");
-  }
-
   actorProto.typeName = actorSpec.typeName;
 
   // Generate request handlers for each method definition
   actorProto.requestTypes = Object.create(null);
   actorSpec.methods.forEach(spec => {
     let handler = function(packet, conn) {
       try {
         let args;
--- a/devtools/shared/specs/tab.js
+++ b/devtools/shared/specs/tab.js
@@ -13,17 +13,16 @@ types.addDictType("tab.attach", {
   traits: "json",
 });
 
 types.addDictType("tab.detach", {
   error: "nullable:string",
   type: "nullable:string",
 });
 
-
 types.addDictType("tab.switchtoframerequest", {
   windowId: "string"
 });
 
 types.addDictType("tab.switchtoframeresponse", {
   error: "nullable:string",
   message: "nullable:string",
 });
@@ -40,37 +39,38 @@ types.addDictType("tab.window", {
 });
 
 types.addDictType("tab.workers", {
   error: "nullable:string",
   from: "nullable:string",
 });
 
 types.addDictType("tab.reload", {
-  options: "nullable:tab.reloadoptions"
+  force: "boolean"
 });
 
-types.addDictType("tab.reloadoptions", {
-  force: "boolean"
+types.addDictType("tab.navigateto", {
+  url: "string"
 });
 
 types.addDictType("tab.reconfigure", {
   options: "nullable:tab.reconfigureoptions"
 });
 
 types.addDictType("tab.reconfigureoptions", {
   javascriptEnabled: "nullable:boolean",
   cacheDisabled: "nullable:boolean",
   serviceWorkersTestingEnabled: "nullable:boolean",
   performReload: "nullable:boolean"
 });
+
 types.addDictType("tab.loginpage", {
   text: "string",
   category: "string",
-  flags: "strng"
+  flags: "string"
 });
 
 const tabSpec = generateActorSpec({
   typeName: "tab",
 
   methods: {
     attach: {
       request: {},
@@ -81,46 +81,50 @@ const tabSpec = generateActorSpec({
       response: RetVal("tab.detach")
     },
     focus: {
       request: {},
       response: {}
     },
     reload: {
       request: {
-        request: Option(0, "tab.reload"),
+        options: Option(0, "tab.reload"),
       },
       response: {}
     },
     navigateTo: {
-      request: {},
+      request: {
+        request: Arg(0, "tab.navigateto"),
+      },
       response: {}
     },
     reconfigure: {
       request: {
-        request: Option(0, "tab.reconfigure")
+        options: Option(0, "tab.reconfigureoptions")
       },
       response: {}
     },
     switchToFrame: {
       request: {
-        request: Arg(0, "tab.switchtoframerequest")
+        windowId: Option(0, "string")
       },
       response: RetVal("tab.switchtoframeresponse")
     },
     listFrames: {
       request: {},
       response: RetVal("tab.listframes")
     },
     listWorkers: {
       request: {},
       response: RetVal("tab.workers")
     },
     logInPage: {
       request: {
-        request: Arg(0, "tab.loginpage")
+        text: Option(0, "string"),
+        category: Option(0, "string"),
+        flags: Option(0, "string")
       },
       response: {}
     }
   },
 });
 
 exports.tabSpec = tabSpec;