mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1227451 - chrome.alarms API doesn't check 'alarms' permission. r=billm
This commit is contained in:
parent
f3ccde98a0
commit
1a681902aa
@ -91,7 +91,7 @@ extensions.on("shutdown", (type, extension) => {
|
|||||||
});
|
});
|
||||||
/* eslint-enable mozilla/balanced-listeners */
|
/* eslint-enable mozilla/balanced-listeners */
|
||||||
|
|
||||||
extensions.registerAPI((extension, context) => {
|
extensions.registerPrivilegedAPI("alarms", (extension, context) => {
|
||||||
return {
|
return {
|
||||||
alarms: {
|
alarms: {
|
||||||
create: function(...args) {
|
create: function(...args) {
|
||||||
|
@ -13,6 +13,32 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
add_task(function* test_alarm_without_permissions() {
|
||||||
|
function backgroundScript() {
|
||||||
|
let ALARM_NAME = "test_ext_alarms";
|
||||||
|
browser.test.log("running alarm script");
|
||||||
|
|
||||||
|
browser.test.assertTrue(!browser.alarms,
|
||||||
|
"alarm API should not be available if the alarm permission is not required")
|
||||||
|
browser.test.notifyPass("alarms_permission");
|
||||||
|
}
|
||||||
|
|
||||||
|
let extensionData = {
|
||||||
|
background: "(" + backgroundScript.toString() + ")()",
|
||||||
|
manifest: {
|
||||||
|
permissions: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||||
|
yield extension.startup();
|
||||||
|
info("extension loaded");
|
||||||
|
yield extension.awaitFinish("alarms_permission");
|
||||||
|
yield extension.unload();
|
||||||
|
info("extension unloaded");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
add_task(function* test_alarm_fires() {
|
add_task(function* test_alarm_fires() {
|
||||||
function backgroundScript() {
|
function backgroundScript() {
|
||||||
let ALARM_NAME = "test_ext_alarms";
|
let ALARM_NAME = "test_ext_alarms";
|
||||||
|
Loading…
Reference in New Issue
Block a user