Bug 1253565 - [webext] Reusable 'UnrecognizedProperty' type for manifest schema validation. r=kmag
☠☠ backed out by 21077a8abccf ☠ ☠
authorLuca Greco <lgreco@mozilla.com>
Thu, 10 Mar 2016 19:06:55 +0100
changeset 288528 c02c1dc34180806bc48e56cc46ddf58b1d929b63
parent 288527 398160abc223561f29deb190949910154c4f5b03
child 288529 1e47cefe3b9b90f6731006768dd7c9bcf1ff8286
push id18159
push userryanvm@gmail.com
push dateMon, 14 Mar 2016 15:59:30 +0000
treeherderfx-team@d50f024f55d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1253565
milestone48.0a1
Bug 1253565 - [webext] Reusable 'UnrecognizedProperty' type for manifest schema validation. r=kmag MozReview-Commit-ID: LLWb07ybvlb
toolkit/components/extensions/schemas/manifest.json
toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -90,30 +90,32 @@
               {
                 "type": "object",
                 "properties": {
                   "page": { "$ref": "ExtensionURL" },
                   "persistent": {
                     "optional": true,
                     "$ref": "PersistentBackgroundProperty"
                   }
-                }
+                },
+                "additionalProperties": { "$ref": "UnrecognizedProperty" }
               },
               {
                 "type": "object",
                 "properties": {
                   "scripts": {
                     "type": "array",
                     "items": { "$ref": "ExtensionURL" }
                   },
                   "persistent": {
                     "optional": true,
                     "$ref": "PersistentBackgroundProperty"
                   }
-                }
+                },
+                "additionalProperties": { "$ref": "UnrecognizedProperty" }
               }
             ],
             "optional": true
           },
 
           "options_ui": {
             "type": "object",
 
@@ -163,20 +165,17 @@
 
           "web_accessible_resources": {
             "type": "array",
             "items": { "type": "string" },
             "optional": true
           }
         },
 
-        "additionalProperties": {
-          "type": "any",
-          "deprecated": "An unexpected property was found in the WebExtension manifest"
-        }
+        "additionalProperties": { "$ref": "UnrecognizedProperty" }
       },
       {
         "id": "Permission",
         "choices": [
           {
             "type": "string",
             "enum": [
               "alarms",
@@ -222,16 +221,17 @@
             "pattern": "^file:///.*$"
           }
         ]
       },
       {
         "id": "ContentScript",
         "type": "object",
         "description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. Based on InjectDetails, but using underscore rather than camel case naming conventions.",
+        "additionalProperties": { "$ref": "UnrecognizedProperty" },
         "properties": {
           "matches": {
             "type": "array",
             "optional": false,
             "minItems": 1,
             "items": { "$ref": "MatchPattern" }
           },
           "exclude_matches": {
@@ -289,15 +289,20 @@
           },
           {
             "type": "object",
             "isInstanceOf": "ImageData"
           }
         ]
       },
       {
+        "id": "UnrecognizedProperty",
+        "type": "any",
+        "deprecated": "An unexpected property was found in the WebExtension manifest."
+      },
+      {
         "id": "PersistentBackgroundProperty",
         "type": "boolean",
         "deprecated": "Event pages are not currently supported. This will run as a persistent background page."
       }
     ]
   }
 ]
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html
@@ -68,15 +68,38 @@ add_task(function* test_eventpages() {
     let [, x] = yield Promise.all([extension.startup(), extension.awaitMessage("running")]);
     is(x, 1, "got correct value from extension");
     info("test complete");
     yield extension.unload();
     info("extension unloaded successfully");
 
     SimpleTest.endMonitorConsole();
     yield waitForConsole;
+
+    waitForConsole = new Promise(resolve => {
+      SimpleTest.monitorConsole(resolve, [{
+        message: /Reading manifest: Error processing background.nonExistentProp: An unexpected property was found/,
+      }]);
+    });
+
+    info("testing additional unrecognized properties on background page");
+
+    extension = createEventPageExtension({
+      "scripts": ["event-page-script.js"],
+      "nonExistentProp": true,
+    });
+
+    info("load complete");
+    [, x] = yield Promise.all([extension.startup(), extension.awaitMessage("running")]);
+    is(x, 1, "got correct value from extension");
+    info("test complete");
+    yield extension.unload();
+    info("extension unloaded successfully");
+
+    SimpleTest.endMonitorConsole();
+    yield waitForConsole;
   }
 });
 
 </script>
 
 </body>
 </html>