mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1253565 - [webext] Use 'UnrecognizedProperty' on browser and page actions. r=kmag
MozReview-Commit-ID: 8RfrogKRoP8 --HG-- rename : browser/components/extensions/test/browser/browser_ext_browserAction_simple.js => browser/components/extensions/test/browser/browser_ext_pageAction_simple.js extra : rebase_source : 7dea353852a920c022e030e76d3c69a9bcdbc5bb
This commit is contained in:
parent
896cbecf01
commit
1c6cca19d7
@ -11,6 +11,7 @@
|
||||
"properties": {
|
||||
"browser_action": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "$ref": "UnrecognizedProperty" },
|
||||
"properties": {
|
||||
"default_title": {
|
||||
"type": "string",
|
||||
|
@ -11,6 +11,7 @@
|
||||
"properties": {
|
||||
"page_action": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "$ref": "UnrecognizedProperty" },
|
||||
"properties": {
|
||||
"default_title": {
|
||||
"type": "string",
|
||||
|
@ -18,6 +18,7 @@ support-files =
|
||||
[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]
|
||||
|
@ -7,6 +7,7 @@ add_task(function* () {
|
||||
manifest: {
|
||||
"browser_action": {
|
||||
"default_popup": "popup.html",
|
||||
"unrecognized_property": "with-a-random-value",
|
||||
},
|
||||
},
|
||||
|
||||
@ -31,6 +32,13 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
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.
|
||||
@ -43,4 +51,7 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
yield extension.unload();
|
||||
|
||||
SimpleTest.endMonitorConsole();
|
||||
yield waitForConsole;
|
||||
});
|
||||
|
@ -0,0 +1,59 @@
|
||||
/* -*- 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: {
|
||||
"page_action": {
|
||||
"default_popup": "popup.html",
|
||||
"unrecognized_property": "with-a-random-value",
|
||||
},
|
||||
},
|
||||
|
||||
files: {
|
||||
"popup.html": `
|
||||
<!DOCTYPE html>
|
||||
<html><body>
|
||||
<script src="popup.js"></script>
|
||||
</body></html>
|
||||
`,
|
||||
|
||||
"popup.js": function() {
|
||||
browser.runtime.sendMessage("from-popup");
|
||||
},
|
||||
},
|
||||
|
||||
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();
|
||||
yield extension.awaitMessage("page-action-shown");
|
||||
|
||||
clickPageAction(extension);
|
||||
|
||||
yield extension.awaitMessage("popup");
|
||||
|
||||
yield extension.unload();
|
||||
|
||||
SimpleTest.endMonitorConsole();
|
||||
yield waitForConsole;
|
||||
});
|
Loading…
Reference in New Issue
Block a user