mirror of
https://github.com/servo/servo.git
synced 2025-08-28 08:38:20 +01:00
Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317
This commit is contained in:
parent
aa199307c8
commit
2b6f573eb5
3440 changed files with 109438 additions and 41750 deletions
|
@ -35,7 +35,7 @@
|
|||
assert_equals(attribution.containerId, 'child-iframe-id');
|
||||
assert_equals(attribution.containerName, 'child-iframe-name');
|
||||
assert_equals(attribution.containerSrc,
|
||||
'http://www1.web-platform.test:8000/longtask-timing/resources/subframe-with-longtask.html');
|
||||
'resources/subframe-with-longtask.html');
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
|
@ -44,10 +44,11 @@
|
|||
const iframe = document.createElement('iframe');
|
||||
iframe.id = 'child-iframe-id';
|
||||
iframe.name = 'child-iframe-name';
|
||||
// Simulate cross-origin by using sandbox.
|
||||
iframe.sandbox = "allow-scripts";
|
||||
document.body.appendChild(iframe);
|
||||
// TODO(panicker): simulate cross-origin instead
|
||||
iframe.src = 'http://www1.web-platform.test:8000/longtask-timing/resources/subframe-with-longtask.html';
|
||||
}, 'Performance longtask entries in child iframe are observable in parent.');
|
||||
iframe.src = 'resources/subframe-with-longtask.html';
|
||||
}, 'Performance longtask entries in cross-origin child iframe are observable in parent.');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -9,7 +9,12 @@
|
|||
<script>
|
||||
const t = async_test(t => {
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
assert_equals(e.data, 'longtask+same-origin-ancestor+script+++');
|
||||
assert_equals(e.data['entryType'], 'longtask');
|
||||
assert_equals(e.data['frame-attribution'], 'same-origin-ancestor');
|
||||
assert_equals(e.data['task-attribution'], 'script');
|
||||
assert_equals(e.data['containerId'], '');
|
||||
assert_equals(e.data['containerName'], '');
|
||||
assert_equals(e.data['containerSrc'], '');
|
||||
t.done();
|
||||
}));
|
||||
}, 'Performance longtask entries in parent are observable in child iframe.');
|
||||
|
|
|
@ -9,21 +9,28 @@
|
|||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
assert_equals(e.data, 'longtask+cross-origin-unreachable+script+++');
|
||||
assert_equals(e.data['entryType'], 'longtask');
|
||||
assert_equals(e.data['frame-attribution'], 'cross-origin-unreachable');
|
||||
assert_equals(e.data['task-attribution'], 'script');
|
||||
assert_equals(e.data['containerId'], '');
|
||||
assert_equals(e.data['containerName'], '');
|
||||
assert_equals(e.data['containerSrc'], '');
|
||||
t.done();
|
||||
}));
|
||||
}, 'Performance longtask entries in parent are observable in child iframe.');
|
||||
const observingFrame = document.createElement('iframe');
|
||||
observingFrame.id = 'observing-iframe-id';
|
||||
observingFrame.name = 'observing-iframe-name';
|
||||
document.body.appendChild(observingFrame);
|
||||
observingFrame.src = 'resources/subframe-observing-longtask.html'
|
||||
|
||||
/* Create a cross-origin iframe that generates a long task. */
|
||||
const longtaskFrame = document.createElement('iframe');
|
||||
longtaskFrame.id = 'longtask-iframe-id';
|
||||
longtaskFrame.name = 'longtask-iframe-name';
|
||||
// Simulate cross-origin by using sandbox.
|
||||
longtaskFrame.sandbox = "allow-scripts";
|
||||
document.body.appendChild(longtaskFrame);
|
||||
longtaskFrame.src = 'resources/subframe-with-longtask.html'
|
||||
}, 'Performance longtask entries from cross-origin iframe are observable in its sibling.');
|
||||
</script>
|
||||
|
||||
<iframe src="resources/subframe-observing-longtask.html"></iframe>
|
||||
|
||||
<script>
|
||||
/* Create a cross-origin iframe that generates a long task. */
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.id = 'child-iframe-id';
|
||||
iframe.name = 'child-iframe-name';
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = 'http://www1.web-platform.test:8000/longtask-timing/resources/subframe-with-longtask.html';
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -9,21 +9,25 @@
|
|||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
assert_equals(e.data, 'longtask+same-origin+script+child-iframe-id+' +
|
||||
'child-iframe-name+resources/subframe-with-longtask.html');
|
||||
assert_equals(e.data['entryType'], 'longtask');
|
||||
assert_equals(e.data['frame-attribution'], 'same-origin');
|
||||
assert_equals(e.data['task-attribution'], 'script');
|
||||
assert_equals(e.data['containerId'], 'longtask-iframe-id');
|
||||
assert_equals(e.data['containerName'], 'longtask-iframe-name');
|
||||
assert_equals(e.data['containerSrc'], 'resources/subframe-with-longtask.html');
|
||||
t.done();
|
||||
}));
|
||||
}, 'Performance longtask entries in parent are observable in child iframe.');
|
||||
</script>
|
||||
const observingFrame = document.createElement('iframe');
|
||||
observingFrame.id = 'observing-iframe-id';
|
||||
observingFrame.name = 'observing-iframe-name';
|
||||
document.body.appendChild(observingFrame);
|
||||
observingFrame.src = 'resources/subframe-observing-longtask.html'
|
||||
|
||||
<iframe src="resources/subframe-observing-longtask.html"></iframe>
|
||||
|
||||
<script>
|
||||
/* Create an iframe that generates a long task. */
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.id = 'child-iframe-id';
|
||||
iframe.name = 'child-iframe-name';
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = 'resources/subframe-with-longtask.html'
|
||||
const longtaskFrame = document.createElement('iframe');
|
||||
longtaskFrame.id = 'longtask-iframe-id';
|
||||
longtaskFrame.name = 'longtask-iframe-name';
|
||||
document.body.appendChild(longtaskFrame);
|
||||
longtaskFrame.src = 'resources/subframe-with-longtask.html'
|
||||
}, 'Performance longtask entries are observable in sibling iframe.');
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
const entries = entryList.getEntries();
|
||||
assert_greater_than_equal(entries.length, 1);
|
||||
const entry = entries[0];
|
||||
assert_equals(typeof(entry.toJSON), 'function');
|
||||
const entryJSON = entry.toJSON();
|
||||
assert_equals(typeof(entryJSON), 'object');
|
||||
// Check attributes inheritted from PerformanceEntry.
|
||||
const performanceEntryKeys = [
|
||||
'name',
|
||||
'entryType',
|
||||
'startTime',
|
||||
'duration'
|
||||
];
|
||||
for (const key of performanceEntryKeys) {
|
||||
assert_equals(entryJSON[key], entry[key],
|
||||
`entry.toJSON().${key} should match entry.${key}`);
|
||||
}
|
||||
|
||||
// Check PerformanceLongTaskTiming specific entries.
|
||||
assert_equals(typeof(entryJSON.attribution), 'object');
|
||||
const entryJsonAttribution = entryJSON.attribution[0];
|
||||
assert_equals(typeof(entryJsonAttribution), 'object');
|
||||
assert_equals(entryJSON.attribution.length, entry.attribution.length);
|
||||
|
||||
// Check TaskAttributionTiming toJSON.
|
||||
const entryAttribution = entry.attribution[0];
|
||||
assert_equals(typeof(entryAttribution.toJSON), 'function');
|
||||
const entryAttributionJSON = entryAttribution.toJSON();
|
||||
assert_equals(typeof(entryAttributionJSON), 'object');
|
||||
// Check TaskAttributionTiming attributes, from both:
|
||||
// 1) |entryJsonAttribution| from PerformanceLongTaskTiming.
|
||||
// 2) |entryAttributionJSON| from TaskAttributionTiming.
|
||||
const taskAttributionTimingKeys = [
|
||||
'name',
|
||||
'entryType',
|
||||
'startTime',
|
||||
'duration',
|
||||
'containerType',
|
||||
'containerSrc',
|
||||
'containerId',
|
||||
'containerName'
|
||||
];
|
||||
for (const key of taskAttributionTimingKeys) {
|
||||
assert_equals(entryAttributionJSON[key], entryAttribution[key],
|
||||
`attribution.toJSON().${key} should match attribution.${key}`);
|
||||
assert_equals(entryJsonAttribution[key], entryAttribution[key],
|
||||
`entry.toJSON().attribution[0].${key} should match attribution.${key}`);
|
||||
}
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ['longtask']});
|
||||
|
||||
// Trigger a long task.
|
||||
const begin = window.performance.now();
|
||||
while (window.performance.now() < begin + 51);
|
||||
}, 'Test toJSON() in PerformanceLongTaskTiming and TaskAttributionTiming');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -15,9 +15,14 @@
|
|||
return;
|
||||
// TODO(panicker): include containerType.
|
||||
const attribution = longtask.attribution[0];
|
||||
const entryContents = longtask.entryType + '+' + longtask.name + '+' +
|
||||
attribution.name + '+' + attribution.containerId + '+' +
|
||||
attribution.containerName + '+' + attribution.containerSrc;
|
||||
const entryContents = {
|
||||
'entryType': longtask.entryType,
|
||||
'frame-attribution': longtask.name,
|
||||
'task-attribution': attribution.name,
|
||||
'containerId': attribution.containerId,
|
||||
'containerName': attribution.containerName,
|
||||
'containerSrc': attribution.containerSrc
|
||||
};
|
||||
top.postMessage(entryContents, '*');
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue