Bug 650161 - Fix sandbox object moved hook to work on partly initialized object r=bholley

This commit is contained in:
Jon Coppeard 2014-10-31 08:45:17 +00:00
parent bcda188339
commit 951df42fa0

View File

@ -327,10 +327,13 @@ sandbox_finalize(js::FreeOp *fop, JSObject *obj)
static void
sandbox_moved(JSObject *obj, const JSObject *old)
{
// Note that this hook can be called before the private pointer is set. In
// this case the SandboxPrivate will not exist yet, so there is nothing to
// do.
nsIScriptObjectPrincipal *sop =
static_cast<nsIScriptObjectPrincipal *>(xpc_GetJSPrivate(obj));
MOZ_ASSERT(sop);
static_cast<SandboxPrivate *>(sop)->ObjectMoved(obj, old);
if (sop)
static_cast<SandboxPrivate *>(sop)->ObjectMoved(obj, old);
}
static bool