Changeset 246057 in webkit
- Timestamp:
- Jun 4, 2019 12:38:17 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246049 r246057 1 2019-06-04 Cathie Chen <cathiechen@igalia.com> 2 3 JS wrapper of target in ResizeObserverEntry/ResizeObserver shouldn't get collected ahead 4 https://bugs.webkit.org/show_bug.cgi?id=197457 5 6 Reviewed by Ryosuke Niwa. 7 8 * platform/win/TestExpectations: 9 * resize-observer/element-leak-expected.txt: Added. 10 * resize-observer/element-leak.html: Added. 11 * resize-observer/resize-observer-entry-keeps-js-wrapper-of-target-alive-expected.txt: Added. 12 * resize-observer/resize-observer-entry-keeps-js-wrapper-of-target-alive.html: Added. 13 * resize-observer/resize-observer-keeps-js-wrapper-of-target-alive-expected.txt: Added. 14 * resize-observer/resize-observer-keeps-js-wrapper-of-target-alive.html: Added. 15 * resize-observer/resources/element-leak-frame.html: Added. 16 1 17 2019-06-03 Youenn Fablet <youenn@apple.com> 2 18 -
trunk/LayoutTests/platform/win/TestExpectations
r246016 r246057 4402 4402 4403 4403 webkit.org/b/198112 http/tests/security/showModalDialog-sync-cross-origin-page-load2.html [ Skip ] 4404 4405 # The removed elements couldn't be released properly in Win. 4406 # The relevant bug is https://bugs.webkit.org/show_bug.cgi?id=197908 4407 resize-observer/element-leak.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r246056 r246057 1 2019-06-04 Cathie Chen <cathiechen@igalia.com> 2 3 JS wrapper of target in ResizeObserverEntry/ResizeObserver shouldn't get collected ahead 4 https://bugs.webkit.org/show_bug.cgi?id=197457 5 6 Reviewed by Ryosuke Niwa. 7 8 Add JSCustomMarkFunction to make sure JS wrappers wouldn't be collected when JSResizeObserverEntry live. 9 10 For ResizeObserver, if targets are removed, it will get fired for the last time. We also need to keep these JS 11 wrappers live. So add these targets to a GCReachableRef list once they're observed. 12 13 Add element-leak.html to test the targets with `entry.target.myEntry = entry` could be released properly. 14 15 Tests: resize-observer/element-leak.html 16 resize-observer/resize-observer-entry-keeps-js-wrapper-of-target-alive.html 17 resize-observer/resize-observer-keeps-js-wrapper-of-target-alive.html 18 19 * Sources.txt: 20 * WebCore.xcodeproj/project.pbxproj: 21 * bindings/js/JSResizeObserverEntryCustom.cpp: Added. 22 (WebCore::JSResizeObserverEntry::visitAdditionalChildren): 23 * page/ResizeObserver.cpp: 24 (WebCore::ResizeObserver::observe): 25 (WebCore::ResizeObserver::removeAllTargets): 26 (WebCore::ResizeObserver::removeObservation): 27 (WebCore::ResizeObserver::stop): 28 * page/ResizeObserver.h: 29 * page/ResizeObserverEntry.idl: 30 1 31 2019-06-03 Andy Estes <aestes@apple.com> 2 32 -
trunk/Source/WebCore/Sources.txt
r245945 r246057 534 534 bindings/js/JSRemoteDOMWindowBase.cpp 535 535 bindings/js/JSRemoteDOMWindowCustom.cpp 536 bindings/js/JSResizeObserverEntryCustom.cpp 536 537 bindings/js/JSSVGPathSegCustom.cpp 537 538 bindings/js/JSSVGViewSpecCustom.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r246002 r246057 8794 8794 585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContents.cpp; sourceTree = "<group>"; }; 8795 8795 585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContents.h; sourceTree = "<group>"; }; 8796 5884FE5622813E2D0040AFF6 /* JSResizeObserverEntryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverEntryCustom.cpp; sourceTree = "<group>"; }; 8796 8797 589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = "<group>"; }; 8797 8798 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = "<group>"; }; … … 20691 20692 833CF70F20DB3F5F00141BCC /* JSPerformanceObserverCustom.cpp */, 20692 20693 A4A69B8BB91B49D0A804C31D /* JSPromiseRejectionEventCustom.cpp */, 20694 5884FE5622813E2D0040AFF6 /* JSResizeObserverEntryCustom.cpp */, 20693 20695 83F572941FA1066F003837BE /* JSServiceWorkerClientCustom.cpp */, 20694 20696 460D19441FCE21DD00C3DB85 /* JSServiceWorkerGlobalScopeCustom.cpp */, -
trunk/Source/WebCore/bindings/js/JSResizeObserverEntryCustom.cpp
r246056 r246057 24 24 */ 25 25 26 // https://wicg.github.io/ResizeObserver/ 26 #include "config.h" 27 #include "JSResizeObserverEntry.h" 27 28 28 [ 29 Conditional=RESIZE_OBSERVER, 30 ImplementationLacksVTable, 31 EnabledBySetting=ResizeObserver 32 ] interface ResizeObserverEntry { 33 readonly attribute Element target; 34 readonly attribute DOMRectReadOnly contentRect; 35 }; 29 #include "JSNodeCustom.h" 30 31 namespace WebCore { 32 33 void JSResizeObserverEntry::visitAdditionalChildren(JSC::SlotVisitor& visitor) 34 { 35 visitor.addOpaqueRoot(root(wrapped().target())); 36 visitor.addOpaqueRoot(wrapped().contentRect()); 37 } 38 39 } -
trunk/Source/WebCore/page/ResizeObserver.cpp
r244182 r246057 70 70 71 71 m_observations.append(ResizeObservation::create(&target)); 72 m_pendingTargets.append(target); 72 73 73 74 if (m_document) { … … 141 142 ASSERT_UNUSED(removed, removed); 142 143 } 144 m_pendingTargets.clear(); 145 m_activeObservations.clear(); 143 146 m_observations.clear(); 144 147 } … … 146 149 bool ResizeObserver::removeObservation(const Element& target) 147 150 { 151 m_pendingTargets.removeFirstMatching([&target](auto& pendingTarget) { 152 return pendingTarget.ptr() == ⌖ 153 }); 154 148 155 m_activeObservations.removeFirstMatching([&target](auto& observation) { 149 156 return observation->target() == ⌖ … … 174 181 disconnect(); 175 182 m_callback = nullptr; 176 m_observations.clear();177 m_activeObservations.clear();178 183 } 179 184 -
trunk/Source/WebCore/page/ResizeObserver.h
r244182 r246057 29 29 30 30 #include "ActiveDOMObject.h" 31 #include "GCReachableRef.h" 31 32 #include "ResizeObservation.h" 32 33 #include "ResizeObserverCallback.h" … … 81 82 82 83 Vector<Ref<ResizeObservation>> m_activeObservations; 84 Vector<GCReachableRef<Element>> m_pendingTargets; 83 85 bool m_hasSkippedObservations { false }; 84 86 }; -
trunk/Source/WebCore/page/ResizeObserverEntry.idl
r243643 r246057 29 29 Conditional=RESIZE_OBSERVER, 30 30 ImplementationLacksVTable, 31 EnabledBySetting=ResizeObserver 31 EnabledBySetting=ResizeObserver, 32 JSCustomMarkFunction 32 33 ] interface ResizeObserverEntry { 33 34 readonly attribute Element target;
Note: See TracChangeset
for help on using the changeset viewer.