Bug 1425267 fix url param schema for launchWebAuthFlow, r=rpl
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 21 Dec 2017 15:18:26 -0800
changeset 397265 0c4f3b8d311e4751dafc00d689c3bf07f17c15dd
parent 397264 bbed4bf1ca00d561e2b3745c2eba349b01a4fd03
child 397266 d58c3059540f117e25352821e7657863720ed3e9
push id98493
push usermixedpuppy@gmail.com
push dateThu, 21 Dec 2017 23:18:43 +0000
treeherdermozilla-inbound@0c4f3b8d311e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1425267
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1425267 fix url param schema for launchWebAuthFlow, r=rpl
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();
 });