Bug 521668: Fire DOMLinkAdded asynchronously to avoid unexpected recursion. r=bent sr=jst
authorJonas Sicking <jonas@sicking.cc>
Fri, 06 Nov 2009 15:30:24 -0800
changeset 34650 6da836add4b9bed0e55fcd1b748a08f29f41daa5
parent 34649 f6c80d9da9940850a0c4c446144f37a309cff65a
child 34651 8abdde9f628c951797d9fe1cafd0125272baa31c
push id10152
push usersicking@mozilla.com
push dateFri, 06 Nov 2009 23:30:47 +0000
treeherdermozilla-central@8abdde9f628c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, jst
bugs521668
milestone1.9.3a1pre
Bug 521668: Fire DOMLinkAdded asynchronously to avoid unexpected recursion. r=bent sr=jst
content/html/content/src/nsHTMLLinkElement.cpp
--- a/content/html/content/src/nsHTMLLinkElement.cpp
+++ b/content/html/content/src/nsHTMLLinkElement.cpp
@@ -263,25 +263,19 @@ nsHTMLLinkElement::CreateAndDispatchEven
   if (!nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                        nsGkAtoms::rev) &&
       FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::rel,
                       strings, eIgnoreCase) != ATTR_VALUE_NO_MATCH)
     return;
 
   nsRefPtr<nsPLDOMEvent> 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();
   }
 }
 
 nsresult
 nsHTMLLinkElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                            nsIAtom* aPrefix, const nsAString& aValue,
                            PRBool aNotify)
 {