Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Fix the Context::Scope compartment leaving bug #174

Closed
ehsan opened this issue Jul 22, 2016 · 1 comment
Closed

Fix the Context::Scope compartment leaving bug #174

ehsan opened this issue Jul 22, 2016 · 1 comment
Assignees

Comments

@ehsan
Copy link
Contributor

ehsan commented Jul 22, 2016

There is a bug in the current Context::Scope based compartment restoration when a Scope object goes away. Consider 3 compartments, 1, 2, 3.

  • Function A uses Context::Scope to enter compartment 1.
  • A calls B.
  • B uses AutoJSAPI to enter compartment 2.
  • B calls C.
  • C uses ContextScope to enter compartment 3.

Currently when C returns, the AutoJSAPI on the stack is invisible to us, so we mistakenly restore the current compartment to 1 instead of 2. Any code running in B before it returns will now be in an incorrect compartment.

@ehsan ehsan self-assigned this Jul 22, 2016
ehsan added a commit that referenced this issue Sep 29, 2016
This reverts commit fa48fdf.

This was actually breaking SpiderShim.TryCatchMixedNesting.  The
scenario described in #174
was happening in that test.

This commit was violating the contract of the JS_Enter/LeaveCompartment
APIs in that it was breaking the tree order of the calls.  If we need
this for some reason, then we need to find an alternative solution.
@ehsan ehsan mentioned this issue Sep 29, 2016
@ehsan
Copy link
Contributor Author

ehsan commented Sep 29, 2016

Fixed in bbf340b.

@ehsan ehsan closed this as completed Sep 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant