Changeset 117728 in webkit


Ignore:
Timestamp:
May 20, 2012 10:42:25 PM (12 years ago)
Author:
haraken@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117726 r117728  
     12012-05-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass Isolate to throwError()s in bindings/v8/*.{h,cpp}
     4        https://bugs.webkit.org/show_bug.cgi?id=86977
     5
     6        Reviewed by Adam Barth.
     7
     8        The objective is to pass Isolate around in V8 bindings.
     9        This patch passes Isolate to throwError()s in bindings/v8/*.{h,cpp}
     10        except for a couple of non-trivial cases. I'll upload a follow-up patch
     11        for the non-trivial cases.
     12
     13        No tests. No change in behavior.
     14
     15        * bindings/v8/DateExtension.cpp:
     16        (WebCore::DateExtension::OnSleepDetected):
     17        * bindings/v8/SerializedScriptValue.cpp:
     18        (WebCore::SerializedScriptValue::transferArrayBuffers):
     19        (WebCore::SerializedScriptValue::SerializedScriptValue):
     20        * bindings/v8/SerializedScriptValue.h:
     21        * bindings/v8/V8NPObject.cpp:
     22        (WebCore::npObjectInvokeImpl):
     23        (WebCore::npObjectPropertyEnumerator):
     24        * bindings/v8/V8Proxy.cpp:
     25        (WebCore::V8Proxy::checkNewLegal):
     26
    1272012-05-20  Keishi Hattori  <keishi@webkit.org>
    228
  • trunk/Source/WebCore/bindings/v8/DateExtension.cpp

    r113111 r117728  
    117117}
    118118
    119 v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments&)
     119v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments& args)
    120120{
    121     V8Proxy::throwError(V8Proxy::GeneralError, "Too much time spent in unload handler.");
     121    V8Proxy::throwError(V8Proxy::GeneralError, "Too much time spent in unload handler.", args.GetIsolate());
    122122    return v8::Undefined();
    123123}
  • trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp

    r117377 r117728  
    21552155}
    21562156
    2157 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow)
     2157PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow, v8::Isolate* isolate)
    21582158{
    21592159    for (size_t i = 0; i < arrayBuffers.size(); i++) {
    21602160        if (arrayBuffers[i]->isNeutered()) {
    2161             throwError(INVALID_STATE_ERR);
     2161            throwError(INVALID_STATE_ERR, isolate);
    21622162            didThrow = true;
    21632163            return nullptr;
     
    21772177        bool result = arrayBuffers[i]->transfer(contents->at(i), neuteredViews);
    21782178        if (!result) {
    2179             throwError(INVALID_STATE_ERR);
     2179            throwError(INVALID_STATE_ERR, isolate);
    21802180            didThrow = true;
    21812181            return nullptr;
     
    22142214        // of the TryCatch scope.
    22152215        didThrow = true;
    2216         throwError(DATA_CLONE_ERR);
     2216        throwError(DATA_CLONE_ERR, isolate);
    22172217        return;
    22182218    case Serializer::InvalidStateError:
    22192219        didThrow = true;
    2220         throwError(INVALID_STATE_ERR);
     2220        throwError(INVALID_STATE_ERR, isolate);
    22212221        return;
    22222222    case Serializer::JSFailure:
     
    22292229        m_data = String(StringImpl::adopt(writer.data())).isolatedCopy();
    22302230        if (arrayBuffers)
    2231             m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, didThrow);
     2231            m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, didThrow, isolate);
    22322232        return;
    22332233    case Serializer::JSException:
  • trunk/Source/WebCore/bindings/v8/SerializedScriptValue.h

    r117377 r117728  
    8989    explicit SerializedScriptValue(const String& wireData);
    9090
    91     static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBufferArray&, bool& didThrow);
     91    static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBufferArray&, bool& didThrow, v8::Isolate*);
    9292
    9393    String m_data;
  • trunk/Source/WebCore/bindings/v8/V8NPObject.cpp

    r117383 r117728  
    9393        // internal fields.
    9494        if (args.Holder()->InternalFieldCount() != npObjectInternalFieldCount)
    95             return V8Proxy::throwError(V8Proxy::ReferenceError, "NPMethod called on non-NPObject");
     95            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPMethod called on non-NPObject", args.GetIsolate());
    9696
    9797        npObject = v8ObjectToNPObject(args.Holder());
     
    100100    // Verify that our wrapper wasn't using a NPObject which has already been deleted.
    101101    if (!npObject || !_NPN_IsAlive(npObject))
    102         return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
     102        return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", args.GetIsolate());
    103103
    104104    // Wrap up parameters.
     
    134134
    135135    if (!retval)
    136         V8Proxy::throwError(V8Proxy::GeneralError, "Error calling method on NPObject.");
     136        V8Proxy::throwError(V8Proxy::GeneralError, "Error calling method on NPObject.", args.GetIsolate());
    137137
    138138    for (int i = 0; i < numArgs; i++)
     
    326326    // has already been deleted.
    327327    if (!npObject || !_NPN_IsAlive(npObject))
    328         V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
     328        V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", info.GetIsolate());
    329329
    330330    if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) {
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r117466 r117728  
    713713{
    714714    if (ConstructorMode::current() == ConstructorMode::CreateNewObject)
    715         return throwError(TypeError, "Illegal constructor");
     715        return throwError(TypeError, "Illegal constructor", args.GetIsolate());
    716716
    717717    return args.This();
Note: See TracChangeset for help on using the changeset viewer.