Closed
Bug 368714
Opened 18 years ago
Closed 18 years ago
[FIX]Sandbox evaluation should handle branch callbacks
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
(Keywords: verified1.8.0.10, verified1.8.1.2)
Attachments
(2 files)
2.39 KB,
patch
|
jst
:
review+
jst
:
superreview+
dveditz
:
approval1.8.1.2+
dveditz
:
approval1.8.0.10+
|
Details | Diff | Splinter Review |
2.36 KB,
patch
|
Details | Diff | Splinter Review |
In particular, it should call the DOM branch callback if that's relevant, so that if the script hangs the user can interrupt it. See bug 368655 for a testcase.
![]() |
Assignee | |
Comment 1•18 years ago
|
||
Though if we're worried about someone unsetting the branch callback on the original cx from inside the sandbox, we could reget it on every branch or something...
Attachment #253351 -
Flags: superreview?(jst)
Attachment #253351 -
Flags: review?(jst)
Comment 2•18 years ago
|
||
Comment on attachment 253351 [details] [diff] [review]
Proposed fix
>+ // Now cache the original branch callback
>+ mOrigBranchCallback = JS_SetBranchCallback(aOuterCx, nsnull);
>+ JS_SetBranchCallback(aOuterCx, mOrigBranchCallback);
Sorry I didn't add a getter to the JS API.
>+JSBool JS_DLL_CALLBACK
>+ContextHolder::ContextHolderBranchCallback(JSContext *cx, JSScript *script)
>+{
>+ ContextHolder* thisObject =
>+ NS_STATIC_CAST(ContextHolder*, JS_GetContextPrivate(cx));
>+ NS_ASSERTION(thisObject, "How did that happen?");
>+
>+ if (thisObject->mOrigBranchCallback) {
>+ return (thisObject->mOrigBranchCallback)(thisObject->mOrigCx, script);
Nit: no need to parenthesize the callable expression. Very old C hackers remember when one had to not only parenthesize, but also put a * after the (, but those were the bad old days ;-).
/be
Updated•18 years ago
|
Attachment #253351 -
Flags: superreview?(jst)
Attachment #253351 -
Flags: superreview+
Attachment #253351 -
Flags: review?(jst)
Attachment #253351 -
Flags: review+
![]() |
Assignee | |
Comment 3•18 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
![]() |
Assignee | |
Comment 4•18 years ago
|
||
Comment on attachment 253351 [details] [diff] [review]
Proposed fix
I think we should consider this for branches as well...
Attachment #253351 -
Flags: approval1.8.1.2?
Attachment #253351 -
Flags: approval1.8.0.10?
Comment 5•18 years ago
|
||
Comment on attachment 253351 [details] [diff] [review]
Proposed fix
approved for 1.8/1.8.0 branches, a=dveditz for drivers
Attachment #253351 -
Flags: approval1.8.1.2?
Attachment #253351 -
Flags: approval1.8.1.2+
Attachment #253351 -
Flags: approval1.8.0.10?
Attachment #253351 -
Flags: approval1.8.0.10+
![]() |
Assignee | |
Comment 6•18 years ago
|
||
Comment 8•18 years ago
|
||
Verified on: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070206 BonEcho/2.0.0.2pre
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10pre) Gecko/20070206
Firefox/1.5.0.10pre
Using testcase url in bug 368655. Also tested on 1.8.1.2 in mac and linux.
You need to log in
before you can comment on or make changes to this bug.
Description
•