mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1622819 [wpt PR 22277] - Migrate LayoutAnimations from feature policy to document policy, a=testonly
Automatic update from web-platform-tests Migrate LayoutAnimations from feature policy to document policy This CL migrates LayoutAnimations from feature policy to document policy. Following web tests are being migrated: - external/wpt/feature-policy/experimental-features/layout-animations-disabled-tentative.html - external/wpt/feature-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html - external/wpt/feature-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html - external/wpt/feature-policy/experimental-features/layout-animations-enabled-tentative.html - http/tests/feature-policy/layout-animations-disabled-by-policy.php Bug: 993790, 998694 Change-Id: I8244c0b997ed9a8f66290bdd8af93b6e40f21e00 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102768 Reviewed-by: Robert Sesek <rsesek@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Ian Clelland <iclelland@chromium.org> Commit-Queue: Charlie Hu <chenleihu@google.com> Cr-Commit-Position: refs/heads/master@{#756726} -- wpt-commits: 6bb87e50ba41b8bc35156ee86c74dc8a99f1fece wpt-pr: 22277 --HG-- rename : testing/web-platform/tests/feature-policy/experimental-features/layout-animations-disabled-tentative.html => testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html rename : testing/web-platform/tests/feature-policy/experimental-features/layout-animations-enabled-tentative.html => testing/web-platform/tests/document-policy/experimental-features/layout-animations-enabled-tentative.html rename : testing/web-platform/tests/feature-policy/experimental-features/resources/animation-property-height.js => testing/web-platform/tests/document-policy/experimental-features/resources/animation-property-height.js
This commit is contained in:
parent
29bbf326cf
commit
b95e0bbc80
@ -0,0 +1 @@
|
||||
Document-Policy: no-layout-animations
|
@ -1,24 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/feature-policy/experimental-features/resources/common.js"></script>
|
||||
<script src="/document-policy/experimental-features/resources/common.js"></script>
|
||||
<title> 'layout-animations' Policy : violation reports from javascript
|
||||
</title>
|
||||
<body>
|
||||
<script>
|
||||
test(() => {
|
||||
document.featurePolicy.allowedFeatures().forEach((enabled_feature) => {
|
||||
assert_not_equals(enabled_feature, "layout-animations");
|
||||
});
|
||||
},
|
||||
"Verify 'layout-animations' is not in document's feature list.");
|
||||
|
||||
promise_test(async () => {
|
||||
let promise = wait_for_violation_in_file(
|
||||
"layout-animations",
|
||||
"animation-property-height.js");
|
||||
let script = document.createElement("script");
|
||||
script.src = "/feature-policy/experimental-features/resources/" +
|
||||
script.src = "/document-policy/experimental-features/resources/" +
|
||||
"animation-property-height.js";
|
||||
document.body.appendChild(script);
|
||||
await promise;
|
@ -0,0 +1 @@
|
||||
Document-Policy: no-layout-animations
|
@ -1,18 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/feature-policy/experimental-features/resources/common.js"></script>
|
||||
<script src="/document-policy/experimental-features/resources/common.js"></script>
|
||||
<title> 'layout-animations' Policy : violation reports from CSS keyframes
|
||||
</title>
|
||||
<body>
|
||||
<script>
|
||||
test(() => {
|
||||
document.featurePolicy.allowedFeatures().forEach((enabled_feature) => {
|
||||
assert_not_equals(enabled_feature, "layout-animations");
|
||||
});
|
||||
},
|
||||
"Sanity-check: 'layout-animations' is not in document's feature list.");
|
||||
|
||||
promise_test(async () => {
|
||||
let promise = wait_for_violation_in_file(
|
||||
"layout-animations", null /* source not specified */);
|
@ -0,0 +1 @@
|
||||
Document-Policy: no-layout-animations
|
@ -0,0 +1,90 @@
|
||||
const url_base = "/document-policy/experimental-features/resources/";
|
||||
window.messageResponseCallback = null;
|
||||
|
||||
// Returns a promise which is resolved when the <iframe> is navigated to |url|
|
||||
// and "load" handler has been called.
|
||||
function loadUrlInIframe(iframe, url) {
|
||||
return new Promise((resolve) => {
|
||||
iframe.addEventListener("load", resolve);
|
||||
iframe.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
// Posts |message| to |target| and resolves the promise with the response coming
|
||||
// back from |target|.
|
||||
function sendMessageAndGetResponse(target, message) {
|
||||
return new Promise((resolve) => {
|
||||
window.messageResponseCallback = resolve;
|
||||
target.postMessage(message, "*");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function onMessage(e) {
|
||||
if (window.messageResponseCallback) {
|
||||
window.messageResponseCallback(e.data);
|
||||
window.messageResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("message", onMessage);
|
||||
|
||||
// Waits for |load_timeout| before resolving the promise. It will resolve the
|
||||
// promise sooner if a message event with |e.data.id| of |id| is received.
|
||||
// In such a case the response is the contents of the message |e.data.contents|.
|
||||
// Otherwise, returns false (when timeout occurs).
|
||||
function waitForMessageOrTimeout(t, id, load_timeout) {
|
||||
return new Promise((resolve) => {
|
||||
window.addEventListener(
|
||||
"message",
|
||||
(e) => {
|
||||
if (!e.data || e.data.id !== id)
|
||||
return;
|
||||
resolve(e.data.contents);
|
||||
}
|
||||
);
|
||||
t.step_timeout(() => { resolve(false); }, load_timeout);
|
||||
});
|
||||
}
|
||||
|
||||
function createIframe(container, attributes) {
|
||||
var new_iframe = document.createElement("iframe");
|
||||
for (attr_name in attributes)
|
||||
new_iframe.setAttribute(attr_name, attributes[attr_name]);
|
||||
container.appendChild(new_iframe);
|
||||
return new_iframe;
|
||||
}
|
||||
|
||||
// Returns a promise which is resolved when |load| event is dispatched for |e|.
|
||||
function wait_for_load(e) {
|
||||
return new Promise((resolve) => {
|
||||
e.addEventListener("load", resolve);
|
||||
});
|
||||
}
|
||||
|
||||
setup(() => {
|
||||
window.reporting_observer_instance = new ReportingObserver((reports, observer) => {
|
||||
if (window.reporting_observer_callback) {
|
||||
reports.forEach(window.reporting_observer_callback);
|
||||
}
|
||||
}, {types: ["document-policy-violation"]});
|
||||
window.reporting_observer_instance.observe();
|
||||
window.reporting_observer_callback = null;
|
||||
});
|
||||
|
||||
// Waits for a violation in |feature| and source file containing |file_name|.
|
||||
function wait_for_violation_in_file(feature, file_name) {
|
||||
return new Promise( (resolve) => {
|
||||
assert_equals(null, window.reporting_observer_callback);
|
||||
window.reporting_observer_callback = (report) => {
|
||||
var feature_match = (feature === report.body.featureId);
|
||||
var file_name_match =
|
||||
!file_name ||
|
||||
(report.body.sourceFile.indexOf(file_name) !== -1);
|
||||
if (feature_match && file_name_match) {
|
||||
window.reporting_observer_callback = null;
|
||||
resolve(report);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
@ -1 +0,0 @@
|
||||
Feature-Policy: layout-animations 'none'
|
@ -1 +0,0 @@
|
||||
Feature-Policy: layout-animations 'none'
|
@ -1 +0,0 @@
|
||||
Feature-Policy: layout-animations 'none'
|
Loading…
Reference in New Issue
Block a user