Skip to content

Commit

Permalink
Bug 1008107 - Allow SandboxPrivate to be null in sandbox_finalize (r=bz)
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-mccloskey committed Aug 21, 2014
1 parent d9219d7 commit 91859b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/xpconnect/src/Sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,13 @@ sandbox_finalize(JSFreeOp *fop, JSObject *obj)
{
nsIScriptObjectPrincipal *sop =
static_cast<nsIScriptObjectPrincipal *>(xpc_GetJSPrivate(obj));
MOZ_ASSERT(sop);
if (!sop) {
// sop can be null if CreateSandboxObject fails in the middle.
return;
}

static_cast<SandboxPrivate *>(sop)->ForgetGlobalObject();
NS_IF_RELEASE(sop);
NS_RELEASE(sop);
DestroyProtoAndIfaceCache(obj);
}

Expand Down

0 comments on commit 91859b4

Please sign in to comment.