Bug 1425267 fix url param schema for launchWebAuthFlow, r=rpl a=gchang
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 21 Dec 2017 15:18:26 -0800
changeset 443077 f926975917f9579d2097552f943aece7f6cb4dc8
parent 443076 5a76bef07139ef629e21c371a28030f04acf612d
child 443078 22cdd0cd23d39e3981b22172a8ab33a872505c12
push id8465
push userarchaeopteryx@coole-files.de
push dateWed, 03 Jan 2018 10:58:10 +0000
treeherdermozilla-beta@f926975917f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl, gchang
bugs1425267
milestone58.0
Bug 1425267 fix url param schema for launchWebAuthFlow, r=rpl a=gchang
toolkit/components/extensions/schemas/identity.json
toolkit/components/extensions/test/mochitest/test_ext_identity.html
--- a/toolkit/components/extensions/schemas/identity.json
+++ b/toolkit/components/extensions/schemas/identity.json
@@ -157,17 +157,17 @@
         "type": "function",
         "description": "Starts an auth flow at the specified URL.",
         "async": "callback",
         "parameters": [
           {
             "name": "details",
             "type": "object",
             "properties": {
-              "url": {"type": "string"},
+              "url": {"$ref": "manifest.HttpURL"},
               "interactive": {"type": "boolean", "optional": true}
             }
           },
           {
             "name": "callback",
             "type": "function",
             "parameters": [
               {
@@ -180,17 +180,17 @@
         ]
       },
       {
         "name": "getRedirectURL",
         "type": "function",
         "description": "Generates a redirect URL to be used in |launchWebAuthFlow|.",
         "parameters": [
           {
-            "name": " path",
+            "name": "path",
             "type": "string",
             "default": "",
             "optional": true,
             "description": "The path appended to the end of the generated URL. "
           }
         ],
         "returns": {
           "type": "string"
--- a/toolkit/components/extensions/test/mochitest/test_ext_identity.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_identity.html
@@ -72,18 +72,23 @@ add_task(async function test_badAuthURI(
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": [
         "identity",
         "https://example.com/",
       ],
     },
     async background() {
-      await browser.test.assertRejects(browser.identity.launchWebAuthFlow({interactive: true, url: "foobar"}),
-                                       "details.url is invalid", "invalid param url");
+      for (let url of ["foobar", "about:addons", "about:blank", "ftp://example.com/test"]) {
+        await browser.test.assertThrows(
+          () => { browser.identity.launchWebAuthFlow({interactive: true, url}); },
+          /Type error for parameter details/,
+          "details.url is invalid");
+      }
+
       browser.test.sendMessage("done");
     },
   });
 
   await extension.startup();
   await extension.awaitMessage("done");
   await extension.unload();
 });