[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
oliver at apple.com
oliver at apple.com
Wed Dec 22 12:30:38 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a27a7a70c9f9bda3d2fa005616c03f4438b5c060
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 24 22:55:49 2010 +0000
2010-08-24 Oliver Hunt <oliver at apple.com>
Reviewed by Geoff Garen.
Don't seed the JS random number generator from time()
https://bugs.webkit.org/show_bug.cgi?id=41868
<rdar://problem/8171025>
Switch to using the secure random number generator to
seed the fast random generator, and make the generator
be per global object.
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
(JSC::JSGlobalObject::weakRandomNumber):
* runtime/MathObject.cpp:
(JSC::mathProtoFuncRandom):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 0e26219..d96f9cd 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,26 @@
2010-08-24 Oliver Hunt <oliver at apple.com>
+ Reviewed by Geoff Garen.
+
+ Don't seed the JS random number generator from time()
+ https://bugs.webkit.org/show_bug.cgi?id=41868
+ <rdar://problem/8171025>
+
+ Switch to using the secure random number generator to
+ seed the fast random generator, and make the generator
+ be per global object.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::weakRandomNumber):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncRandom):
+
+2010-08-24 Oliver Hunt <oliver at apple.com>
+
Reviewed by Beth Dakin.
Make overflow guards in UString::utf8 explicit
diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp
index ca8605b..97f9be5 100644
--- a/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -143,7 +143,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
, firstStringifierToMark(0)
, markStack(jsArrayVPtr)
, cachedUTCOffset(NaN)
- , weakRandom(static_cast<int>(currentTime()))
, maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth)
, m_regExpCache(new RegExpCache(this))
#ifndef NDEBUG
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index 1928f77..07acb43 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -213,8 +213,6 @@ namespace JSC {
UString cachedDateString;
double cachedDateStringValue;
-
- WeakRandom weakRandom;
int maxReentryDepth;
diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h
index e57b737..359f1d9 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/JavaScriptCore/runtime/JSGlobalObject.h
@@ -31,6 +31,7 @@
#include "StringPrototype.h"
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
+#include <wtf/RandomNumber.h>
namespace JSC {
@@ -92,6 +93,7 @@ namespace JSC {
, datePrototype(0)
, regExpPrototype(0)
, methodCallDummy(0)
+ , weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
{
}
@@ -156,6 +158,7 @@ namespace JSC {
HashSet<GlobalCodeBlock*> codeBlocks;
WeakMapSet weakMaps;
+ WeakRandom weakRandom;
};
public:
@@ -295,6 +298,7 @@ namespace JSC {
d()->weakMaps.remove(map);
}
+ double weakRandomNumber() { return d()->weakRandom.get(); }
protected:
static const unsigned AnonymousSlotCount = JSVariableObject::AnonymousSlotCount + 1;
diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp
index cfbaab2..5648264 100644
--- a/JavaScriptCore/runtime/MathObject.cpp
+++ b/JavaScriptCore/runtime/MathObject.cpp
@@ -211,7 +211,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
{
- return JSValue::encode(jsDoubleNumber(exec, exec->globalData().weakRandom.get()));
+ return JSValue::encode(jsDoubleNumber(exec, exec->lexicalGlobalObject()->weakRandomNumber()));
}
EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
diff --git a/JavaScriptGlue/ChangeLog b/JavaScriptGlue/ChangeLog
index 3b56156..fe04083 100644
--- a/JavaScriptGlue/ChangeLog
+++ b/JavaScriptGlue/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-24 Oliver Hunt <oliver at apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Don't seed the JS random number generator from time()
+ https://bugs.webkit.org/show_bug.cgi?id=41868
+ <rdar://problem/8171025>
+
+ Add forwarding header for RandomNumber in JavaScriptGlue
+
+ * ForwardingHeaders/wtf/RandomNumber.h: Added.
+
2010-08-11 Gavin Barraclough <barraclough at apple.com>
Rubber stamps by Darin Adler & Sam Weinig.
diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/RandomNumber.h b/JavaScriptGlue/ForwardingHeaders/wtf/RandomNumber.h
new file mode 100644
index 0000000..42e148a
--- /dev/null
+++ b/JavaScriptGlue/ForwardingHeaders/wtf/RandomNumber.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/RandomNumber.h>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list