-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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}
- Loading branch information
1 parent
11051ca
commit 1333238
Showing
12 changed files
with
204 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// META: script=resources/user-timing-helper.js | ||
|
||
test(()=>{ | ||
const entry = new PerformanceMark("name"); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark"}); | ||
}, "Mark entry can be created by 'new PerformanceMark(string)'."); | ||
|
||
test(()=>{ | ||
const entry = new PerformanceMark("name", {}); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark"}); | ||
}, "Mark entry can be created by 'new PerformanceMark(string, {})'."); | ||
|
||
test(()=>{ | ||
const entry = new PerformanceMark("name", {startTime: 1}); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark", startTime: 1}); | ||
}, "Mark entry can be created by 'new PerformanceMark(string, {startTime})'."); | ||
|
||
test(()=>{ | ||
const entry = new PerformanceMark("name", {detail: {info: "abc"}}); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark", detail: {info: "abc"}}); | ||
}, "Mark entry can be created by 'new PerformanceMark(string, {detail})'."); | ||
|
||
test(()=>{ | ||
const entry = | ||
new PerformanceMark("name", {startTime: 1, detail: {info: "abc"}}); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark", startTime: 1, detail: {info: "abc"}}); | ||
}, "Mark entry can be created by " + | ||
"'new PerformanceMark(string, {startTime, detail})'."); | ||
|
||
test(()=>{ | ||
const entry = new PerformanceMark("name"); | ||
assert_true(entry instanceof PerformanceMark); | ||
checkEntry(entry, {name: "name", entryType: "mark"}); | ||
assert_equals(performance.getEntriesByName("name").length, 0); | ||
}, "Using new PerformanceMark() shouldn't add the entry to performance timeline."); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
test(function() { | ||
assert_throws(new TypeError(), function() { self.performance.mark("mark1", 123); }, "Number passed as a dict argument should cause type-error.") | ||
}, "Number should be rejected as the mark-options.") | ||
|
||
test(function() { | ||
assert_throws(new TypeError(), function() { self.performance.mark("mark1", NaN); }, "NaN passed as a dict argument should cause type-error.") | ||
}, "NaN should be rejected as the mark-options.") | ||
|
||
test(function() { | ||
assert_throws(new TypeError(), function() { self.performance.mark("mark1", Infinity); }, "Infinity passed as a dict argument should cause type-error.") | ||
}, "Infinity should be rejected as the mark-options.") | ||
|
||
test(function() { | ||
assert_throws(new TypeError(), function() { self.performance.mark("mark1", "string"); }, "String passed as a dict argument should cause type-error.") | ||
}, "String should be rejected as the mark-options.") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
async_test(function (t) { | ||
self.performance.clearMeasures(); | ||
const measure = self.performance.measure("measure1"); | ||
assert_true(measure instanceof PerformanceMeasure); | ||
t.done(); | ||
}, "L3: performance.measure(name) should return an entry."); | ||
|
||
async_test(function (t) { | ||
self.performance.clearMeasures(); | ||
const measure = self.performance.measure("measure2", | ||
{ startTime: 12, endTime:23 }); | ||
assert_true(measure instanceof PerformanceMeasure); | ||
t.done(); | ||
}, "L3: performance.measure(name, param1) should return an entry."); | ||
|
||
async_test(function (t) { | ||
self.performance.clearMeasures(); | ||
self.performance.mark("1"); | ||
self.performance.mark("2"); | ||
const measure = self.performance.measure("measure3", "1", "2"); | ||
assert_true(measure instanceof PerformanceMeasure); | ||
t.done(); | ||
}, "L3: performance.measure(name, param1, param2) should return an entry."); | ||
|
||
async_test(function (t) { | ||
self.performance.clearMarks(); | ||
const mark = self.performance.mark("mark1"); | ||
assert_true(mark instanceof PerformanceMark); | ||
t.done(); | ||
}, "L3: performance.mark(name) should return an entry."); | ||
|
||
async_test(function (t) { | ||
self.performance.clearMarks(); | ||
const mark = self.performance.mark("mark2", { startTime: 34 }); | ||
assert_true(mark instanceof PerformanceMark); | ||
t.done(); | ||
}, "L3: performance.mark(name, param) should return an entry."); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// META: script=resources/user-timing-helper.js | ||
|
||
function endTime(entry) { | ||
return entry.startTime + entry.duration; | ||
} | ||
|
||
test(function() { | ||
performance.clearMarks(); | ||
performance.clearMeasures(); | ||
const markEntry = performance.mark("mark", {startTime: 123}); | ||
const measureEntry = performance.measure("A", undefined, "mark"); | ||
assert_equals(measureEntry.startTime, 0); | ||
assert_equals(endTime(measureEntry), markEntry.startTime); | ||
}, "When the end mark is given and the start is unprovided, the end time of the measure entry should be the end mark's time, the start time should be 0."); | ||
|
||
test(function() { | ||
performance.clearMarks(); | ||
performance.clearMeasures(); | ||
const markEntry = performance.mark("mark", {startTime: 123}); | ||
const endMin = performance.now(); | ||
const measureEntry = performance.measure("A", "mark", undefined); | ||
const endMax = performance.now(); | ||
assert_equals(measureEntry.startTime, markEntry.startTime); | ||
assert_greater_than_equal(endTime(measureEntry), endMin); | ||
assert_greater_than_equal(endMax, endTime(measureEntry)); | ||
}, "When the start mark is given and the end is unprovided, the start time of the measure entry should be the start mark's time, the end should be now."); | ||
|
||
test(function() { | ||
performance.clearMarks(); | ||
performance.clearMeasures(); | ||
const markEntry = performance.mark("mark", {startTime: 123}); | ||
const measureEntry = performance.measure("A", "mark", "mark"); | ||
assert_equals(endTime(measureEntry), markEntry.startTime); | ||
assert_equals(measureEntry.startTime, markEntry.startTime); | ||
}, "When start and end mark are both given, the start time and end time of the measure entry should be the the marks' time, repectively"); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.