Bug 909567 - Fix some exact rooting hazards in content/; r=bholley

--HG--
extra : rebase_source : bbdfb35f37c62d654d5a5cd325cc9b6e5f8bc9ae
This commit is contained in:
Terrence Cole 2013-08-26 14:43:58 -07:00
parent bd6877012b
commit 731eedc64e
2 changed files with 7 additions and 7 deletions

View File

@ -356,7 +356,7 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
JSObject*
Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
{
JSObject* obj = nsINode::WrapObject(aCx, aScope);
JS::Rooted<JSObject*> obj(aCx, nsINode::WrapObject(aCx, aScope));
if (!obj) {
return nullptr;
}

View File

@ -3543,6 +3543,11 @@ XULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
NS_IMETHODIMP
XULDocument::OnScriptCompileComplete(JSScript* aScript, nsresult aStatus)
{
// When compiling off thread the script will not have been attached to the
// script proto yet.
if (aScript && !mCurrentScriptProto->GetScriptObject())
mCurrentScriptProto->Set(aScript);
// Allow load events to be fired once off thread compilation finishes.
if (mOffThreadCompiling) {
mOffThreadCompiling = false;
@ -3552,11 +3557,6 @@ XULDocument::OnScriptCompileComplete(JSScript* aScript, nsresult aStatus)
// After compilation finishes the script's characters are no longer needed.
mOffThreadCompileString.Truncate();
// When compiling off thread the script will not have been attached to the
// script proto yet.
if (aScript && !mCurrentScriptProto->GetScriptObject())
mCurrentScriptProto->Set(aScript);
// Clear mCurrentScriptProto now, but save it first for use below in
// the execute code, and in the while loop that resumes walks of other
// documents that raced to load this script.
@ -3664,7 +3664,7 @@ XULDocument::ExecuteScript(nsIScriptContext * aContext,
nsAutoMicroTask mt;
JSContext *cx = aContext->GetNativeContext();
AutoCxPusher pusher(cx);
JSObject* global = mScriptGlobalObject->GetGlobalJSObject();
JS::Rooted<JSObject*> global(cx, mScriptGlobalObject->GetGlobalJSObject());
xpc_UnmarkGrayObject(global);
xpc_UnmarkGrayScript(aScriptObject);
JSAutoCompartment ac(cx, global);