- Revision
- 117728
- Author
- [email protected]
- Date
- 2012-05-20 22:42:25 -0700 (Sun, 20 May 2012)
Log Message
[V8] Pass Isolate to throwError()s in bindings/v8/*.{h,cpp}
https://bugs.webkit.org/show_bug.cgi?id=86977
Reviewed by Adam Barth.
The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to throwError()s in bindings/v8/*.{h,cpp}
except for a couple of non-trivial cases. I'll upload a follow-up patch
for the non-trivial cases.
No tests. No change in behavior.
* bindings/v8/DateExtension.cpp:
(WebCore::DateExtension::OnSleepDetected):
* bindings/v8/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::transferArrayBuffers):
(WebCore::SerializedScriptValue::SerializedScriptValue):
* bindings/v8/SerializedScriptValue.h:
* bindings/v8/V8NPObject.cpp:
(WebCore::npObjectInvokeImpl):
(WebCore::npObjectPropertyEnumerator):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::checkNewLegal):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (117727 => 117728)
--- trunk/Source/WebCore/ChangeLog 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/ChangeLog 2012-05-21 05:42:25 UTC (rev 117728)
@@ -1,3 +1,29 @@
+2012-05-20 Kentaro Hara <[email protected]>
+
+ [V8] Pass Isolate to throwError()s in bindings/v8/*.{h,cpp}
+ https://bugs.webkit.org/show_bug.cgi?id=86977
+
+ Reviewed by Adam Barth.
+
+ The objective is to pass Isolate around in V8 bindings.
+ This patch passes Isolate to throwError()s in bindings/v8/*.{h,cpp}
+ except for a couple of non-trivial cases. I'll upload a follow-up patch
+ for the non-trivial cases.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/DateExtension.cpp:
+ (WebCore::DateExtension::OnSleepDetected):
+ * bindings/v8/SerializedScriptValue.cpp:
+ (WebCore::SerializedScriptValue::transferArrayBuffers):
+ (WebCore::SerializedScriptValue::SerializedScriptValue):
+ * bindings/v8/SerializedScriptValue.h:
+ * bindings/v8/V8NPObject.cpp:
+ (WebCore::npObjectInvokeImpl):
+ (WebCore::npObjectPropertyEnumerator):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::checkNewLegal):
+
2012-05-20 Keishi Hattori <[email protected]>
[Chromium] Enable datalist for input type email
Modified: trunk/Source/WebCore/bindings/v8/DateExtension.cpp (117727 => 117728)
--- trunk/Source/WebCore/bindings/v8/DateExtension.cpp 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/bindings/v8/DateExtension.cpp 2012-05-21 05:42:25 UTC (rev 117728)
@@ -116,9 +116,9 @@
return v8::Undefined();
}
-v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments&)
+v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments& args)
{
- V8Proxy::throwError(V8Proxy::GeneralError, "Too much time spent in unload handler.");
+ V8Proxy::throwError(V8Proxy::GeneralError, "Too much time spent in unload handler.", args.GetIsolate());
return v8::Undefined();
}
Modified: trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp (117727 => 117728)
--- trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp 2012-05-21 05:42:25 UTC (rev 117728)
@@ -2154,11 +2154,11 @@
}
}
-PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow)
+PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow, v8::Isolate* isolate)
{
for (size_t i = 0; i < arrayBuffers.size(); i++) {
if (arrayBuffers[i]->isNeutered()) {
- throwError(INVALID_STATE_ERR);
+ throwError(INVALID_STATE_ERR, isolate);
didThrow = true;
return nullptr;
}
@@ -2176,7 +2176,7 @@
bool result = arrayBuffers[i]->transfer(contents->at(i), neuteredViews);
if (!result) {
- throwError(INVALID_STATE_ERR);
+ throwError(INVALID_STATE_ERR, isolate);
didThrow = true;
return nullptr;
}
@@ -2213,11 +2213,11 @@
// If there was an input error, throw a new exception outside
// of the TryCatch scope.
didThrow = true;
- throwError(DATA_CLONE_ERR);
+ throwError(DATA_CLONE_ERR, isolate);
return;
case Serializer::InvalidStateError:
didThrow = true;
- throwError(INVALID_STATE_ERR);
+ throwError(INVALID_STATE_ERR, isolate);
return;
case Serializer::JSFailure:
// If there was a JS failure (but no exception), there's not
@@ -2228,7 +2228,7 @@
case Serializer::Success:
m_data = String(StringImpl::adopt(writer.data())).isolatedCopy();
if (arrayBuffers)
- m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, didThrow);
+ m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, didThrow, isolate);
return;
case Serializer::JSException:
// We should never get here because this case was handled above.
Modified: trunk/Source/WebCore/bindings/v8/SerializedScriptValue.h (117727 => 117728)
--- trunk/Source/WebCore/bindings/v8/SerializedScriptValue.h 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/bindings/v8/SerializedScriptValue.h 2012-05-21 05:42:25 UTC (rev 117728)
@@ -88,7 +88,7 @@
SerializedScriptValue(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferArray*, bool& didThrow, v8::Isolate*);
explicit SerializedScriptValue(const String& wireData);
- static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBufferArray&, bool& didThrow);
+ static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBufferArray&, bool& didThrow, v8::Isolate*);
String m_data;
OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
Modified: trunk/Source/WebCore/bindings/v8/V8NPObject.cpp (117727 => 117728)
--- trunk/Source/WebCore/bindings/v8/V8NPObject.cpp 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/bindings/v8/V8NPObject.cpp 2012-05-21 05:42:25 UTC (rev 117728)
@@ -92,14 +92,14 @@
// The holder object is not a subtype of HTMLPlugInElement, it must be an NPObject which has three
// internal fields.
if (args.Holder()->InternalFieldCount() != npObjectInternalFieldCount)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "NPMethod called on non-NPObject");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "NPMethod called on non-NPObject", args.GetIsolate());
npObject = v8ObjectToNPObject(args.Holder());
}
// Verify that our wrapper wasn't using a NPObject which has already been deleted.
if (!npObject || !_NPN_IsAlive(npObject))
- return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", args.GetIsolate());
// Wrap up parameters.
int numArgs = args.Length();
@@ -133,7 +133,7 @@
}
if (!retval)
- V8Proxy::throwError(V8Proxy::GeneralError, "Error calling method on NPObject.");
+ V8Proxy::throwError(V8Proxy::GeneralError, "Error calling method on NPObject.", args.GetIsolate());
for (int i = 0; i < numArgs; i++)
_NPN_ReleaseVariantValue(&npArgs[i]);
@@ -325,7 +325,7 @@
// Verify that our wrapper wasn't using a NPObject which
// has already been deleted.
if (!npObject || !_NPN_IsAlive(npObject))
- V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+ V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", info.GetIsolate());
if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) {
uint32_t count;
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (117727 => 117728)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-05-21 05:16:35 UTC (rev 117727)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-05-21 05:42:25 UTC (rev 117728)
@@ -712,7 +712,7 @@
v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
{
if (ConstructorMode::current() == ConstructorMode::CreateNewObject)
- return throwError(TypeError, "Illegal constructor");
+ return throwError(TypeError, "Illegal constructor", args.GetIsolate());
return args.This();
}