mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Backed out 3 changesets (bug 1875257) for causing crashes at permission.html.
Backed out changeset 5df20aa207c2 (bug 1875257) Backed out changeset c0bc6a564dde (bug 1875257) Backed out changeset 4b036bb03d45 (bug 1875257)
This commit is contained in:
parent
46edc28b3e
commit
cb5fbaf067
@ -3446,6 +3446,12 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Prevent errors when using set_permission from permissions.sys.mjs
|
||||
- name: dom.screenwakelock.testing
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether to enable the JavaScript start-up cache. This causes one of the first
|
||||
# execution to record the bytecode of the JavaScript function used, and save it
|
||||
# in the existing cache entry. On the following loads of the same script, the
|
||||
|
@ -3323,46 +3323,6 @@ GeckoDriver.prototype.setUserVerified = function (cmd) {
|
||||
|
||||
GeckoDriver.prototype.setPermission = async function (cmd) {
|
||||
const { descriptor, state, oneRealm = false } = cmd.parameters;
|
||||
const browsingContext = lazy.assert.open(this.getBrowsingContext());
|
||||
|
||||
// XXX: WPT should not have these but currently they do and we pass testing pref to
|
||||
// pass them, see bug 1875837.
|
||||
if (
|
||||
["clipboard-read", "clipboard-write"].includes(descriptor.name) &&
|
||||
state === "granted"
|
||||
) {
|
||||
if (
|
||||
Services.prefs.getBoolPref("dom.events.testing.asyncClipboard", false)
|
||||
) {
|
||||
// Okay, do nothing. The clipboard module will work without permission.
|
||||
return;
|
||||
}
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"setPermission: expected dom.events.testing.asyncClipboard to be set"
|
||||
);
|
||||
}
|
||||
|
||||
// XXX: We currently depend on camera/microphone tests throwing UnsupportedOperationError,
|
||||
// the fix is ongoing in bug 1609427.
|
||||
if (["camera", "microphone"].includes(descriptor.name)) {
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"setPermission: camera and microphone permissions are currently unsupported"
|
||||
);
|
||||
}
|
||||
|
||||
// This abuses permissions.query() to do the IDL conversion in step 1 in the spec:
|
||||
// https://w3c.github.io/permissions/#webdriver-command-set-permission
|
||||
// If this does not throw then the descriptor is valid.
|
||||
//
|
||||
// TODO: Currently we consume the original JS object later on, but we should
|
||||
// consume the IDL-converted dictionary instead.
|
||||
// For WPT purpose the current state is fine, but for general webdriver extension
|
||||
// this is not ideal as the script might get access to fields that are not in IDL.
|
||||
try {
|
||||
await this.curBrowser.window.navigator.permissions.query(descriptor);
|
||||
} catch (err) {
|
||||
throw new lazy.error.InvalidArgumentError(`setPermission: ${err.message}`);
|
||||
}
|
||||
|
||||
lazy.assert.boolean(oneRealm);
|
||||
lazy.assert.that(
|
||||
@ -3370,7 +3330,13 @@ GeckoDriver.prototype.setPermission = async function (cmd) {
|
||||
`state is ${state}, expected "granted", "denied", or "prompt"`
|
||||
)(state);
|
||||
|
||||
lazy.permissions.set(descriptor, state, oneRealm, browsingContext);
|
||||
lazy.permissions.set(
|
||||
descriptor,
|
||||
state,
|
||||
oneRealm,
|
||||
this.getBrowsingContext(),
|
||||
this.getBrowsingContext({ top: true })
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,7 @@
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
|
||||
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
|
||||
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
|
||||
});
|
||||
@ -12,46 +13,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
/** @namespace */
|
||||
export const permissions = {};
|
||||
|
||||
const specialPermissionNameMap = {
|
||||
geolocation: "geo",
|
||||
notifications: "desktop-notification",
|
||||
};
|
||||
|
||||
function mapToInternalPermissionParameters(browsingContext, descriptor) {
|
||||
const currentURI = browsingContext.currentWindowGlobal.documentURI;
|
||||
|
||||
const { name } = descriptor;
|
||||
|
||||
// storage-access is quite special...
|
||||
if (name === "storage-access") {
|
||||
const thirdPartyPrincipalSite = Services.eTLD.getSite(currentURI);
|
||||
|
||||
const topLevelURI = browsingContext.top.currentWindowGlobal.documentURI;
|
||||
const topLevelPrincipal =
|
||||
Services.scriptSecurityManager.createContentPrincipal(topLevelURI, {});
|
||||
|
||||
return {
|
||||
name: "3rdPartyFrameStorage^" + thirdPartyPrincipalSite,
|
||||
principal: topLevelPrincipal,
|
||||
};
|
||||
}
|
||||
|
||||
const currentPrincipal =
|
||||
Services.scriptSecurityManager.createContentPrincipal(currentURI, {});
|
||||
|
||||
if (name === "midi" && descriptor.sysex) {
|
||||
return {
|
||||
name: "midi-sysex",
|
||||
principal: currentPrincipal,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
name: specialPermissionNameMap[name] ?? name,
|
||||
principal: currentPrincipal,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a permission's state.
|
||||
* Note: Currently just a shim to support testdriver's set_permission.
|
||||
@ -62,48 +23,107 @@ function mapToInternalPermissionParameters(browsingContext, descriptor) {
|
||||
* State of the permission. It can be `granted`, `denied` or `prompt`.
|
||||
* @param {boolean} oneRealm
|
||||
* Currently ignored
|
||||
* @param {browsingContext=} browsingContext
|
||||
* Current browsing context object
|
||||
* @param {browsingContext=} thirdPartyBrowsingContext
|
||||
* 3rd party browsing context object
|
||||
* @param {browsingContext=} topLevelBrowsingContext
|
||||
* Top level browsing context object
|
||||
* @throws {UnsupportedOperationError}
|
||||
* If `marionette.setpermission.enabled` is not set or
|
||||
* an unsupported permission is used.
|
||||
*/
|
||||
permissions.set = function (descriptor, state, oneRealm, browsingContext) {
|
||||
permissions.set = function (
|
||||
descriptor,
|
||||
state,
|
||||
oneRealm,
|
||||
thirdPartyBrowsingContext,
|
||||
topLevelBrowsingContext
|
||||
) {
|
||||
if (!lazy.MarionettePrefs.setPermissionEnabled) {
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"'Set Permission' is not available"
|
||||
);
|
||||
}
|
||||
|
||||
const { name, principal } = mapToInternalPermissionParameters(
|
||||
browsingContext,
|
||||
descriptor
|
||||
);
|
||||
// This is not a real implementation of the permissions API.
|
||||
// Instead the purpose of this implementation is to have web-platform-tests
|
||||
// that use `set_permission()` not fail.
|
||||
// Each test needs the corresponding testing pref to make it actually work.
|
||||
const { name } = descriptor;
|
||||
|
||||
switch (state) {
|
||||
case "granted": {
|
||||
Services.perms.addFromPrincipal(
|
||||
principal,
|
||||
name,
|
||||
Services.perms.ALLOW_ACTION
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "denied": {
|
||||
Services.perms.addFromPrincipal(
|
||||
principal,
|
||||
name,
|
||||
Services.perms.DENY_ACTION
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "prompt": {
|
||||
Services.perms.removeFromPrincipal(principal, name);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"Unrecognized permission keyword for 'Set Permission' operation"
|
||||
);
|
||||
if (state === "prompt" && name !== "storage-access") {
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"'Set Permission' doesn't support prompt"
|
||||
);
|
||||
}
|
||||
if (["clipboard-write", "clipboard-read"].includes(name)) {
|
||||
if (
|
||||
Services.prefs.getBoolPref("dom.events.testing.asyncClipboard", false)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"'Set Permission' expected dom.events.testing.asyncClipboard to be set"
|
||||
);
|
||||
} else if (name === "notifications") {
|
||||
if (Services.prefs.getBoolPref("notification.prompt.testing", false)) {
|
||||
return;
|
||||
}
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"'Set Permission' expected notification.prompt.testing to be set"
|
||||
);
|
||||
} else if (name === "storage-access") {
|
||||
// Check if browsing context has a window global object
|
||||
lazy.assert.open(thirdPartyBrowsingContext);
|
||||
lazy.assert.open(topLevelBrowsingContext);
|
||||
|
||||
const thirdPartyURI =
|
||||
thirdPartyBrowsingContext.currentWindowGlobal.documentURI;
|
||||
const topLevelURI = topLevelBrowsingContext.currentWindowGlobal.documentURI;
|
||||
|
||||
const thirdPartyPrincipalSite = Services.eTLD.getSite(thirdPartyURI);
|
||||
|
||||
const topLevelPrincipal =
|
||||
Services.scriptSecurityManager.createContentPrincipal(topLevelURI, {});
|
||||
|
||||
switch (state) {
|
||||
case "granted": {
|
||||
Services.perms.addFromPrincipal(
|
||||
topLevelPrincipal,
|
||||
"3rdPartyFrameStorage^" + thirdPartyPrincipalSite,
|
||||
Services.perms.ALLOW_ACTION
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "denied": {
|
||||
Services.perms.addFromPrincipal(
|
||||
topLevelPrincipal,
|
||||
"3rdPartyFrameStorage^" + thirdPartyPrincipalSite,
|
||||
Services.perms.DENY_ACTION
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "prompt": {
|
||||
Services.perms.removeFromPrincipal(
|
||||
topLevelPrincipal,
|
||||
"3rdPartyFrameStorage^" + thirdPartyPrincipalSite
|
||||
);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
`'Set Permission' did not work for storage-access'`
|
||||
);
|
||||
}
|
||||
} else if (name === "screen-wake-lock") {
|
||||
if (Services.prefs.getBoolPref("dom.screenwakelock.testing", false)) {
|
||||
return;
|
||||
}
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
"'Set Permission' expected dom.screenwakelock.testing to be set"
|
||||
);
|
||||
}
|
||||
|
||||
throw new lazy.error.UnsupportedOperationError(
|
||||
`'Set Permission' doesn't support '${name}'`
|
||||
);
|
||||
};
|
||||
|
@ -1,3 +1,2 @@
|
||||
lsan-allowed: [Alloc, NS_GetXPTCallStub, NewPage, nsXPCWrappedJS::GetNewOrUsed]
|
||||
leak-threshold: [default:51200]
|
||||
prefs: [marionette.setpermission.enabled:true]
|
||||
|
@ -1,3 +1,5 @@
|
||||
prefs: [notification.prompt.testing:true,marionette.setpermission.enabled:true]
|
||||
|
||||
[event-onclose.https.html]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1816427
|
||||
expected:
|
||||
|
@ -1,3 +1,5 @@
|
||||
prefs: [notification.prompt.testing:true,marionette.setpermission.enabled:true]
|
||||
|
||||
[event-onshow.https.html]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1816427
|
||||
expected:
|
||||
|
@ -1,3 +1,4 @@
|
||||
prefs: [notification.prompt.testing:true, marionette.setpermission.enabled:true]
|
||||
[getnotifications-across-processes.https.window.html]
|
||||
expected:
|
||||
if processor == "x86": [OK, TIMEOUT]
|
||||
|
@ -1,172 +1,113 @@
|
||||
[lang.https.html]
|
||||
expected:
|
||||
if os == "android": TIMEOUT
|
||||
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[Roundtripping lang "". Expecting "".]
|
||||
expected:
|
||||
if os == "android": TIMEOUT
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "en". Expecting "en".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "en-US-x-hixie". Expecting "en-US-x-hixie".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-DE". Expecting "de-DE".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-de". Expecting "de-de".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-De". Expecting "de-De".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-dE". Expecting "de-dE".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-DE-1996". Expecting "de-DE-1996".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-Latn-DE". Expecting "de-Latn-DE".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-Latf-DE". Expecting "de-Latf-DE".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-Latn-DE-1996". Expecting "de-Latn-DE-1996".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "de-CH". Expecting "de-CH".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "it-CH". Expecting "it-CH".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "fr-CH". Expecting "fr-CH".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "rm-CH". Expecting "rm-CH".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "es-CH". Expecting "es-CH".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "Latn-de". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "Latf-de". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "tic-tac-tac-toe". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "cocoa-1-bar". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "cocoa-a-bar". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "en-". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "en--". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "foo--bar". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "id---Java". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "fr-x". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "fr-xenomorph". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "fr-x-xenomorph". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "a". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "a-fr-lang". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "b-fr-lang". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "es1-KK-aa-bb-cc-dd". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "es2-KL-aa-bb-cc-dd". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "es3-KM-aa-bb-cc-dd". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "fooÉ". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "foöÉ-bÁr". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Roundtripping lang "foöÉbÁr". Expecting "".]
|
||||
expected:
|
||||
if os == "android": NOTRUN
|
||||
FAIL
|
||||
expected: NOTRUN
|
||||
|
@ -1,3 +1,4 @@
|
||||
prefs: [notification.prompt.testing:true, marionette.setpermission.enabled:true]
|
||||
[getnotifications-across-processes.https.window.html]
|
||||
[Get notification created from window]
|
||||
expected:
|
||||
|
@ -1 +1 @@
|
||||
prefs: [marionette.setpermission.enabled:true, dom.screenwakelock.enabled:true]
|
||||
prefs: [marionette.setpermission.enabled:true, dom.screenwakelock.enabled:true, dom.screenwakelock.testing:true]
|
||||
|
@ -5,13 +5,13 @@
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/custom-data.js"></script>
|
||||
<script>
|
||||
const n = new Notification("Radio check",
|
||||
var n = new Notification("Radio check",
|
||||
{
|
||||
dir: "ltr",
|
||||
lang: "aa",
|
||||
body: "This is a radio check.",
|
||||
tag: "radio_check999",
|
||||
icon: `${location.origin}/icon.png`,
|
||||
icon: "http://example.com/icon.png",
|
||||
data: fakeCustomData,
|
||||
}
|
||||
)
|
||||
@ -37,22 +37,22 @@ test(function() {
|
||||
assert_true("onclose" in n)
|
||||
},"Attribute exists: onclose")
|
||||
test(function() {
|
||||
assert_equals(n.title, "Radio check")
|
||||
assert_equals("Radio check", n.title)
|
||||
},"Attribute exists with expected value: title")
|
||||
test(function() {
|
||||
assert_equals(n.dir, "ltr")
|
||||
assert_equals("ltr", n.dir)
|
||||
},"Attribute exists with expected value: dir")
|
||||
test(function() {
|
||||
assert_equals(n.lang, "aa")
|
||||
assert_equals("aa", n.lang)
|
||||
},"Attribute exists with expected value: lang")
|
||||
test(function() {
|
||||
assert_equals(n.body, "This is a radio check.")
|
||||
assert_equals("This is a radio check.", n.body)
|
||||
},"Attribute exists with expected value: body")
|
||||
test(function() {
|
||||
assert_equals(n.tag, "radio_check999")
|
||||
assert_equals("radio_check999", n.tag)
|
||||
},"Attribute exists with expected value: tag")
|
||||
test(function() {
|
||||
assert_equals(n.icon, `${location.origin}/icon.png`)
|
||||
assert_equals("http://example.com/icon.png", n.icon)
|
||||
},"Attribute exists with expected value: icon")
|
||||
test(function() {
|
||||
assert_custom_data(n.data);
|
||||
|
@ -4,9 +4,9 @@
|
||||
<link rel="author" title="Apple Inc." href="http://www.apple.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script>
|
||||
setup({ explicit_done: true });
|
||||
|
||||
/* Validity and well-formedness was determined by using the BCP 47
|
||||
Validator at http://schneegans.de/lv/ */
|
||||
|
||||
@ -29,22 +29,20 @@ var invalid_langs = ["en-", "en-\-", "foo-\-bar", "id-\-\-Java", "fr-x",
|
||||
"es2-KL-aa-bb-cc-dd", "es3-KM-aa-bb-cc-dd", "fooÉ",
|
||||
"foöÉ-bÁr", "foöÉbÁr"];
|
||||
|
||||
|
||||
promise_setup(() => {
|
||||
return test_driver.set_permission({ name: "notifications" }, "granted");
|
||||
});
|
||||
|
||||
function test_lang(language, should_passthrough) {
|
||||
var expected = should_passthrough ? language : "";
|
||||
promise_test(async () => {
|
||||
test(function() {
|
||||
if (Notification.permission != "granted") {
|
||||
this.force_timeout()
|
||||
this.set_status(this.NOTRUN, "You must allow notifications for this origin before running this test.")
|
||||
}
|
||||
var notification = new Notification("This is a notification.", {
|
||||
lang: language
|
||||
});
|
||||
// Make sure to await and close so that running this test
|
||||
// wouldn't leave any remaining notification tasks
|
||||
await new Promise(resolve => notification.onshow = resolve);
|
||||
notification.close();
|
||||
assert_equals(notification.lang, expected, "notification.lang");
|
||||
notification.onshow = function() {
|
||||
notification.close();
|
||||
};
|
||||
},
|
||||
"Roundtripping lang \"" + language + "\". Expecting \"" + expected + "\".");
|
||||
}
|
||||
@ -60,4 +58,6 @@ for (var i=0; i<well_formed_langs.length; i++) {
|
||||
for (var i=0; i<invalid_langs.length; i++) {
|
||||
test_lang(invalid_langs[i], false);
|
||||
}
|
||||
|
||||
done();
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user