зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1710093 [wpt PR 28898] - Clean up resource-timing/resource_ignore_data_url.html, a=testonly
Automatic update from web-platform-tests Clean up resource-timing/resource_ignore_data_url.html Bug: 1171767 Change-Id: Ic3fc4c2bc1d7eb5e083e6e4213c36d08429a07ec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877956 Reviewed-by: Tom McKee <tommckee@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#880508} -- wpt-commits: e985799f913af8f2a12563876bc981161ed3a482 wpt-pr: 28898
This commit is contained in:
Родитель
c42887c7cf
Коммит
7ae1548dc6
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing ignores resources with data: URIs</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#resources-included-in-the-performanceresourcetiming-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/resource-loaders.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAOTm7AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="></img>
|
||||
<script>
|
||||
promise_test(async t => {
|
||||
const promise = new Promise(resolve => {
|
||||
new PerformanceObserver(t.step_func(list => {
|
||||
const entries = list.getEntries();
|
||||
const dataEntries = entries.filter(e => e.name.includes('data:'));
|
||||
assert_equals(dataEntries.length, 0, 'There must be no entry for `data: URL`.');
|
||||
const blueEntries = entries.filter(e => e.name.includes('blue.png'));
|
||||
if (blueEntries.length) {
|
||||
// We can finish the test once we see the entry with blue.png.
|
||||
resolve();
|
||||
}
|
||||
})).observe({entryTypes: ['resource']});
|
||||
});
|
||||
// Wait until the document is loaded.
|
||||
await new Promise(resolve => {
|
||||
window.addEventListener('load', resolve);
|
||||
});
|
||||
// Add the blue.png image after document is loaded to ensure we've received
|
||||
// all of the previous Resource Timing entries.
|
||||
load.image('blue.png');
|
||||
return promise;
|
||||
}, 'Resources with data: URIs must not be surfaced in Resource Timing');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing ignores requests for data: URIs</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/webperftestharness.js"></script>
|
||||
<script src="resources/webperftestharnessextension.js"></script>
|
||||
<script>
|
||||
let iframe;
|
||||
function setup_iframe() {
|
||||
const iframe_content = '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAOTm7AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="></img>';
|
||||
iframe = document.getElementById('frameContext');
|
||||
iframe.contentWindow.document.write(iframe_content);
|
||||
}
|
||||
function onload_test() {
|
||||
const context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
const entries = context.getEntriesByType('resource');
|
||||
test_true(entries.length == 0, "entries.length == 0");
|
||||
}
|
||||
window.setup_iframe = setup_iframe;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that resources with data: URIs aren't present in the Resource Timing buffer.</p>
|
||||
<div id="log"></div>
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/inject_resource_test.html"></iframe>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче