Changeset 163810 in webkit


Ignore:
Timestamp:
Feb 10, 2014, 1:37:00 PM (11 years ago)
Author:
ap@apple.com
Message:

Remove some unused functions from SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=128407

Reviewed by Oliver Hunt.

Removed functions that used Deprecated::ScriptValue

  • Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::put):

  • bindings/js/IDBBindingUtilities.cpp:

(WebCore::deserializeIDBValue):
(WebCore::deserializeIDBValueBuffer):

  • bindings/js/SerializedScriptValue.cpp:
  • bindings/js/SerializedScriptValue.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163807 r163810  
     12014-02-10  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Remove some unused functions from SerializedScriptValue
     4        https://bugs.webkit.org/show_bug.cgi?id=128407
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Removed functions that used Deprecated::ScriptValue
     9
     10        * Modules/indexeddb/IDBObjectStore.cpp:
     11        (WebCore::IDBObjectStore::put):
     12        * bindings/js/IDBBindingUtilities.cpp:
     13        (WebCore::deserializeIDBValue):
     14        (WebCore::deserializeIDBValueBuffer):
     15        * bindings/js/SerializedScriptValue.cpp:
     16        * bindings/js/SerializedScriptValue.h:
     17
    1182014-02-10  Roger Fong  <roger_fong@apple.com>
    219
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp

    r163732 r163810  
    133133    if (m_deleted) {
    134134        ec = IDBDatabaseException::InvalidStateError;
    135         return 0;
    136     }
    137     if (!m_transaction->isActive()) {
    138         ec = IDBDatabaseException::TransactionInactiveError;
    139         return 0;
     135        return nullptr;
     136    }
     137    if (!m_transaction->isActive()) {
     138        ec = IDBDatabaseException::TransactionInactiveError;
     139        return nullptr;
    140140    }
    141141    if (m_transaction->isReadOnly()) {
    142142        ec = IDBDatabaseException::ReadOnlyError;
    143         return 0;
    144     }
    145 
    146     // FIXME: Expose the JS engine exception state through ScriptState.
    147     bool didThrow = false;
    148     RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, state, nullptr, nullptr, didThrow);
    149     if (didThrow) {
    150         // Setting an explicit ExceptionCode here would defer handling the already thrown exception.
    151         return 0;
    152     }
     143        return nullptr;
     144    }
     145
     146    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(state, value.jsValue(), nullptr, nullptr);
     147    if (state->hadException())
     148        return nullptr;
    153149
    154150    if (serializedValue->blobURLs().size() > 0) {
    155151        // FIXME: Add Blob/File/FileList support
    156152        ec = IDBDatabaseException::DataCloneError;
    157         return 0;
     153        return nullptr;
    158154    }
    159155
     
    167163    if (putMode != IDBDatabaseBackend::CursorUpdate && usesInLineKeys && key) {
    168164        ec = IDBDatabaseException::DataError;
    169         return 0;
     165        return nullptr;
    170166    }
    171167    if (!usesInLineKeys && !hasKeyGenerator && !key) {
    172168        ec = IDBDatabaseException::DataError;
    173         return 0;
     169        return nullptr;
    174170    }
    175171    if (usesInLineKeys) {
     
    177173        if (keyPathKey && !keyPathKey->isValid()) {
    178174            ec = IDBDatabaseException::DataError;
    179             return 0;
     175            return nullptr;
    180176        }
    181177        if (!hasKeyGenerator && !keyPathKey) {
    182178            ec = IDBDatabaseException::DataError;
    183             return 0;
     179            return nullptr;
    184180        }
    185181        if (hasKeyGenerator && !keyPathKey) {
    186182            if (!canInjectIDBKeyIntoScriptValue(&requestState, value, keyPath)) {
    187183                ec = IDBDatabaseException::DataError;
    188                 return 0;
     184                return nullptr;
    189185            }
    190186        }
     
    194190    if (key && !key->isValid()) {
    195191        ec = IDBDatabaseException::DataError;
    196         return 0;
     192        return nullptr;
    197193    }
    198194
  • trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp

    r163662 r163810  
    300300    ExecState* exec = requestState->exec();
    301301    RefPtr<SerializedScriptValue> serializedValue = prpValue;
     302    JSValue result;
    302303    if (serializedValue)
    303         return SerializedScriptValue::deserialize(exec, serializedValue.get(), NonThrowing);
    304     return Deprecated::ScriptValue(exec->vm(), jsNull());
     304        result = serializedValue->deserialize(exec, exec->lexicalGlobalObject(), 0);
     305    else
     306        result = jsNull();
     307    return Deprecated::ScriptValue(exec->vm(), result);
    305308}
    306309
     
    325328    }
    326329
     330    JSValue result;
    327331    if (buffer.size()) {
    328332        RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(buffer);
    329         return SerializedScriptValue::deserialize(exec, serializedValue.get(), NonThrowing);
    330     }
    331 
    332     return Deprecated::ScriptValue(exec->vm(), jsNull());
     333        result = serializedValue->deserialize(exec, exec->lexicalGlobalObject(), 0, NonThrowing);
     334    } else
     335        result = jsNull();
     336
     337    return Deprecated::ScriptValue(exec->vm(), result);
    333338}
    334339
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r163732 r163810  
    26172617}
    26182618
    2619 PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const Deprecated::ScriptValue& value, JSC::ExecState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
    2620 {
    2621     RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(scriptState, value.jsValue(), messagePorts, arrayBuffers);
    2622     didThrow = scriptState->hadException();
    2623     return serializedValue.release();
    2624 }
    2625 
    2626 Deprecated::ScriptValue SerializedScriptValue::deserialize(JSC::ExecState* scriptState, SerializedScriptValue* value, SerializationErrorMode throwExceptions)
    2627 {
    2628     return Deprecated::ScriptValue(scriptState->vm(), value->deserialize(scriptState, scriptState->lexicalGlobalObject(), 0, throwExceptions));
    2629 }
    2630 
    26312619void SerializedScriptValue::maybeThrowExceptionIfSerializationFailed(ExecState* exec, SerializationReturnCode code)
    26322620{
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.h

    r163732 r163810  
    8080    JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode = Throwing);
    8181
    82     static PassRefPtr<SerializedScriptValue> create(const Deprecated::ScriptValue&, JSC::ExecState*, MessagePortArray*, ArrayBufferArray*, bool& didThrow);
    83     static Deprecated::ScriptValue deserialize(JSC::ExecState*, SerializedScriptValue*, SerializationErrorMode = Throwing);
    84 
    8582    static uint32_t wireFormatVersion();
    8683
Note: See TracChangeset for help on using the changeset viewer.