зеркало из https://github.com/mozilla/pjs.git
Bug 489008. Destroy anonymous content off a script-runner. r=bzbarsky
This commit is contained in:
Родитель
43aa3fca5b
Коммит
466a59cbb1
|
@ -3878,13 +3878,31 @@ nsContentUtils::IsInSameAnonymousTree(nsINode* aNode,
|
|||
|
||||
}
|
||||
|
||||
class AnonymousContentDestroyer : public nsRunnable {
|
||||
public:
|
||||
AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent) {
|
||||
mContent.swap(*aContent);
|
||||
mParent = mContent->GetParent();
|
||||
mDoc = mContent->GetOwnerDoc();
|
||||
}
|
||||
NS_IMETHOD Run() {
|
||||
mContent->UnbindFromTree();
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
// Hold strong refs to the parent content and document so that they
|
||||
// don't die unexpectedly
|
||||
nsCOMPtr<nsIDocument> mDoc;
|
||||
nsCOMPtr<nsIContent> mParent;
|
||||
};
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::DestroyAnonymousContent(nsCOMPtr<nsIContent>* aContent)
|
||||
{
|
||||
if (*aContent) {
|
||||
(*aContent)->UnbindFromTree();
|
||||
*aContent = nsnull;
|
||||
AddScriptRunner(new AnonymousContentDestroyer(aContent));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче