Automatic update from web-platform-tests Remove obsolete feature-policy sensor tests and rename to permissions-policy (#58469) * Remove obsolete feature-policy tests and rename to permissions-policy This PR cleans up remaining references to the deleted /feature-policy/ directory by: 1. Deleting obsolete sensor *-feature-policy* test files since their *-permissions-policy* equivalents already exist: - accelerometer/Accelerometer-*-by-feature-policy*.html (5 files + 3 headers) - gyroscope/Gyroscope-*-by-feature-policy*.html (5 files + 3 headers) - magnetometer/Magnetometer-*-by-feature-policy*.html (5 files + 3 headers) 2. Renaming generic-sensor-feature-policy-test.sub.js to generic-sensor-permissions-policy-test.sub.js and updating all imports 3. Updating generic-sensor-tests.js: - featurePolicyNames -> permissionsPolicyNames - Updated test description text 4. Updating generic-sensor-helpers.js: - featurePolicyNames -> permissionsPolicyNames 5. Updating all sensor-data.js files: - accelerometer/resources/sensor-data.js - ambient-light/resources/sensor-data.js - gyroscope/resources/sensor-data.js - magnetometer/resources/sensor-data.js - orientation-sensor/resources/sensor-data.js 6. Renaming client-hints files: - client-hints/accept-ch-stickiness/cross-origin-subresource-with-feature-policy.https.html -> cross-origin-subresource-with-permissions-policy.https.html (+ resources) - client-hints/accept-ch/feature-policy-navigation/ -> permissions-policy-navigation/ - client-hints/accept-ch/feature-policy.sub.https.html -> permissions-policy.sub.https.html 7. Renaming gamepad and permissions files: - gamepad/feature-policy-gamepad.html -> permissions-policy-gamepad.html - permissions/feature-policy-permissions-query.html -> permissions-policy-permissions-query.html - permissions/permissions-query-feature-policy-attribute.https.sub.html -> permissions-query-permissions-policy-attribute.https.sub.html 8. Deleting fenced-frame/client-hints-meta* files: These tests used <meta http-equiv="Feature-Policy"> which was deprecated. Permissions-Policy does NOT support http-equiv meta tags (only HTTP headers), so these tests cannot be migrated and are now obsolete. This follows up on PR #58327 which deleted the /feature-policy/ directory. * fixup -- wpt-commits: 0b8936dd0880c8251a4c247833327aaa6ae519de wpt-pr: 58469
76 lines
2.0 KiB
HTML
76 lines
2.0 KiB
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<title>Test permissions query againts feature policy allow attribute</title>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
"use strict";
|
|
|
|
function test_permissions_query(
|
|
feature_description, test, src, expect_state, allow_attribute) {
|
|
let frame = document.createElement('iframe');
|
|
frame.src = src;
|
|
|
|
if (typeof allow_attribute !== 'undefined') {
|
|
frame.allow = allow_attribute;
|
|
}
|
|
|
|
window.addEventListener('message', test.step_func(function handler(evt) {
|
|
if (evt.source === frame.contentWindow) {
|
|
assert_equals(evt.data.state, expect_state, feature_description);
|
|
document.body.removeChild(frame);
|
|
window.removeEventListener('message', handler);
|
|
test.done();
|
|
}
|
|
}));
|
|
|
|
document.body.appendChild(frame);
|
|
}
|
|
|
|
const same_origin_src =
|
|
"/permissions/permissions-policy-permissions-query.html";
|
|
const cross_origin_src =
|
|
"https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src;
|
|
|
|
async_test(t => {
|
|
test_permissions_query(
|
|
'navigator.permissions.query("geolocation")',
|
|
t,
|
|
same_origin_src,
|
|
"prompt",
|
|
"geolocation"
|
|
);
|
|
}, 'Permissions.state is "prompt" with allow="geolocation" in same-origin iframes.');
|
|
|
|
async_test(t => {
|
|
test_permissions_query(
|
|
'navigator.permissions.query("geolocation")',
|
|
t,
|
|
cross_origin_src,
|
|
"prompt",
|
|
"geolocation"
|
|
);
|
|
}, 'Permissions.state is "prompt" with allow="geolocation" in cross-origin iframes.');
|
|
|
|
async_test(t => {
|
|
test_permissions_query(
|
|
'navigator.permissions.query("geolocation")',
|
|
t,
|
|
same_origin_src,
|
|
"prompt"
|
|
);
|
|
}, 'Permission.state is "prompt" in same-origin iframes.');
|
|
|
|
async_test(t => {
|
|
test_permissions_query(
|
|
'navigator.permissions.query("geolocation")',
|
|
t,
|
|
cross_origin_src,
|
|
"denied"
|
|
);
|
|
}, 'Permission.state is "denied" in cross-origin iframes.');
|
|
|
|
</script>
|