Closed Bug 332514 Opened 18 years ago Closed 18 years ago

Passing null to Sandbox constructor crashes

Categories

(Core :: XPConnect, defect)

x86
Windows Server 2003
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: bugzilla-mozilla-20000923, Assigned: bugzilla-mozilla-20000923)

Details

(Keywords: crash)

Attachments

(2 files, 1 obsolete file)

The following JS code crashes on trunk (not checked branches):
  new Components.utils.Sandbox(null)
Attached file Stack at crash
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?
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
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+
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+
Checked in --> FIXED.

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

Attachment

General

Creator:
Created:
Updated:
Size: