Changeset 199003 in webkit
- Timestamp:
- Apr 4, 2016 5:56:33 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199001 r199003 1 2016-04-04 Antti Koivisto <antti@apple.com> 2 3 Enable assertions against DOM mutations in RenderTreeUpdater 4 https://bugs.webkit.org/show_bug.cgi?id=156156 5 6 Reviewed by Andreas Kling. 7 8 Ensure we don't mutate DOM or dispatch events during render tree updates. 9 10 * WebCore.xcodeproj/project.pbxproj: 11 * dom/ContainerNode.cpp: 12 * dom/ContainerNode.h: 13 (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted. 14 (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted. 15 (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Deleted. 16 17 Move NoEventDispatchAssertion to a header of its own. 18 19 * dom/NoEventDispatchAssertion.h: Added. 20 (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): 21 (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): 22 (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): 23 (WebCore::NoEventDispatchAssertion::dropTemporarily): 24 (WebCore::NoEventDispatchAssertion::restoreDropped): 25 26 Add a way to disable event assertions temporarily. 27 28 * loader/cache/CachedSVGFont.cpp: 29 (WebCore::CachedSVGFont::ensureCustomFontData): 30 31 Temporary SVG font document may get constructed during render tree update. These can't run scripts or generally 32 affect anything outside the font document as it does not have a frame. Disable event assertions temporarily. 33 34 Tested by svg/W3C-SVG-1.1/fonts-elem-07-b.svg 35 36 * style/RenderTreeUpdater.cpp: 37 (WebCore::RenderTreeUpdater::updateRenderTree): 38 39 Enable assertions. 40 1 41 2016-04-04 Emanuele Aina <emanuele.aina@collabora.com> 2 42 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r198943 r199003 6626 6626 E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6627 6627 E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6628 E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6628 6629 E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; }; 6629 6630 E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; }; … … 14658 14659 E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; }; 14659 14660 E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; }; 14661 E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoEventDispatchAssertion.h; sourceTree = "<group>"; }; 14660 14662 E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = "<group>"; }; 14661 14663 E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; }; … … 24421 24423 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */, 24422 24424 9382AAB10D8C386100F357A6 /* NodeWithIndex.h */, 24425 E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */, 24423 24426 8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */, 24424 24427 7C6752BA1B06E82000C279CB /* NonElementParentNode.idl */, … … 26307 26310 5185FC9B1BB4C4E80012898F /* IDBKeyRange.h in Headers */, 26308 26311 5185FC9E1BB4C4E80012898F /* IDBKeyRangeData.h in Headers */, 26312 E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */, 26309 26313 5185FCA01BB4C4E80012898F /* IDBObjectStore.h in Headers */, 26310 26314 5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */, -
trunk/Source/WebCore/dom/ContainerNode.cpp
r196888 r199003 43 43 #include "MutationEvent.h" 44 44 #include "NameNodeList.h" 45 #include "NoEventDispatchAssertion.h" 45 46 #include "NodeOrString.h" 46 47 #include "NodeRareData.h" -
trunk/Source/WebCore/dom/ContainerNode.h
r197887 r199003 34 34 class RadioNodeList; 35 35 class RenderElement; 36 37 class NoEventDispatchAssertion {38 public:39 NoEventDispatchAssertion()40 {41 #if !ASSERT_DISABLED42 if (!isMainThread())43 return;44 ++s_count;45 #endif46 }47 48 NoEventDispatchAssertion(const NoEventDispatchAssertion&)49 : NoEventDispatchAssertion()50 {51 }52 53 ~NoEventDispatchAssertion()54 {55 #if !ASSERT_DISABLED56 if (!isMainThread())57 return;58 ASSERT(s_count);59 s_count--;60 #endif61 }62 63 static bool isEventDispatchForbidden()64 {65 #if ASSERT_DISABLED66 return false;67 #else68 return isMainThread() && s_count;69 #endif70 }71 72 #if !ASSERT_DISABLED73 74 private:75 WEBCORE_EXPORT static unsigned s_count;76 77 #endif78 };79 36 80 37 class ContainerNode : public Node { -
trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
r191955 r199003 27 27 #include "ContainerNodeAlgorithms.h" 28 28 29 #include "NoEventDispatchAssertion.h" 29 30 30 31 namespace WebCore { -
trunk/Source/WebCore/dom/Document.cpp
r198943 r199003 117 117 #include "NameNodeList.h" 118 118 #include "NestingLevelIncrementer.h" 119 #include "NoEventDispatchAssertion.h" 119 120 #include "NodeIterator.h" 120 121 #include "NodeRareData.h" -
trunk/Source/WebCore/dom/Element.cpp
r198992 r199003 67 67 #include "MutationObserverInterestGroup.h" 68 68 #include "MutationRecord.h" 69 #include "NoEventDispatchAssertion.h" 69 70 #include "NodeRenderStyle.h" 70 71 #include "PlatformWheelEvent.h" -
trunk/Source/WebCore/dom/ElementIteratorAssertions.h
r196281 r199003 28 28 29 29 #include "Element.h" 30 #include "NoEventDispatchAssertion.h" 30 31 31 32 namespace WebCore { -
trunk/Source/WebCore/dom/EventDispatcher.cpp
r198483 r199003 32 32 #include "HTMLInputElement.h" 33 33 #include "MouseEvent.h" 34 #include "NoEventDispatchAssertion.h" 34 35 #include "PseudoElement.h" 35 36 #include "ScopedEventQueue.h" -
trunk/Source/WebCore/dom/EventTarget.cpp
r196520 r199003 35 35 #include "ExceptionCode.h" 36 36 #include "InspectorInstrumentation.h" 37 #include "NoEventDispatchAssertion.h" 37 38 #include "ScriptController.h" 38 39 #include "WebKitAnimationEvent.h" -
trunk/Source/WebCore/dom/Node.cpp
r198992 r199003 52 52 #include "Logging.h" 53 53 #include "MutationEvent.h" 54 #include "NoEventDispatchAssertion.h" 54 55 #include "NodeOrString.h" 55 56 #include "NodeRenderStyle.h" -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r197690 r199003 35 35 #include "ErrorEvent.h" 36 36 #include "MessagePort.h" 37 #include "NoEventDispatchAssertion.h" 37 38 #include "PublicURLManager.h" 38 39 #include "Settings.h" -
trunk/Source/WebCore/dom/WebKitNamedFlow.cpp
r194324 r199003 32 32 33 33 #include "NamedFlowCollection.h" 34 #include "NoEventDispatchAssertion.h" 34 35 #include "RenderNamedFlowFragment.h" 35 36 #include "RenderNamedFlowThread.h" -
trunk/Source/WebCore/history/PageCache.cpp
r198924 r199003 47 47 #include "MainFrame.h" 48 48 #include "MemoryPressureHandler.h" 49 #include "NoEventDispatchAssertion.h" 49 50 #include "Page.h" 50 51 #include "Settings.h" -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r198901 r199003 69 69 #include "MemoryPressureHandler.h" 70 70 #include "NetworkingContext.h" 71 #include "NoEventDispatchAssertion.h" 71 72 #include "PageGroup.h" 72 73 #include "PageThrottler.h" -
trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp
r198074 r199003 32 32 #include "FontDescription.h" 33 33 #include "FontPlatformData.h" 34 #include "NoEventDispatchAssertion.h" 34 35 #include "SVGDocument.h" 35 36 #include "SVGFontElement.h" … … 65 66 { 66 67 if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) { 68 // We may get here during render tree updates when events are forbidden. 69 // Frameless document can't run scripts or call back to the client so this is safe. 70 auto count = NoEventDispatchAssertion::dropTemporarily(); 71 67 72 m_externalSVGDocument = SVGDocument::create(nullptr, URL()); 68 73 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); 69 74 m_externalSVGDocument->setContent(decoder->decodeAndFlush(m_data->data(), m_data->size())); 75 76 NoEventDispatchAssertion::restoreDropped(count); 77 70 78 if (decoder->sawError()) 71 79 m_externalSVGDocument = nullptr; -
trunk/Source/WebCore/style/RenderTreeUpdater.cpp
r198992 r199003 110 110 auto end = descendants.end(); 111 111 112 // FIXME: SVG <use> element may cause tree mutations during style recalc.113 it.dropAssertions();114 115 112 while (it != end) { 116 113 popParentsToDepth(it.depth());
Note: See TracChangeset
for help on using the changeset viewer.