Netmonitor JS stack traces shouldn't include chrome frames

NEW
Unassigned

Status

P3
normal
2 years ago
4 months ago

People

(Reporter: jsnajdr, Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
Dependency tree / graph

Firefox Tracking Flags

(firefox50 affected)

Details

(Reporter)

Description

2 years ago
Requests JS stack traces in Netmonitor sometimes show chrome:// stack frames. This is confusing for users - they should only see the JS code from the page content.

The chrome:// frames should be shown only in browser toolbox.

Two examples of this behavior:

1) When the page is reloaded, the main document request shows stack trace from the browser calling into webNav.reload at chrome://browser/content/tab-content.js:73

2) When issuing a request from the console (i.e., type "fetch('x')"), the request stack trace contains frames like:

WCA_evalWithDebugger resource://devtools/server/actors/webconsole.js:1299
(Reporter)

Comment 1

2 years ago
One way how to implement this: when calling "components.stack", it eventually calls GetFirstSubsumedFrame at [1], which filters the frames by the current JSContext's principal. When called from network-monitor.js (at [2]), it's the system principal. It would help if we could somehow pass the content principal there instead.

Nick, do you have any advice?

[1] https://dxr.mozilla.org/mozilla-central/source/js/src/vm/SavedStacks.cpp#556
[2] https://dxr.mozilla.org/mozilla-central/source/devtools/shared/webconsole/network-monitor.js#220
Blocks: 1134073
Flags: needinfo?(nfitzgerald)
https://github.com/fitzgen/gecko-dev/blob/master/js/src/doc/SavedFrame/SavedFrame.md has the documentation you're looking for.

Basically, Cu.waiveXrays(stack) will give you the content's view of the stack.
Flags: needinfo?(nfitzgerald)
(Reporter)

Updated

2 years ago
Assignee: nobody → jsnajdr
Priority: -- → P1
Blocks: 1230922
Priority: P1 → P3
Assignee: jsnajdr → nobody

Updated

4 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.