Changeset 192582 in webkit
- Timestamp:
- Nov 18, 2015 11:07:54 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r192578 r192582 1 2015-11-18 Chris Dumez <cdumez@apple.com> 2 3 Null dereference in Performance::Performance(WebCore::Frame*) 4 https://bugs.webkit.org/show_bug.cgi?id=151390 5 6 Reviewed by Brady Eidson. 7 8 Based on the stack trace, it appears the DocumentLoader can be null 9 when constructing the Performance object. This patch thus adds a null 10 check before trying to dereference it. 11 12 No new tests, was not able to reproduce. 13 14 * page/DOMWindow.cpp: 15 (WebCore::DOMWindow::navigator): 16 (WebCore::DOMWindow::performance): 17 * page/Performance.cpp: 18 (WebCore::Performance::Performance): 19 (WebCore::Performance::scriptExecutionContext): 20 * page/Performance.h: 21 1 22 2015-11-18 Per Arne Vollan <peavo@outlook.com> 2 23 -
trunk/Source/WebCore/page/DOMWindow.cpp
r192354 r192582 724 724 { 725 725 if (!isCurrentlyDisplayedInFrame()) 726 return 0;726 return nullptr; 727 727 if (!m_navigator) 728 728 m_navigator = Navigator::create(m_frame); … … 734 734 { 735 735 if (!isCurrentlyDisplayedInFrame()) 736 return 0;736 return nullptr; 737 737 if (!m_performance) 738 m_performance = Performance::create( m_frame);738 m_performance = Performance::create(*m_frame); 739 739 return m_performance.get(); 740 740 } -
trunk/Source/WebCore/page/Performance.cpp
r186208 r192582 31 31 32 32 #include "config.h" 33 34 #if ENABLE(WEB_TIMING) 33 35 #include "Performance.h" 34 36 35 37 #include "Document.h" 36 38 #include "DocumentLoader.h" 39 #include "Frame.h" 37 40 #include "PerformanceEntry.h" 38 41 #include "PerformanceNavigation.h" … … 43 46 #include <wtf/CurrentTime.h> 44 47 45 #if ENABLE(WEB_TIMING)46 47 #include "Frame.h"48 49 48 namespace WebCore { 50 49 … … 53 52 #endif 54 53 55 Performance::Performance(Frame *frame)56 : DOMWindowProperty( frame)54 Performance::Performance(Frame& frame) 55 : DOMWindowProperty(&frame) 57 56 #if ENABLE(RESOURCE_TIMING) 58 57 , m_resourceTimingBufferSize(defaultResourceTimingBufferSize) 59 58 #endif // ENABLE(RESOURCE_TIMING) 60 , m_referenceTime(frame ->document()->loader()->timing().referenceMonotonicTime())59 , m_referenceTime(frame.document()->loader() ? frame.document()->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime()) 61 60 #if ENABLE(USER_TIMING) 62 61 , m_userTiming(nullptr) … … 73 72 { 74 73 if (!frame()) 75 return 0;74 return nullptr; 76 75 return frame()->document(); 77 76 } … … 232 231 double Performance::now() const 233 232 { 234 double nowSeconds = WTF::monotonicallyIncreasingTime() - m_referenceTime;233 double nowSeconds = monotonicallyIncreasingTime() - m_referenceTime; 235 234 const double resolutionSeconds = 0.000005; 236 235 return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds; -
trunk/Source/WebCore/page/Performance.h
r184066 r192582 55 55 class Performance final : public ScriptWrappable, public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData { 56 56 public: 57 static Ref<Performance> create(Frame *frame) { return adoptRef(*new Performance(frame)); }57 static Ref<Performance> create(Frame& frame) { return adoptRef(*new Performance(frame)); } 58 58 ~Performance(); 59 59 … … 90 90 91 91 private: 92 explicit Performance(Frame *);92 explicit Performance(Frame&); 93 93 94 94 virtual void refEventTarget() override { ref(); }
Note: See TracChangeset
for help on using the changeset viewer.