Bug 1253565 - [webext] add "UnrecognizedProperty" to commands manifest properties. r=kmag
authorLuca Greco <lgreco@mozilla.com>
Mon, 14 Mar 2016 12:03:46 +0100
changeset 341215 c715f7a518276c10ef3ace02ea374a511312ac8a
parent 341214 229b9d4e139665815f2339e9a566400517bb2f47
child 341216 e5c63c3fb088c0f47becdbf3b2afa5e9576dd9d3
push id13172
push userdtownsend@mozilla.com
push dateWed, 16 Mar 2016 19:41:48 +0000
reviewerskmag
bugs1253565
milestone48.0a1
Bug 1253565 - [webext] add "UnrecognizedProperty" to commands manifest properties. r=kmag MozReview-Commit-ID: 9r2MaceQ4Kk
browser/components/extensions/schemas/commands.json
browser/components/extensions/test/browser/browser_ext_commands_onCommand.js
--- a/browser/components/extensions/schemas/commands.json
+++ b/browser/components/extensions/schemas/commands.json
@@ -22,16 +22,17 @@
       {
         "$extend": "WebExtensionManifest",
         "properties": {
           "commands": {
             "type": "object",
             "optional": true,
             "additionalProperties": {
               "type": "object",
+              "additionalProperties": { "$ref": "UnrecognizedProperty" },
               "properties": {
                 "suggested_key": {
                   "type": "object",
                   "optional": true,
                   "properties": {
                     "default": {
                       "$ref": "KeyName",
                       "optional": true
@@ -138,9 +139,9 @@
               }
             ],
             "description": "Called to return the registered commands."
           }
         ]
       }
     ]
   }
-]
\ No newline at end of file
+]
--- a/browser/components/extensions/test/browser/browser_ext_commands_onCommand.js
+++ b/browser/components/extensions/test/browser/browser_ext_commands_onCommand.js
@@ -16,28 +16,37 @@ add_task(function* () {
           "suggested_key": {
             "default": "Alt+Shift+3",
           },
         },
         "toggle-feature-using-alt-shift-comma": {
           "suggested_key": {
             "default": "Alt+Shift+Comma",
           },
+          "unrecognized_property": "with-a-random-value",
         },
       },
     },
 
     background: function() {
       browser.commands.onCommand.addListener((message) => {
         browser.test.sendMessage("oncommand", message);
       });
       browser.test.sendMessage("ready");
     },
   });
 
+
+  SimpleTest.waitForExplicitFinish();
+  let waitForConsole = new Promise(resolve => {
+    SimpleTest.monitorConsole(resolve, [{
+      message: /Reading manifest: Error processing commands.*.unrecognized_property: An unexpected property was found/,
+    }]);
+  });
+
   yield extension.startup();
   yield extension.awaitMessage("ready");
 
   // Create another window after the extension is loaded.
   let win2 = yield BrowserTestUtils.openNewBrowserWindow();
   yield BrowserTestUtils.loadURI(win2.gBrowser.selectedBrowser, "about:config");
   yield BrowserTestUtils.browserLoaded(win2.gBrowser.selectedBrowser);
 
@@ -66,9 +75,12 @@ add_task(function* () {
   keyset = win1.document.getElementById(keysetID);
   is(keyset, null, "Expected keyset to be removed from the window");
 
   keyset = win2.document.getElementById(keysetID);
   is(keyset, null, "Expected keyset to be removed from the window");
 
   yield BrowserTestUtils.closeWindow(win1);
   yield BrowserTestUtils.closeWindow(win2);
+
+  SimpleTest.endMonitorConsole();
+  yield waitForConsole;
 });