Changeset 181656 in webkit
- Timestamp:
- Mar 17, 2015, 12:15:54 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/animation/request-animation-frame-unparented-iframe-crash-expected.txt (added)
-
LayoutTests/fast/animation/request-animation-frame-unparented-iframe-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/ScriptedAnimationController.cpp (modified) (1 diff)
-
Source/WebCore/dom/ScriptedAnimationController.h (modified) (1 diff)
-
Source/WebCore/page/ChromeClient.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp (modified) (4 diffs)
-
Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/GraphicsLayerUpdater.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderLayerCompositor.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerCompositor.h (modified) (1 diff)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181655 r181656 1 2015-03-17 Timothy Horton <timothy_horton@apple.com> 2 3 Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor 4 https://bugs.webkit.org/show_bug.cgi?id=142776 5 <rdar://problem/18921338> 6 7 Reviewed by Alexey Proskuryakov. 8 9 * fast/animation/request-animation-frame-unparented-iframe-crash-expected.txt: Added. 10 * fast/animation/request-animation-frame-unparented-iframe-crash.html: Added. 11 Add a test that ensures that calling requestAnimationFrame on a recently-unparented 12 frame doesn't crash. 13 1 14 2015-03-17 Dean Jackson <dino@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r181655 r181656 1 2015-03-17 Timothy Horton <timothy_horton@apple.com> 2 3 Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor 4 https://bugs.webkit.org/show_bug.cgi?id=142776 5 <rdar://problem/18921338> 6 7 Reviewed by Alexey Proskuryakov. 8 9 Test: fast/animation/request-animation-frame-unparented-iframe-crash.html 10 11 In some cases (like the new test), we can end up trying to start 12 requestAnimationFrame on a Document that has no Page. Most paths null-checked 13 the Page and did the right thing, but one failed to do so. In addition, 14 the current fallback (when Page is null) can result in us constructing 15 the wrong kind of DisplayRefreshMonitor, which could lead to trouble 16 down the road when it's reused. Instead, just completely avoid making a 17 DisplayRefreshMonitor in the null-page case. 18 19 * dom/ScriptedAnimationController.cpp: 20 (WebCore::ScriptedAnimationController::createDisplayRefreshMonitor): 21 If the page is null, bail. 22 23 * dom/ScriptedAnimationController.h: 24 * platform/graphics/DisplayRefreshMonitor.cpp: 25 (WebCore::DisplayRefreshMonitor::create): 26 Use Optional<> to make it easy to distinguish between ChromeClient 27 being unreachable (because we don't have a Page for some reason) and 28 ChromeClient declaring that it doesn't want to override the type of 29 DisplayRefreshMonitor that is created. 30 31 If ChromeClient was unreachable for some reason, we'll get back an engaged 32 nullptr and return it (instead of creating a DisplayRefreshMonitor based 33 on the platform). This avoids creating the wrong type of DisplayRefreshMonitor 34 in the rare case where we can't reach the ChromeClient (e.g. a freshly unparented 35 IFrame). 36 37 If instead the client returns a disengaged Nullopt, we'll interpret that as 38 "construct the default type", which falls back on the platform #ifdefs to 39 decide what to make. 40 41 * platform/graphics/DisplayRefreshMonitorManager.cpp: 42 (WebCore::DisplayRefreshMonitorManager::ensureMonitorForClient): 43 (WebCore::DisplayRefreshMonitorManager::scheduleAnimation): 44 Silently handle the case where we failed to make a DisplayRefreshMonitor. 45 46 * platform/graphics/DisplayRefreshMonitor.h: 47 * platform/graphics/DisplayRefreshMonitorClient.h: 48 * platform/graphics/GraphicsLayerUpdater.cpp: 49 (WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor): 50 * platform/graphics/GraphicsLayerUpdater.h: 51 * rendering/RenderLayerCompositor.cpp: 52 (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor): 53 * rendering/RenderLayerCompositor.h: 54 Adjust to the new signature of createDisplayRefreshMonitor, and return 55 an engaged (nullptr) Optional if we can't get to ChromeClient for any reason. 56 57 * page/ChromeClient.h: 58 Return Nullopt (indicating a lack of override) by default. 59 1 60 2015-03-17 Dean Jackson <dino@apple.com> 2 61 -
trunk/Source/WebCore/dom/ScriptedAnimationController.cpp
r178859 r181656 227 227 228 228 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 229 PassRefPtr<DisplayRefreshMonitor> ScriptedAnimationController::createDisplayRefreshMonitor(PlatformDisplayID displayID) const 230 { 231 return m_document->page()->chrome().client().createDisplayRefreshMonitor(displayID); 232 } 233 #endif 234 235 236 } 237 238 #endif 229 Optional<RefPtr<DisplayRefreshMonitor>> ScriptedAnimationController::createDisplayRefreshMonitor(PlatformDisplayID displayID) const 230 { 231 if (!m_document->page()) 232 return Optional<RefPtr<DisplayRefreshMonitor>>(nullptr); 233 return Optional<RefPtr<DisplayRefreshMonitor>>(m_document->page()->chrome().client().createDisplayRefreshMonitor(displayID)); 234 } 235 #endif 236 237 238 } 239 240 #endif -
trunk/Source/WebCore/dom/ScriptedAnimationController.h
r176459 r181656 92 92 // Override for DisplayRefreshMonitorClient 93 93 virtual void displayRefreshFired(double timestamp) override; 94 virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;94 virtual Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const override; 95 95 96 96 bool m_isUsingTimer; -
trunk/Source/WebCore/page/ChromeClient.h
r181442 r181656 291 291 292 292 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 293 virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const { return nullptr; }293 virtual Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const { return Nullopt; } 294 294 #endif 295 295 -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp
r169299 r181656 36 36 namespace WebCore { 37 37 38 PassRefPtr<DisplayRefreshMonitor> DisplayRefreshMonitor::create(DisplayRefreshMonitorClient* client)38 RefPtr<DisplayRefreshMonitor> DisplayRefreshMonitor::create(DisplayRefreshMonitorClient* client) 39 39 { 40 40 PlatformDisplayID displayID = client->displayID(); 41 41 42 if (RefPtr<DisplayRefreshMonitor> monitor = client->createDisplayRefreshMonitor(displayID)) 43 return monitor.release(); 42 if (Optional<RefPtr<DisplayRefreshMonitor>> monitor = client->createDisplayRefreshMonitor(displayID)) 43 return monitor.value(); 44 45 // If ChromeClient returned Nullopt, we'll go ahead and make one of the default type. 44 46 45 47 #if PLATFORM(MAC) -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h
r172814 r181656 42 42 class DisplayRefreshMonitor : public RefCounted<DisplayRefreshMonitor> { 43 43 public: 44 static PassRefPtr<DisplayRefreshMonitor> create(DisplayRefreshMonitorClient*);44 static RefPtr<DisplayRefreshMonitor> create(DisplayRefreshMonitorClient*); 45 45 WEBCORE_EXPORT virtual ~DisplayRefreshMonitor(); 46 46 -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h
r169299 r181656 30 30 31 31 #include "PlatformScreen.h" 32 #include <wtf/Optional.h> 32 33 33 34 namespace WebCore { … … 44 45 virtual void displayRefreshFired(double timestamp) = 0; 45 46 46 virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const = 0; 47 // Returning nullopt indicates that WebCore should create whatever DisplayRefreshMonitor it deems 48 // most appropriate for the current platform. Returning nullptr indicates that we should not try to 49 // create a DisplayRefreshMonitor at all (and should instead fall back to using a timer). 50 virtual Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const = 0; 47 51 48 52 PlatformDisplayID displayID() const { return m_displayID; } -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp
r179850 r181656 45 45 } 46 46 47 DisplayRefreshMonitor* DisplayRefreshMonitorManager:: ensureMonitorForClient(DisplayRefreshMonitorClient* client)47 DisplayRefreshMonitor* DisplayRefreshMonitorManager::createMonitorForClient(DisplayRefreshMonitorClient* client) 48 48 { 49 49 PlatformDisplayID clientDisplayID = client->displayID(); … … 56 56 57 57 RefPtr<DisplayRefreshMonitor> monitor = DisplayRefreshMonitor::create(client); 58 if (!monitor) 59 return nullptr; 58 60 monitor->addClient(client); 59 61 DisplayRefreshMonitor* result = monitor.get(); … … 67 69 return; 68 70 69 ensureMonitorForClient(client);71 createMonitorForClient(client); 70 72 } 71 73 … … 93 95 return false; 94 96 95 DisplayRefreshMonitor* monitor = ensureMonitorForClient(client); 97 DisplayRefreshMonitor* monitor = createMonitorForClient(client); 98 if (!monitor) 99 return false; 96 100 97 101 client->setIsScheduled(true); -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h
r179850 r181656 55 55 virtual ~DisplayRefreshMonitorManager(); 56 56 57 DisplayRefreshMonitor* ensureMonitorForClient(DisplayRefreshMonitorClient*);57 DisplayRefreshMonitor* createMonitorForClient(DisplayRefreshMonitorClient*); 58 58 59 59 Vector<RefPtr<DisplayRefreshMonitor>> m_monitors; -
trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp
r180441 r181656 82 82 83 83 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 84 PassRefPtr<DisplayRefreshMonitor> GraphicsLayerUpdater::createDisplayRefreshMonitor(PlatformDisplayID displayID) const84 Optional<RefPtr<DisplayRefreshMonitor>> GraphicsLayerUpdater::createDisplayRefreshMonitor(PlatformDisplayID displayID) const 85 85 { 86 return m_client ? m_client->createDisplayRefreshMonitor(displayID) : nullptr; 86 if (!m_client) 87 return Optional<RefPtr<DisplayRefreshMonitor>>(nullptr); 88 return m_client->createDisplayRefreshMonitor(displayID); 87 89 } 88 90 #endif -
trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h
r180441 r181656 39 39 virtual void flushLayersSoon(GraphicsLayerUpdater*) = 0; 40 40 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 41 virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const = 0;41 virtual Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const = 0; 42 42 #endif 43 43 }; … … 56 56 57 57 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 58 virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;58 virtual Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const override; 59 59 #endif 60 60 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r181515 r181656 4151 4151 4152 4152 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 4153 PassRefPtr<DisplayRefreshMonitor> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const4153 Optional<RefPtr<DisplayRefreshMonitor>> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const 4154 4154 { 4155 4155 Frame& frame = m_renderView.frameView().frame(); 4156 4156 Page* page = frame.page(); 4157 4157 if (!page) 4158 return nullptr;4159 4160 return page->chrome().client().createDisplayRefreshMonitor(displayID);4158 return Optional<RefPtr<DisplayRefreshMonitor>>(nullptr); 4159 4160 return Optional<RefPtr<DisplayRefreshMonitor>>(page->chrome().client().createDisplayRefreshMonitor(displayID)); 4161 4161 } 4162 4162 #endif -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r181515 r181656 400 400 401 401 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 402 PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;402 Optional<RefPtr<DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const override; 403 403 #endif 404 404 -
trunk/Source/WebKit2/ChangeLog
r181651 r181656 1 2015-03-17 Timothy Horton <timothy_horton@apple.com> 2 3 Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor 4 https://bugs.webkit.org/show_bug.cgi?id=142776 5 <rdar://problem/18921338> 6 7 Reviewed by Alexey Proskuryakov. 8 9 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 10 (WebKit::WebChromeClient::createDisplayRefreshMonitor): 11 * WebProcess/WebCoreSupport/WebChromeClient.h: 12 Adjust to the new signature. 13 1 14 2015-03-17 Antti Koivisto <antti@apple.com> 2 15 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r181442 r181656 851 851 852 852 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 853 PassRefPtr<WebCore::DisplayRefreshMonitor> WebChromeClient::createDisplayRefreshMonitor(PlatformDisplayID displayID) const854 { 855 return m_page->drawingArea()->createDisplayRefreshMonitor(displayID);853 Optional<RefPtr<WebCore::DisplayRefreshMonitor>> WebChromeClient::createDisplayRefreshMonitor(PlatformDisplayID displayID) const 854 { 855 return Optional<RefPtr<WebCore::DisplayRefreshMonitor>>(m_page->drawingArea()->createDisplayRefreshMonitor(displayID)); 856 856 } 857 857 #endif -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r181442 r181656 218 218 219 219 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 220 virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;220 virtual Optional<RefPtr<WebCore::DisplayRefreshMonitor>> createDisplayRefreshMonitor(PlatformDisplayID) const override; 221 221 #endif 222 222
Note:
See TracChangeset
for help on using the changeset viewer.