Automatic update from web-platform-tests [UserTimingL3] Fix crash: create mark in worker Currently, the renderer crashes when creating mark entry in worker. The crash is because PerformanceMark::Create() return nullptr without setting exception_state. The caller of the function assumes that no exception indicates the PerformanceMark entry exists. Thus, when the entry is visited, the crash occurs. There is another bug hidden in this issue. Currently, when window-performance is not found, Create() returns nullptr directly. It should instead also check whether worker-performance exist. This CL fix these issues. To verify the change, the CL also changes the related web tests from *.html to *.any.js, which enables these tests in worker's context. Bug: 981982 Change-Id: Ia20ce1c194e4db2810ff3f1c52070e5970951600 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696085 Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#676484} -- wpt-commits: 133323811602dd4ceced46f11aabb645a3582983 wpt-pr: 17773
40 lines
2.0 KiB
JavaScript
40 lines
2.0 KiB
JavaScript
// META: script=resources/user-timing-helper.js
|
|
|
|
async_test(function (t) {
|
|
let mark_entries = [];
|
|
const expected_entries =
|
|
[{ entryType: "mark", name: "mark1", detail: null},
|
|
{ entryType: "mark", name: "mark2", detail: null},
|
|
{ entryType: "mark", name: "mark3", detail: null},
|
|
{ entryType: "mark", name: "mark4", detail: null},
|
|
{ entryType: "mark", name: "mark5", detail: null},
|
|
{ entryType: "mark", name: "mark6", detail: {}},
|
|
{ entryType: "mark", name: "mark7", detail: {info: 'abc'}},
|
|
{ entryType: "mark", name: "mark8", detail: null, startTime: 234.56},
|
|
{ entryType: "mark", name: "mark9", detail: {count: 3}, startTime: 345.67}];
|
|
const observer = new PerformanceObserver(
|
|
t.step_func(function (entryList, obs) {
|
|
mark_entries =
|
|
mark_entries.concat(entryList.getEntries());
|
|
if (mark_entries.length >= expected_entries.length) {
|
|
checkEntries(mark_entries, expected_entries);
|
|
observer.disconnect();
|
|
t.done();
|
|
}
|
|
})
|
|
);
|
|
self.performance.clearMarks();
|
|
observer.observe({entryTypes: ["mark"]});
|
|
const returned_entries = [];
|
|
returned_entries.push(self.performance.mark("mark1"));
|
|
returned_entries.push(self.performance.mark("mark2", undefined));
|
|
returned_entries.push(self.performance.mark("mark3", null));
|
|
returned_entries.push(self.performance.mark("mark4", {}));
|
|
returned_entries.push(self.performance.mark("mark5", {detail: null}));
|
|
returned_entries.push(self.performance.mark("mark6", {detail: {}}));
|
|
returned_entries.push(self.performance.mark("mark7", {detail: {info: 'abc'}}));
|
|
returned_entries.push(self.performance.mark("mark8", {startTime: 234.56}));
|
|
returned_entries.push(self.performance.mark("mark9", {detail: {count: 3}, startTime: 345.67}));
|
|
checkEntries(returned_entries, expected_entries);
|
|
}, "mark entries' detail and startTime are customizable.");
|