Closed Bug 2073509 Opened 2 months ago Closed 2 months ago

[wpt-sync] Sync PR 62778 - [js-self-profiling] Filter stack frames on the script's muted errors

Categories

(Core :: DOM: Performance APIs, task, P4)

task

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 62778 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62778
Details from upstream follow.

Mike Taylor <miketaylr@chromium.org> wrote:

[js-self-profiling] Filter stack frames on the script's muted errors

ProfilerTraceBuilder::ShouldIncludeStackFrame() included a frame if
v8::CpuProfileNode::IsScriptSharedCrossOrigin() was true, or, as a
fallback, if the origin of GetScriptResourceNameStr() was same-origin
with allowed_origin_. GetScriptResourceNameStr() holds the initial
pre-redirect request URL, so a classic script requested from a
same-origin URL that redirected to a cross-origin response without CORS
satisfied the fallback, exposing its function names and source locations
in the trace.

Drop the fallback and decide inclusion on IsScriptSharedCrossOrigin()
alone, which is the inverse of the script's muted-errors state. This
matches step 7 of the "get a frame ID" algorithm in the JS
Self-Profiling specification, and it derives from the response rather
than the request: true for same-origin classic scripts, CORS-enabled
cross-origin scripts, inline scripts, and module scripts, and false for
opaque no-cors responses no matter how the request got there. Traces no
longer describe scripts that already report "Script error." to
window.onerror.

Keep the guard that omits frames whose script has no parseable resource
name, such as eval() and new Function(). The specification includes
those frames, and they expose nothing opaque, as V8 propagates
is_shared_cross_origin to eval()ed scripts and defaults it to false for
entries that have no script. Including them would newly emit frames that
carry a line and column but no resource, which consumers have never
seen.

With the fallback gone, nothing needs the profiling context's origin.
Remove Profiler::source_origin_, Profiler::SourceOrigin(),
ProfilerTraceBuilder::allowed_origin_, and the GetSecurityOrigin() call
in ProfilerGroup::CreateProfiler(). Rename script_same_origin_cache_ to
script_inclusion_cache_, as it now caches the whole decision rather than
a same-origin check.

Add cross-origin-script-redirect-no-cors.sub.html, which fails before
this change and passes after it.

Bug: 511311494
Change-Id: If605837e57a7084729930d7acec982a28bd785eb
Reviewed-on: https://chromium-review.googlesource.com/8409345
WPT-Export-Revision: fc052b246eb56f5cadfa8d158fcaebf9317ebd11

Component: web-platform-tests → DOM: Performance APIs
Product: Testing → Core

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 26 tests

Status Summary

Firefox

TIMEOUT: 2

Chrome

OK : 1
FAIL : 1

Safari

TIMEOUT: 1
ERROR : 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c5ac69f0c59c https://hg.mozilla.org/integration/autoland/rev/d698ee7f7102 [wpt PR 62778] - [js-self-profiling] Filter stack frames on the script's muted errors, a=testonly
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
You need to log in before you can comment on or make changes to this bug.