Automatic update from web-platform-tests
Add js-profiling-mode enum Document Policy with eager/lazy V8 profiler initialization
Introduce a new `Document-Policy` feature named `js-profiling-mode` that accepts
enum values `eager` and `lazy`, allowing pages to defer V8 CPU profiler
initialization until the first `new Profiler()` call.
This is the first enum-type Document Policy feature in Chromium.
Changes:
- Add `kJSProfilingMode` mojom enum entry and JSON5 feature definition
- Extend Document Policy parser and serializer to handle enum (Token) values
- Add `GetDocumentPolicyValue()` to SecurityContext/ExecutionContext
- Implement lazy mode in ProfilerGroup: defers V8 profiler init to first use
- Gate behind `DocumentPolicyJSProfilingMode` runtime feature flag
- Maintain backward compatibility with existing `js-profiling` boolean policy
Bug: https://issues.chromium.org/issues/473861788
Change-Id: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7575656
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Michal Mocny <mmocny@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1658751}
--
wpt-commits: fe407963fa1a07a34dc55e6089ba9cd08a3803e8
wpt-pr: 60590
38 lines
1.3 KiB
HTML
38 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
// These tests verify that js-profiling-mode=eager is recognised as a valid
|
|
// enum value and that profiling is allowed. The observable JS behaviour is
|
|
// identical to lazy mode — the difference (V8 profiler initialised with
|
|
// eager JIT logging at context-add time rather than deferred) is internal
|
|
// and not detectable from the JS API.
|
|
promise_test(async t => {
|
|
const profiler = new Profiler({
|
|
sampleInterval: 10,
|
|
maxBufferSize: Number.MAX_SAFE_INTEGER,
|
|
});
|
|
assert_false(profiler.stopped, 'profiler should be running');
|
|
await profiler.stop();
|
|
}, 'js-profiling-mode=eager should allow profiling');
|
|
|
|
promise_test(async t => {
|
|
const profiler_a = new Profiler({
|
|
sampleInterval: 10,
|
|
maxBufferSize: Number.MAX_SAFE_INTEGER,
|
|
});
|
|
const profiler_b = new Profiler({
|
|
sampleInterval: 10,
|
|
maxBufferSize: Number.MAX_SAFE_INTEGER,
|
|
});
|
|
await profiler_b.stop();
|
|
await profiler_a.stop();
|
|
}, 'js-profiling-mode=eager should support concurrent profilers');
|
|
</script>
|
|
</body>
|
|
</html>
|