Closed Bug 1874382 Opened 2 months ago Closed 1 month ago

Crash with "TypeError: selectedFrame is undefined"

Categories

(DevTools :: Debugger, defect)

Firefox 121
defect

Tracking

(firefox123 fixed)

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: 5i13ghzt462u, Assigned: bomsy)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

Steps to reproduce:

Access a simple website index.html, it was really a one-html-site only, with inline JS that creates/appends some DIVs to the HTML. Nothing more, very basic HTML.

And opened or had open the devtools -> Debugger.

Actual results:

TypeError: selectedFrame is undefined

React Component Stack

componentStack

in Connect(Scopes)

in div

in aside

in div

in Accordion

in div

in div

in div

in SecondaryPanes

in Connect(SecondaryPanes)

in div

in div

in SplitBox

in AppErrorBoundary

in div

in App

in Connect(App)

in Provider

in Provider


Stacktrace

mapStateToProps@resource://devtools/client/debugger/src/components/SecondaryPanes/Scopes.js:301:53

mapToPropsProxy@resource://devtools/client/shared/vendor/react-redux.js:1776:92

handleNewState@resource://devtools/client/shared/vendor/react-redux.js:1937:41

handleSubsequentCalls@resource://devtools/client/shared/vendor/react-redux.js:1954:30

pureFinalPropsSelector@resource://devtools/client/shared/vendor/react-redux.js:1959:32

runComponentSelector@resource://devtools/client/shared/vendor/react-redux.js:1233:39

componentWillReceiveProps@resource://devtools/client/shared/vendor/react-redux.js:1357:23

callComponentWillReceiveProps@resource://devtools/client/shared/vendor/react-dom.js:8303:14

updateClassInstance@resource://devtools/client/shared/vendor/react-dom.js:8482:36

updateClassComponent@resource://devtools/client/shared/vendor/react-dom.js:10599:20

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

performSyncWork@resource://devtools/client/shared/vendor/react-dom.js:15541:14

requestWork@resource://devtools/client/shared/vendor/react-dom.js:15410:5

scheduleWork@resource://devtools/client/shared/vendor/react-dom.js:15224:16

enqueueSetState@resource://devtools/client/shared/vendor/react-dom.js:8192:17

Component.prototype.setState@resource://devtools/client/shared/vendor/react.js:328:16

onStateChange@resource://devtools/client/shared/vendor/react-redux.js:1412:16

notify@resource://devtools/client/shared/vendor/react-redux.js:1159:21

notifyNestedSubs@resource://devtools/client/shared/vendor/react-redux.js:1198:20

onStateChange@resource://devtools/client/shared/vendor/react-redux.js:1409:16

dispatch@resource://devtools/client/shared/vendor/redux.js:265:7

waitUntilService/</<@resource://devtools/client/debugger/src/actions/utils/middleware/wait-service.js:71:24

promiseMiddleware/</<@resource://devtools/client/debugger/src/actions/utils/middleware/promise.js:39:14

context/</<@resource://devtools/client/debugger/src/actions/utils/middleware/context.js:85:12

thunk/</</<@resource://devtools/client/debugger/src/actions/utils/middleware/thunk.js:29:100

dispatch@resource://devtools/client/shared/vendor/redux.js:681:28

mapFrames/<@resource://devtools/client/debugger/src/actions/pause/mapFrames.js:149:13

Expected results:

No crash.

Bug 1533945 looks related, but is said to be fixed years ago.

Happened again on Bugzilla this time.

not sure what's happening, but we have this code where we have a guard on selectedFrame, but we're accessing it before...

https://searchfox.org/mozilla-central/rev/f465027ef4d334dbc9ad270718c8a5e8045e7a2b/devtools/client/debugger/src/components/SecondaryPanes/Scopes.js#350-351,355-357

const why = getPauseReason(state, selectedFrame.thread);
const expandedScopes = getLastExpandedScopes(state, selectedFrame.thread);
...
if (!selectedFrame) {
  return {};
}

so we might have reintroduced a bug (in Bug 1856270 I guess?)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #2)

not sure what's happening, but we have this code where we have a guard on selectedFrame, but we're accessing it before...

https://searchfox.org/mozilla-central/rev/f465027ef4d334dbc9ad270718c8a5e8045e7a2b/devtools/client/debugger/src/components/SecondaryPanes/Scopes.js#350-351,355-357

const why = getPauseReason(state, selectedFrame.thread);
const expandedScopes = getLastExpandedScopes(state, selectedFrame.thread);
...
if (!selectedFrame) {
  return {};
}

so we might have reintroduced a bug (in Bug 1856270 I guess?)

Yep looks like that was introduced by me...will open a patch to fix.

Assignee: nobody → hmanilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Duplicate of this bug: 1874640
Pushed by hmanilla@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/253b1ef032b4
[devtools] Make sure to check the selectedFrame before trying to call it r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
QA Whiteboard: [qa-123b-p2]
See Also: → 1877382

bomsy, could you request an uplift to beta?

Flags: needinfo?(hmanilla)
Duplicate of this bug: 1877382

Comment on attachment 9372788 [details]
Bug 1874382 - [devtools] Make sure to check the selectedFrame before trying to call it r=#devtools-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined: The devtools crashes for users.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It's a small javascript change to check a value exists before it is used.
  • String changes made/needed:
  • Is Android affected?: Unknown
Flags: needinfo?(hmanilla)
Attachment #9372788 - Flags: approval-mozilla-beta?

Comment on attachment 9372788 [details]
Bug 1874382 - [devtools] Make sure to check the selectedFrame before trying to call it r=#devtools-reviewers

The fix landed to mozilla-central during the 123 nightly cycle so it is already part of 123 beta, thanks!

Attachment #9372788 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Duplicate of this bug: 1878717
You need to log in before you can comment on or make changes to this bug.