Bug 749385 - use deferred release in nsHTMLDocumentSH::ReleaseDocument. r=peterv

This commit is contained in:
Andrew McCreight 2012-05-18 15:00:19 -07:00
parent be8a13e7a8
commit 499dfe9257
5 changed files with 14 additions and 5 deletions

View File

@ -9095,9 +9095,10 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHan
void
nsHTMLDocumentSH::ReleaseDocument(JSFreeOp *fop, JSObject *obj)
{
nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(obj);
NS_IF_RELEASE(doc);
nsIHTMLDocument *doc = static_cast<nsIHTMLDocument *>(JS_GetPrivate(obj));
if (doc) {
xpc::DeferredRelease(doc);
}
}
JSBool

View File

@ -2128,7 +2128,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
return true;
}
JSBool
bool
XPCJSRuntime::DeferredRelease(nsISupports* obj)
{
NS_ASSERTION(obj, "bad param");

View File

@ -2558,6 +2558,12 @@ nsXPConnect::GetCaller(JSContext **aJSContext, JSObject **aObj)
namespace xpc {
bool
DeferredRelease(nsISupports *obj)
{
return nsXPConnect::GetRuntimeInstance()->DeferredRelease(obj);
}
bool
Base64Encode(JSContext *cx, JS::Value val, JS::Value *out)
{

View File

@ -698,7 +698,7 @@ public:
JSBool OnJSContextNew(JSContext* cx);
JSBool DeferredRelease(nsISupports* obj);
bool DeferredRelease(nsISupports* obj);
JSBool GetDoingFinalization() const {return mDoingFinalization;}

View File

@ -219,6 +219,8 @@ class nsIMemoryMultiReporterCallback;
namespace xpc {
bool DeferredRelease(nsISupports *obj);
// If these functions return false, then an exception will be set on cx.
bool Base64Encode(JSContext *cx, JS::Value val, JS::Value *out);
bool Base64Decode(JSContext *cx, JS::Value val, JS::Value *out);