TypeError: this.nodelist is null if WalkerActor.querySelectorAll is called with an invalid selector

RESOLVED FIXED in Firefox 33

Status

()

Firefox
Developer Tools: Inspector
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: Sami Jaktholm, Assigned: Sami Jaktholm)

Tracking

unspecified
Firefox 33
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
This seem to be caused by the fact that when WalkerActor.querySelectorAll is called with an invalid selector, NodeListActor is initialized with null nodelist and calling NodeListActor.form calls nodelist.length causing the error.

Steps to reproduce:
1. Open inspector.
2. Write 'div.' to the searchbox.
3. Following exception occurs.

TypeError: this.nodeList is null
Stack trace:
exports.NodeListActor<.form@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/inspector.js:677:1
types.addActorType/type<.write@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:272:9
RetVal<.write@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:472:5
Response<.write/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:607:9
Response<.write@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:605:5
actorProto/</handler/sendReturn@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:911:1
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/promise.js:118:11
then@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/promise.js:43:43
then@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/promise.js:153:9
actorProto/</handler/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:929:1
Actor<._queueResponse@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:827:1
actorProto/</handler@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:926:9
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1103:9
LDT_send/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/server/transport.js:258:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:80:7
(Assignee)

Comment 1

3 years ago
Created attachment 8453011 [details] [diff] [review]
fix-this-nodelist-is-null.patch

Here's a simple fix to the problem that treats null nodelist parameter as an empty list. It also contains an xpcshell-test to ensure no exception is triggered and the reported length is correct for null, empty and populated nodelists.

Try: https://tbpl.mozilla.org/?tree=Try&rev=fa89c6afcc9b
Assignee: nobody → sjakthol
Attachment #8453011 - Flags: review?(pbrosset)
Comment on attachment 8453011 [details] [diff] [review]
fix-this-nodelist-is-null.patch

Review of attachment 8453011 [details] [diff] [review]:
-----------------------------------------------------------------

Nice and simple. Nothing to comment about this.
Attachment #8453011 - Flags: review?(pbrosset) → review+
Keywords: checkin-needed
OS: Linux → All
Hardware: x86_64 → All
https://hg.mozilla.org/integration/fx-team/rev/6da650753652
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/6da650753652
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 33
You need to log in before you can comment on or make changes to this bug.