Diff
Modified: trunk/Source/WebCore/ChangeLog (125011 => 125012)
--- trunk/Source/WebCore/ChangeLog 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/ChangeLog 2012-08-08 09:45:23 UTC (rev 125012)
@@ -1,3 +1,47 @@
+2012-08-08 Kentaro Hara <[email protected]>
+
+ [V8] Pass Isolate to ArrayValue and Dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=93315
+
+ Reviewed by Adam Barth.
+
+ This patch passes Isolate to ArrayValue and Dictionary.
+
+ Rationale 1: We want to replace V8Proxy::throwError(ExceptionCode)
+ with setDOMException(ExceptionCode, Isolate*). For the replacement,
+ we need to pass Isolate to V8Utilities::extractTransferables().
+ To pass Isolate to V8Utilities::extractTransferables(), ( ...omitted... ),
+ we need to pass Isolate to ArrayValue and Dictionary.
+
+ Rationale 2: JSC already passes ExecState to ArrayValue and Dictionary.
+
+ Tests: storage/indexeddb/*
+ fast/files/*
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateEventConstructorCallback):
+ (JSValueToNative):
+ * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
+ (WebCore::V8TestEventConstructor::constructorCallback):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::optionsObjectCallback):
+ * bindings/v8/ArrayValue.cpp:
+ (WebCore::ArrayValue::operator=):
+ (WebCore::ArrayValue::get):
+ * bindings/v8/ArrayValue.h:
+ (WebCore::ArrayValue::ArrayValue):
+ (ArrayValue):
+ * bindings/v8/Dictionary.cpp:
+ (WebCore::Dictionary::Dictionary):
+ (WebCore::Dictionary::operator=):
+ (WebCore::Dictionary::get):
+ * bindings/v8/Dictionary.h:
+ (Dictionary):
+ * bindings/v8/custom/V8BlobCustom.cpp:
+ (WebCore::V8Blob::constructorCallback):
+ * bindings/v8/custom/V8IntentConstructor.cpp:
+ (WebCore::V8Intent::constructorCallback):
+
2012-08-08 Yury Semikhatsky <[email protected]>
Web Inspector: cached images memory instrumentation regression after r124744
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (125011 => 125012)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-08 09:45:23 UTC (rev 125012)
@@ -1892,7 +1892,7 @@
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]);
${implClassName}Init eventInit;
if (args.Length() >= 2) {
- EXCEPTION_BLOCK(Dictionary, options, args[1]);
+ EXCEPTION_BLOCK(Dictionary, options, Dictionary(args[1], args.GetIsolate()));
if (!fill${implClassName}Init(eventInit, options))
return v8Undefined();
}
@@ -3744,7 +3744,7 @@
if ($type eq "Dictionary") {
AddToImplIncludes("Dictionary.h");
- return $value;
+ return "Dictionary($value, $getIsolate)";
}
if ($type eq "DOMObject") {
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -78,7 +78,7 @@
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]);
TestEventConstructorInit eventInit;
if (args.Length() >= 2) {
- EXCEPTION_BLOCK(Dictionary, options, args[1]);
+ EXCEPTION_BLOCK(Dictionary, options, Dictionary(args[1], args.GetIsolate()));
if (!fillTestEventConstructorInit(eventInit, options))
return v8Undefined();
}
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -1180,14 +1180,14 @@
if (args.Length() < 1)
return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
- EXCEPTION_BLOCK(Dictionary, oo, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
+ EXCEPTION_BLOCK(Dictionary, oo, Dictionary(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
if (!oo.isUndefinedOrNull() && !oo.isObject())
return V8Proxy::throwTypeError("Not an object.", args.GetIsolate());
if (args.Length() <= 1) {
imp->optionsObject(oo);
return v8Undefined();
}
- EXCEPTION_BLOCK(Dictionary, ooo, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
+ EXCEPTION_BLOCK(Dictionary, ooo, Dictionary(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined), args.GetIsolate()));
if (!ooo.isUndefinedOrNull() && !ooo.isObject())
return V8Proxy::throwTypeError("Not an object.", args.GetIsolate());
imp->optionsObject(oo, ooo);
Modified: trunk/Source/WebCore/bindings/v8/ArrayValue.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/ArrayValue.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/ArrayValue.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -34,6 +34,7 @@
ArrayValue& ArrayValue::operator=(const ArrayValue& other)
{
m_array = other.m_array;
+ m_isolate = other.m_isolate;
return *this;
}
@@ -63,7 +64,9 @@
if (indexedValue.IsEmpty() || !indexedValue->IsObject())
return false;
- value = Dictionary(indexedValue);
+ ASSERT(m_isolate);
+ ASSERT(m_isolate == v8::Isolate::GetCurrent());
+ value = Dictionary(indexedValue, m_isolate);
return true;
}
Modified: trunk/Source/WebCore/bindings/v8/ArrayValue.h (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/ArrayValue.h 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/ArrayValue.h 2012-08-08 09:45:23 UTC (rev 125012)
@@ -34,8 +34,13 @@
class ArrayValue {
public:
- ArrayValue() { }
- explicit ArrayValue(const v8::Local<v8::Array>& array) : m_array(array) { }
+ ArrayValue() : m_isolate(0) { }
+ explicit ArrayValue(const v8::Local<v8::Array>& array, v8::Isolate* isolate)
+ : m_array(array)
+ , m_isolate(isolate)
+ {
+ ASSERT(m_isolate);
+ }
~ArrayValue() { }
ArrayValue& operator=(const ArrayValue&);
@@ -52,6 +57,7 @@
static void operator delete(void *);
v8::Local<v8::Array> m_array;
+ v8::Isolate* m_isolate;
};
}
Modified: trunk/Source/WebCore/bindings/v8/Dictionary.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -61,12 +61,15 @@
namespace WebCore {
Dictionary::Dictionary()
+ : m_isolate(0)
{
}
-Dictionary::Dictionary(const v8::Local<v8::Value>& options)
+Dictionary::Dictionary(const v8::Local<v8::Value>& options, v8::Isolate* isolate)
: m_options(options)
+ , m_isolate(isolate)
{
+ ASSERT(m_isolate);
}
Dictionary::~Dictionary()
@@ -76,6 +79,7 @@
Dictionary& Dictionary::operator=(const Dictionary& optionsObject)
{
m_options = optionsObject.m_options;
+ m_isolate = optionsObject.m_isolate;
return *this;
}
@@ -419,8 +423,11 @@
if (!getKey(key, v8Value))
return false;
- if (v8Value->IsObject())
- value = Dictionary(v8Value);
+ if (v8Value->IsObject()) {
+ ASSERT(m_isolate);
+ ASSERT(m_isolate == v8::Isolate::GetCurrent());
+ value = Dictionary(v8Value, m_isolate);
+ }
return true;
}
@@ -452,7 +459,9 @@
if (!v8Value->IsArray())
return false;
- value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value));
+ ASSERT(m_isolate);
+ ASSERT(m_isolate == v8::Isolate::GetCurrent());
+ value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value), m_isolate);
return true;
}
Modified: trunk/Source/WebCore/bindings/v8/Dictionary.h (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/Dictionary.h 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.h 2012-08-08 09:45:23 UTC (rev 125012)
@@ -52,7 +52,7 @@
class Dictionary {
public:
Dictionary();
- Dictionary(const v8::Local<v8::Value>& options);
+ Dictionary(const v8::Local<v8::Value>& options, v8::Isolate*);
~Dictionary();
Dictionary& operator=(const Dictionary&);
@@ -104,6 +104,7 @@
static void operator delete(void *);
v8::Local<v8::Value> m_options;
+ v8::Isolate* m_isolate;
};
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -86,7 +86,7 @@
if (!args[1]->IsObject())
return V8Proxy::throwTypeError("Second argument of the constructor is not of type Object", args.GetIsolate());
- Dictionary dictionary(args[1]);
+ EXCEPTION_BLOCK(Dictionary, dictionary, Dictionary(args[1], args.GetIsolate()));
v8::TryCatch tryCatchEndings;
bool containsEndings = dictionary.get("endings", endings);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp (125011 => 125012)
--- trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp 2012-08-08 09:16:30 UTC (rev 125011)
+++ trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp 2012-08-08 09:45:23 UTC (rev 125012)
@@ -56,7 +56,7 @@
if (args.Length() == 1) {
// Use the dictionary constructor. This block will return if the
// argument isn't a valid Dictionary.
- EXCEPTION_BLOCK(Dictionary, options, args[0]);
+ EXCEPTION_BLOCK(Dictionary, options, Dictionary(args[0], args.GetIsolate()));
ExceptionCode ec = 0;
RefPtr<Intent> impl = Intent::create(ScriptState::current(), options, ec);
if (ec)