Title: [194282] branches/safari-601.4-branch/Source/WebCore
- Revision
- 194282
- Author
- matthew_han...@apple.com
- Date
- 2015-12-18 11:49:27 -0800 (Fri, 18 Dec 2015)
Log Message
Merge r192582. rdar://problem/23910980
Modified Paths
Diff
Modified: branches/safari-601.4-branch/Source/WebCore/ChangeLog (194281 => 194282)
--- branches/safari-601.4-branch/Source/WebCore/ChangeLog 2015-12-18 19:48:20 UTC (rev 194281)
+++ branches/safari-601.4-branch/Source/WebCore/ChangeLog 2015-12-18 19:49:27 UTC (rev 194282)
@@ -1,3 +1,28 @@
+2015-12-18 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r192582. rdar://problem/23910980
+
+ 2015-11-18 Chris Dumez <cdu...@apple.com>
+
+ Null dereference in Performance::Performance(WebCore::Frame*)
+ https://bugs.webkit.org/show_bug.cgi?id=151390
+
+ Reviewed by Brady Eidson.
+
+ Based on the stack trace, it appears the DocumentLoader can be null
+ when constructing the Performance object. This patch thus adds a null
+ check before trying to dereference it.
+
+ No new tests, was not able to reproduce.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::navigator):
+ (WebCore::DOMWindow::performance):
+ * page/Performance.cpp:
+ (WebCore::Performance::Performance):
+ (WebCore::Performance::scriptExecutionContext):
+ * page/Performance.h:
+
2015-12-09 Babak Shafiei <bshaf...@apple.com>
Roll out r192369.
Modified: branches/safari-601.4-branch/Source/WebCore/page/DOMWindow.cpp (194281 => 194282)
--- branches/safari-601.4-branch/Source/WebCore/page/DOMWindow.cpp 2015-12-18 19:48:20 UTC (rev 194281)
+++ branches/safari-601.4-branch/Source/WebCore/page/DOMWindow.cpp 2015-12-18 19:49:27 UTC (rev 194282)
@@ -724,7 +724,7 @@
Navigator* DOMWindow::navigator() const
{
if (!isCurrentlyDisplayedInFrame())
- return 0;
+ return nullptr;
if (!m_navigator)
m_navigator = Navigator::create(m_frame);
return m_navigator.get();
@@ -734,9 +734,9 @@
Performance* DOMWindow::performance() const
{
if (!isCurrentlyDisplayedInFrame())
- return 0;
+ return nullptr;
if (!m_performance)
- m_performance = Performance::create(m_frame);
+ m_performance = Performance::create(*m_frame);
return m_performance.get();
}
#endif
Modified: branches/safari-601.4-branch/Source/WebCore/page/Performance.cpp (194281 => 194282)
--- branches/safari-601.4-branch/Source/WebCore/page/Performance.cpp 2015-12-18 19:48:20 UTC (rev 194281)
+++ branches/safari-601.4-branch/Source/WebCore/page/Performance.cpp 2015-12-18 19:49:27 UTC (rev 194282)
@@ -30,10 +30,13 @@
*/
#include "config.h"
+
+#if ENABLE(WEB_TIMING)
#include "Performance.h"
#include "Document.h"
#include "DocumentLoader.h"
+#include "Frame.h"
#include "PerformanceEntry.h"
#include "PerformanceNavigation.h"
#include "PerformanceResourceTiming.h"
@@ -42,22 +45,18 @@
#include "ResourceResponse.h"
#include <wtf/CurrentTime.h>
-#if ENABLE(WEB_TIMING)
-
-#include "Frame.h"
-
namespace WebCore {
#if ENABLE(RESOURCE_TIMING)
static const size_t defaultResourceTimingBufferSize = 150;
#endif
-Performance::Performance(Frame* frame)
- : DOMWindowProperty(frame)
+Performance::Performance(Frame& frame)
+ : DOMWindowProperty(&frame)
#if ENABLE(RESOURCE_TIMING)
, m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
#endif // ENABLE(RESOURCE_TIMING)
- , m_referenceTime(frame->document()->loader()->timing().referenceMonotonicTime())
+ , m_referenceTime(frame.document()->loader() ? frame.document()->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime())
#if ENABLE(USER_TIMING)
, m_userTiming(nullptr)
#endif // ENABLE(USER_TIMING)
@@ -72,7 +71,7 @@
ScriptExecutionContext* Performance::scriptExecutionContext() const
{
if (!frame())
- return 0;
+ return nullptr;
return frame()->document();
}
@@ -231,7 +230,7 @@
double Performance::now() const
{
- double nowSeconds = WTF::monotonicallyIncreasingTime() - m_referenceTime;
+ double nowSeconds = monotonicallyIncreasingTime() - m_referenceTime;
const double resolutionSeconds = 0.000005;
return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds;
}
Modified: branches/safari-601.4-branch/Source/WebCore/page/Performance.h (194281 => 194282)
--- branches/safari-601.4-branch/Source/WebCore/page/Performance.h 2015-12-18 19:48:20 UTC (rev 194281)
+++ branches/safari-601.4-branch/Source/WebCore/page/Performance.h 2015-12-18 19:49:27 UTC (rev 194282)
@@ -54,7 +54,7 @@
class Performance final : public ScriptWrappable, public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData {
public:
- static Ref<Performance> create(Frame* frame) { return adoptRef(*new Performance(frame)); }
+ static Ref<Performance> create(Frame& frame) { return adoptRef(*new Performance(frame)); }
~Performance();
virtual EventTargetInterface eventTargetInterface() const override { return PerformanceEventTargetInterfaceType; }
@@ -89,7 +89,7 @@
#endif // ENABLE(USER_TIMING)
private:
- explicit Performance(Frame*);
+ explicit Performance(Frame&);
virtual void refEventTarget() override { ref(); }
virtual void derefEventTarget() override { deref(); }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes