Title: [201280] releases/WebKitGTK/webkit-2.12
- Revision
- 201280
- Author
- [email protected]
- Date
- 2016-05-23 06:22:40 -0700 (Mon, 23 May 2016)
Log Message
Merge r201053 - REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations
https://bugs.webkit.org/show_bug.cgi?id=157805
<rdar://problem/26327851>
Patch by Joseph Pecoraro <[email protected]> on 2016-05-17
Reviewed by Geoffrey Garen.
Source/WTF:
* wtf/WeakRandom.h:
(WTF::WeakRandom::setSeed):
Advance once to randomize the 32bit seed across the 128bit state
and avoid re-using 64bits of state in the second advance.
LayoutTests:
* js/dom/math-random-initial-values-expected.txt: Added.
* js/dom/math-random-initial-values.html: Added.
* js/resources/math-random-initial-values-iframe.html: Added.
Test that less then 5% of the time, early Math.random invocations
produce very similiar values. Before this change we were failing
100%, but after we see similiar values mostly around 0-3%.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (201279 => 201280)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-05-23 12:58:49 UTC (rev 201279)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-05-23 13:22:40 UTC (rev 201280)
@@ -1,3 +1,18 @@
+2016-05-17 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations
+ https://bugs.webkit.org/show_bug.cgi?id=157805
+ <rdar://problem/26327851>
+
+ Reviewed by Geoffrey Garen.
+
+ * js/dom/math-random-initial-values-expected.txt: Added.
+ * js/dom/math-random-initial-values.html: Added.
+ * js/resources/math-random-initial-values-iframe.html: Added.
+ Test that less then 5% of the time, early Math.random invocations
+ produce very similiar values. Before this change we were failing
+ 100%, but after we see similiar values mostly around 0-3%.
+
2016-05-16 Brent Fulgham <[email protected]>
heap use-after-free at WebCore::TimerBase::heapPopMin()
Added: releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values-expected.txt (0 => 201280)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values-expected.txt 2016-05-23 13:22:40 UTC (rev 201280)
@@ -0,0 +1,10 @@
+This tests early Math.random values are not consistently nearly identical.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS framesWithSimiliarEarlyRandomValues <= 5 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values.html (0 => 201280)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values.html (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/js/dom/math-random-initial-values.html 2016-05-23 13:22:40 UTC (rev 201280)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+window.jsTestIsAsync = true;
+
+description("This tests early Math.random values are not consistently nearly identical.");
+
+var seen = 0;
+var expected = 100;
+var framesWithSimiliarEarlyRandomValues = 0;
+var lastRandom1 = 0;
+
+window.addEventListener("message", function(event) {
+ if (event.data.similiar)
+ framesWithSimiliarEarlyRandomValues++;
+
+ if (event.data.random1 === lastRandom1)
+ testFailed("Random number should be different between frames");
+ lastRandom1 = event.data.random1;
+
+ if (++seen === expected) {
+ shouldBeTrue("framesWithSimiliarEarlyRandomValues <= 5");
+ if (framesWithSimiliarEarlyRandomValues > 5)
+ debug("framesWithSimiliarEarlyRandomValues: " + framesWithSimiliarEarlyRandomValues);
+ finishJSTest();
+ }
+});
+
+function createFrame() {
+ var iframe = document.createElement("iframe");
+ iframe.src = ""
+ document.body.appendChild(iframe);
+}
+
+for (var i = 0; i < expected; ++i)
+ createFrame();
+</script>
+<script src=""
+</body>
+</html>
Added: releases/WebKitGTK/webkit-2.12/LayoutTests/js/resources/math-random-initial-values-iframe.html (0 => 201280)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/js/resources/math-random-initial-values-iframe.html (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/js/resources/math-random-initial-values-iframe.html 2016-05-23 13:22:40 UTC (rev 201280)
@@ -0,0 +1,6 @@
+<script>
+var random1 = Math.random();
+var random2 = Math.random();
+var similiar = Math.floor(random1 * 1000) === Math.floor(random2 * 1000);
+window.top.postMessage({similiar, random1, random2}, "*");
+</script>
Modified: releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog (201279 => 201280)
--- releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog 2016-05-23 12:58:49 UTC (rev 201279)
+++ releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog 2016-05-23 13:22:40 UTC (rev 201280)
@@ -1,3 +1,16 @@
+2016-05-17 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations
+ https://bugs.webkit.org/show_bug.cgi?id=157805
+ <rdar://problem/26327851>
+
+ Reviewed by Geoffrey Garen.
+
+ * wtf/WeakRandom.h:
+ (WTF::WeakRandom::setSeed):
+ Advance once to randomize the 32bit seed across the 128bit state
+ and avoid re-using 64bits of state in the second advance.
+
2016-04-25 Fujii Hironori <[email protected]>
Heap corruption is detected when destructing JSGlobalObject
Modified: releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/WeakRandom.h (201279 => 201280)
--- releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/WeakRandom.h 2016-05-23 12:58:49 UTC (rev 201279)
+++ releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/WeakRandom.h 2016-05-23 13:22:40 UTC (rev 201280)
@@ -56,6 +56,7 @@
m_low = seed;
m_high = seed;
+ advance();
}
unsigned seed() const { return m_seed; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes