document->Release();
FinalizeDocument(JSContext *cx, JSObject *obj){  nsIDOMDocument *document = (nsIDOMDocument*)JS_GetPrivate(cx, obj);  NS_ASSERTION(nsnull != document, "null pointer");  // get the js object  nsIScriptObjectOwner *owner = nsnull;  if (NS_OK == document->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {    owner->ResetScriptObject();    NS_RELEASE(owner);  }  document->Release();}