- Revision
- 175955
- Author
- [email protected]
- Date
- 2014-11-11 10:15:46 -0800 (Tue, 11 Nov 2014)
Log Message
Merge r175655 - Assertion hit DOMTimer::updateTimerIntervalIfNecessary()
https://bugs.webkit.org/show_bug.cgi?id=138440
Reviewed by Geoffrey Garen.
Source/WebCore:
We sometimes hit the ASSERT(repeatInterval() == previousInterval)
assertion in DOMTimer::updateTimerIntervalIfNecessary() when visiting
the following pages:
http://lifehacker.com/the-healthiest-foods-for-one-handed-snacking-while-gami-1654728164
http://longform.org/posts/like-something-the-lord-made
After debugging, the issue turned out to be that we are comparing
floating point numbers using ==, and the check sometimes fails even
though the values really close to each other. This patch updates the
DOMTimer code to use WTF::withinEpsilon() instead of operator==()
to compare the floating point intervals.
I confirmed manually that the assertion is no longer hit.
* page/DOMTimer.cpp:
(WebCore::DOMTimer::updateTimerIntervalIfNecessary):
* platform/graphics/FloatQuad.cpp:
(WebCore::FloatQuad::isRectilinear):
(WebCore::withinEpsilon): Deleted.
Source/WTF:
Move the withinEpsilon() function to WTF to avoid code duplication.
* wtf/MathExtras.h:
(WTF::withinEpsilon):
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.6/Source/WTF/ChangeLog (175954 => 175955)
--- releases/WebKitGTK/webkit-2.6/Source/WTF/ChangeLog 2014-11-11 17:59:03 UTC (rev 175954)
+++ releases/WebKitGTK/webkit-2.6/Source/WTF/ChangeLog 2014-11-11 18:15:46 UTC (rev 175955)
@@ -1,3 +1,15 @@
+2014-11-05 Chris Dumez <[email protected]>
+
+ Assertion hit DOMTimer::updateTimerIntervalIfNecessary()
+ https://bugs.webkit.org/show_bug.cgi?id=138440
+
+ Reviewed by Geoffrey Garen.
+
+ Move the withinEpsilon() function to WTF to avoid code duplication.
+
+ * wtf/MathExtras.h:
+ (WTF::withinEpsilon):
+
2014-10-30 Jeffrey Pfau <[email protected]>
ASSERT(!m_deletionHasBegun) in RefCounted.h should be ASSERT_WITH_SECURITY_IMPLICATION
Modified: releases/WebKitGTK/webkit-2.6/Source/WTF/wtf/MathExtras.h (175954 => 175955)
--- releases/WebKitGTK/webkit-2.6/Source/WTF/wtf/MathExtras.h 2014-11-11 17:59:03 UTC (rev 175954)
+++ releases/WebKitGTK/webkit-2.6/Source/WTF/wtf/MathExtras.h 2014-11-11 18:15:46 UTC (rev 175955)
@@ -384,6 +384,12 @@
return log2;
}
+template <typename T>
+inline bool withinEpsilon(T a, T b)
+{
+ return std::abs(a - b) <= std::numeric_limits<T>::epsilon();
+}
+
} // namespace WTF
#endif // #ifndef WTF_MathExtras_h
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (175954 => 175955)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2014-11-11 17:59:03 UTC (rev 175954)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2014-11-11 18:15:46 UTC (rev 175955)
@@ -1,5 +1,32 @@
2014-11-05 Chris Dumez <[email protected]>
+ Assertion hit DOMTimer::updateTimerIntervalIfNecessary()
+ https://bugs.webkit.org/show_bug.cgi?id=138440
+
+ Reviewed by Geoffrey Garen.
+
+ We sometimes hit the ASSERT(repeatInterval() == previousInterval)
+ assertion in DOMTimer::updateTimerIntervalIfNecessary() when visiting
+ the following pages:
+ http://lifehacker.com/the-healthiest-foods-for-one-handed-snacking-while-gami-1654728164
+ http://longform.org/posts/like-something-the-lord-made
+
+ After debugging, the issue turned out to be that we are comparing
+ floating point numbers using ==, and the check sometimes fails even
+ though the values really close to each other. This patch updates the
+ DOMTimer code to use WTF::withinEpsilon() instead of operator==()
+ to compare the floating point intervals.
+
+ I confirmed manually that the assertion is no longer hit.
+
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimer::updateTimerIntervalIfNecessary):
+ * platform/graphics/FloatQuad.cpp:
+ (WebCore::FloatQuad::isRectilinear):
+ (WebCore::withinEpsilon): Deleted.
+
+2014-11-05 Chris Dumez <[email protected]>
+
Stop special-casing the empty string in HTMLInputElement.type setter
https://bugs.webkit.org/show_bug.cgi?id=138403
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/page/DOMTimer.cpp (175954 => 175955)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/page/DOMTimer.cpp 2014-11-11 17:59:03 UTC (rev 175954)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/page/DOMTimer.cpp 2014-11-11 18:15:46 UTC (rev 175955)
@@ -35,6 +35,7 @@
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
+#include <wtf/MathExtras.h>
#include <wtf/StdLibExtras.h>
#if PLATFORM(IOS)
@@ -261,11 +262,11 @@
double previousInterval = m_currentTimerInterval;
m_currentTimerInterval = intervalClampedToMinimum();
- if (previousInterval == m_currentTimerInterval)
+ if (WTF::withinEpsilon(previousInterval, m_currentTimerInterval))
return;
if (repeatInterval()) {
- ASSERT(repeatInterval() == previousInterval);
+ ASSERT(WTF::withinEpsilon(repeatInterval(), previousInterval));
augmentRepeatInterval(m_currentTimerInterval - previousInterval);
} else
augmentFireInterval(m_currentTimerInterval - previousInterval);
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/FloatQuad.cpp (175954 => 175955)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/FloatQuad.cpp 2014-11-11 17:59:03 UTC (rev 175954)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/FloatQuad.cpp 2014-11-11 18:15:46 UTC (rev 175955)
@@ -33,6 +33,7 @@
#include <algorithm>
#include <limits>
+#include <wtf/MathExtras.h>
namespace WebCore {
@@ -90,15 +91,10 @@
return FloatRect(left, top, right - left, bottom - top);
}
-static inline bool withinEpsilon(float a, float b)
-{
- return fabs(a - b) < std::numeric_limits<float>::epsilon();
-}
-
bool FloatQuad::isRectilinear() const
{
- return (withinEpsilon(m_p1.x(), m_p2.x()) && withinEpsilon(m_p2.y(), m_p3.y()) && withinEpsilon(m_p3.x(), m_p4.x()) && withinEpsilon(m_p4.y(), m_p1.y()))
- || (withinEpsilon(m_p1.y(), m_p2.y()) && withinEpsilon(m_p2.x(), m_p3.x()) && withinEpsilon(m_p3.y(), m_p4.y()) && withinEpsilon(m_p4.x(), m_p1.x()));
+ return (WTF::withinEpsilon(m_p1.x(), m_p2.x()) && WTF::withinEpsilon(m_p2.y(), m_p3.y()) && WTF::withinEpsilon(m_p3.x(), m_p4.x()) && WTF::withinEpsilon(m_p4.y(), m_p1.y()))
+ || (WTF::withinEpsilon(m_p1.y(), m_p2.y()) && WTF::withinEpsilon(m_p2.x(), m_p3.x()) && WTF::withinEpsilon(m_p3.y(), m_p4.y()) && WTF::withinEpsilon(m_p4.x(), m_p1.x()));
}
bool FloatQuad::containsPoint(const FloatPoint& p) const