Passing null to Sandbox constructor crashes

RESOLVED FIXED

Status

()

Core
XPConnect
--
critical
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: James Ross, Assigned: James Ross)

Tracking

({crash})

Trunk
x86
Windows Server 2003
crash
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

12 years ago
The following JS code crashes on trunk (not checked branches):
  new Components.utils.Sandbox(null)
(Assignee)

Comment 1

12 years ago
Created attachment 216974 [details]
Stack at crash
(Assignee)

Comment 2

12 years ago
Created attachment 216975 [details] [diff] [review]
Don't try and use null as an object

With this patch, the same code produces the following exception:

JavaScript error: , line 0: uncaught exception: [Exception... "Illegal value"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: javascript: new Components.utils.Sandbox(null) :: <TOP_LEVEL> :: line 1"  data: no]
Assignee: dbradley → silver
Status: NEW → ASSIGNED
Attachment #216975 - Flags: review?
(Assignee)

Updated

12 years ago
Attachment #216975 - Flags: review? → review?(brendan)
Comment on attachment 216975 [details] [diff] [review]
Don't try and use null as an object

Use !JSVAL_IS_PRIMITIVE(argv[0]) instead of that && expression, and r=me.

/be
(Assignee)

Comment 4

12 years ago
Created attachment 216981 [details] [diff] [review]
Use JSVAL_IS_PRIMITIVE instead
Attachment #216975 - Attachment is obsolete: true
Attachment #216981 - Flags: review?(brendan)
Attachment #216975 - Flags: review?(brendan)
Comment on attachment 216981 [details] [diff] [review]
Use JSVAL_IS_PRIMITIVE instead

Thanks, r=me.

/be
Attachment #216981 - Flags: review?(brendan) → review+
(Assignee)

Updated

12 years ago
Attachment #216981 - Flags: superreview?(jst)
Comment on attachment 216981 [details] [diff] [review]
Use JSVAL_IS_PRIMITIVE instead

sr=jst
Attachment #216981 - Flags: superreview?(jst) → superreview+
(Assignee)

Comment 7

12 years ago
Checked in --> FIXED.

Might be good to stick onto the 1.8 branch too; who should approve that?
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.