Bug 1500320 - Updating the omnibox keyword regex to allow trailing slashes r=robwu,aswan
authorhawaiianchimp <hawaiianchimp@gmail.com>
Mon, 26 Nov 2018 23:16:22 +0000
changeset 504912 f3417713c0534a4d8aaf9bd265d58f81f4c85e25
parent 504908 209ed62867bf0159b4d9a49fdd98bcea43c64287
child 504913 1da65c8d52d341780a82fbfacc03a6e7c27d421e
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobwu, aswan
bugs1500320
milestone65.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 1500320 - Updating the omnibox keyword regex to allow trailing slashes r=robwu,aswan Previously the omnibox keyword would not allow trailing slashes, such as go/ Chrome allows this keyword, and Firefox should allow this too. Differential Revision: https://phabricator.services.mozilla.com/D12242
browser/components/extensions/schemas/omnibox.json
browser/components/extensions/test/xpcshell/test_ext_manifest_omnibox.js
--- a/browser/components/extensions/schemas/omnibox.json
+++ b/browser/components/extensions/schemas/omnibox.json
@@ -9,17 +9,17 @@
         "$extend": "WebExtensionManifest",
         "properties": {
           "omnibox": {
             "type": "object",
             "additionalProperties": { "$ref": "UnrecognizedProperty" },
             "properties": {
               "keyword": {
                 "type": "string",
-                "pattern": "^[^?\\s:]([^\\s:]*[^/\\s:])?$"
+                "pattern": "^[^?\\s:][^\\s:]*$"
               }
             },
             "optional": true
           }
         }
       }
     ]
   },
--- a/browser/components/extensions/test/xpcshell/test_ext_manifest_omnibox.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_manifest_omnibox.js
@@ -7,17 +7,17 @@ async function testKeyword(params) {
     "omnibox": {
       "keyword": params.keyword,
     },
   });
 
   if (params.expectError) {
     let expectedError = (
       String.raw`omnibox.keyword: String "${params.keyword}" ` +
-      String.raw`must match /^[^?\s:]([^\s:]*[^/\s:])?$/`
+      String.raw`must match /^[^?\s:][^\s:]*$/`
     );
     ok(normalized.error.includes(expectedError),
        `The manifest error ${JSON.stringify(normalized.error)} ` +
        `must contain ${JSON.stringify(expectedError)}`);
   } else {
     equal(normalized.error, undefined, "Should not have an error");
     equal(normalized.errors.length, 0, "Should not have warnings");
   }
@@ -38,24 +38,24 @@ add_task(async function test_manifest_co
 
   // accepted multi-character keywords
   await testKeyword({keyword: "aa", expectError: false});
   await testKeyword({keyword: "http", expectError: false});
   await testKeyword({keyword: "f?a", expectError: false});
   await testKeyword({keyword: "fa?", expectError: false});
   await testKeyword({keyword: "f/x", expectError: false});
   await testKeyword({keyword: "/fx", expectError: false});
+  await testKeyword({keyword: "fx/", expectError: false});
 
   // rejected multi-character keywords
   await testKeyword({keyword: " a", expectError: true});
   await testKeyword({keyword: "a ", expectError: true});
   await testKeyword({keyword: "  ", expectError: true});
   await testKeyword({keyword: " a ", expectError: true});
   await testKeyword({keyword: "?fx", expectError: true});
-  await testKeyword({keyword: "fx/", expectError: true});
   await testKeyword({keyword: "f:x", expectError: true});
   await testKeyword({keyword: "fx:", expectError: true});
   await testKeyword({keyword: "f x", expectError: true});
 
   // miscellaneous tests
   await testKeyword({keyword: "こんにちは", expectError: false});
   await testKeyword({keyword: "http://", expectError: true});
 });