Bug 1253565 - [webext] add "UnrecognizedProperty" to commands manifest properties. r?kmag draft
authorLuca Greco <lgreco@mozilla.com>
Mon, 14 Mar 2016 12:03:46 +0100
changeset 341083 5b15d39643c9b051839336172ead0c61bea0a690
parent 341082 d159c8d14dc28339e00d4bf5e0da622d2ea1afd2
child 516324 ebf1f14e5430572e9e234bb0218b8d3736ab69b6
push id13131
push userluca.greco@alcacoop.it
push dateWed, 16 Mar 2016 13:28:58 +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;
 });