Bug 1277686 - Reject manifests with any "incognito" property other than "spanning", r?kmag
MozReview-Commit-ID: 7DJ6EMQ5jnX
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -74,16 +74,22 @@
"icons": {
"type": "object",
"optional": true,
"patternProperties": {
"^[1-9]\\d*$": { "type": "string" }
}
},
+ "incognito": {
+ "type": "string",
+ "enum": ["spanning"],
+ "optional": true
+ },
+
"background": {
"choices": [
{
"type": "object",
"properties": {
"page": { "$ref": "ExtensionURL" },
"persistent": {
"optional": true,
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js
@@ -0,0 +1,23 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+
+add_task(function* test_manifest_incognito() {
+ let normalized = yield normalizeManifest({
+ "incognito": "spanning",
+ });
+
+ equal(normalized.error, undefined, "Should not have an error");
+ equal(normalized.errors.length, 0, "Should not have warnings");
+ equal(normalized.value.incognito,
+ "spanning",
+ "Should have the expected incognito string");
+
+ normalized = yield normalizeManifest({
+ "incognito": "split",
+ });
+
+ equal(normalized.error, 'Error processing incognito: Invalid enumeration value "split"', "Should have the expected error");
+ equal(normalized.errors.length, 0, "Should not have warnings");
+});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -6,13 +6,14 @@ skip-if = toolkit == 'gonk' || appname =
[test_csp_custom_policies.js]
[test_csp_validator.js]
[test_locale_data.js]
[test_locale_converter.js]
[test_ext_contexts.js]
[test_ext_json_parser.js]
[test_ext_manifest_content_security_policy.js]
+[test_ext_manifest_incognito.js]
[test_ext_schemas.js]
[test_getAPILevelForWindow.js]
[test_native_messaging.js]
# Re-enable for Windows with bug 1270359.
skip-if = os != "mac" && os != "linux"