mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1591102 - Let some SpecialPowers.pushPermissions callers use promises r=jdm
Some callers of SpecialPowers.pushPermissions wrapped the call in a promise. That is not needed; directly use the returned promise instead. Differential Revision: https://phabricator.services.mozilla.com/D50487 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
20949d82c8
commit
34c77beb98
@ -1,16 +1,11 @@
|
||||
async function addNotificationPermission(originString) {
|
||||
return new Promise(resolve => {
|
||||
SpecialPowers.pushPermissions(
|
||||
[
|
||||
{
|
||||
type: "desktop-notification",
|
||||
allow: true,
|
||||
context: originString,
|
||||
},
|
||||
],
|
||||
resolve
|
||||
);
|
||||
});
|
||||
return SpecialPowers.pushPermissions([
|
||||
{
|
||||
type: "desktop-notification",
|
||||
allow: true,
|
||||
context: originString,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,10 +13,8 @@ let registration;
|
||||
let subscription;
|
||||
|
||||
const registerServiceWorker = async function() {
|
||||
await new Promise(resolve => {
|
||||
const perm = { type: "desktop-notification", allow: true, context: document };
|
||||
SpecialPowers.pushPermissions([perm], resolve);
|
||||
});
|
||||
const perm = { type: "desktop-notification", allow: true, context: document };
|
||||
await SpecialPowers.pushPermissions([perm]);
|
||||
|
||||
try {
|
||||
registration = await navigator.serviceWorker.register("push-sw.js");
|
||||
|
@ -31,16 +31,11 @@ function log(msg) {
|
||||
const autoplayPermission = "autoplay-media";
|
||||
|
||||
async function pushAutoplayAllowedPermission() {
|
||||
return new Promise((resolve, reject) => {
|
||||
SpecialPowers.pushPermissions(
|
||||
[
|
||||
{
|
||||
type: autoplayPermission,
|
||||
allow: true,
|
||||
context: document,
|
||||
},
|
||||
],
|
||||
resolve
|
||||
);
|
||||
});
|
||||
return SpecialPowers.pushPermissions([
|
||||
{
|
||||
type: autoplayPermission,
|
||||
allow: true,
|
||||
context: document,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
@ -43,9 +43,7 @@
|
||||
async function run() {
|
||||
ok(await SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Shockwave Flash"), "Should find allowed test flash plugin");
|
||||
ok(!await SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Third Test Plug-in"), "Should not find disallowed plugin");
|
||||
await new Promise(resolve => {
|
||||
SpecialPowers.pushPermissions([{type: "plugin:flash", allow: true, context: document}], resolve);
|
||||
});
|
||||
await SpecialPowers.pushPermissions([{type: "plugin:flash", allow: true, context: document}]);
|
||||
|
||||
createNode("plugin-flash", "application/x-shockwave-flash-test");
|
||||
createNode("disallowedPlugin", "application/x-third-test");
|
||||
|
@ -172,12 +172,9 @@ SimpleTest.registerCleanupFunction(async function() {
|
||||
});
|
||||
|
||||
function setPushPermission(allow) {
|
||||
return new Promise(resolve => {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ type: "desktop-notification", allow, context: document }],
|
||||
resolve
|
||||
);
|
||||
});
|
||||
return SpecialPowers.pushPermissions([
|
||||
{ type: "desktop-notification", allow, context: document },
|
||||
]);
|
||||
}
|
||||
|
||||
function setupPrefs() {
|
||||
|
Loading…
Reference in New Issue
Block a user