Closed Bug 1710909 Opened 2 years ago Closed 2 years ago

DevTools in DevEdition crashed unexpectedly

Categories

(DevTools :: Netmonitor, defect, P3)

Firefox 89
x86_64
Windows 10
defect

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: alex_mayorga, Assigned: claubatista)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug)

User Story

See comment #6 for all details

Attachments

(2 files)

TypeError: can't access property "value", requestHeaders.headers.find(...) is undefined
in TreeView
in div
in div
in PropertiesView
in VisibilityHandler
in Unknown
in Connect(Component)
in bound createElement
in div
in li
in ul
in Accordion
in div
in div
in HeadersPanel
in VisibilityHandler
in Unknown
in Connect(Component)
in div
in Panel
in div
in div
in div
in Tabs
in Sidebar
in div
in Tabbar
in TabboxPanel
in div
in NetworkDetailsBar
in VisibilityHandler
in Unknown
in Connect(Component)
in div
in div
in SplitBox
in div
in MonitorPanel
in VisibilityHandler
in Unknown
in Connect(Component)
in div
in DropHarHandler
in AppErrorBoundary
in div
in App
in VisibilityHandler
in Unknown
in Connect(Component)
in Provider

The Network panel has crashed.
File Bug Report
TypeError: can't access property "value", requestHeaders.headers.find(...) is undefined
React Component Stack

componentStack

in TreeView

in div

in div

in PropertiesView

in VisibilityHandler

in Unknown

in Connect(Component)

in bound createElement

in div

in li

in ul

in Accordion

in div

in div

in HeadersPanel

in VisibilityHandler

in Unknown

in Connect(Component)

in div

in Panel

in div

in div

in div

in Tabs

in Sidebar

in div

in Tabbar

in TabboxPanel

in div

in NetworkDetailsBar

in VisibilityHandler

in Unknown

in Connect(Component)

in div

in div

in SplitBox

in div

in MonitorPanel

in VisibilityHandler

in Unknown

in Connect(Component)

in div

in DropHarHandler

in AppErrorBoundary

in div

in App

in VisibilityHandler

in Unknown

in Connect(Component)

in Provider
Stacktrace

renderRow@resource://devtools/client/netmonitor/src/components/request-details/HeadersPanel.js:358:38

renderRows/<@resource://devtools/client/shared/components/tree/TreeView.js:683:19

renderRows@resource://devtools/client/shared/components/tree/TreeView.js:667:15

renderRows/<@resource://devtools/client/shared/components/tree/TreeView.js:687:34

renderRows@resource://devtools/client/shared/components/tree/TreeView.js:667:15

render@resource://devtools/client/shared/components/tree/TreeView.js:721:23

finishClassComponent@resource://devtools/client/shared/vendor/react-dom.js:10638:31

updateClassComponent@resource://devtools/client/shared/vendor/react-dom.js:10601:44

beginWork@resource://devtools/client/shared/vendor/react-dom.js:11419:16

performUnitOfWork@resource://devtools/client/shared/vendor/react-dom.js:14702:12

workLoop@resource://devtools/client/shared/vendor/react-dom.js:14720:24

renderRoot@resource://devtools/client/shared/vendor/react-dom.js:14803:15

performWorkOnRoot@resource://devtools/client/shared/vendor/react-dom.js:15655:17

performWork@resource://devtools/client/shared/vendor/react-dom.js:15567:24

flushInteractiveUpdates$1@resource://devtools/client/shared/vendor/react-dom.js:15816:16

batchedUpdates@resource://devtools/client/shared/vendor/react-dom.js:1894:7

dispatchEvent@resource://devtools/client/shared/vendor/react-dom.js:4351:19

interactiveUpdates$1/<@resource://devtools/client/shared/vendor/react-dom.js:15803:14

unstable_runWithPriority@resource://devtools/client/shared/vendor/react.js:617:12

interactiveUpdates$1@resource://devtools/client/shared/vendor/react-dom.js:15802:12

interactiveUpdates@resource://devtools/client/shared/vendor/react-dom.js:1901:10

