Changeset 183729 in webkit
- Timestamp:
- May 3, 2015 2:54:35 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r183727 r183729 1 2015-05-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] API tests crashing on debug builds due to extra unref 4 https://bugs.webkit.org/show_bug.cgi?id=144508 5 6 Reviewed by Mario Sanchez Prada. 7 8 The problem is that we were assuming that when a new DOMWindow is 9 created, the DOM object cache was notified about the previous 10 DOMWindow being destroyed before objects for the new DOMWindow are 11 added to the cache. However, that's not always the case and we 12 only create a DOMWindowObserver for the first DOMWindow. We need 13 to keep a pointer to the DOMWindow being observed to clear() the 14 cache and create a new DOMWindowObserver when it changes in the 15 Frame. 16 17 Fixes crashes in several unit tests in debug builds. 18 19 * bindings/gobject/DOMObjectCache.cpp: 20 1 21 2015-05-03 Alexey Proskuryakov <ap@apple.com> 2 22 -
trunk/Source/WebCore/bindings/gobject/DOMObjectCache.cpp
r182537 r183729 101 101 ASSERT(!m_objects.contains(&data)); 102 102 103 if (!m_domWindowObserver && m_frame->document()->domWindow()) 104 m_domWindowObserver = std::make_unique<DOMWindowObserver>(*m_frame, *this); 103 WebCore::DOMWindow* domWindow = m_frame->document()->domWindow(); 104 if (domWindow && (!m_domWindowObserver || m_domWindowObserver->domWindow() != domWindow)) { 105 // New DOMWindow, clear the cache and create a new DOMWindowObserver. 106 clear(); 107 m_domWindowObserver = std::make_unique<DOMWindowObserver>(*m_frame, *this, domWindow); 108 } 105 109 106 110 m_objects.append(&data); … … 112 116 WTF_MAKE_FAST_ALLOCATED; 113 117 public: 114 DOMWindowObserver(WebCore::Frame& frame, DOMObjectCacheFrameObserver& frameObserver )118 DOMWindowObserver(WebCore::Frame& frame, DOMObjectCacheFrameObserver& frameObserver, WebCore::DOMWindow* window) 115 119 : DOMWindowProperty(&frame) 116 120 , m_frameObserver(frameObserver) 121 , m_domWindow(window) 117 122 { 123 ASSERT(m_domWindow); 118 124 } 119 125 … … 121 127 { 122 128 } 129 130 WebCore::DOMWindow* domWindow() const { return m_domWindow; } 123 131 124 132 private: … … 131 139 132 140 DOMObjectCacheFrameObserver& m_frameObserver; 141 WebCore::DOMWindow* m_domWindow; 133 142 }; 134 143
Note: See TracChangeset
for help on using the changeset viewer.