From f84ddd9e6bbe45e25a0b0ddfc2c46163cf1f809d Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Fri, 6 Nov 2009 15:30:24 -0800 Subject: [PATCH] Bug 521668: Fire DOMLinkAdded asynchronously to avoid unexpected recursion. r=bent sr=jst --- content/html/content/src/nsHTMLLinkElement.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index 97323dd1fb6..14592f26f17 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -268,15 +268,9 @@ nsHTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc, nsRefPtr event = new nsPLDOMEvent(this, aEventName, PR_TRUE); if (event) { - // If we have script blockers on the stack then we want to run as soon as - // they are removed. Otherwise punt the runable to the event loop as we - // don't know when it will be safe to run script. In particular, we might - // be in the middle of a pagehide right now, and firing this event at that - // point is not such a great idea. - if (nsContentUtils::IsSafeToRunScript()) - event->PostDOMEvent(); - else - event->RunDOMEventWhenSafe(); + // Always run async in order to avoid running script when the content + // sink isn't expecting it. + event->PostDOMEvent(); } }