Closed Bug 629822 Opened 14 years ago Closed 14 years ago

GatherAndConvertResults passes wrong scope to NativeData2JS

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 627954

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(1 file)

Currently GatherAndConvertResults passes mCurrentJSObject as the scope to NativeData2JS which may be in a different compartment than the caller, in whose compartment NativeData2JS is creating the return value. It seems like the fix is to hoist/reuse (and rename) ComputeWrapperInfo. Steve Fink is able to reproduce a crash with Firebug.
STR: 1. Install Firebug1.7 (version probably doesn't matter) 2. Open up any page 3. Start Firebug by clicking on the bug icon in the bottom right corner 4. Click on the 'Console' tab 5. At the command line (bottom; prefixed with '>>>'), enter 'Firebug' and press enter 6. Repeat step 5. It will first say 'Firebug is undefined' (step 5), then it will crash with a compartment mismatch (step 6).
Blocks: 630471
I'm going to base this on top of the patches in bug 627954.
Depends on: 627954
Hah, wow, the sanity asserts I added in the patches in bug 627954 hit just starting a browser with Firebug enabled! #2 PR_Assert("!scope || scope->compartment() == GetJSContext()->compartment") #3 XPCConvert::NativeData2JS #4 XPCConvert::NativeData2JS #5 CallMethodHelper::GatherAndConvertResults #6 CallMethodHelper::Call #7 XPCWrappedNative::CallMethod #8 XPCWrappedNative::GetAttribute #9 XPC_WN_GetterSetter ...
Oh, nevermind, this is not related to Firebug, since the patches used to be green, the assert must have come in with a recent pull --rebase. However, if these asserts are fixed, then this bug should be resolved (its the same issue: mCurrentJSObject is in a different compartment than cx and mCurrentJSObject is being passed as the 'scope' to NativeData*.
If anyone else is hitting this, here's a temporary workaround to allow things to proceed. Just in case, NOTE: THIS IS NOT A FIX. Asa or whoever, do not add [has patch] to the whiteboard solely for this patch.
The crash with STR in comment 1 are fixed by the WIP patch in bug 627954.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: