Bug 1363886 - Part 2: Fix a number of async callback parameters schemas draft
authorTomislav Jovanovic <tomica@gmail.com>
Sun, 21 May 2017 03:40:22 +0200
changeset 582096 7fa1fdb6a39261ae6eac1ca4057cc2f92b0c8930
parent 582095 b0b7993a7bcfd17487352efd4e5c81ed9808feee
child 582097 c1b7d358e7c3f86f1789d569865d781cf26a92f6
push id59972
push userbmo:tomica@gmail.com
push dateSun, 21 May 2017 11:45:33 +0000
bugs1363886
milestone55.0a1
Bug 1363886 - Part 2: Fix a number of async callback parameters schemas MozReview-Commit-ID: JY8r8IePEcw
browser/components/extensions/ext-history.js
browser/components/extensions/schemas/devtools_inspected_window.json
browser/components/extensions/schemas/tabs.json
toolkit/components/extensions/schemas/alarms.json
toolkit/components/extensions/schemas/cookies.json
toolkit/components/extensions/schemas/downloads.json
toolkit/components/extensions/schemas/notifications.json
toolkit/components/extensions/schemas/web_navigation.json
--- a/browser/components/extensions/ext-history.js
+++ b/browser/components/extensions/ext-history.js
@@ -57,19 +57,19 @@ function convertNodeToHistoryItem(node) 
 /*
  * Converts a nsINavHistoryResultNode into a VisitItem
  *
  * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavHistoryResultNode
  */
 function convertNodeToVisitItem(node) {
   return {
     id: node.pageGuid,
-    visitId: node.visitId,
+    visitId: String(node.visitId),
     visitTime: PlacesUtils.toDate(node.time).getTime(),
-    referringVisitId: node.fromVisitId,
+    referringVisitId: String(node.fromVisitId),
     transition: getTransition(node.visitType),
   };
 }
 
 /*
  * Converts a nsINavHistoryContainerResultNode into an array of objects
  *
  * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavHistoryContainerResultNode
--- a/browser/components/extensions/schemas/devtools_inspected_window.json
+++ b/browser/components/extensions/schemas/devtools_inspected_window.json
@@ -131,23 +131,23 @@
           {
             "name": "callback",
             "type": "function",
             "description": "A function called when evaluation completes.",
             "optional": true,
             "parameters": [
               {
                 "name": "result",
-                "type": "object",
-                "additionalProperties": {"type": "any"},
+                "type": "any",
                 "description": "The result of evaluation."
               },
               {
                 "name": "exceptionInfo",
                 "type": "object",
+                "optional": true,
                 "description": "An object providing details if an exception occurred while evaluating the expression.",
                 "properties": {
                   "isError": {
                     "type": "boolean",
                     "description": "Set if the error occurred on the DevTools side before the expression is evaluated."
                   },
                   "code": {
                     "type": "string",
--- a/browser/components/extensions/schemas/tabs.json
+++ b/browser/components/extensions/schemas/tabs.json
@@ -53,33 +53,33 @@
         }
       },
       {
         "id": "Tab",
         "type": "object",
         "properties": {
           "id": {"type": "integer", "minimum": -1, "optional": true, "description": "The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present. Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows."},
           "index": {"type": "integer", "minimum": -1, "description": "The zero-based index of the tab within its window."},
-          "windowId": {"type": "integer", "minimum": 0, "description": "The ID of the window the tab is contained within."},
+          "windowId": {"type": "integer", "optional": true, "minimum": 0, "description": "The ID of the window the tab is contained within."},
           "openerTabId": {"unsupported": true, "type": "integer", "minimum": 0, "optional": true, "description": "The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists."},
           "selected": {"type": "boolean", "description": "Whether the tab is selected.", "deprecated": "Please use $(ref:tabs.Tab.highlighted).", "unsupported": true},
           "highlighted": {"type": "boolean", "description": "Whether the tab is highlighted."},
           "active": {"type": "boolean", "description": "Whether the tab is active in its window. (Does not necessarily mean the window is focused.)"},
           "pinned": {"type": "boolean", "description": "Whether the tab is pinned."},
           "audible": {"type": "boolean", "optional": true, "description": "Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing."},
           "mutedInfo": {"$ref": "MutedInfo", "optional": true, "description": "Current tab muted state and the reason for the last state change."},
           "url": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."},
           "title": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The title of the tab. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."},
           "favIconUrl": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission. It may also be an empty string if the tab is loading."},
           "status": {"type": "string", "optional": true, "description": "Either <em>loading</em> or <em>complete</em>."},
           "incognito": {"type": "boolean", "description": "Whether the tab is in an incognito window."},
           "width": {"type": "integer", "optional": true, "description": "The width of the tab in pixels."},
           "height": {"type": "integer", "optional": true, "description": "The height of the tab in pixels."},
-          "sessionId": {"unsupported": true, "type": "string", "optional": true, "description": "The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API."},
-          "cookieStoreId": {"type": "string", "description": "The CookieStoreId used for the tab."}
+          "sessionId": {"type": "string", "optional": true, "description": "The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API."},
+          "cookieStoreId": {"type": "string", "optional": true, "description": "The CookieStoreId used for the tab."}
         }
       },
       {
         "id": "ZoomSettingsMode",
         "type": "string",
         "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.",
         "enum": [
           {
@@ -403,16 +403,17 @@
           {
             "type": "function",
             "name": "callback",
             "optional": true,
             "parameters": [
               {
                 "name": "tab",
                 "$ref": "Tab",
+                "optional": true,
                 "description": "Details about the created tab. Will contain the ID of the new tab."
               }
             ]
           }
         ]
       },
       {
         "name": "duplicate",
--- a/toolkit/components/extensions/schemas/alarms.json
+++ b/toolkit/components/extensions/schemas/alarms.json
@@ -65,17 +65,21 @@
             "name": "name",
             "optional": true,
             "description": "The name of the alarm to get. Defaults to the empty string."
           },
           {
             "type": "function",
             "name": "callback",
             "parameters": [
-              { "name": "alarm", "$ref": "Alarm" }
+              {
+                "name": "alarm",
+                "$ref": "Alarm",
+                "optional": true
+               }
             ]
           }
         ]
       },
       {
         "name": "getAll",
         "type": "function",
         "description": "Gets an array of all the alarms.",
--- a/toolkit/components/extensions/schemas/cookies.json
+++ b/toolkit/components/extensions/schemas/cookies.json
@@ -40,17 +40,18 @@
         }
       },
       {
         "id": "CookieStore",
         "type": "object",
         "description": "Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.",
         "properties": {
           "id": {"type": "string", "description": "The unique identifier for the cookie store."},
-          "tabIds": {"type": "array", "items": {"type": "integer"}, "description": "Identifiers of all the browser tabs that share this cookie store."}
+          "tabIds": {"type": "array", "items": {"type": "integer"}, "description": "Identifiers of all the browser tabs that share this cookie store."},
+          "incognito": {"type": "boolean", "description": "Indicates if this is an incognito cookie store"}
         }
       },
       {
         "id": "OnChangedCause",
         "type": "string",
         "enum": ["evicted", "expired", "explicit", "expired_overwrite", "overwrite"],
         "description": "The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to $(ref:cookies.remove), \"cause\" will be \"explicit\". If a cookie was automatically removed due to expiry, \"cause\" will be \"expired\". If a cookie was removed due to being overwritten with an already-expired expiration date, \"cause\" will be set to \"expired_overwrite\".  If a cookie was automatically removed due to garbage collection, \"cause\" will be \"evicted\".  If a cookie was automatically removed due to a \"set\" call that overwrote it, \"cause\" will be \"overwrite\". Plan your response accordingly."
       }
--- a/toolkit/components/extensions/schemas/downloads.json
+++ b/toolkit/components/extensions/schemas/downloads.json
@@ -91,17 +91,18 @@
             "description": "An identifier that is persistent across browser sessions.",
             "type": "integer"
           },
           "url": {
             "description": "Absolute URL.",
             "type": "string"
           },
           "referrer": {
-            "type": "string"
+            "type": "string",
+            "optional": true
           },
           "filename": {
             "description": "Absolute local path.",
             "type": "string"
           },
           "incognito": {
             "description": "False if this download is recorded in the history, true if it is not recorded.",
             "type": "boolean"
--- a/toolkit/components/extensions/schemas/notifications.json
+++ b/toolkit/components/extensions/schemas/notifications.json
@@ -311,16 +311,17 @@
         "parameters": [
           {
             "type": "function",
             "name": "callback",
             "parameters": [
               {
                 "name": "notifications",
                 "type": "object",
+                "additionalProperties": {"$ref": "CreateNotificationOptions"},
                 "description": "The set of notifications currently in the system."
               }
             ]
           }
         ]
       },
       {
         "name": "getPermissionLevel",
--- a/toolkit/components/extensions/schemas/web_navigation.json
+++ b/toolkit/components/extensions/schemas/web_navigation.json
@@ -68,24 +68,32 @@
             "parameters": [
               {
                 "type": "object",
                 "name": "details",
                 "optional": true,
                 "description": "Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.",
                 "properties": {
                   "errorOccurred": {
-                    "unsupported": true,
+                    "optional": true,
                     "type": "boolean",
                     "description": "True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired."
                   },
                   "url": {
                     "type": "string",
                     "description": "The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists."
                   },
+                  "tabId": {
+                    "type": "integer",
+                    "description": "The ID of the tab in which the frame is."
+                  },
+                  "frameId": {
+                    "type": "integer",
+                    "description": "The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe."
+                  },
                   "parentFrameId": {
                     "type": "integer",
                     "description": "ID of frame that wraps the frame. Set to -1 of no parent frame exists."
                   }
                 }
               }
             ]
           }
@@ -113,25 +121,29 @@
                 "name": "details",
                 "type": "array",
                 "description": "A list of frames in the given tab, null if the specified tab ID is invalid.",
                 "optional": true,
                 "items": {
                   "type": "object",
                   "properties": {
                     "errorOccurred": {
-                      "unsupported": true,
+                      "optional": true,
                       "type": "boolean",
                       "description": "True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired."
                     },
                     "processId": {
                       "unsupported": true,
                       "type": "integer",
                       "description": "The ID of the process runs the renderer for this tab."
                     },
+                    "tabId": {
+                      "type": "integer",
+                      "description": "The ID of the tab in which the frame is."
+                    },
                     "frameId": {
                       "type": "integer",
                       "description": "The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe."
                     },
                     "parentFrameId": {
                       "type": "integer",
                       "description": "ID of frame that wraps the frame. Set to -1 of no parent frame exists."
                     },