Changeset 199643 in webkit
- Timestamp:
- Apr 17, 2016, 11:49:53 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 27 edited
-
ChangeLog (modified) (1 diff)
-
Modules/indexeddb/IDBAny.cpp (modified) (2 diffs)
-
Modules/indexeddb/IDBAny.h (modified) (5 diffs)
-
Modules/indexeddb/IDBCursor.cpp (modified) (8 diffs)
-
Modules/indexeddb/IDBCursor.h (modified) (3 diffs)
-
Modules/indexeddb/IDBCursor.idl (modified) (1 diff)
-
Modules/indexeddb/IDBCursorWithValue.idl (modified) (1 diff)
-
Modules/indexeddb/IDBFactory.cpp (modified) (2 diffs)
-
Modules/indexeddb/IDBIndex.cpp (modified) (4 diffs)
-
Modules/indexeddb/IDBKeyRange.cpp (modified) (6 diffs)
-
Modules/indexeddb/IDBKeyRange.h (modified) (1 diff)
-
Modules/indexeddb/IDBKeyRange.idl (modified) (1 diff)
-
Modules/indexeddb/IDBObjectStore.cpp (modified) (4 diffs)
-
Modules/indexeddb/IDBRequest.cpp (modified) (4 diffs)
-
Modules/indexeddb/server/MemoryObjectStore.cpp (modified) (3 diffs)
-
Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (modified) (2 diffs)
-
Modules/indexeddb/server/UniqueIDBDatabase.cpp (modified) (1 diff)
-
bindings/js/IDBBindingUtilities.cpp (modified) (12 diffs)
-
bindings/js/IDBBindingUtilities.h (modified) (3 diffs)
-
bindings/js/JSIDBAnyCustom.cpp (modified) (1 diff)
-
bindings/js/JSIDBDatabaseCustom.cpp (modified) (1 diff)
-
bindings/js/JSIDBObjectStoreCustom.cpp (modified) (1 diff)
-
bindings/scripts/CodeGeneratorJS.pm (modified) (1 diff)
-
bindings/scripts/IDLAttributes.txt (modified) (1 diff)
-
dom/ScriptExecutionContext.cpp (modified) (1 diff)
-
dom/ScriptExecutionContext.h (modified) (1 diff)
-
inspector/InspectorIndexedDBAgent.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199642 r199643 1 2016-04-17 Brady Eidson <beidson@apple.com> 2 3 Clean up IDBBindingUtilities. 4 https://bugs.webkit.org/show_bug.cgi?id=156472 5 6 Reviewed by Alex Christensen. 7 8 No new tests (No change in behavior). 9 10 - Get rid of a whole bunch of unused functions (since we got rid of Legacy IDB). 11 - Make more functions deal in ExecState/ScriptExecutionContexts instead of DOMRequestState. 12 - Make more functions deal in JSValue (as JSC::Strong<JSC::Unknown>) instead of Deprecated::ScriptValue. 13 14 * bindings/scripts/IDLAttributes.txt: Add a new attribute to signify that an implementation returns 15 JSValues instead of Deprecated::ScriptState 16 * bindings/scripts/CodeGeneratorJS.pm: 17 (NativeToJSValue): Use that new attribute. 18 19 * Modules/indexeddb/IDBAny.cpp: 20 (WebCore::IDBAny::IDBAny): 21 (WebCore::IDBAny::scriptValue): 22 * Modules/indexeddb/IDBAny.h: 23 (WebCore::IDBAny::create): 24 25 * Modules/indexeddb/IDBCursor.cpp: 26 (WebCore::IDBCursor::key): 27 (WebCore::IDBCursor::primaryKey): 28 (WebCore::IDBCursor::value): 29 (WebCore::IDBCursor::update): 30 (WebCore::IDBCursor::continueFunction): 31 (WebCore::IDBCursor::deleteFunction): 32 (WebCore::IDBCursor::setGetResult): 33 * Modules/indexeddb/IDBCursor.h: 34 * Modules/indexeddb/IDBCursor.idl: 35 * Modules/indexeddb/IDBCursorWithValue.idl: 36 37 * Modules/indexeddb/IDBFactory.cpp: 38 (WebCore::IDBFactory::cmp): 39 40 * Modules/indexeddb/IDBIndex.cpp: 41 (WebCore::IDBIndex::count): 42 (WebCore::IDBIndex::get): 43 (WebCore::IDBIndex::getKey): 44 45 * Modules/indexeddb/IDBKeyRange.cpp: 46 (WebCore::IDBKeyRange::lowerValue): 47 (WebCore::IDBKeyRange::upperValue): 48 (WebCore::IDBKeyRange::only): 49 (WebCore::IDBKeyRange::lowerBound): 50 (WebCore::IDBKeyRange::upperBound): 51 (WebCore::IDBKeyRange::bound): 52 * Modules/indexeddb/IDBKeyRange.h: 53 * Modules/indexeddb/IDBKeyRange.idl: 54 55 * Modules/indexeddb/IDBObjectStore.cpp: 56 (WebCore::IDBObjectStore::get): 57 (WebCore::IDBObjectStore::modernDelete): 58 (WebCore::IDBObjectStore::count): 59 60 * Modules/indexeddb/IDBRequest.cpp: 61 (WebCore::IDBRequest::setResult): 62 (WebCore::IDBRequest::setResultToStructuredClone): 63 64 * Modules/indexeddb/server/MemoryObjectStore.cpp: 65 (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord): 66 (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords): 67 68 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 69 (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): 70 (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): 71 72 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 73 (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): 74 75 * bindings/js/IDBBindingUtilities.cpp: 76 (WebCore::idbKeyPathFromValue): 77 (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath): 78 (WebCore::injectIDBKeyIntoScriptValue): 79 (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath): 80 (WebCore::canInjectIDBKeyIntoScriptValue): 81 (WebCore::deserializeIDBValueToJSValue): 82 (WebCore::deserializeIDBValueDataToJSValue): 83 (WebCore::scriptValueToIDBKey): 84 (WebCore::idbKeyDataToScriptValue): 85 (WebCore::idbKeyDataToJSValue): Deleted. 86 (WebCore::createIDBKeyFromScriptValueAndKeyPath): Deleted. 87 (WebCore::deserializeIDBValue): Deleted. 88 (WebCore::deserializeIDBValueData): Deleted. 89 (WebCore::deserializeIDBValueBuffer): Deleted. 90 (WebCore::idbValueDataToJSValue): Deleted. 91 (WebCore::idbKeyToScriptValue): Deleted. 92 * bindings/js/IDBBindingUtilities.h: 93 94 * bindings/js/JSIDBAnyCustom.cpp: 95 (WebCore::toJS): 96 97 * bindings/js/JSIDBDatabaseCustom.cpp: 98 (WebCore::JSIDBDatabase::createObjectStore): 99 100 * bindings/js/JSIDBObjectStoreCustom.cpp: 101 (WebCore::JSIDBObjectStore::createIndex): 102 103 * dom/ScriptExecutionContext.cpp: 104 (WebCore::ScriptExecutionContext::execState): 105 * dom/ScriptExecutionContext.h: 106 107 * inspector/InspectorIndexedDBAgent.cpp: 108 1 109 2016-04-17 Darin Adler <darin@apple.com> 2 110 -
trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp
r199323 r199643 79 79 } 80 80 81 IDBAny::IDBAny(const Deprecated::ScriptValue& value)81 IDBAny::IDBAny(const JSC::Strong<JSC::Unknown>& value) 82 82 : m_type(IDBAny::Type::ScriptValue) 83 83 , m_scriptValue(value) … … 134 134 } 135 135 136 const Deprecated::ScriptValue&IDBAny::scriptValue()136 JSC::JSValue IDBAny::scriptValue() 137 137 { 138 return m_scriptValue ;138 return m_scriptValue.get(); 139 139 } 140 140 -
trunk/Source/WebCore/Modules/indexeddb/IDBAny.h
r199323 r199643 30 30 #include "IDBKeyPath.h" 31 31 #include "ScriptWrappable.h" 32 #include <bindings/ScriptValue.h> 32 #include <heap/Strong.h> 33 #include <runtime/JSCJSValue.h> 33 34 #include <wtf/RefCounted.h> 34 35 … … 71 72 } 72 73 73 static RefPtr<IDBAny> create(const Deprecated::ScriptValue& value)74 static RefPtr<IDBAny> create(const JSC::Strong<JSC::Unknown>& value) 74 75 { 75 76 return adoptRef(new IDBAny(value)); … … 109 110 RefPtr<IDBObjectStore> idbObjectStore(); 110 111 RefPtr<IDBTransaction> idbTransaction(); 111 const Deprecated::ScriptValue&scriptValue();112 JSC::JSValue scriptValue(); 112 113 int64_t integer(); 113 114 const String& string(); … … 121 122 explicit IDBAny(Ref<IDBCursor>&&); 122 123 explicit IDBAny(const IDBKeyPath&); 123 explicit IDBAny(const Deprecated::ScriptValue&);124 explicit IDBAny(const JSC::Strong<JSC::Unknown>&); 124 125 125 126 IDBAny::Type m_type { IDBAny::Type::Undefined }; … … 131 132 132 133 const IDBKeyPath m_idbKeyPath; 133 const Deprecated::ScriptValuem_scriptValue;134 JSC::Strong<JSC::Unknown> m_scriptValue; 134 135 const String m_string; 135 136 const int64_t m_integer { 0 }; -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
r199524 r199643 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "DOMRequestState.h"32 31 #include "ExceptionCode.h" 33 32 #include "IDBBindingUtilities.h" … … 41 40 #include <wtf/NeverDestroyed.h> 42 41 42 using namespace JSC; 43 43 44 namespace WebCore { 44 45 … … 158 159 } 159 160 160 const Deprecated::ScriptValue& IDBCursor::key() const161 { 162 return m_ deprecatedCurrentKey;163 } 164 165 const Deprecated::ScriptValue& IDBCursor::primaryKey() const166 { 167 return m_ deprecatedCurrentPrimaryKey;168 } 169 170 const Deprecated::ScriptValue& IDBCursor::value() const171 { 172 return m_ deprecatedCurrentValue;161 JSValue IDBCursor::key(ExecState&) const 162 { 163 return m_currentKey.get(); 164 } 165 166 JSValue IDBCursor::primaryKey(ExecState&) const 167 { 168 return m_currentPrimaryKey.get(); 169 } 170 171 JSValue IDBCursor::value(ExecState&) const 172 { 173 return m_currentValue.get(); 173 174 } 174 175 … … 225 226 } 226 227 227 auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_ deprecatedCurrentPrimaryKey.jsValue(), ec);228 auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_currentPrimaryKey.get(), ec); 228 229 if (ec.code) 229 230 return nullptr; … … 281 282 void IDBCursor::continueFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCodeWithMessage& ec) 282 283 { 283 DOMRequestState requestState(&context);284 284 RefPtr<IDBKey> key; 285 285 if (!keyValue.jsValue().isUndefined()) 286 key = scriptValueToIDBKey( &requestState, keyValue);286 key = scriptValueToIDBKey(context, keyValue); 287 287 288 288 continueFunction(key.get(), ec); … … 381 381 } 382 382 383 auto request = effectiveObjectStore().modernDelete(context, m_ deprecatedCurrentPrimaryKey.jsValue(), ec);383 auto request = effectiveObjectStore().modernDelete(context, m_currentPrimaryKey.get(), ec); 384 384 if (ec.code) 385 385 return nullptr; … … 401 401 402 402 if (!getResult.isDefined()) { 403 m_ deprecatedCurrentKey = { };403 m_currentKey = { }; 404 404 m_currentKeyData = { }; 405 m_ deprecatedCurrentPrimaryKey = { };405 m_currentPrimaryKey = { }; 406 406 m_currentPrimaryKeyData = { }; 407 m_ deprecatedCurrentValue = { };407 m_currentValue = { }; 408 408 409 409 m_gotValue = false; … … 411 411 } 412 412 413 m_ deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());413 m_currentKey = idbKeyDataToScriptValue(*context, getResult.keyData()); 414 414 m_currentKeyData = getResult.keyData(); 415 m_ deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());415 m_currentPrimaryKey = idbKeyDataToScriptValue(*context, getResult.primaryKeyData()); 416 416 m_currentPrimaryKeyData = getResult.primaryKeyData(); 417 417 418 418 if (isKeyCursor()) 419 m_ deprecatedCurrentValue = { };419 m_currentValue = { }; 420 420 else 421 m_ deprecatedCurrentValue = deserializeIDBValue(*context, getResult.value());421 m_currentValue = deserializeIDBValueToJSValue(*context, getResult.value()); 422 422 423 423 m_gotValue = true; -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h
r199323 r199643 32 32 #include "IDBAny.h" 33 33 #include "IDBCursorInfo.h" 34 #include <runtime/JSCJSValue.h> 34 35 35 36 namespace WebCore { … … 57 58 // Implement the IDL 58 59 const String& direction() const; 59 const Deprecated::ScriptValue& key() const;60 const Deprecated::ScriptValue& primaryKey() const;61 const Deprecated::ScriptValue& value() const;60 JSC::JSValue key(JSC::ExecState&) const; 61 JSC::JSValue primaryKey(JSC::ExecState&) const; 62 JSC::JSValue value(JSC::ExecState&) const; 62 63 IDBAny* source(); 63 64 … … 112 113 IDBKeyData m_currentPrimaryKeyData; 113 114 114 // FIXME: When ditching Legacy IDB and combining this implementation with the abstract IDBCursor, 115 // these Deprecated::ScriptValue members should be JSValues instead. 116 Deprecated::ScriptValue m_deprecatedCurrentKey; 117 Deprecated::ScriptValue m_deprecatedCurrentPrimaryKey; 118 Deprecated::ScriptValue m_deprecatedCurrentValue; 115 JSC::Strong<JSC::Unknown> m_currentKey; 116 JSC::Strong<JSC::Unknown> m_currentPrimaryKey; 117 JSC::Strong<JSC::Unknown> m_currentValue; 119 118 }; 120 119 -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl
r199323 r199643 33 33 readonly attribute IDBAny source; 34 34 readonly attribute DOMString direction; 35 readonly attribute any key;36 readonly attribute any primaryKey;35 [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any key; 36 [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any primaryKey; 37 37 38 38 [CallWith=ScriptState, RaisesExceptionWithMessage] IDBRequest update(any value); -
trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl
r199323 r199643 31 31 JSCustomMarkFunction, 32 32 ] interface IDBCursorWithValue : IDBCursor { 33 readonly attribute any value;33 [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any value; 34 34 }; -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp
r199323 r199643 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "DOMRequestState.h"32 31 #include "Document.h" 33 32 #include "ExceptionCode.h" … … 150 149 short IDBFactory::cmp(ScriptExecutionContext& context, const Deprecated::ScriptValue& firstValue, const Deprecated::ScriptValue& secondValue, ExceptionCodeWithMessage& ec) 151 150 { 152 DOMRequestState requestState(&context); 153 RefPtr<IDBKey> first = scriptValueToIDBKey(&requestState, firstValue); 154 RefPtr<IDBKey> second = scriptValueToIDBKey(&requestState, secondValue); 151 RefPtr<IDBKey> first = scriptValueToIDBKey(context, firstValue); 152 RefPtr<IDBKey> second = scriptValueToIDBKey(context, secondValue); 155 153 156 154 ASSERT(first); -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp
r199323 r199643 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "DOMRequestState.h"32 31 #include "IDBAny.h" 33 32 #include "IDBBindingUtilities.h" … … 161 160 LOG(IndexedDB, "IDBIndex::count"); 162 161 163 DOMRequestState requestState(&context); 164 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 162 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 165 163 if (!idbKey || idbKey->type() == KeyType::Invalid) { 166 164 ec.code = IDBDatabaseException::DataError; … … 243 241 LOG(IndexedDB, "IDBIndex::get"); 244 242 245 DOMRequestState requestState(&context); 246 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 243 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 247 244 if (!idbKey || idbKey->type() == KeyType::Invalid) { 248 245 ec.code = IDBDatabaseException::DataError; … … 288 285 LOG(IndexedDB, "IDBIndex::getKey"); 289 286 290 DOMRequestState requestState(&context); 291 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 287 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 292 288 if (!idbKey || idbKey->type() == KeyType::Invalid) { 293 289 ec.code = IDBDatabaseException::DataError; -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp
r199323 r199643 27 27 #include "IDBKeyRange.h" 28 28 29 #include "DOMRequestState.h"30 29 #include "IDBBindingUtilities.h" 31 30 #include "IDBDatabaseException.h" 32 31 #include "IDBKey.h" 32 #include "IDBKeyData.h" 33 33 34 34 #if ENABLE(INDEXED_DATABASE) 35 36 using namespace JSC; 35 37 36 38 namespace WebCore { … … 50 52 } 51 53 52 Deprecated::ScriptValue IDBKeyRange::lowerValue(ScriptExecutionContext& context) const54 JSValue IDBKeyRange::lowerValue(ScriptExecutionContext& context) const 53 55 { 54 DOMRequestState requestState(&context); 55 return idbKeyToScriptValue(&requestState, m_lower); 56 return idbKeyDataToScriptValue(context, IDBKeyData(m_lower.get())).get(); 56 57 } 57 58 58 Deprecated::ScriptValue IDBKeyRange::upperValue(ScriptExecutionContext& context) const59 JSValue IDBKeyRange::upperValue(ScriptExecutionContext& context) const 59 60 { 60 DOMRequestState requestState(&context); 61 return idbKeyToScriptValue(&requestState, m_upper); 61 return idbKeyDataToScriptValue(context, IDBKeyData(m_upper.get())).get(); 62 62 } 63 63 … … 74 74 RefPtr<IDBKeyRange> IDBKeyRange::only(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCode& ec) 75 75 { 76 DOMRequestState requestState(&context); 77 RefPtr<IDBKey> key = scriptValueToIDBKey(&requestState, keyValue); 76 RefPtr<IDBKey> key = scriptValueToIDBKey(context, keyValue); 78 77 if (!key || !key->isValid()) { 79 78 ec = IDBDatabaseException::DataError; … … 86 85 RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ScriptExecutionContext& context, const Deprecated::ScriptValue& boundValue, bool open, ExceptionCode& ec) 87 86 { 88 DOMRequestState requestState(&context); 89 RefPtr<IDBKey> bound = scriptValueToIDBKey(&requestState, boundValue); 87 RefPtr<IDBKey> bound = scriptValueToIDBKey(context, boundValue); 90 88 if (!bound || !bound->isValid()) { 91 89 ec = IDBDatabaseException::DataError; … … 98 96 RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ScriptExecutionContext& context, const Deprecated::ScriptValue& boundValue, bool open, ExceptionCode& ec) 99 97 { 100 DOMRequestState requestState(&context); 101 RefPtr<IDBKey> bound = scriptValueToIDBKey(&requestState, boundValue); 98 RefPtr<IDBKey> bound = scriptValueToIDBKey(context, boundValue); 102 99 if (!bound || !bound->isValid()) { 103 100 ec = IDBDatabaseException::DataError; … … 110 107 RefPtr<IDBKeyRange> IDBKeyRange::bound(ScriptExecutionContext& context, const Deprecated::ScriptValue& lowerValue, const Deprecated::ScriptValue& upperValue, bool lowerOpen, bool upperOpen, ExceptionCode& ec) 111 108 { 112 DOMRequestState requestState(&context); 113 RefPtr<IDBKey> lower = scriptValueToIDBKey(&requestState, lowerValue); 114 RefPtr<IDBKey> upper = scriptValueToIDBKey(&requestState, upperValue); 109 RefPtr<IDBKey> lower = scriptValueToIDBKey(context, lowerValue); 110 RefPtr<IDBKey> upper = scriptValueToIDBKey(context, upperValue); 115 111 116 112 if (!lower || !lower->isValid() || !upper || !upper->isValid()) { -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h
r199323 r199643 59 59 IDBKey* upper() const { return m_upper.get(); } 60 60 61 Deprecated::ScriptValue lowerValue(ScriptExecutionContext&) const;62 Deprecated::ScriptValue upperValue(ScriptExecutionContext&) const;61 JSC::JSValue lowerValue(ScriptExecutionContext&) const; 62 JSC::JSValue upperValue(ScriptExecutionContext&) const; 63 63 bool lowerOpen() const { return m_lowerType == LowerBoundOpen; } 64 64 bool upperOpen() const { return m_upperType == UpperBoundOpen; } -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl
r199323 r199643 29 29 EnabledAtRuntime=IndexedDB, 30 30 ] interface IDBKeyRange { 31 [ImplementedAs=lowerValue, CallWith=ScriptExecutionContext] readonly attribute any lower;32 [ImplementedAs=upperValue, CallWith=ScriptExecutionContext] readonly attribute any upper;31 [ImplementedAs=lowerValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any lower; 32 [ImplementedAs=upperValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any upper; 33 33 readonly attribute boolean lowerOpen; 34 34 readonly attribute boolean upperOpen; -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
r199323 r199643 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "DOMRequestState.h"32 31 #include "DOMStringList.h" 33 32 #include "IDBBindingUtilities.h" … … 183 182 } 184 183 185 DOMRequestState requestState(&context); 186 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 184 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 187 185 if (!idbKey || idbKey->type() == KeyType::Invalid) { 188 186 ec.code = IDBDatabaseException::DataError; … … 400 398 RefPtr<IDBRequest> IDBObjectStore::modernDelete(ScriptExecutionContext& context, JSC::JSValue key, ExceptionCodeWithMessage& ec) 401 399 { 402 DOMRequestState requestState(&context); 403 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 400 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 404 401 if (!idbKey || idbKey->type() == KeyType::Invalid) { 405 402 ec.code = IDBDatabaseException::DataError; … … 595 592 LOG(IndexedDB, "IDBObjectStore::count"); 596 593 597 DOMRequestState requestState(&context); 598 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key); 594 RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key); 599 595 if (!idbKey || idbKey->type() == KeyType::Invalid) { 600 596 ec.code = IDBDatabaseException::DataError; -
trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
r199581 r199643 30 30 31 31 #include "DOMError.h" 32 #include "DOMRequestState.h"33 32 #include "Event.h" 34 33 #include "EventQueue.h" … … 327 326 void IDBRequest::setResult(const IDBKeyData* keyData) 328 327 { 329 if (!keyData) { 328 auto* context = scriptExecutionContext(); 329 if (!context || !keyData) { 330 330 m_result = nullptr; 331 331 return; 332 332 } 333 333 334 Deprecated::ScriptValue value = idbKeyDataToScriptValue(scriptExecutionContext(), *keyData); 335 m_result = IDBAny::create(WTFMove(value)); 334 m_result = IDBAny::create(idbKeyDataToScriptValue(*context, *keyData)); 336 335 } 337 336 … … 339 338 { 340 339 ASSERT(scriptExecutionContext()); 341 m_result = IDBAny::create( Deprecated::ScriptValue(scriptExecutionContext()->vm(), JSC::JSValue(number)));340 m_result = IDBAny::create(JSC::Strong<JSC::Unknown>(scriptExecutionContext()->vm(), JSC::JSValue(number))); 342 341 } 343 342 … … 350 349 return; 351 350 352 Deprecated::ScriptValue scriptValue = deserializeIDBValue(*context, value); 353 m_result = IDBAny::create(WTFMove(scriptValue)); 351 m_result = IDBAny::create(deserializeIDBValueToJSValue(*context, value)); 354 352 } 355 353 -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
r199323 r199643 302 302 JSLockHolder locker(UniqueIDBDatabase::databaseThreadVM()); 303 303 304 auto jsValue = idbValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), value);304 auto jsValue = deserializeIDBValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), value); 305 305 if (jsValue.isUndefinedOrNull()) 306 306 return { }; … … 311 311 for (auto& index : m_indexesByName.values()) { 312 312 IndexKey indexKey; 313 generateIndexKeyForValue(UniqueIDBDatabase::databaseThreadExecState(), index->info(), jsValue , indexKey);313 generateIndexKeyForValue(UniqueIDBDatabase::databaseThreadExecState(), index->info(), jsValue.get(), indexKey); 314 314 315 315 if (indexKey.isNull()) … … 340 340 341 341 for (auto iterator : *m_keyValueStore) { 342 auto jsValue = idbValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), iterator.value);342 auto jsValue = deserializeIDBValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), iterator.value); 343 343 if (jsValue.isUndefinedOrNull()) 344 344 return { }; 345 345 346 346 IndexKey indexKey; 347 generateIndexKeyForValue(UniqueIDBDatabase::databaseThreadExecState(), index.info(), jsValue , indexKey);347 generateIndexKeyForValue(UniqueIDBDatabase::databaseThreadExecState(), index.info(), jsValue.get(), indexKey); 348 348 349 349 if (indexKey.isNull()) -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r199524 r199643 1469 1469 1470 1470 IndexKey indexKey; 1471 generateIndexKeyForValue(*m_globalObject->globalExec(), info, jsValue , indexKey);1471 generateIndexKeyForValue(*m_globalObject->globalExec(), info, jsValue.get(), indexKey); 1472 1472 1473 1473 if (indexKey.isNull()) … … 1489 1489 for (auto& index : info.indexMap().values()) { 1490 1490 IndexKey indexKey; 1491 generateIndexKeyForValue(*m_globalObject->globalExec(), index, jsValue , indexKey);1491 generateIndexKeyForValue(*m_globalObject->globalExec(), index, jsValue.get(), indexKey); 1492 1492 1493 1493 if (indexKey.isNull()) -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r199250 r199643 766 766 JSLockHolder locker(databaseThreadVM()); 767 767 768 JSValuevalue = deserializeIDBValueDataToJSValue(databaseThreadExecState(), originalRecordValue.data());769 if (value. isUndefined()) {768 auto value = deserializeIDBValueDataToJSValue(databaseThreadExecState(), originalRecordValue.data()); 769 if (value.get().isUndefined()) { 770 770 m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to deserialize record value for record key injection")), usedKey)); 771 771 return; 772 772 } 773 773 774 if (!injectIDBKeyIntoScriptValue(databaseThreadExecState(), usedKey, value , objectStoreInfo->keyPath())) {774 if (!injectIDBKeyIntoScriptValue(databaseThreadExecState(), usedKey, value.get(), objectStoreInfo->keyPath())) { 775 775 m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to inject record key into record value")), usedKey)); 776 776 return; 777 777 } 778 778 779 auto serializedValue = SerializedScriptValue::create(&databaseThreadExecState(), value , nullptr, nullptr);779 auto serializedValue = SerializedScriptValue::create(&databaseThreadExecState(), value.get(), nullptr, nullptr); 780 780 if (databaseThreadExecState().hadException()) { 781 781 m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to serialize record value after injecting record key")), usedKey)); -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
r199524 r199643 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * Copyright (C) 2012 Michael Pruett <michael@68k.org> 4 * Copyright (C) 2014, 2015, 2016 Apple Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 30 31 #include "IDBBindingUtilities.h" 31 32 32 #include "DOMRequestState.h"33 33 #include "IDBIndexInfo.h" 34 34 #include "IDBKey.h" … … 39 39 #include "JSDOMBinding.h" 40 40 #include "Logging.h" 41 #include "ScriptExecutionContext.h" 41 42 #include "SharedBuffer.h" 42 43 #include "ThreadSafeDataBuffer.h" … … 77 78 asObject(object)->putDirect(exec->vm(), identifier, jsValue); 78 79 return true; 79 }80 81 JSValue idbKeyDataToJSValue(JSC::ExecState& exec, const IDBKeyData& keyData)82 {83 if (keyData.isNull())84 return jsUndefined();85 86 Locker<JSLock> locker(exec.vm().apiLock());87 88 switch (keyData.type()) {89 case KeyType::Array:90 {91 const Vector<IDBKeyData>& inArray = keyData.array();92 size_t size = inArray.size();93 JSArray* outArray = constructEmptyArray(&exec, 0, exec.lexicalGlobalObject(), size);94 for (size_t i = 0; i < size; ++i) {95 auto& arrayKey = inArray.at(i);96 outArray->putDirectIndex(&exec, i, idbKeyDataToJSValue(exec, arrayKey));97 }98 return JSValue(outArray);99 }100 case KeyType::String:101 return jsStringWithCache(&exec, keyData.string());102 case KeyType::Date:103 return jsDateOrNull(&exec, keyData.date());104 case KeyType::Number:105 return jsNumber(keyData.number());106 case KeyType::Min:107 case KeyType::Max:108 case KeyType::Invalid:109 ASSERT_NOT_REACHED();110 return jsUndefined();111 }112 113 ASSERT_NOT_REACHED();114 return jsUndefined();115 116 80 } 117 81 … … 203 167 } 204 168 205 IDBKeyPath idbKeyPathFromValue(ExecState *exec, JSValue keyPathValue)169 IDBKeyPath idbKeyPathFromValue(ExecState& exec, JSValue keyPathValue) 206 170 { 207 171 IDBKeyPath keyPath; 208 172 if (isJSArray(keyPathValue)) 209 keyPath = IDBKeyPath(toNativeArray<String>( exec, keyPathValue));173 keyPath = IDBKeyPath(toNativeArray<String>(&exec, keyPathValue)); 210 174 else 211 keyPath = IDBKeyPath(keyPathValue.toString( exec)->value(exec));175 keyPath = IDBKeyPath(keyPathValue.toString(&exec)->value(&exec)); 212 176 return keyPath; 213 177 } … … 225 189 } 226 190 227 static RefPtr<IDBKey> internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const JS C::JSValue& value, const String& keyPath)191 static RefPtr<IDBKey> internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const JSValue& value, const String& keyPath) 228 192 { 229 193 Vector<String> keyPathElements; … … 275 239 } 276 240 277 bool injectIDBKeyIntoScriptValue( DOMRequestState* requestState, PassRefPtr<IDBKey> key, Deprecated::ScriptValue&value, const IDBKeyPath& keyPath)278 { 279 LOG( StorageAPI, "injectIDBKeyIntoScriptValue");241 bool injectIDBKeyIntoScriptValue(ExecState& exec, const IDBKeyData& keyData, JSValue value, const IDBKeyPath& keyPath) 242 { 243 LOG(IndexedDB, "injectIDBKeyIntoScriptValue"); 280 244 281 245 ASSERT(keyPath.type() == IndexedDB::KeyPathType::String); … … 289 253 return false; 290 254 291 ExecState* exec = requestState->exec();292 293 JSValue parent = ensureNthValueOnKeyPath(exec, value.jsValue(), keyPathElements, keyPathElements.size() - 1);294 if (parent.isUndefined())295 return false;296 297 if (!set(exec, parent, keyPathElements.last(), idbKeyToJSValue(exec, exec->lexicalGlobalObject(), key.get())))298 return false;299 300 return true;301 }302 303 bool injectIDBKeyIntoScriptValue(JSC::ExecState& exec, const IDBKeyData& keyData, JSC::JSValue value, const IDBKeyPath& keyPath)304 {305 LOG(IndexedDB, "injectIDBKeyIntoScriptValue");306 307 ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);308 309 Vector<String> keyPathElements;310 IDBKeyPathParseError error;311 IDBParseKeyPath(keyPath.string(), keyPathElements, error);312 ASSERT(error == IDBKeyPathParseError::None);313 314 if (keyPathElements.isEmpty())315 return false;316 317 255 JSValue parent = ensureNthValueOnKeyPath(&exec, value, keyPathElements, keyPathElements.size() - 1); 318 256 if (parent.isUndefined()) … … 329 267 } 330 268 331 RefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath) 332 { 333 LOG(StorageAPI, "createIDBKeyFromScriptValueAndKeyPath"); 334 ASSERT(!keyPath.isNull()); 335 336 if (keyPath.type() == IndexedDB::KeyPathType::Array) { 337 Vector<RefPtr<IDBKey>> result; 338 const Vector<String>& array = keyPath.array(); 339 for (size_t i = 0; i < array.size(); i++) { 340 RefPtr<IDBKey> key = internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, array[i]); 341 if (!key) 342 return nullptr; 343 result.append(key); 344 } 345 return IDBKey::createArray(result); 346 } 347 348 ASSERT(keyPath.type() == IndexedDB::KeyPathType::String); 349 return internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath.string()); 350 } 351 352 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState& exec, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath) 353 { 354 ASSERT(!keyPath.isNull()); 355 356 if (keyPath.type() == IndexedDB::KeyPathType::Array) { 357 Vector<RefPtr<IDBKey>> result; 358 const Vector<String>& array = keyPath.array(); 359 for (size_t i = 0; i < array.size(); i++) { 360 RefPtr<IDBKey> key = internalCreateIDBKeyFromScriptValueAndKeyPath(&exec, value, array[i]); 361 if (!key) 362 return nullptr; 363 result.append(key); 364 } 365 return IDBKey::createArray(result); 366 } 367 368 ASSERT(keyPath.type() == IndexedDB::KeyPathType::String); 369 return internalCreateIDBKeyFromScriptValueAndKeyPath(&exec, value, keyPath.string()); 370 } 371 372 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState& exec, const JSC::JSValue& value, const IDBKeyPath& keyPath) 269 270 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState& exec, const JSValue& value, const IDBKeyPath& keyPath) 373 271 { 374 272 ASSERT(!keyPath.isNull()); … … 391 289 } 392 290 393 bool canInjectIDBKeyIntoScriptValue(DOMRequestState* requestState, const JSC::JSValue& scriptValue, const IDBKeyPath& keyPath) 394 { 395 LOG(StorageAPI, "canInjectIDBKeyIntoScriptValue"); 396 397 JSC::ExecState* exec = requestState->exec(); 398 if (!exec) 399 return false; 400 401 return canInjectIDBKeyIntoScriptValue(*exec, scriptValue, keyPath); 402 } 403 404 bool canInjectIDBKeyIntoScriptValue(JSC::ExecState& execState, const JSC::JSValue& scriptValue, const IDBKeyPath& keyPath) 291 bool canInjectIDBKeyIntoScriptValue(ExecState& execState, const JSValue& scriptValue, const IDBKeyPath& keyPath) 405 292 { 406 293 LOG(StorageAPI, "canInjectIDBKeyIntoScriptValue"); … … 418 305 } 419 306 420 Deprecated::ScriptValue deserializeIDBValue(DOMRequestState* requestState, PassRefPtr<SerializedScriptValue> prpValue) 421 { 422 ExecState* exec = requestState->exec(); 423 RefPtr<SerializedScriptValue> serializedValue = prpValue; 424 JSValue result; 425 if (serializedValue) 426 result = serializedValue->deserialize(exec, exec->lexicalGlobalObject(), 0); 427 else 428 result = jsNull(); 429 return Deprecated::ScriptValue(exec->vm(), result); 430 } 431 432 static JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData, const Vector<String> blobURLs, const Vector<String> blobFilePaths) 433 { 434 if (!valueData.data()) 435 return jsUndefined(); 436 437 const Vector<uint8_t>& data = *valueData.data(); 307 308 static Strong<Unknown> deserializeIDBValueToJSValue(ExecState& exec, const IDBValue& value) 309 { 310 if (!value.data().data()) 311 return { exec.vm(), jsUndefined() }; 312 313 const Vector<uint8_t>& data = *value.data().data(); 438 314 JSValue result; 439 315 if (data.size()) { … … 441 317 442 318 exec.vm().apiLock().lock(); 443 result = serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing, blobURLs, blobFilePaths);319 result = serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing, value.blobURLs(), value.blobFilePaths()); 444 320 exec.vm().apiLock().unlock(); 445 321 } else 446 322 result = jsNull(); 447 323 448 return result; 449 } 450 451 Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext& context, const ThreadSafeDataBuffer& valueData) 452 { 453 DOMRequestState state(&context); 454 auto* execState = state.exec(); 455 324 return { exec.vm(), result }; 325 } 326 327 Strong<Unknown> deserializeIDBValueToJSValue(ScriptExecutionContext& context, const IDBValue& value) 328 { 329 auto* execState = context.execState(); 456 330 if (!execState) 457 331 return { }; 458 332 459 return { execState->vm(), deserializeIDBValueDataToJSValue(*execState, valueData) }; 460 } 461 462 Deprecated::ScriptValue deserializeIDBValue(ScriptExecutionContext& context, const IDBValue& value) 463 { 464 DOMRequestState state(&context); 465 auto* execState = state.exec(); 466 467 if (!execState) 468 return { }; 469 470 return { execState->vm(), deserializeIDBValueDataToJSValue(*execState, value.data(), value.blobURLs(), value.blobFilePaths()) }; 471 } 472 473 JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData) 474 { 475 Vector<String> dummyURLs, dummyFilePaths; 476 return deserializeIDBValueDataToJSValue(exec, valueData, dummyURLs, dummyFilePaths); 477 } 478 479 Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState* requestState, PassRefPtr<SharedBuffer> prpBuffer, bool keyIsDefined) 480 { 481 if (prpBuffer) { 482 Vector<uint8_t> value; 483 value.append(prpBuffer->data(), prpBuffer->size()); 484 return deserializeIDBValueBuffer(requestState->exec(), WTFMove(value), keyIsDefined); 485 } 486 487 return Deprecated::ScriptValue(requestState->exec()->vm(), jsNull()); 488 } 489 490 static JSValue idbValueDataToJSValue(JSC::ExecState& exec, Vector<uint8_t>&& buffer) 491 { 492 if (buffer.isEmpty()) 493 return jsNull(); 494 495 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(WTFMove(buffer)); 496 return serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing); 497 } 498 499 Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, Vector<uint8_t>&& buffer, bool keyIsDefined) 500 { 501 ASSERT(exec); 502 503 // If the key doesn't exist, then the value must be undefined (as opposed to null). 504 if (!keyIsDefined) { 505 // We either shouldn't have a buffer or it should be of size 0. 506 ASSERT(!buffer.size()); 507 return Deprecated::ScriptValue(exec->vm(), jsUndefined()); 508 } 509 510 JSValue result = idbValueDataToJSValue(*exec, WTFMove(buffer)); 511 return Deprecated::ScriptValue(exec->vm(), result); 512 } 513 514 JSValue idbValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData) 515 { 516 if (!valueData.data()) 517 return jsUndefined(); 518 519 return idbValueDataToJSValue(exec, Vector<uint8_t>(*valueData.data())); 520 } 521 522 Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState* requestState, PassRefPtr<IDBKey> key) 523 { 524 ExecState* exec = requestState->exec(); 333 return deserializeIDBValueToJSValue(*execState, value); 334 } 335 336 Strong<Unknown> deserializeIDBValueDataToJSValue(ExecState& exec, const ThreadSafeDataBuffer& valueData) 337 { 338 return deserializeIDBValueToJSValue(exec, IDBValue(valueData)); 339 } 340 341 RefPtr<IDBKey> scriptValueToIDBKey(ExecState& exec, const JSValue& scriptValue) 342 { 343 return createIDBKeyFromValue(&exec, scriptValue); 344 } 345 346 RefPtr<IDBKey> scriptValueToIDBKey(ScriptExecutionContext& context, const JSValue& scriptValue) 347 { 348 auto* execState = context.execState(); 349 return execState ? scriptValueToIDBKey(*execState, scriptValue) : nullptr; 350 } 351 352 Strong<Unknown> idbKeyDataToScriptValue(ScriptExecutionContext& context, const IDBKeyData& keyData) 353 { 354 RefPtr<IDBKey> key = keyData.maybeCreateIDBKey(); 355 356 ExecState* exec = context.execState(); 525 357 if (!exec) 526 358 return { }; 527 359 528 return Deprecated::ScriptValue(exec->vm(), idbKeyToJSValue(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), key.get())); 529 } 530 531 RefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState* requestState, const JSC::JSValue& scriptValue) 532 { 533 ExecState* exec = requestState->exec(); 534 return createIDBKeyFromValue(exec, scriptValue); 535 } 536 537 RefPtr<IDBKey> scriptValueToIDBKey(ExecState& exec, const JSC::JSValue& scriptValue) 538 { 539 return createIDBKeyFromValue(&exec, scriptValue); 540 } 541 542 Deprecated::ScriptValue idbKeyDataToScriptValue(ScriptExecutionContext* context, const IDBKeyData& keyData) 543 { 544 RefPtr<IDBKey> key = keyData.maybeCreateIDBKey(); 545 DOMRequestState requestState(context); 546 return idbKeyToScriptValue(&requestState, key.get()); 360 return { exec->vm(), idbKeyToJSValue(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), key.get()) }; 547 361 } 548 362 -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h
r199524 r199643 1 1 /* 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2014, 2015, 2016 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 30 31 31 32 #include "Dictionary.h" 32 #include <bindings/ScriptValue.h>33 33 #include <wtf/Forward.h> 34 34 35 35 namespace WebCore { 36 36 37 class DOMRequestState;38 37 class IDBIndexInfo; 39 38 class IDBKey; … … 42 41 class IDBValue; 43 42 class IndexKey; 44 class SharedBuffer;45 43 class ThreadSafeDataBuffer; 46 44 47 IDBKeyPath idbKeyPathFromValue(JSC::ExecState *, JSC::JSValue);45 IDBKeyPath idbKeyPathFromValue(JSC::ExecState&, JSC::JSValue); 48 46 49 bool injectIDBKeyIntoScriptValue(DOMRequestState*, PassRefPtr<IDBKey>, Deprecated::ScriptValue&, const IDBKeyPath&); 47 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&); 48 bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&); 50 49 bool injectIDBKeyIntoScriptValue(JSC::ExecState&, const IDBKeyData&, JSC::JSValue, const IDBKeyPath&); 51 50 52 RefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(JSC::ExecState*, const Deprecated::ScriptValue&, const IDBKeyPath&); 53 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const Deprecated::ScriptValue&, const IDBKeyPath&); 54 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&); 51 JSC::Strong<JSC::Unknown> idbKeyDataToScriptValue(ScriptExecutionContext&, const IDBKeyData&); 52 void generateIndexKeyForValue(JSC::ExecState&, const IDBIndexInfo&, JSC::JSValue, IndexKey& outKey); 55 53 56 bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const JSC::JSValue&, const IDBKeyPath&);57 bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&);54 JSC::Strong<JSC::Unknown> deserializeIDBValueToJSValue(ScriptExecutionContext&, const IDBValue&); 55 JSC::Strong<JSC::Unknown> deserializeIDBValueDataToJSValue(JSC::ExecState&, const ThreadSafeDataBuffer& valueData); 58 56 59 Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr<SerializedScriptValue>); 60 Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext&, const ThreadSafeDataBuffer& valueData); 61 Deprecated::ScriptValue deserializeIDBValue(ScriptExecutionContext&, const IDBValue&); 62 Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr<SharedBuffer>, bool keyIsDefined); 63 WEBCORE_EXPORT Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, Vector<uint8_t>&&, bool keyIsDefined); 64 65 JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState&, const ThreadSafeDataBuffer& valueData); 66 67 Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState*, PassRefPtr<IDBKey>); 68 RefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState*, const JSC::JSValue&); 57 RefPtr<IDBKey> scriptValueToIDBKey(ScriptExecutionContext&, const JSC::JSValue&); 69 58 RefPtr<IDBKey> scriptValueToIDBKey(JSC::ExecState&, const JSC::JSValue&); 70 71 Deprecated::ScriptValue idbKeyDataToScriptValue(ScriptExecutionContext*, const IDBKeyData&);72 73 JSC::JSValue idbValueDataToJSValue(JSC::ExecState&, const ThreadSafeDataBuffer& valueData);74 void generateIndexKeyForValue(JSC::ExecState&, const IDBIndexInfo&, JSC::JSValue, IndexKey& outKey);75 JSC::JSValue idbKeyDataToJSValue(JSC::ExecState&, const IDBKeyData&);76 59 77 60 } -
trunk/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp
r199323 r199643 99 99 return toJS(exec, globalObject, idbAny->idbTransaction()); 100 100 case IDBAny::Type::ScriptValue: 101 return idbAny->scriptValue() .jsValue();101 return idbAny->scriptValue(); 102 102 case IDBAny::Type::String: 103 103 return jsStringWithCache(exec, idbAny->string()); -
trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp
r199323 r199643 67 67 68 68 if (!keyPathValue.isUndefinedOrNull()) { 69 keyPath = idbKeyPathFromValue( &state, keyPathValue);69 keyPath = idbKeyPathFromValue(state, keyPathValue); 70 70 if (state.hadException()) 71 71 return jsUndefined(); -
trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp
r199323 r199643 120 120 JSValue keyPathValue = state.argument(1); 121 121 if (!keyPathValue.isUndefinedOrNull()) 122 keyPath = idbKeyPathFromValue( &state, keyPathValue);122 keyPath = idbKeyPathFromValue(state, keyPathValue); 123 123 else { 124 124 ExceptionCodeWithMessage ec; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r199323 r199643 4350 4350 } 4351 4351 4352 my $returnType = $signature->extendedAttributes->{"ImplementationReturnType"}; 4352 4353 if ($type eq "any") { 4353 4354 if ($interfaceName eq "Document") { 4354 4355 AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional); 4356 } elsif (defined $returnType and $returnType eq "JSValue") { 4357 return "$value"; 4355 4358 } else { 4356 4359 return "($value.hasNoValue() ? jsNull() : $value.jsValue())"; -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r199587 r199643 68 68 GetterRaisesExceptionWithMessage 69 69 Immutable 70 ImplementedAs=* 70 71 ImplementationLacksVTable 71 72 ImplementationNamespace=* 72 Implement edAs=*73 ImplementationReturnType=* 73 74 ImplicitThis 74 75 InitializedByEventConstructor -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r199323 r199643 488 488 } 489 489 490 JSC::ExecState* ScriptExecutionContext::execState() 491 { 492 if (is<Document>(*this)) { 493 Document& document = downcast<Document>(*this); 494 return execStateFromPage(mainThreadNormalWorld(), document.page()); 495 } 496 497 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(this); 498 return execStateFromWorkerGlobalScope(workerGlobalScope); 499 } 500 490 501 } // namespace WebCore -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r199323 r199643 189 189 void setTimerNestingLevel(int timerNestingLevel) { m_timerNestingLevel = timerNestingLevel; } 190 190 191 JSC::ExecState* execState(); 192 191 193 protected: 192 194 class AddConsoleMessageTask : public Task { -
trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
r199642 r199643 45 45 #include "ExceptionCode.h" 46 46 #include "Frame.h" 47 #include "IDBBindingUtilities.h" 47 48 #include "IDBCursor.h" 48 49 #include "IDBCursorWithValue.h" … … 335 336 } 336 337 337 void handleEvent(ScriptExecutionContext* , Event* event) override338 void handleEvent(ScriptExecutionContext* context, Event* event) override 338 339 { 339 340 if (event->type() != eventNames().successEvent) { … … 382 383 } 383 384 385 JSC::ExecState* state = context ? context->execState() : nullptr; 386 if (!state) 387 return; 388 384 389 RefPtr<DataEntry> dataEntry = DataEntry::create() 385 .setKey(m_injectedScript.wrapObject(idbCursor->key( ), String(), true))386 .setPrimaryKey(m_injectedScript.wrapObject(idbCursor->primaryKey( ), String(), true))387 .setValue(m_injectedScript.wrapObject(idbCursor->value( ), String(), true))390 .setKey(m_injectedScript.wrapObject(idbCursor->key(*state), String(), true)) 391 .setPrimaryKey(m_injectedScript.wrapObject(idbCursor->primaryKey(*state), String(), true)) 392 .setValue(m_injectedScript.wrapObject(idbCursor->value(*state), String(), true)) 388 393 .release(); 389 394 m_result->addItem(WTFMove(dataEntry));
Note:
See TracChangeset
for help on using the changeset viewer.