Changeset 65281 in webkit
- Timestamp:
- Aug 12, 2010 4:23:13 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65280 r65281 1 2010-08-12 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Ensure that parser doesn't attach children that have been removed by JavaScript event handlers. 6 https://bugs.webkit.org/show_bug.cgi?id=43813 7 8 This patch re-fixes bug 40742 in a way that keeps allowing HTMLLinkElement 9 to lazy-attach. 10 11 * html/HTMLConstructionSite.cpp: 12 (WebCore::HTMLConstructionSite::attach): Added parent check. 13 * html/HTMLLinkElement.cpp: Basically undoes changes introduced by r61424. 14 * html/HTMLLinkElement.h: Ditto. 15 1 16 2010-08-12 Justin Schuh <jschuh@chromium.org> 2 17 -
trunk/WebCore/html/HTMLConstructionSite.cpp
r65167 r65281 98 98 99 99 parent->parserAddChild(child); 100 101 // An event handler (DOM Mutation, beforeload, et al.) could have removed 102 // the child, in which case we shouldn't try attaching it. 103 if (!child->parentNode()) 104 return child.release(); 105 100 106 // It's slightly unfortunate that we need to hold a reference to child 101 107 // here to call attach(). We should investigate whether we can rely on -
trunk/WebCore/html/HTMLLinkElement.cpp
r63924 r65281 52 52 , m_loading(false) 53 53 , m_createdByParser(createdByParser) 54 , m_shouldProcessAfterAttach(false)55 54 { 56 55 ASSERT(hasTagName(linkTag)); … … 243 242 } 244 243 } 245 246 void HTMLLinkElement::processCallback(Node* node)247 {248 ASSERT_ARG(node, node && node->hasTagName(linkTag));249 static_cast<HTMLLinkElement*>(node)->process();250 }251 244 252 245 void HTMLLinkElement::insertedIntoDocument() … … 254 247 HTMLElement::insertedIntoDocument(); 255 248 document()->addStyleSheetCandidateNode(this, m_createdByParser); 256 257 // Since processing a stylesheet link causes a beforeload event258 // to fire, it is possible for JavaScript to remove the element in the midst259 // of it being inserted into the DOM, which can lead to assertion failures260 // and crashes. Avoid this by postponing the beforeload/load until after261 // attach if there are beforeload listeners.262 if (document()->hasListenerType(Document::BEFORELOAD_LISTENER)) {263 m_shouldProcessAfterAttach = true;264 return;265 }266 249 267 250 process(); … … 277 260 if (document()->renderer()) 278 261 document()->updateStyleSelector(); 279 280 m_shouldProcessAfterAttach = false; 281 } 282 283 void HTMLLinkElement::attach() 284 { 285 if (m_shouldProcessAfterAttach) { 286 m_shouldProcessAfterAttach = false; 287 queuePostAttachCallback(&HTMLLinkElement::processCallback, this); 288 } 289 290 HTMLElement::attach(); 291 } 292 262 } 263 293 264 void HTMLLinkElement::finishParsingChildren() 294 265 { -
trunk/WebCore/html/HTMLLinkElement.h
r63204 r65281 74 74 bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; } 75 75 bool isIcon() const { return m_relAttribute.m_isIcon; } 76 77 virtual void attach();78 virtual bool canLazyAttach() { return false; }79 76 80 77 private: … … 126 123 bool m_loading; 127 124 bool m_createdByParser; 128 bool m_shouldProcessAfterAttach;129 125 }; 130 126
Note: See TracChangeset
for help on using the changeset viewer.