mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Backed out changeset 2e087a053898 (bug 1524001) for test_ext_management.js failures CLOSED TREE
This commit is contained in:
parent
ad385bf56a
commit
9cbf5ced1f
@ -1,48 +0,0 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
async function testIconPaths(icon, manifest, expectedError) {
|
||||
let normalized = await ExtensionTestUtils.normalizeManifest(manifest);
|
||||
|
||||
if (expectedError) {
|
||||
ok(expectedError.test(normalized.error),
|
||||
`Should have an error for ${JSON.stringify(manifest)}`);
|
||||
} else {
|
||||
ok(!normalized.error, `Should not have an error ${JSON.stringify(manifest)}, ${normalized.error}`);
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function test_manifest() {
|
||||
let badpaths = ["", " ", "\t", "http://foo.com/icon.png"];
|
||||
for (let path of badpaths) {
|
||||
for (let action of ["browser_action", "page_action", "sidebar_action"]) {
|
||||
let manifest = {};
|
||||
manifest[action] = {default_icon: path};
|
||||
let error = new RegExp(`Error processing ${action}.default_icon`);
|
||||
await testIconPaths(path, manifest, error);
|
||||
|
||||
manifest[action] = {default_icon: {"16": path}};
|
||||
await testIconPaths(path, manifest, error);
|
||||
}
|
||||
}
|
||||
|
||||
let paths = ["icon.png", "/icon.png", "./icon.png", "path to an icon.png", " icon.png"];
|
||||
for (let path of paths) {
|
||||
for (let action of ["browser_action", "page_action", "sidebar_action"]) {
|
||||
let manifest = {};
|
||||
manifest[action] = {default_icon: path};
|
||||
if (action == "sidebar_action") {
|
||||
// Sidebar requires panel.
|
||||
manifest[action].default_panel = "foo.html";
|
||||
}
|
||||
await testIconPaths(path, manifest);
|
||||
|
||||
manifest[action] = {default_icon: {"16": path}};
|
||||
if (action == "sidebar_action") {
|
||||
manifest[action].default_panel = "foo.html";
|
||||
}
|
||||
await testIconPaths(path, manifest);
|
||||
}
|
||||
}
|
||||
});
|
@ -17,7 +17,6 @@ dupe-manifest =
|
||||
# For tests which should only run with both remote extensions and remote content.
|
||||
|
||||
[test_ext_geckoProfiler_schema.js]
|
||||
[test_ext_manifest.js]
|
||||
[test_ext_manifest_commands.js]
|
||||
[test_ext_manifest_omnibox.js]
|
||||
[test_ext_manifest_permissions.js]
|
||||
|
@ -95,7 +95,7 @@
|
||||
"type": "object",
|
||||
"optional": true,
|
||||
"patternProperties": {
|
||||
"^[1-9]\\d*$": { "$ref": "ExtensionFileUrl" }
|
||||
"^[1-9]\\d*$": { "type": "string" }
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2,42 +2,48 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
async function testIconPaths(icon, manifest, expectedError) {
|
||||
let normalized = await ExtensionTestUtils.normalizeManifest(manifest);
|
||||
|
||||
if (expectedError) {
|
||||
ok(expectedError.test(normalized.error),
|
||||
`Should have an error for ${JSON.stringify(icon)}`);
|
||||
} else {
|
||||
ok(!normalized.error, `Should not have an error ${JSON.stringify(icon)}`);
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function test_manifest() {
|
||||
let badpaths = ["", " ", "\t", "http://foo.com/icon.png"];
|
||||
for (let path of badpaths) {
|
||||
await testIconPaths(path, {
|
||||
"icons": path,
|
||||
}, /Error processing icons/);
|
||||
|
||||
await testIconPaths(path, {
|
||||
"icons": {
|
||||
"16": path,
|
||||
let normalized = await ExtensionTestUtils.normalizeManifest({
|
||||
"browser_action": {
|
||||
"default_icon": path,
|
||||
},
|
||||
}, /Error processing icons/);
|
||||
});
|
||||
|
||||
ok(/Error processing browser_action.default_icon/.test(normalized.error),
|
||||
`Should have an error for ${JSON.stringify(path)}`);
|
||||
|
||||
normalized = await ExtensionTestUtils.normalizeManifest({
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"16": path,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
ok(/Error processing browser_action.default_icon/.test(normalized.error),
|
||||
`Should have an error for ${JSON.stringify(path)}`);
|
||||
}
|
||||
|
||||
let paths = ["icon.png", "/icon.png", "./icon.png", "path to an icon.png", " icon.png"];
|
||||
for (let path of paths) {
|
||||
// manifest.icons is an object
|
||||
await testIconPaths(path, {
|
||||
"icons": path,
|
||||
}, /Error processing icons/);
|
||||
|
||||
await testIconPaths(path, {
|
||||
"icons": {
|
||||
"16": path,
|
||||
let normalized = await ExtensionTestUtils.normalizeManifest({
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"16": path,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
ok(!normalized.error, `Should not have an error ${JSON.stringify(path)}`);
|
||||
|
||||
normalized = await ExtensionTestUtils.normalizeManifest({
|
||||
"browser_action": {
|
||||
"default_icon": path,
|
||||
},
|
||||
});
|
||||
|
||||
ok(!normalized.error, `Should not have an error ${JSON.stringify(path)}`);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user