Bug 580033 - JS_Save/RestoreFrameChain should update cx->compartment. r=gal,mrbkap.
☠☠ backed out by 8422935a2d91 ☠ ☠
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 14 Sep 2010 14:38:09 -0700
changeset 54153 84b4d4856e1eaab0ccc7ba6184a977ab44ef5ab5
parent 53865 708c6d2e33ee3e34e3d71c75be12c4624b32a53e
child 54154 35e5647f070a56000dc6b1c6835c4c843e966f6a
child 54155 8422935a2d917c8769c68fbff2a7443e286ae28e
push id15788
push userrsayre@mozilla.com
push dateThu, 16 Sep 2010 16:26:06 +0000
treeherdermozilla-central@f1f07a0a036b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal, mrbkap
bugs580033
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 580033 - JS_Save/RestoreFrameChain should update cx->compartment. r=gal,mrbkap.
js/src/jscntxt.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -2084,16 +2084,19 @@ struct JSContext
 
   public:
     friend class js::StackSpace;
     friend bool js::Interpret(JSContext *, JSStackFrame *, uintN, uintN);
 
     /* 'regs' must only be changed by calling this function. */
     void setCurrentRegs(JSFrameRegs *regs) {
         this->regs = regs;
+
+        JSObject *obj = JS_GetGlobalForScopeChain(this);
+        compartment = obj ? obj->getCompartment(this) : runtime->defaultCompartment;
     }
 
     /* Temporary arena pool used while compiling and decompiling. */
     JSArenaPool         tempPool;
 
     /* Temporary arena pool used while evaluate regular expressions. */
     JSArenaPool         regExpPool;