Bug 868634 - Remove compartment entry in nsStructuredCloneContainer. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Tue, 07 May 2013 14:18:03 -0700
changeset 131162 ea66aac44f3146304bc24ab3755badd6716143de
parent 131161 60201d176dd23ef18200c918a34e9566ff3458b1
child 131163 0550d3d146cff508a8465c54dfd82204aa67579b
push id27718
push userbobbyholley@gmail.com
push dateTue, 07 May 2013 21:18:35 +0000
treeherdermozilla-inbound@e2c5a5d03c49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs868634
milestone23.0a1
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 868634 - Remove compartment entry in nsStructuredCloneContainer. r=bz I can't see what this is supposed to be doing. The one caller defaults to aCx, and if not, gets and pushes a context associated with the document, restoring it to the default compartment. So this only changes the behavior when we use the aCx that comes in from above, in which case it's totally not clear to me why we would want to get the default global here.
dom/base/nsStructuredCloneContainer.cpp
--- a/dom/base/nsStructuredCloneContainer.cpp
+++ b/dom/base/nsStructuredCloneContainer.cpp
@@ -47,17 +47,16 @@ nsStructuredCloneContainer::InitFromVari
   // if the variant implements GetAsJSVal.
   JS::Rooted<JS::Value> jsData(aCx);
   nsresult rv = aData->GetAsJSVal(jsData.address());
   NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
 
   // Make sure that we serialize in the right context.
   MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
   JSAutoRequest ar(aCx);
-  JSAutoCompartment ac(aCx, JS_GetGlobalObject(aCx));
   JS_WrapValue(aCx, jsData.address());
 
   uint64_t* jsBytes = nullptr;
   bool success = JS_WriteStructuredClone(aCx, jsData, &jsBytes, &mSize,
                                            nullptr, nullptr, JSVAL_VOID);
   NS_ENSURE_STATE(success);
   NS_ENSURE_STATE(jsBytes);