Bug 1253565 - [webext] use 'UnrecognizedProperty' on browser and page actions. r=kmag
authorLuca Greco <lgreco@mozilla.com>
Mon, 14 Mar 2016 12:26:45 +0100
changeset 288998 229b9d4e139665815f2339e9a566400517bb2f47
parent 288997 96c02999683fcc53b23aafa0987211a4c0659ffc
child 288999 c715f7a518276c10ef3ace02ea374a511312ac8a
push id30095
push usercbook@mozilla.com
push dateThu, 17 Mar 2016 09:58:44 +0000
treeherdermozilla-central@fd2500051296 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1253565
milestone48.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 1253565 - [webext] use 'UnrecognizedProperty' on browser and page actions. r=kmag MozReview-Commit-ID: 8RfrogKRoP8
browser/components/extensions/schemas/browser_action.json
browser/components/extensions/schemas/page_action.json
browser/components/extensions/test/browser/browser.ini
browser/components/extensions/test/browser/browser_ext_browserAction_simple.js
browser/components/extensions/test/browser/browser_ext_pageAction_simple.js
--- a/browser/components/extensions/schemas/browser_action.json
+++ b/browser/components/extensions/schemas/browser_action.json
@@ -6,16 +6,17 @@
   {
     "namespace": "manifest",
     "types": [
       {
         "$extend": "WebExtensionManifest",
         "properties": {
           "browser_action": {
             "type": "object",
+            "additionalProperties": { "$ref": "UnrecognizedProperty" },
             "properties": {
               "default_title": {
                 "type": "string",
                 "optional": true,
                 "preprocess": "localize"
               },
               "default_icon": {
                 "$ref": "IconPath",
--- a/browser/components/extensions/schemas/page_action.json
+++ b/browser/components/extensions/schemas/page_action.json
@@ -6,16 +6,17 @@
   {
     "namespace": "manifest",
     "types": [
       {
         "$extend": "WebExtensionManifest",
         "properties": {
           "page_action": {
             "type": "object",
+            "additionalProperties": { "$ref": "UnrecognizedProperty" },
             "properties": {
               "default_title": {
                 "type": "string",
                 "optional": true,
                 "preprocess": "localize"
               },
               "default_icon": {
                 "$ref": "IconPath",
--- a/browser/components/extensions/test/browser/browser.ini
+++ b/browser/components/extensions/test/browser/browser.ini
@@ -13,16 +13,17 @@ support-files =
   file_language_ja.html
 
 [browser_ext_simple.js]
 [browser_ext_currentWindow.js]
 [browser_ext_browserAction_simple.js]
 [browser_ext_browserAction_pageAction_icon.js]
 [browser_ext_browserAction_context.js]
 [browser_ext_browserAction_disabled.js]
+[browser_ext_pageAction_simple.js]
 [browser_ext_pageAction_context.js]
 [browser_ext_pageAction_popup.js]
 [browser_ext_browserAction_popup.js]
 [browser_ext_popup_api_injection.js]
 [browser_ext_contextMenus.js]
 [browser_ext_commands_getAll.js]
 [browser_ext_commands_onCommand.js]
 [browser_ext_getViews.js]
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js
@@ -2,16 +2,17 @@
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 add_task(function* () {
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "browser_action": {
         "default_popup": "popup.html",
+        "unrecognized_property": "with-a-random-value",
       },
     },
 
     files: {
       "popup.html": `
       <!DOCTYPE html>
       <html><body>
       <script src="popup.js"></script>
@@ -26,21 +27,31 @@ add_task(function* () {
     background: function() {
       browser.runtime.onMessage.addListener(msg => {
         browser.test.assertEq(msg, "from-popup", "correct message received");
         browser.test.sendMessage("popup");
       });
     },
   });
 
+  SimpleTest.waitForExplicitFinish();
+  let waitForConsole = new Promise(resolve => {
+    SimpleTest.monitorConsole(resolve, [{
+      message: /Reading manifest: Error processing browser_action.unrecognized_property: An unexpected property was found/,
+    }]);
+  });
+
   yield extension.startup();
 
   // Do this a few times to make sure the pop-up is reloaded each time.
   for (let i = 0; i < 3; i++) {
     clickBrowserAction(extension);
 
     yield extension.awaitMessage("popup");
 
     closeBrowserAction(extension);
   }
 
   yield extension.unload();
+
+  SimpleTest.endMonitorConsole();
+  yield waitForConsole;
 });
copy from browser/components/extensions/test/browser/browser_ext_browserAction_simple.js
copy to browser/components/extensions/test/browser/browser_ext_pageAction_simple.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js
+++ b/browser/components/extensions/test/browser/browser_ext_pageAction_simple.js
@@ -1,17 +1,18 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 add_task(function* () {
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
-      "browser_action": {
+      "page_action": {
         "default_popup": "popup.html",
+        "unrecognized_property": "with-a-random-value",
       },
     },
 
     files: {
       "popup.html": `
       <!DOCTYPE html>
       <html><body>
       <script src="popup.js"></script>
@@ -23,24 +24,36 @@ add_task(function* () {
       },
     },
 
     background: function() {
       browser.runtime.onMessage.addListener(msg => {
         browser.test.assertEq(msg, "from-popup", "correct message received");
         browser.test.sendMessage("popup");
       });
+      browser.tabs.query({active: true, currentWindow: true}, tabs => {
+        let tabId = tabs[0].id;
+
+        browser.pageAction.show(tabId);
+        browser.test.sendMessage("page-action-shown");
+      });
     },
   });
 
+  SimpleTest.waitForExplicitFinish();
+  let waitForConsole = new Promise(resolve => {
+    SimpleTest.monitorConsole(resolve, [{
+      message: /Reading manifest: Error processing page_action.unrecognized_property: An unexpected property was found/,
+    }]);
+  });
+
   yield extension.startup();
-
-  // Do this a few times to make sure the pop-up is reloaded each time.
-  for (let i = 0; i < 3; i++) {
-    clickBrowserAction(extension);
+  yield extension.awaitMessage("page-action-shown");
 
-    yield extension.awaitMessage("popup");
+  clickPageAction(extension);
 
-    closeBrowserAction(extension);
-  }
+  yield extension.awaitMessage("popup");
 
   yield extension.unload();
+
+  SimpleTest.endMonitorConsole();
+  yield waitForConsole;
 });