dispatchInteractiveEvent@resource://devtools/client/shared/vendor/react-dom.js:4328:21

Close and reopen the toolbox to clear this error.

Error while processing HAR file: can't access property "pageTimings", pages.get(...) is undefined

This is triggered when trying to see the raw headers of one requests in a HAR file.

I don't believe I can share the HAR file publicly unfortunately.

Thanks for the report!

The stack trace (comment #0, comment #1) points to this line:
https://searchfox.org/mozilla-central/rev/2bc4e5cdf669cc9de3ed98e38be3e50a27b25332/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js#358

It looks like there is no "Host" request header (the array of request headers could be empty from some reason)

The comment #2 is generated when HAR file is being parsed:
https://searchfox.org/mozilla-central/rev/2bc4e5cdf669cc9de3ed98e38be3e50a27b25332/devtools/client/netmonitor/src/har/har-menu-utils.js#79
I guess the HAR is wrongly generated since the state of the Network panel is wrong (consequence of the bug above)

Any chance to get a test case we could use to see the problem on our machines?

Honza

Flags: needinfo?(alex_mayorga)

¡Hola Jan!

I've sent you a test case via e-mail.

¡Gracias!
Alex

Flags: needinfo?(alex_mayorga)
Attached file test.har

Thank you for the HAR file Alex. I was able to reproduce the bug on my machine.

I am attaching my own HAR file to make it possible to reproduce the bug for others.

I am marking this as good first bug and here are some information about how to fix it.

STR:

  1. Open DevTools Toolbox and select the Network panel
  2. Remove all requests in the panel and drop the attached HAR File
  3. Select the only request in the panel
  4. Go to the Headers panel and show "Raw" headers for Request headers
  5. The pane should crash

Note that there is also an error in the Console panel saying:
Error while processing HAR file: can't access property "pageTimings", pages.get(...) is undefined

Both problems should be fixed in this bug

#1) Raw headers
The problem is that "Host" request header isn't in the HAR file

There are two places in the code where we are expecting the "Host" header to exist

https://searchfox.org/mozilla-central/search?q=requestHeaders.headers.find%28ele+%3D%3E+ele.name+%3D%3D%3D+%22Host%22%29.value&path=

In this case:
https://searchfox.org/mozilla-central/rev/5359952d8b0be3e706e8c943c2bef2674723b8a9/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js#193

We need to return empty "" result from the getHeadersTitle if Host isn't available

In this case:
https://searchfox.org/mozilla-central/rev/5359952d8b0be3e706e8c943c2bef2674723b8a9/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js#358

We need to replace the host name by <unknown> and generate e.g. this string for the raw headers text area GET <unknown> HTTP/1.1 string

#2) Page Timings
The problem is that pages array in the HAR file doesn't contain specific page_id used by an entry (request) in the HAR file

The related code:
https://searchfox.org/mozilla-central/rev/5359952d8b0be3e706e8c943c2bef2674723b8a9/devtools/client/netmonitor/src/har/har-importer.js#136-138

pageTimings might be undefined and so, we need to secure such case and avoid NPE.

Doing something as follows should help:

const pageTimings = pages.get(entry.pageref)?.pageTimings;
let onContentLoad = pageTimings && pageTimings.onContentLoad || 0;
let onLoad = pageTimings && pageTimings.onLoad || 0;

Honza

Severity: -- → S4
Has STR: --- → yes
Priority: -- → P3
User Story: (updated)

Hi [:Honza], I'd like to work on this bug. :)
I was able to reproduce the crash.

Flags: needinfo?(odvarko)

Assigned to you. Go for it.

Thanks

Assignee: nobody → contatodaclau
Flags: needinfo?(odvarko)
Attachment #9225901 - Attachment description: Bug 1710909 - [devTools] Do not crash when the Host Header is not there. r=Honza → Bug 1710909 - [devtools] Do not crash when the Host Header is not there. r=Honza
Pushed by jodvarko@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/45bd7bb1b10b
[devtools] Do not crash when the Host Header is not there. r=Honza
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.