Bug 785191: Push a null JSContext when binding / unbinding image elements in a document. r=bz

This commit is contained in:
Daniel Holbert 2012-08-23 16:24:58 -07:00
parent 87bb1cdc45
commit f4e969d582

View File

@ -1158,6 +1158,11 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (!aDocument)
return;
// Push a null JSContext on the stack so that callbacks triggered by the
// below code won't think they're being called from JS.
nsCxPusher pusher;
pusher.PushNull();
if (mCurrentRequestFlags & REQUEST_SHOULD_BE_TRACKED)
aDocument->AddImage(mCurrentRequest);
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
@ -1172,6 +1177,11 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
if (!doc)
return;
// Push a null JSContext on the stack so that callbacks triggered by the
// below code won't think they're being called from JS.
nsCxPusher pusher;
pusher.PushNull();
if (mCurrentRequestFlags & REQUEST_SHOULD_BE_TRACKED)
doc->RemoveImage(mCurrentRequest);
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)