Changeset 185769 in webkit
- Timestamp:
- Jun 19, 2015, 2:55:55 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/element-removed-while-inserting-parent-crash-expected.txt (added)
-
LayoutTests/fast/dom/element-removed-while-inserting-parent-crash.html (added)
-
LayoutTests/fast/dom/named-map-removed-while-inserting-parent-crash-expected.txt (added)
-
LayoutTests/fast/dom/named-map-removed-while-inserting-parent-crash.html (added)
-
LayoutTests/fast/forms/form-control-removed-while-inserting-parent-crash-expected.txt (added)
-
LayoutTests/fast/forms/form-control-removed-while-inserting-parent-crash.html (added)
-
LayoutTests/svg/dom/element-removed-while-inserting-parent-crash-expected.txt (added)
-
LayoutTests/svg/dom/element-removed-while-inserting-parent-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/ScriptElement.cpp (modified) (1 diff)
-
Source/WebCore/dom/ScriptElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLScriptElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLScriptElement.h (modified) (1 diff)
-
Source/WebCore/svg/SVGScriptElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGScriptElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r185758 r185769 1 2015-06-19 Andy Estes <aestes@apple.com> 2 3 Various assertion failures occur when executing script in the midst of DOM insertion 4 https://bugs.webkit.org/show_bug.cgi?id=132482 5 6 Reviewed by Darin Adler. 7 8 Wrote named-map-removed-while-inserting-parent-crash.html by reducing the test case attached to bug 132482. 9 The remaining tests were taken from blink r132482. 10 11 * fast/dom/element-removed-while-inserting-parent-crash-expected.txt: Added. 12 * fast/dom/element-removed-while-inserting-parent-crash.html: Added. 13 * fast/dom/named-map-removed-while-inserting-parent-crash-expected.txt: Added. 14 * fast/dom/named-map-removed-while-inserting-parent-crash.html: Added. 15 * fast/forms/form-control-removed-while-inserting-parent-crash-expected.txt: Added. 16 * fast/forms/form-control-removed-while-inserting-parent-crash.html: Added. 17 * svg/dom/element-removed-while-inserting-parent-crash-expected.txt: Added. 18 * svg/dom/element-removed-while-inserting-parent-crash.html: Added. 19 1 20 2015-06-19 Csaba Osztrogonác <ossy@webkit.org> 2 21 -
trunk/Source/WebCore/ChangeLog
r185766 r185769 1 2015-06-19 Andy Estes <aestes@apple.com> 2 3 Various assertion failures occur when executing script in the midst of DOM insertion 4 https://bugs.webkit.org/show_bug.cgi?id=132482 5 6 Reviewed by Darin Adler. 7 8 Prior to this change, when an element containing a <script> child was inserted into a document, the script was 9 executed in ScriptElement::insertedInto(). That script can access nodes that follow it in the newly-inserted 10 hierarchy but are not yet fully inserted, leading to at least the following problems: 11 12 - The script could remove a node that is not yet marked as in the document. 13 - The script could remove a named <map> that has yet to be added to TreeScope::m_imageMapsByName. 14 - The script could remove a form control that has yet to be added to FormController::m_formElementsWithState. 15 16 These scenarios all result in assertion failures. This change ensures that each node in the newly-inserted 17 hierarchy is fully inserted before executing any scripts. 18 19 Tests: fast/dom/element-removed-while-inserting-parent-crash.html 20 fast/dom/named-map-removed-while-inserting-parent-crash.html 21 fast/forms/form-control-removed-while-inserting-parent-crash.html 22 svg/dom/element-removed-while-inserting-parent-crash.html 23 24 * dom/ScriptElement.cpp: 25 (WebCore::ScriptElement::shouldNotifySubtreeInsertions): Renamed from insertedInto(). 26 Returned true in the case where insertedInto() would've called prepareScript(). 27 (WebCore::ScriptElement::didNotifySubtreeInsertions): Called prepareScript(). 28 (WebCore::ScriptElement::insertedInto): Renamed to shouldNotifySubtreeInsertions(). 29 * dom/ScriptElement.h: 30 * html/HTMLScriptElement.cpp: 31 (WebCore::HTMLScriptElement::insertedInto): If shouldNotifySubtreeInsertions() is true, returned InsertionShouldCallDidNotifySubtreeInsertions. 32 Otherwise, returned InsertionDone. 33 (WebCore::HTMLScriptElement::didNotifySubtreeInsertions): Called ScriptElement::didNotifySubtreeInsertions(). 34 * html/HTMLScriptElement.h: 35 * svg/SVGScriptElement.cpp: 36 (WebCore::SVGScriptElement::insertedInto): Did the same as HTMLScriptElement::insertedInto(). 37 (WebCore::SVGScriptElement::didNotifySubtreeInsertions): Called ScriptElement::didNotifySubtreeInsertions(). 38 * svg/SVGScriptElement.h: 39 1 40 2015-06-19 Brent Fulgham <bfulgham@apple.com> 2 41 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r184434 r185769 80 80 } 81 81 82 void ScriptElement::insertedInto(ContainerNode& insertionPoint) 83 { 84 if (insertionPoint.inDocument() && !m_parserInserted) 85 prepareScript(); // FIXME: Provide a real starting line number here. 82 bool ScriptElement::shouldNotifySubtreeInsertions(ContainerNode& insertionPoint) 83 { 84 return insertionPoint.inDocument() && !m_parserInserted; 85 } 86 87 void ScriptElement::didNotifySubtreeInsertions() 88 { 89 ASSERT(!m_parserInserted); 90 prepareScript(); // FIXME: Provide a real starting line number here. 86 91 } 87 92 -
trunk/Source/WebCore/dom/ScriptElement.h
r170809 r185769 70 70 71 71 // Helper functions used by our parent classes. 72 void insertedInto(ContainerNode&); 72 bool shouldNotifySubtreeInsertions(ContainerNode&); 73 void didNotifySubtreeInsertions(); 73 74 void childrenChanged(); 74 75 void handleSourceAttribute(const String& sourceUrl); -
trunk/Source/WebCore/html/HTMLScriptElement.cpp
r182120 r185769 71 71 { 72 72 HTMLElement::insertedInto(insertionPoint); 73 ScriptElement::insertedInto(insertionPoint); 74 return InsertionDone; 73 return shouldNotifySubtreeInsertions(insertionPoint) ? InsertionShouldCallDidNotifySubtreeInsertions : InsertionDone; 74 } 75 76 void HTMLScriptElement::didNotifySubtreeInsertions() 77 { 78 ScriptElement::didNotifySubtreeInsertions(); 75 79 } 76 80 -
trunk/Source/WebCore/html/HTMLScriptElement.h
r177996 r185769 47 47 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; 48 48 virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; 49 virtual void didNotifySubtreeInsertions() override; 49 50 virtual void childrenChanged(const ChildChange&) override; 50 51 -
trunk/Source/WebCore/svg/SVGScriptElement.cpp
r182121 r185769 78 78 { 79 79 SVGElement::insertedInto(rootParent); 80 ScriptElement::insertedInto(rootParent);81 80 if (rootParent.inDocument()) 82 81 SVGExternalResourcesRequired::insertedIntoDocument(this); 83 return InsertionDone; 82 return shouldNotifySubtreeInsertions(rootParent) ? InsertionShouldCallDidNotifySubtreeInsertions : InsertionDone; 83 } 84 85 void SVGScriptElement::didNotifySubtreeInsertions() 86 { 87 ScriptElement::didNotifySubtreeInsertions(); 84 88 } 85 89 -
trunk/Source/WebCore/svg/SVGScriptElement.h
r185503 r185769 43 43 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; 44 44 virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; 45 virtual void didNotifySubtreeInsertions() override; 45 46 virtual void childrenChanged(const ChildChange&) override; 46 47
Note:
See TracChangeset
for help on using the changeset viewer.