Closed
Bug 323156
Opened 19 years ago
Closed 19 years ago
XPCDispConvert::JSArrayToCOMArray does not convert empty arrays correctly
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
People
(Reporter: gdavis, Assigned: gdavis)
Details
Attachments
(1 file)
1.06 KB,
patch
|
dbradley
:
review+
jst
:
superreview+
jst
:
approval-branch-1.8.1+
dveditz
:
approval1.8.0.2-
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
If a the JS array is empty, SafeArrayCreateVector() is not called. After the for loop that would call SafeArrayCreateVector() (if there were any elements in the array), the parray member of the returned VARIANT is blindly set to nsnull. When this VARIANT is passed into IDispatch::Invoke(), the COM framework throws an exception.
Reproducible: Always
Steps to Reproduce:
1. Create a COM component with a method that has a SAFEARRAY* parameter.
2. Create that component in JavaScript using GeckoActiveXObject.
3. Call the method on the component passing an empty JavaScript array as the parameter that's of type SAFEARRAY*.
Actual Results:
An exception is thrown.
Expected Results:
No exception should be thrown, but the empty array should be passed to the COM component's method.
When there are no elements in the array, SafeArrayCreateVector() should be called with a length of zero. The result of this call should be then placed in the parray member of the VARIANT struct that is returned.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #208273 -
Flags: superreview?(jst)
Attachment #208273 -
Flags: review?(dbradley)
Comment 2•19 years ago
|
||
Comment on attachment 208273 [details] [diff] [review]
Patch accounting for empty JS array
r=dbradley
Good catch.
Attachment #208273 -
Flags: review?(dbradley) → review+
Comment 3•19 years ago
|
||
Comment on attachment 208273 [details] [diff] [review]
Patch accounting for empty JS array
sr=jst
Attachment #208273 -
Flags: superreview?(jst) → superreview+
Updated•19 years ago
|
Assignee: dbradley → gdavis
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Assignee | ||
Updated•19 years ago
|
Attachment #208273 -
Flags: approval1.8.0.1?
Comment 4•19 years ago
|
||
gdavis: it is too late for 1.8.0.1. try 1.8.0.2 instead.
Assignee | ||
Updated•19 years ago
|
Attachment #208273 -
Flags: approval1.8.0.1? → approval1.8.0.2?
Comment 5•19 years ago
|
||
Fix checked in on the trunk. FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 6•19 years ago
|
||
Comment on attachment 208273 [details] [diff] [review]
Patch accounting for empty JS array
Maybe for 1.8 branch (Firefox 2), not 1.8.0.x
Attachment #208273 -
Flags: approval1.8.0.2?
Attachment #208273 -
Flags: approval1.8.0.2-
Attachment #208273 -
Flags: approval-branch-1.8.1?(jst)
Updated•19 years ago
|
Attachment #208273 -
Flags: approval-branch-1.8.1?(jst) → approval-branch-1.8.1+
You need to log in
before you can comment on or make changes to this bug.
Description
•