Netmonitor JS stack traces shouldn't include chrome frames
Categories
(DevTools :: Netmonitor, defect, P2)
Tracking
(firefox50 affected)
Tracking | Status | |
---|---|---|
firefox50 | --- | affected |
People
(Reporter: jsnajdr, Assigned: rizwansyed876)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug)
Attachments
(1 file)
Reporter | ||
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
Reporter | ||
Updated•9 years ago
|
Updated•9 years ago
|
Updated•9 years ago
|
Comment hidden (obsolete) |
Updated•8 years ago
|
Updated•8 years ago
|
Updated•7 years ago
|
Comment 4•6 years ago
|
||
This seems to be fixed, probably by bug 1392411. Re-open if chrome stacks still appear.
Comment 5•6 years ago
•
|
||
Sorry, not fixed yet!
STR:
- Open the Network panel on this page
- Reload the page
- Click the request for the document
- Switch to the Stack Trace tab
You'll see something like this:
receiveMessage/< resource:///actors/BrowserTabChild.jsm:98:26
wrapHandlingUserInput resource://gre/modules/E10SUtils.jsm:837:7
receiveMessage resource:///actors/BrowserTabChild.jsm:95:21
I've tested this in Nightly 72.0a1 (2019-11-04).
In the case of a user initiated request or one only containing stack frames of chrome scripts, I would expect the Stack Trace tab not to be displayed at all.
Having said that, in the Browser Toolbox this info might still be useful.
Sebastian
Comment 6•6 years ago
|
||
I can reproduce the problem on my machine too (Win10, Nightly).
@Brian, could you please look at this.
Thanks,
Honza
Updated•5 years ago
|
Comment 7•5 years ago
|
||
Honza, Initiator column will put this front and center. For the non-browser-toolbox case, could we test if a stack looks internal and discard it if it does?
Comment 8•5 years ago
|
||
I am no longer able to reproduce the problem using STR from comment #5 (there is no Stack Trace tab).
Sebastian, can you?
Honza
Comment 9•5 years ago
|
||
Still occurs for me.
Load https://platform-status.mozilla.org/
. For https://platform-status.mozilla.org/images/favicon.ico
I get:
load
resource:///modules/FaviconLoader.jsm:165:20
load
resource:///modules/FaviconLoader.jsm:557:70
loadIcons
resource:///modules/FaviconLoader.jsm:633:26
onPageShow
resource:///modules/FaviconLoader.jsm:670:12
onHeadParsed
resource:///actors/LinkHandlerChild.jsm:60:24
handleEvent
resource:///actors/LinkHandlerChild.jsm:175:21
Comment 10•5 years ago
|
||
For reference, the Stack Trace tab is not shown for the main document request anymore since bug 1595637 got fixed (according to moz-regression).
But, as Harald already pointed out, the issue can still be reproduced on other requests.
In the case of a user initiated request or one only containing stack frames of chrome scripts, I would expect the Stack Trace tab not to be displayed at all.
Having said that, in the Browser Toolbox this info might still be useful.
Actually, I believe displaying chrome frames should depend on the option Show Gecko platform data, which obviously got introduced for the JS Profiler, though also fits for this case, in my opinion.
Sebastian
Comment 11•5 years ago
•
|
||
Thanks!
Some pointers to the code base:
-
The Stack Trace panel is rendered here:
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/devtools/client/netmonitor/src/components/StackTracePanel.js#67 -
It's using
StackTrace
component that is implemented here
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/devtools/client/shared/components/StackTrace.js#37 -
The stack-trace is collected on the backend here
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/devtools/server/actors/network-monitor/stack-trace-collector.js#114 -
We could peel off the chrome frame on the backend to safe a bit on RDP traffic but, also depends whether we want to support that
Show Gecko platform data
pref.
Here is an existing helper implemented for the Console panel. It isn't handling all of the chrome frames but, could be adapted:
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/devtools/server/actors/webconsole/utils.js#173-214
@Nicolas: can you provide some info about how the helper could be improved?
Honza
Updated•5 years ago
|
Comment 12•5 years ago
|
||
I think we could have another helper, which would do a similar job, but that would filter out all the frames that starts with resource://
or chrome://
? (maybe we should be more thoughtful on this for webextension? not sure
Comment 14•5 years ago
|
||
Should the helper function be implemented in the StackTrace
class or in StackTraceCollector
itself?
Comment 15•5 years ago
|
||
We should peel off the chrome frames directly in the StackTraceCollector
(and send to the client only what's needed) but, want tot keep these frames within the Browser Toolbox Network panel. Nicolas, do we have a way to check out whether the Network panel (and it's backend) is instantiated in the regular or Browser Toolbox?
Honza
Comment 16•5 years ago
|
||
Is someone working on this bug? I want to try it
Comment 17•5 years ago
|
||
Assigned to you, thanks for the help!
Honza
Comment 18•5 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #15)
We should peel off the chrome frames directly in the
StackTraceCollector
(and send to the client only what's needed) but, want tot keep these frames within the Browser Toolbox Network panel. Nicolas, do we have a way to check out whether the Network panel (and it's backend) is instantiated in the regular or Browser Toolbox?
We have this function on the toolbox devtools/client/framework/toolbox.js#606-608
Comment 19•5 years ago
|
||
Hi Maria, are you still interested in fixing this bug?
Is there anything we can help with?
Honza
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
See also bug 1640371, should we fix both by one patch?
Honza
Comment 24•5 years ago
|
||
Another nice test case that shows the problem if HTTP request for fav-icon. It's done by the browser (not by the page) and the stack trace points to resource://
modules.
Honza
Comment 25•4 years ago
|
||
This good-first-bug hasn't had any activity for 6 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Assignee | ||
Comment 26•4 days ago
|
||
Hi, I can reproduce this problem when looking at the stack trace of an HTTP request to https://www.google.com/favicon.ico .
My User-Agent when reproducing this bug is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Can you assign this bug to me please?
Assignee | ||
Comment 27•3 days ago
|
||
Hi, I've started looking in to this. I can't find an identifier called StackTraceCollector
in the codebase (as per comment #15).
I can see how this helper could be repurposed to filter out the frames that start with resource://
, chrome://
and webextension://
(should we filter out webextension://
too?) , and am trying to figure out how to ensure that it does so for the Network panel in the regular browser, but not in the Browser Toolbox.
Do I need to find the StackTraceCollector
identifier and then peel the chrome frames directly in StackTraceCollector
(as per comment #15)?
I think the codebase has changed significantly since the above comments were posted, so this insight might now be out of date.
Thanks
Comment 28•2 days ago
•
|
||
Thanks Riz for the interest in working on this.
I'll assign to you.
The stacktraces are created and sent for network panel in https://searchfox.org/mozilla-central/rev/578d9c83f046d8c361ac6b98b297c27990d468fd/devtools/server/actors/resources/network-events-stacktraces.js#192-199. I think you might be able to filter out the chrome requests before this.onStackTraceAvailable
is called.
For distinguishing the browser toolbox you could probably use this.watcherActor.sessionContext.type == "all"
as in https://searchfox.org/mozilla-central/rev/578d9c83f046d8c361ac6b98b297c27990d468fd/devtools/server/actors/resources/network-events.js#255
Hope this helps!
Assignee | ||
Comment 29•2 days ago
|
||
Thank you Hubert
Assignee | ||
Comment 30•2 days ago
|
||
Hi Hubert, I added a console.log()
statement to the first line of this method for my testing and local development, and it is barely ever invoked when I run my test case in the Nightly browser. My test case for this patch is to navigate to google.com and then look at the stacktrace of the favicon request in the Network tab of the browser inspector.
But despite the chrome frames always appearing in the stacktrace of the request, in the Network tab (and so the stacktrace always being generated), the console.log('stacktrace: ', stacktrace);
call that I added, on the first line of _setStackTrace()
, isn't always invoked when I navigate to google.com. In fact it is hardly ever invoked.
I could be missing something here about when/how it is invoked, and if so then this is likely because I am new to the codebase.
For me to write a helper function that successfully filters out the chrome frames from the stacktrace, I need to verify that it works by logging output. And that doesn't seem to be possible because this method doesn't seem to be called.
Comment 31•2 days ago
|
||
(In reply to Riz from comment #30)
Hi Hubert, I added a
console.log()
statement to the first line of this method for my testing and local development, and it is barely ever invoked when I run my test case in the Nightly browser. My test case for this patch is to navigate to google.com and then look at the stacktrace of the favicon request in the Network tab of the browser inspector.But despite the chrome frames always appearing in the stacktrace of the request, in the Network tab (and so the stacktrace always being generated), the
console.log('stacktrace: ', stacktrace);
call that I added, on the first line of_setStackTrace()
, isn't always invoked when I navigate to google.com. In fact it is hardly ever invoked.I could be missing something here about when/how it is invoked, and if so then this is likely because I am new to the codebase.
For me to write a helper function that successfully filters out the chrome frames from the stacktrace, I need to verify that it works by logging output. And that doesn't seem to be possible because this method doesn't seem to be called.
console.log
won't work as this is devtools server code. Try using dump
instead like this dump("the msg to log \n")
. Also see https://searchfox.org/mozilla-central/search?q=dump%28&path=&case=false®exp=false
Assignee | ||
Comment 32•2 days ago
|
||
Hi, that doesn't work either. I can't see any output as a result of invoking dump()
on the first line of _setStackTrace.
I have recorded a demo and uploaded it to YouTube so you can take a look at the output in the console as I navigate to google.com in Nightly: https://www.youtube.com/watch?v=s7fd0_oaGgs
Comment 33•9 hours ago
|
||
(In reply to Riz from comment #32)
Hi, that doesn't work either. I can't see any output as a result of invoking
dump()
on the first line of _setStackTrace.I have recorded a demo and uploaded it to YouTube so you can take a look at the output in the console as I navigate to google.com in Nightly: https://www.youtube.com/watch?v=s7fd0_oaGgs
Thanks for the video.
That's odd! Did you build i.e ./mach build
after adding the dump
statement?
Assignee | ||
Comment 34•9 hours ago
|
||
Hi, I did build (i.e ./mach build
) after adding the dump statement, but didn't record myself doing so because I didn't want the video to be longer than it needed to be.
I can record the video again in doing so record the ./mach build
process in Powershell if you want.
Assignee | ||
Comment 35•9 hours ago
|
||
I can record the video again** and, in doing so,** record the ./mach build process in Powershell if you want. *
Description
•