diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /testing/web-platform/tests/permissions-policy/resources/permissions-policy.js | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/permissions-policy/resources/permissions-policy.js')
-rw-r--r-- | testing/web-platform/tests/permissions-policy/resources/permissions-policy.js | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/testing/web-platform/tests/permissions-policy/resources/permissions-policy.js b/testing/web-platform/tests/permissions-policy/resources/permissions-policy.js index 32fb4cfd4a..d30d1191d1 100644 --- a/testing/web-platform/tests/permissions-policy/resources/permissions-policy.js +++ b/testing/web-platform/tests/permissions-policy/resources/permissions-policy.js @@ -6,8 +6,9 @@ function assert_permissions_policy_supported() { // Tests whether a feature that is enabled/disabled by permissions policy works // as expected. // Arguments: -// feature_description: a short string describing what feature is being -// tested. Examples: "usb.GetDevices()", "PaymentRequest()". +// feature_descriptionOrObject: either and object, containing the following +// properties, or a string describing what feature is being tested. +// Examples: "usb.GetDevices()", "PaymentRequest()". // test: test created by testharness. Examples: async_test, promise_test. // src: URL where a feature's availability is checked. Examples: // "/permissions-policy/resources/permissions-policy-payment.html", @@ -24,13 +25,36 @@ function assert_permissions_policy_supported() { // feature (https://w3c.github.io/webappsec-permissions-policy/#features). // See examples at: // https://github.com/w3c/webappsec-permissions-policy/blob/main/features.md -// allow_attribute: Optional argument, only used for testing fullscreen +// allowfullscreen: Optional argument, only used for testing fullscreen // by passing "allowfullscreen". // is_promise_test: Optional argument, true if this call should return a // promise. Used by test_feature_availability_with_post_message_result() function test_feature_availability( - feature_description, test, src, expect_feature_available, feature_name, - allow_attribute, is_promise_test = false) { + feature_descriptionOrObject, test, src, expect_feature_available, feature_name, + allowfullscreen, is_promise_test = false) { + + if (feature_descriptionOrObject && feature_descriptionOrObject instanceof Object) { + const { + feature_description, + test, + src, + expect_feature_available, + feature_name, + allowfullscreen, + is_promise_test, + } = feature_descriptionOrObject; + return test_feature_availability( + feature_description, + test, + src, + expect_feature_available, + feature_name, + allowfullscreen, + is_promise_test + ); + } + + const feature_description = feature_descriptionOrObject; let frame = document.createElement('iframe'); frame.src = src; @@ -38,8 +62,8 @@ function test_feature_availability( frame.allow = frame.allow.concat(";" + feature_name); } - if (typeof allow_attribute !== 'undefined') { - frame.setAttribute(allow_attribute, true); + if (typeof allowfullscreen !== 'undefined') { + frame.setAttribute(allowfullscreen, true); } function expectFeatureAvailable(evt) { |