Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284760 => 284761)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-24 17:37:41 UTC (rev 284761)
@@ -1,5 +1,17 @@
2021-10-24 Alexey Shvayka <[email protected]>
+ Assertions in IDBTransaction::request*() methods fail on cross-realm methods
+ https://bugs.webkit.org/show_bug.cgi?id=230128
+
+ Reviewed by Sihui Liu.
+
+ * web-platform-tests/IndexedDB/idbindex-cross-realm-methods-expected.txt: Added.
+ * web-platform-tests/IndexedDB/idbindex-cross-realm-methods.html: Added.
+ * web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods-expected.txt: Added.
+ * web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods.html: Added.
+
+2021-10-24 Alexey Shvayka <[email protected]>
+
document.open() and friends use incorrect document as a source for reseted document's URL
https://bugs.webkit.org/show_bug.cgi?id=230131
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods-expected.txt (0 => 284761)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods-expected.txt 2021-10-24 17:37:41 UTC (rev 284761)
@@ -0,0 +1,9 @@
+
+PASS Cross-realm IDBIndex::get() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::getKey() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::getAll() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::getAllKeys() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::count() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::openCursor() method from detached <iframe> works as expected
+PASS Cross-realm IDBIndex::openKeyCursor() method from detached <iframe> works as expected
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods.html (0 => 284761)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods.html 2021-10-24 17:37:41 UTC (rev 284761)
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Cross-realm IDBIndex methods from detached iframe work as expected</title>
+<script src=""
+<script src=""
+<script src=""
+
+<body>
+<script>
+"use strict";
+const INDEX_LOWER = 1000;
+const INDEX_UPPER = 1001;
+const INDEX_RANGE = IDBKeyRange.bound(INDEX_LOWER, INDEX_UPPER);
+
+const testCases = [
+ {
+ methodName: "get",
+ arguments: [INDEX_LOWER],
+ validateResult: e => {
+ assert_equals(e.target.result.indexedKey, INDEX_LOWER);
+ },
+ },
+ {
+ methodName: "getKey",
+ arguments: [INDEX_UPPER],
+ validateResult: e => {
+ assert_equals(e.target.result, INDEX_UPPER);
+ },
+ },
+ {
+ methodName: "getAll",
+ arguments: [INDEX_RANGE],
+ validateResult: e => {
+ assert_array_equals(e.target.result.map(v => v.indexedKey), [INDEX_LOWER, INDEX_UPPER]);
+ },
+ },
+ {
+ methodName: "getAllKeys",
+ arguments: [INDEX_RANGE],
+ validateResult: e => {
+ assert_array_equals(e.target.result, [INDEX_LOWER, INDEX_UPPER]);
+ },
+ },
+ {
+ methodName: "count",
+ arguments: [INDEX_RANGE],
+ validateResult: e => {
+ assert_equals(e.target.result, 2);
+ },
+ },
+ {
+ methodName: "openCursor",
+ arguments: [],
+ validateResult: e => {
+ const cursor = e.target.result;
+ assert_true(cursor instanceof IDBCursor);
+ assert_equals(cursor.value.indexedKey, INDEX_LOWER);
+ },
+ },
+ {
+ methodName: "openKeyCursor",
+ arguments: [],
+ validateResult: e => {
+ const cursor = e.target.result;
+ assert_true(cursor instanceof IDBCursor);
+ assert_equals(cursor.key, INDEX_LOWER);
+ },
+ },
+];
+
+for (const testCase of testCases) {
+ async_test(t => {
+ const iframe = document.createElement("iframe");
+ iframe._onload_ = t.step_func(() => {
+ const method = iframe.contentWindow.IDBIndex.prototype[testCase.methodName];
+ iframe.remove();
+
+ let db;
+ const open_rq = createdb(t);
+ open_rq._onupgradeneeded_ = t.step_func(e => {
+ db = e.target.result;
+ const objectStore = db.createObjectStore("store");
+ objectStore.createIndex("index", "indexedKey");
+ objectStore.add({ indexedKey: INDEX_LOWER }, INDEX_LOWER);
+ objectStore.add({ indexedKey: INDEX_UPPER }, INDEX_UPPER);
+ });
+
+ open_rq._onsuccess_ = t.step_func(() => {
+ const index = db.transaction("store").objectStore("store").index("index");
+ const rq = method.call(index, ...testCase.arguments);
+ rq._onsuccess_ = t.step_func_done(e => {
+ testCase.validateResult(e);
+ });
+ });
+ });
+ document.body.append(iframe);
+ }, `Cross-realm IDBIndex::${testCase.methodName}() method from detached <iframe> works as expected`);
+}
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods-expected.txt (0 => 284761)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods-expected.txt 2021-10-24 17:37:41 UTC (rev 284761)
@@ -0,0 +1,13 @@
+
+PASS Cross-realm IDBObjectStore::put() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::add() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::delete() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::clear() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::get() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::getKey() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::getAll() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::getAllKeys() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::count() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::openCursor() method from detached <iframe> works as expected
+PASS Cross-realm IDBObjectStore::openKeyCursor() method from detached <iframe> works as expected
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods.html (0 => 284761)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods.html 2021-10-24 17:37:41 UTC (rev 284761)
@@ -0,0 +1,154 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Cross-realm IDBObjectStore methods from detached iframe work as expected</title>
+<script src=""
+<script src=""
+<script src=""
+
+<body>
+<script>
+"use strict";
+const KEY_EXISTING_LOWER = 1000;
+const KEY_EXISTING_UPPER = 1001;
+const KEY_EXISTING_RANGE = IDBKeyRange.bound(KEY_EXISTING_LOWER, KEY_EXISTING_UPPER);
+const KEY_NEWLY_ADDED = 1002;
+
+const VALUE_EXISTING_LOWER = "VALUE_EXISTING_LOWER";
+const VALUE_EXISTING_UPPER = "VALUE_EXISTING_UPPER";
+const VALUE_NEWLY_ADDED = "VALUE_NEWLY_ADDED";
+
+const testCases = [
+ {
+ methodName: "put",
+ arguments: [KEY_NEWLY_ADDED, KEY_EXISTING_LOWER],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, KEY_EXISTING_LOWER);
+ const rq = e.target.source.getAll();
+ rq._onsuccess_ = t.step_func_done(e => {
+ assert_array_equals(e.target.result, [KEY_NEWLY_ADDED, VALUE_EXISTING_UPPER]);
+ });
+ },
+ },
+ {
+ methodName: "add",
+ arguments: [VALUE_NEWLY_ADDED, KEY_NEWLY_ADDED],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, KEY_NEWLY_ADDED);
+ const rq = e.target.source.getAll();
+ rq._onsuccess_ = t.step_func_done(e => {
+ assert_array_equals(e.target.result, [VALUE_EXISTING_LOWER, VALUE_EXISTING_UPPER, VALUE_NEWLY_ADDED]);
+ });
+ },
+ },
+ {
+ methodName: "delete",
+ arguments: [KEY_EXISTING_LOWER],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, undefined);
+ const rq = e.target.source.getAllKeys();
+ rq._onsuccess_ = t.step_func_done(e => {
+ assert_array_equals(e.target.result, [KEY_EXISTING_UPPER]);
+ });
+ },
+ },
+ {
+ methodName: "clear",
+ arguments: [],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, undefined);
+ const rq = e.target.source.count();
+ rq._onsuccess_ = t.step_func_done(e => {
+ assert_equals(e.target.result, 0);
+ });
+ },
+ },
+ {
+ methodName: "get",
+ arguments: [KEY_EXISTING_UPPER],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, VALUE_EXISTING_UPPER);
+ t.done();
+ },
+ },
+ {
+ methodName: "getKey",
+ arguments: [KEY_EXISTING_LOWER],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, KEY_EXISTING_LOWER);
+ t.done();
+ },
+ },
+ {
+ methodName: "getAll",
+ arguments: [KEY_EXISTING_RANGE],
+ validateResult: (t, e) => {
+ assert_array_equals(e.target.result, [VALUE_EXISTING_LOWER, VALUE_EXISTING_UPPER]);
+ t.done();
+ },
+ },
+ {
+ methodName: "getAllKeys",
+ arguments: [KEY_EXISTING_RANGE],
+ validateResult: (t, e) => {
+ assert_array_equals(e.target.result, [KEY_EXISTING_LOWER, KEY_EXISTING_UPPER]);
+ t.done();
+ },
+ },
+ {
+ methodName: "count",
+ arguments: [],
+ validateResult: (t, e) => {
+ assert_equals(e.target.result, 2);
+ t.done();
+ },
+ },
+ {
+ methodName: "openCursor",
+ arguments: [],
+ validateResult: (t, e) => {
+ const cursor = e.target.result;
+ assert_true(cursor instanceof IDBCursor);
+ assert_equals(cursor.value, VALUE_EXISTING_LOWER);
+ t.done();
+ },
+ },
+ {
+ methodName: "openKeyCursor",
+ arguments: [],
+ validateResult: (t, e) => {
+ const cursor = e.target.result;
+ assert_true(cursor instanceof IDBCursor);
+ assert_equals(cursor.key, KEY_EXISTING_LOWER);
+ t.done();
+ },
+ },
+];
+
+for (const testCase of testCases) {
+ async_test(t => {
+ const iframe = document.createElement("iframe");
+ iframe._onload_ = t.step_func(() => {
+ const method = iframe.contentWindow.IDBObjectStore.prototype[testCase.methodName];
+ iframe.remove();
+
+ let db;
+ const open_rq = createdb(t);
+ open_rq._onupgradeneeded_ = t.step_func(e => {
+ db = e.target.result;
+ const objectStore = db.createObjectStore("store");
+ objectStore.add(VALUE_EXISTING_LOWER, KEY_EXISTING_LOWER);
+ objectStore.add(VALUE_EXISTING_UPPER, KEY_EXISTING_UPPER);
+ });
+
+ open_rq._onsuccess_ = t.step_func(() => {
+ const objectStore = db.transaction("store", "readwrite").objectStore("store");
+ const rq = method.call(objectStore, ...testCase.arguments);
+ rq._onsuccess_ = t.step_func(e => {
+ testCase.validateResult(t, e);
+ });
+ });
+ });
+ document.body.append(iframe);
+ }, `Cross-realm IDBObjectStore::${testCase.methodName}() method from detached <iframe> works as expected`);
+}
+</script>
Modified: trunk/Source/WebCore/ChangeLog (284760 => 284761)
--- trunk/Source/WebCore/ChangeLog 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/ChangeLog 2021-10-24 17:37:41 UTC (rev 284761)
@@ -1,3 +1,86 @@
+2021-10-24 Alexey Shvayka <[email protected]>
+
+ Assertions in IDBTransaction::request*() methods fail on cross-realm methods
+ https://bugs.webkit.org/show_bug.cgi?id=230128
+
+ Reviewed by Sihui Liu.
+
+ Except when used with constructors, [CallWith=GlobalObject] WebIDL attribute passes
+ _current_ global object [1], one that the function was created in.
+
+ A method from another realm has different ScriptExecutionContext than the IDBTransaction,
+ and it's fine: function's global object is used only for IDBKey parsing and structure
+ cloning as per spec [2].
+
+ This patch removes incorrect assertions, fixing IDBObjectStore / IDBIndex cross-realm
+ methods not to crash --debug build, and removes now unused JSGlobalObject parameters.
+
+ [1] https://html.spec.whatwg.org/multipage/webappapis.html#concept-current-everything
+ [2] https://www.w3.org/TR/IndexedDB/#ref-for-retrieve-a-value-from-an-object-store
+
+ Tests: imported/w3c/web-platform-tests/IndexedDB/idbindex-cross-realm-methods.html
+ imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-cross-realm-methods.html
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::deleteFunction):
+ * Modules/indexeddb/IDBCursor.h:
+ * Modules/indexeddb/IDBCursor.idl:
+ * Modules/indexeddb/IDBIndex.cpp:
+ (WebCore::IDBIndex::doOpenCursor):
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::doOpenKeyCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ (WebCore::IDBIndex::count):
+ (WebCore::IDBIndex::doCount):
+ (WebCore::IDBIndex::get):
+ (WebCore::IDBIndex::doGet):
+ (WebCore::IDBIndex::getKey):
+ (WebCore::IDBIndex::doGetKey):
+ (WebCore::IDBIndex::doGetAll):
+ (WebCore::IDBIndex::getAll):
+ (WebCore::IDBIndex::doGetAllKeys):
+ (WebCore::IDBIndex::getAllKeys):
+ * Modules/indexeddb/IDBIndex.h:
+ * Modules/indexeddb/IDBIndex.idl:
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::doOpenCursor):
+ (WebCore::IDBObjectStore::openCursor):
+ (WebCore::IDBObjectStore::doOpenKeyCursor):
+ (WebCore::IDBObjectStore::openKeyCursor):
+ (WebCore::IDBObjectStore::get):
+ (WebCore::IDBObjectStore::getKey):
+ (WebCore::IDBObjectStore::putOrAdd):
+ Use IDBObjectStore's context instead of _current_ global object for private browsing
+ check as per recommendation for spec authors [1]. This doesn't seem to be observable.
+
+ (WebCore::IDBObjectStore::deleteFunction):
+ (WebCore::IDBObjectStore::doDelete):
+ (WebCore::IDBObjectStore::clear):
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::count):
+ (WebCore::IDBObjectStore::doCount):
+ (WebCore::IDBObjectStore::doGetAll):
+ (WebCore::IDBObjectStore::getAll):
+ (WebCore::IDBObjectStore::doGetAllKeys):
+ (WebCore::IDBObjectStore::getAllKeys):
+ * Modules/indexeddb/IDBObjectStore.h:
+ * Modules/indexeddb/IDBObjectStore.idl:
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::requestOpenCursor):
+ (WebCore::IDBTransaction::doRequestOpenCursor):
+ (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
+ (WebCore::IDBTransaction::requestGetAllIndexRecords):
+ (WebCore::IDBTransaction::requestGetRecord):
+ (WebCore::IDBTransaction::requestGetValue):
+ (WebCore::IDBTransaction::requestGetKey):
+ (WebCore::IDBTransaction::requestIndexRecord):
+ (WebCore::IDBTransaction::requestCount):
+ (WebCore::IDBTransaction::requestDeleteRecord):
+ (WebCore::IDBTransaction::requestClearObjectStore):
+ (WebCore::IDBTransaction::requestPutOrAdd):
+ * Modules/indexeddb/IDBTransaction.h:
+ * inspector/agents/InspectorIndexedDBAgent.cpp:
+
2021-10-24 Tyler Wilcock <[email protected]>
AX: Any addition of children should funnel through AccessibilityObject::addChild
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2021-10-24 17:37:41 UTC (rev 284761)
@@ -294,7 +294,7 @@
transaction().iterateCursor(*this, { key, primaryKey, 0 });
}
-ExceptionOr<Ref<WebCore::IDBRequest>> IDBCursor::deleteFunction(JSGlobalObject& state)
+ExceptionOr<Ref<WebCore::IDBRequest>> IDBCursor::deleteFunction()
{
LOG(IndexedDB, "IDBCursor::deleteFunction");
ASSERT(canCurrentThreadAccessThreadLocalData(effectiveObjectStore().transaction().database().originThread()));
@@ -314,7 +314,7 @@
if (!isKeyCursorWithValue())
return Exception { InvalidStateError, "Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor."_s };
- auto result = effectiveObjectStore().deleteFunction(state, IDBKeyRange::create(m_primaryKey.copyRef()).ptr());
+ auto result = effectiveObjectStore().deleteFunction(IDBKeyRange::create(m_primaryKey.copyRef()).ptr());
if (result.hasException())
return result.releaseException();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h 2021-10-24 17:37:41 UTC (rev 284761)
@@ -68,7 +68,7 @@
ExceptionOr<void> advance(unsigned);
ExceptionOr<void> continueFunction(JSC::JSGlobalObject&, JSC::JSValue key);
ExceptionOr<void> continuePrimaryKey(JSC::JSGlobalObject&, JSC::JSValue key, JSC::JSValue primaryKey);
- ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::JSGlobalObject&);
+ ExceptionOr<Ref<IDBRequest>> deleteFunction();
ExceptionOr<void> continueFunction(const IDBKeyData&);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2021-10-24 17:37:41 UTC (rev 284761)
@@ -40,5 +40,5 @@
[CallWith=GlobalObject] undefined continuePrimaryKey(any key, any primaryKey);
[NewObject, CallWith=GlobalObject] IDBRequest update(any value);
- [NewObject, CallWith=GlobalObject, ImplementedAs=deleteFunction] IDBRequest delete();
+ [NewObject, ImplementedAs=deleteFunction] IDBRequest delete();
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp 2021-10-24 17:37:41 UTC (rev 284761)
@@ -144,7 +144,7 @@
m_deleted = false;
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doOpenCursor(JSGlobalObject& execState, IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doOpenCursor(IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBIndex::openCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -166,12 +166,12 @@
rangeData.upperKey = IDBKeyData::maximum();
auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction, IndexedDB::CursorType::KeyAndValue);
- return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
+ return m_objectStore.transaction().requestOpenCursor(*this, info);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
{
- return doOpenCursor(execState, direction, [range=WTFMove(range)]() {
+ return doOpenCursor(direction, [range = WTFMove(range)]() {
return range;
});
}
@@ -178,7 +178,7 @@
ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(JSGlobalObject& execState, JSValue key, IDBCursorDirection direction)
{
- return doOpenCursor(execState, direction, [state=&execState, key]() {
+ return doOpenCursor(direction, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key."_s) };
@@ -187,7 +187,7 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doOpenKeyCursor(JSGlobalObject& execState, IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doOpenKeyCursor(IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBIndex::openKeyCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -204,12 +204,12 @@
auto* keyRangePointer = keyRange.returnValue().get();
auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), keyRangePointer, direction, IndexedDB::CursorType::KeyOnly);
- return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
+ return m_objectStore.transaction().requestOpenCursor(*this, info);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
{
- return doOpenKeyCursor(execState, direction, [range=WTFMove(range)]() {
+ return doOpenKeyCursor(direction, [range = WTFMove(range)]() {
return range;
});
}
@@ -216,7 +216,7 @@
ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(JSGlobalObject& execState, JSValue key, IDBCursorDirection direction)
{
- return doOpenKeyCursor(execState, direction, [state=&execState, key]() {
+ return doOpenKeyCursor(direction, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key."_s) };
@@ -225,11 +225,11 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::count(JSGlobalObject& execState, IDBKeyRange* range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::count(IDBKeyRange* range)
{
LOG(IndexedDB, "IDBIndex::count");
- return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
+ return doCount(range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
}
ExceptionOr<Ref<IDBRequest>> IDBIndex::count(JSGlobalObject& execState, JSValue key)
@@ -239,10 +239,10 @@
auto idbKey = scriptValueToIDBKey(execState, key);
auto* idbKeyPointer = idbKey->isValid() ? idbKey.ptr() : nullptr;
- return doCount(execState, IDBKeyRangeData(idbKeyPointer));
+ return doCount(IDBKeyRangeData(idbKeyPointer));
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doCount(JSGlobalObject& execState, const IDBKeyRangeData& range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doCount(const IDBKeyRangeData& range)
{
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -256,14 +256,14 @@
if (!range.isValid())
return Exception { DataError, "Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key."_s };
- return transaction.requestCount(execState, *this, range);
+ return transaction.requestCount(*this, range);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::get(JSGlobalObject& execState, IDBKeyRange* range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::get(IDBKeyRange* range)
{
LOG(IndexedDB, "IDBIndex::get");
- return doGet(execState, IDBKeyRangeData(range));
+ return doGet(IDBKeyRangeData(range));
}
ExceptionOr<Ref<IDBRequest>> IDBIndex::get(JSGlobalObject& execState, JSValue key)
@@ -272,12 +272,12 @@
auto idbKey = scriptValueToIDBKey(execState, key);
if (!idbKey->isValid())
- return doGet(execState, Exception(DataError, "Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key."_s));
+ return doGet(Exception(DataError, "Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key."_s));
- return doGet(execState, IDBKeyRangeData(idbKey.ptr()));
+ return doGet(IDBKeyRangeData(idbKey.ptr()));
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doGet(JSGlobalObject& execState, ExceptionOr<IDBKeyRangeData> range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGet(ExceptionOr<IDBKeyRangeData> range)
{
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -295,14 +295,14 @@
if (keyRange.isNull)
return Exception { DataError };
- return transaction.requestGetValue(execState, *this, keyRange);
+ return transaction.requestGetValue(*this, keyRange);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::getKey(JSGlobalObject& execState, IDBKeyRange* range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getKey(IDBKeyRange* range)
{
LOG(IndexedDB, "IDBIndex::getKey");
- return doGetKey(execState, IDBKeyRangeData(range));
+ return doGetKey(IDBKeyRangeData(range));
}
ExceptionOr<Ref<IDBRequest>> IDBIndex::getKey(JSGlobalObject& execState, JSValue key)
@@ -311,12 +311,12 @@
auto idbKey = scriptValueToIDBKey(execState, key);
if (!idbKey->isValid())
- return doGetKey(execState, Exception(DataError, "Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key."_s));
+ return doGetKey(Exception(DataError, "Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key."_s));
- return doGetKey(execState, IDBKeyRangeData(idbKey.ptr()));
+ return doGetKey(IDBKeyRangeData(idbKey.ptr()));
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetKey(JSGlobalObject& execState, ExceptionOr<IDBKeyRangeData> range)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetKey(ExceptionOr<IDBKeyRangeData> range)
{
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -334,10 +334,10 @@
if (keyRange.isNull)
return Exception { DataError };
- return transaction.requestGetKey(execState, *this, keyRange);
+ return transaction.requestGetKey(*this, keyRange);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetAll(JSGlobalObject& execState, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetAll(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBIndex::getAll");
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -353,12 +353,12 @@
return keyRange.releaseException();
auto keyRangePointer = keyRange.returnValue().get();
- return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, keyRangePointer, IndexedDB::GetAllType::Values, count);
+ return m_objectStore.transaction().requestGetAllIndexRecords(*this, keyRangePointer, IndexedDB::GetAllType::Values, count);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
{
- return doGetAll(execState, count, [range = WTFMove(range)]() {
+ return doGetAll(count, [range = WTFMove(range)]() {
return range;
});
}
@@ -365,7 +365,7 @@
ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(JSGlobalObject& execState, JSValue key, std::optional<uint32_t> count)
{
- return doGetAll(execState, count, [state=&execState, key]() {
+ return doGetAll(count, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'getAll' on 'IDBIndex': The parameter is not a valid key."_s) };
@@ -374,7 +374,7 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetAllKeys(JSGlobalObject& execState, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetAllKeys(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBIndex::getAllKeys");
ASSERT(canCurrentThreadAccessThreadLocalData(m_objectStore.transaction().database().originThread()));
@@ -390,12 +390,12 @@
return keyRange.releaseException();
auto* keyRangePointer = keyRange.returnValue().get();
- return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, keyRangePointer, IndexedDB::GetAllType::Keys, count);
+ return m_objectStore.transaction().requestGetAllIndexRecords(*this, keyRangePointer, IndexedDB::GetAllType::Keys, count);
}
-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
{
- return doGetAllKeys(execState, count, [range = WTFMove(range)]() {
+ return doGetAllKeys(count, [range = WTFMove(range)]() {
return range;
});
}
@@ -402,7 +402,7 @@
ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(JSGlobalObject& execState, JSValue key, std::optional<uint32_t> count)
{
- return doGetAllKeys(execState, count, [state=&execState, key]() {
+ return doGetAllKeys(count, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'getAllKeys' on 'IDBIndex': The parameter is not a valid key."_s) };
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h 2021-10-24 17:37:41 UTC (rev 284761)
@@ -56,22 +56,22 @@
void rollbackInfoForVersionChangeAbort();
- ExceptionOr<Ref<IDBRequest>> openCursor(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, IDBCursorDirection);
+ ExceptionOr<Ref<IDBRequest>> openCursor(RefPtr<IDBKeyRange>&&, IDBCursorDirection);
ExceptionOr<Ref<IDBRequest>> openCursor(JSC::JSGlobalObject&, JSC::JSValue key, IDBCursorDirection);
- ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, IDBCursorDirection);
+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(RefPtr<IDBKeyRange>&&, IDBCursorDirection);
ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::JSGlobalObject&, JSC::JSValue key, IDBCursorDirection);
- ExceptionOr<Ref<IDBRequest>> count(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> count(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> count(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> get(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> get(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> get(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> getKey(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> getKey(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> getKey(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> getAll(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAll(RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
ExceptionOr<Ref<IDBRequest>> getAll(JSC::JSGlobalObject&, JSC::JSValue key, std::optional<uint32_t> count);
- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAllKeys(RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::JSGlobalObject&, JSC::JSValue key, std::optional<uint32_t> count);
const IDBIndexInfo& info() const { return m_info; }
@@ -85,13 +85,13 @@
void* objectStoreAsOpaqueRoot() { return &m_objectStore; }
private:
- ExceptionOr<Ref<IDBRequest>> doCount(JSC::JSGlobalObject&, const IDBKeyRangeData&);
- ExceptionOr<Ref<IDBRequest>> doGet(JSC::JSGlobalObject&, ExceptionOr<IDBKeyRangeData>);
- ExceptionOr<Ref<IDBRequest>> doGetKey(JSC::JSGlobalObject&, ExceptionOr<IDBKeyRangeData>);
- ExceptionOr<Ref<IDBRequest>> doOpenCursor(JSC::JSGlobalObject&, IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
- ExceptionOr<Ref<IDBRequest>> doOpenKeyCursor(JSC::JSGlobalObject&, IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
- ExceptionOr<Ref<IDBRequest>> doGetAll(JSC::JSGlobalObject&, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
- ExceptionOr<Ref<IDBRequest>> doGetAllKeys(JSC::JSGlobalObject&, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doCount(const IDBKeyRangeData&);
+ ExceptionOr<Ref<IDBRequest>> doGet(ExceptionOr<IDBKeyRangeData>);
+ ExceptionOr<Ref<IDBRequest>> doGetKey(ExceptionOr<IDBKeyRangeData>);
+ ExceptionOr<Ref<IDBRequest>> doOpenCursor(IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doOpenKeyCursor(IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doGetAll(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doGetAllKeys(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
// ActiveDOMObject.
const char* activeDOMObjectName() const final;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl 2021-10-24 17:37:41 UTC (rev 284761)
@@ -40,19 +40,19 @@
readonly attribute boolean multiEntry;
readonly attribute boolean unique;
- [NewObject, CallWith=GlobalObject] IDBRequest get(IDBKeyRange? key);
+ [NewObject] IDBRequest get(IDBKeyRange? key);
[NewObject, CallWith=GlobalObject] IDBRequest get(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest getKey(IDBKeyRange? key);
+ [NewObject] IDBRequest getKey(IDBKeyRange? key);
[NewObject, CallWith=GlobalObject] IDBRequest getKey(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest getAll(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
+ [NewObject] IDBRequest getAll(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
[NewObject, CallWith=GlobalObject] IDBRequest getAll(any key, optional [EnforceRange] unsigned long count);
- [NewObject, CallWith=GlobalObject] IDBRequest getAllKeys(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
+ [NewObject] IDBRequest getAllKeys(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
[NewObject, CallWith=GlobalObject] IDBRequest getAllKeys(any key, optional [EnforceRange] unsigned long count);
- [NewObject, CallWith=GlobalObject] IDBRequest count(optional IDBKeyRange? range = null);
+ [NewObject] IDBRequest count(optional IDBKeyRange? range = null);
[NewObject, CallWith=GlobalObject] IDBRequest count(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+ [NewObject] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
[NewObject, CallWith=GlobalObject] IDBRequest openCursor(any key, optional IDBCursorDirection direction = "next");
- [NewObject, CallWith=GlobalObject] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+ [NewObject] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
[NewObject, CallWith=GlobalObject] IDBRequest openKeyCursor(any key, optional IDBCursorDirection direction = "next");
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2021-10-24 17:37:41 UTC (rev 284761)
@@ -145,7 +145,7 @@
return m_info.autoIncrement();
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doOpenCursor(JSGlobalObject& execState, IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doOpenCursor(IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBObjectStore::openCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -162,12 +162,12 @@
auto* keyRangePointer = keyRange.returnValue().get();
auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), keyRangePointer, direction, IndexedDB::CursorType::KeyAndValue);
- return m_transaction.requestOpenCursor(execState, *this, info);
+ return m_transaction.requestOpenCursor(*this, info);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
{
- return doOpenCursor(execState, direction, [range = WTFMove(range)]() {
+ return doOpenCursor(direction, [range = WTFMove(range)]() {
return range;
});
}
@@ -174,7 +174,7 @@
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(JSGlobalObject& execState, JSValue key, IDBCursorDirection direction)
{
- return doOpenCursor(execState, direction, [state=&execState, key]() {
+ return doOpenCursor(direction, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key."_s) };
@@ -183,7 +183,7 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doOpenKeyCursor(JSGlobalObject& execState, IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doOpenKeyCursor(IDBCursorDirection direction, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBObjectStore::openKeyCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -200,12 +200,12 @@
auto* keyRangePointer = keyRange.returnValue().get();
auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), keyRangePointer, direction, IndexedDB::CursorType::KeyOnly);
- return m_transaction.requestOpenCursor(execState, *this, info);
+ return m_transaction.requestOpenCursor(*this, info);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(RefPtr<IDBKeyRange>&& range, IDBCursorDirection direction)
{
- return doOpenKeyCursor(execState, direction, [range = WTFMove(range)]() {
+ return doOpenKeyCursor(direction, [range = WTFMove(range)]() {
return range;
});
}
@@ -212,7 +212,7 @@
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(JSGlobalObject& execState, JSValue key, IDBCursorDirection direction)
{
- return doOpenCursor(execState, direction, [state=&execState, key]() {
+ return doOpenCursor(direction, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'openKeyCursor' on 'IDBObjectStore': The parameter is not a valid key."_s) };
@@ -236,10 +236,10 @@
if (!idbKey->isValid())
return Exception { DataError, "Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key."_s };
- return m_transaction.requestGetRecord(execState, *this, { idbKey.ptr(), IDBGetRecordDataType::KeyAndValue });
+ return m_transaction.requestGetRecord(*this, { idbKey.ptr(), IDBGetRecordDataType::KeyAndValue });
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::get(JSGlobalObject& execState, IDBKeyRange* keyRange)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::get(IDBKeyRange* keyRange)
{
LOG(IndexedDB, "IDBObjectStore::get");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -254,7 +254,7 @@
if (!keyRangeData.isValid())
return Exception { DataError };
- return m_transaction.requestGetRecord(execState, *this, { keyRangeData, IDBGetRecordDataType::KeyAndValue });
+ return m_transaction.requestGetRecord(*this, { keyRangeData, IDBGetRecordDataType::KeyAndValue });
}
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getKey(JSGlobalObject& execState, JSValue key)
@@ -272,10 +272,10 @@
if (!idbKey->isValid())
return Exception { DataError, "Failed to execute 'getKey' on 'IDBObjectStore': The parameter is not a valid key."_s };
- return m_transaction.requestGetRecord(execState, *this, { idbKey.ptr(), IDBGetRecordDataType::KeyOnly });
+ return m_transaction.requestGetRecord(*this, { idbKey.ptr(), IDBGetRecordDataType::KeyOnly });
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getKey(JSGlobalObject& execState, IDBKeyRange* keyRange)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getKey(IDBKeyRange* keyRange)
{
LOG(IndexedDB, "IDBObjectStore::getKey");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -290,7 +290,7 @@
if (!keyRangeData.isValid())
return Exception { DataError, "Failed to execute 'getKey' on 'IDBObjectStore': The parameter is not a valid key range."_s };
- return m_transaction.requestGetRecord(execState, *this, { keyRangeData, IDBGetRecordDataType::KeyOnly });
+ return m_transaction.requestGetRecord(*this, { keyRangeData, IDBGetRecordDataType::KeyOnly });
}
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::add(JSGlobalObject& execState, JSValue value, JSValue key)
@@ -322,7 +322,7 @@
LOG(IndexedDB, "IDBObjectStore::putOrAdd");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
- auto context = scriptExecutionContextFromExecState(&state);
+ auto context = scriptExecutionContext();
if (!context)
return Exception { UnknownError, "Unable to store record in object store because it does not have a valid script execution context"_s };
@@ -384,17 +384,17 @@
} else if (!usesKeyGenerator && !key)
return Exception { DataError, "Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided."_s };
- return m_transaction.requestPutOrAdd(state, *this, WTFMove(key), *serializedValue, overwriteMode);
+ return m_transaction.requestPutOrAdd(*this, WTFMove(key), *serializedValue, overwriteMode);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(JSGlobalObject& execState, IDBKeyRange* keyRange)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(IDBKeyRange* keyRange)
{
- return doDelete(execState, [keyRange]() {
+ return doDelete([keyRange]() {
return RefPtr { keyRange };
});
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doDelete(JSGlobalObject& execState, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doDelete(WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBObjectStore::deleteFunction");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -421,12 +421,12 @@
if (!keyRangeData.isValid())
return Exception { DataError, "Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range."_s };
- return m_transaction.requestDeleteRecord(execState, *this, keyRangeData);
+ return m_transaction.requestDeleteRecord(*this, keyRangeData);
}
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(JSGlobalObject& execState, JSValue key)
{
- return doDelete(execState, [state=&execState, key]() {
+ return doDelete([state = &execState, key]() {
auto idbKey = scriptValueToIDBKey(*state, key);
if (!idbKey->isValid())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key."_s) };
@@ -434,7 +434,7 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::clear(JSGlobalObject& execState)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::clear()
{
LOG(IndexedDB, "IDBObjectStore::clear");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -453,10 +453,10 @@
if (m_transaction.isReadOnly())
return Exception { ReadonlyError, "Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only."_s };
- return m_transaction.requestClearObjectStore(execState, *this);
+ return m_transaction.requestClearObjectStore(*this);
}
-ExceptionOr<Ref<IDBIndex>> IDBObjectStore::createIndex(JSGlobalObject&, const String& name, IDBKeyPath&& keyPath, const IndexParameters& parameters)
+ExceptionOr<Ref<IDBIndex>> IDBObjectStore::createIndex(const String& name, IDBKeyPath&& keyPath, const IndexParameters& parameters)
{
LOG(IndexedDB, "IDBObjectStore::createIndex %s (keyPath: %s, unique: %i, multiEntry: %i)", name.utf8().data(), loggingString(keyPath).utf8().data(), parameters.unique, parameters.multiEntry);
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -572,17 +572,17 @@
auto idbKey = scriptValueToIDBKey(execState, key);
- return doCount(execState, IDBKeyRangeData(idbKey->isValid() ? idbKey.ptr() : nullptr));
+ return doCount(IDBKeyRangeData(idbKey->isValid() ? idbKey.ptr() : nullptr));
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::count(JSGlobalObject& execState, IDBKeyRange* range)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::count(IDBKeyRange* range)
{
LOG(IndexedDB, "IDBObjectStore::count");
- return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
+ return doCount(range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doCount(JSGlobalObject& execState, const IDBKeyRangeData& range)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doCount(const IDBKeyRangeData& range)
{
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -600,10 +600,10 @@
if (!range.isValid())
return Exception { DataError, "Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key."_s };
- return m_transaction.requestCount(execState, *this, range);
+ return m_transaction.requestCount(*this, range);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doGetAll(JSGlobalObject& execState, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doGetAll(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBObjectStore::getAll");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -619,12 +619,12 @@
return keyRange.releaseException();
auto* keyRangePointer = keyRange.returnValue().get();
- return m_transaction.requestGetAllObjectStoreRecords(execState, *this, keyRangePointer, IndexedDB::GetAllType::Values, count);
+ return m_transaction.requestGetAllObjectStoreRecords(*this, keyRangePointer, IndexedDB::GetAllType::Values, count);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
{
- return doGetAll(execState, count, [range = WTFMove(range)]() {
+ return doGetAll(count, [range = WTFMove(range)]() {
return range;
});
}
@@ -631,7 +631,7 @@
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(JSGlobalObject& execState, JSValue key, std::optional<uint32_t> count)
{
- return doGetAll(execState, count, [state=&execState, key]() {
+ return doGetAll(count, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'getAll' on 'IDBObjectStore': The parameter is not a valid key."_s) };
@@ -640,7 +640,7 @@
});
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doGetAllKeys(JSGlobalObject& execState, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doGetAllKeys(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&& function)
{
LOG(IndexedDB, "IDBObjectStore::getAllKeys");
ASSERT(canCurrentThreadAccessThreadLocalData(m_transaction.database().originThread()));
@@ -656,12 +656,12 @@
return keyRange.releaseException();
auto* keyRangePointer = keyRange.returnValue().get();
- return m_transaction.requestGetAllObjectStoreRecords(execState, *this, keyRangePointer, IndexedDB::GetAllType::Keys, count);
+ return m_transaction.requestGetAllObjectStoreRecords(*this, keyRangePointer, IndexedDB::GetAllType::Keys, count);
}
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(JSGlobalObject& execState, RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(RefPtr<IDBKeyRange>&& range, std::optional<uint32_t> count)
{
- return doGetAllKeys(execState, count, [range = WTFMove(range)]() {
+ return doGetAllKeys(count, [range = WTFMove(range)]() {
return range;
});
}
@@ -668,7 +668,7 @@
ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(JSGlobalObject& execState, JSValue key, std::optional<uint32_t> count)
{
- return doGetAllKeys(execState, count, [state=&execState, key]() {
+ return doGetAllKeys(count, [state = &execState, key]() {
auto _onlyResult_ = IDBKeyRange::only(*state, key);
if (onlyResult.hasException())
return ExceptionOr<RefPtr<IDBKeyRange>>{ Exception(DataError, "Failed to execute 'getAllKeys' on 'IDBObjectStore': The parameter is not a valid key."_s) };
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2021-10-24 17:37:41 UTC (rev 284761)
@@ -74,27 +74,27 @@
bool multiEntry;
};
- ExceptionOr<Ref<IDBRequest>> openCursor(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, IDBCursorDirection);
+ ExceptionOr<Ref<IDBRequest>> openCursor(RefPtr<IDBKeyRange>&&, IDBCursorDirection);
ExceptionOr<Ref<IDBRequest>> openCursor(JSC::JSGlobalObject&, JSC::JSValue key, IDBCursorDirection);
- ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, IDBCursorDirection);
+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(RefPtr<IDBKeyRange>&&, IDBCursorDirection);
ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::JSGlobalObject&, JSC::JSValue key, IDBCursorDirection);
ExceptionOr<Ref<IDBRequest>> get(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> get(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> get(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> getKey(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> getKey(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> getKey(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> add(JSC::JSGlobalObject&, JSC::JSValue, JSC::JSValue key);
ExceptionOr<Ref<IDBRequest>> put(JSC::JSGlobalObject&, JSC::JSValue, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> deleteFunction(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> clear(JSC::JSGlobalObject&);
- ExceptionOr<Ref<IDBIndex>> createIndex(JSC::JSGlobalObject&, const String& name, IDBKeyPath&&, const IndexParameters&);
+ ExceptionOr<Ref<IDBRequest>> clear();
+ ExceptionOr<Ref<IDBIndex>> createIndex(const String& name, IDBKeyPath&&, const IndexParameters&);
ExceptionOr<Ref<IDBIndex>> index(const String& name);
ExceptionOr<void> deleteIndex(const String& name);
- ExceptionOr<Ref<IDBRequest>> count(JSC::JSGlobalObject&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> count(IDBKeyRange*);
ExceptionOr<Ref<IDBRequest>> count(JSC::JSGlobalObject&, JSC::JSValue key);
- ExceptionOr<Ref<IDBRequest>> getAll(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAll(RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
ExceptionOr<Ref<IDBRequest>> getAll(JSC::JSGlobalObject&, JSC::JSValue key, std::optional<uint32_t> count);
- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::JSGlobalObject&, RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAllKeys(RefPtr<IDBKeyRange>&&, std::optional<uint32_t> count);
ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::JSGlobalObject&, JSC::JSValue key, std::optional<uint32_t> count);
ExceptionOr<Ref<IDBRequest>> putForCursorUpdate(JSC::JSGlobalObject&, JSC::JSValue, RefPtr<IDBKey>&&, RefPtr<SerializedScriptValue>&&);
@@ -115,12 +115,12 @@
private:
enum class InlineKeyCheck { Perform, DoNotPerform };
ExceptionOr<Ref<IDBRequest>> putOrAdd(JSC::JSGlobalObject&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck, RefPtr<SerializedScriptValue>&& = nullptr);
- ExceptionOr<Ref<IDBRequest>> doCount(JSC::JSGlobalObject&, const IDBKeyRangeData&);
- ExceptionOr<Ref<IDBRequest>> doDelete(JSC::JSGlobalObject&, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
- ExceptionOr<Ref<IDBRequest>> doOpenCursor(JSC::JSGlobalObject&, IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&&);
- ExceptionOr<Ref<IDBRequest>> doOpenKeyCursor(JSC::JSGlobalObject&, IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&&);
- ExceptionOr<Ref<IDBRequest>> doGetAll(JSC::JSGlobalObject&, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
- ExceptionOr<Ref<IDBRequest>> doGetAllKeys(JSC::JSGlobalObject&, std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doCount(const IDBKeyRangeData&);
+ ExceptionOr<Ref<IDBRequest>> doDelete(WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doOpenCursor(IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&&);
+ ExceptionOr<Ref<IDBRequest>> doOpenKeyCursor(IDBCursorDirection, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()>&&);
+ ExceptionOr<Ref<IDBRequest>> doGetAll(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
+ ExceptionOr<Ref<IDBRequest>> doGetAllKeys(std::optional<uint32_t> count, WTF::Function<ExceptionOr<RefPtr<IDBKeyRange>>()> &&);
// ActiveDOMObject.
const char* activeDOMObjectName() const final;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl 2021-10-24 17:37:41 UTC (rev 284761)
@@ -42,28 +42,28 @@
[NewObject, CallWith=GlobalObject] IDBRequest put(any value, optional any key);
[NewObject, CallWith=GlobalObject] IDBRequest add(any value, optional any key);
- [NewObject, CallWith=GlobalObject, ImplementedAs=deleteFunction] IDBRequest delete(IDBKeyRange? keyRange);
+ [NewObject, ImplementedAs=deleteFunction] IDBRequest delete(IDBKeyRange? keyRange);
[NewObject, CallWith=GlobalObject, ImplementedAs=deleteFunction] IDBRequest delete(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest clear();
- [NewObject, CallWith=GlobalObject] IDBRequest get(IDBKeyRange? key);
+ [NewObject] IDBRequest clear();
+ [NewObject] IDBRequest get(IDBKeyRange? key);
[NewObject, CallWith=GlobalObject] IDBRequest get(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest getKey(IDBKeyRange? key);
+ [NewObject] IDBRequest getKey(IDBKeyRange? key);
[NewObject, CallWith=GlobalObject] IDBRequest getKey(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest getAll(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
+ [NewObject] IDBRequest getAll(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
[NewObject, CallWith=GlobalObject] IDBRequest getAll(any key, optional [EnforceRange] unsigned long count);
- [NewObject, CallWith=GlobalObject] IDBRequest getAllKeys(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
+ [NewObject] IDBRequest getAllKeys(optional IDBKeyRange? range = null, optional [EnforceRange] unsigned long count);
[NewObject, CallWith=GlobalObject] IDBRequest getAllKeys(any key, optional [EnforceRange] unsigned long count);
- [NewObject, CallWith=GlobalObject] IDBRequest count(optional IDBKeyRange? range = null);
+ [NewObject] IDBRequest count(optional IDBKeyRange? range = null);
[NewObject, CallWith=GlobalObject] IDBRequest count(any key);
- [NewObject, CallWith=GlobalObject] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+ [NewObject] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
[NewObject, CallWith=GlobalObject] IDBRequest openCursor(any key, optional IDBCursorDirection direction = "next");
- [NewObject, CallWith=GlobalObject] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+ [NewObject] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
[NewObject, CallWith=GlobalObject] IDBRequest openKeyCursor(any key, optional IDBCursorDirection direction = "next");
IDBIndex index(DOMString name);
- [NewObject, CallWith=GlobalObject] IDBIndex createIndex(DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters options);
+ [NewObject] IDBIndex createIndex(DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters options);
undefined deleteIndex(DOMString name);
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2021-10-24 17:37:41 UTC (rev 284761)
@@ -818,35 +818,33 @@
ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::RenameIndexSuccess || resultData.type() == IDBResultType::Error);
}
-Ref<IDBRequest> IDBTransaction::requestOpenCursor(JSGlobalObject& state, IDBObjectStore& objectStore, const IDBCursorInfo& info)
+Ref<IDBRequest> IDBTransaction::requestOpenCursor(IDBObjectStore& objectStore, const IDBCursorInfo& info)
{
LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
if (info.cursorType() == IndexedDB::CursorType::KeyOnly)
- return doRequestOpenCursor(state, IDBCursor::create(objectStore, info));
+ return doRequestOpenCursor(IDBCursor::create(objectStore, info));
- return doRequestOpenCursor(state, IDBCursorWithValue::create(objectStore, info));
+ return doRequestOpenCursor(IDBCursorWithValue::create(objectStore, info));
}
-Ref<IDBRequest> IDBTransaction::requestOpenCursor(JSGlobalObject& state, IDBIndex& index, const IDBCursorInfo& info)
+Ref<IDBRequest> IDBTransaction::requestOpenCursor(IDBIndex& index, const IDBCursorInfo& info)
{
LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
if (info.cursorType() == IndexedDB::CursorType::KeyOnly)
- return doRequestOpenCursor(state, IDBCursor::create(index, info));
+ return doRequestOpenCursor(IDBCursor::create(index, info));
- return doRequestOpenCursor(state, IDBCursorWithValue::create(index, info));
+ return doRequestOpenCursor(IDBCursorWithValue::create(index, info));
}
-Ref<IDBRequest> IDBTransaction::doRequestOpenCursor(JSGlobalObject& state, Ref<IDBCursor>&& cursor)
+Ref<IDBRequest> IDBTransaction::doRequestOpenCursor(Ref<IDBCursor>&& cursor)
{
ASSERT(isActive());
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), cursor.get(), *this);
addRequest(request.get());
@@ -926,14 +924,12 @@
completeCursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestGetAllObjectStoreRecords(JSC::JSGlobalObject& state, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count)
+Ref<IDBRequest> IDBTransaction::requestGetAllObjectStoreRecords(IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count)
{
LOG(IndexedDB, "IDBTransaction::requestGetAllObjectStoreRecords");
ASSERT(isActive());
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), objectStore, *this);
addRequest(request.get());
@@ -949,13 +945,12 @@
return request;
}
-Ref<IDBRequest> IDBTransaction::requestGetAllIndexRecords(JSC::JSGlobalObject& state, IDBIndex& index, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count)
+Ref<IDBRequest> IDBTransaction::requestGetAllIndexRecords(IDBIndex& index, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count)
{
LOG(IndexedDB, "IDBTransaction::requestGetAllIndexRecords");
ASSERT(isActive());
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
auto request = IDBRequest::create(*scriptExecutionContext(), index, *this);
addRequest(request.get());
@@ -1005,7 +1000,7 @@
completeNoncursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestGetRecord(JSGlobalObject& state, IDBObjectStore& objectStore, const IDBGetRecordData& getRecordData)
+Ref<IDBRequest> IDBTransaction::requestGetRecord(IDBObjectStore& objectStore, const IDBGetRecordData& getRecordData)
{
LOG(IndexedDB, "IDBTransaction::requestGetRecord");
ASSERT(isActive());
@@ -1012,8 +1007,6 @@
ASSERT(!getRecordData.keyRangeData.isNull);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
IndexedDB::ObjectStoreRecordType type = getRecordData.type == IDBGetRecordDataType::KeyAndValue ? IndexedDB::ObjectStoreRecordType::ValueOnly : IndexedDB::ObjectStoreRecordType::KeyOnly;
auto request = IDBRequest::createObjectStoreGet(*scriptExecutionContext(), objectStore, type, *this);
@@ -1029,23 +1022,23 @@
return request;
}
-Ref<IDBRequest> IDBTransaction::requestGetValue(JSGlobalObject& state, IDBIndex& index, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestGetValue(IDBIndex& index, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestGetValue");
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- return requestIndexRecord(state, index, IndexedDB::IndexRecordType::Value, range);
+ return requestIndexRecord(index, IndexedDB::IndexRecordType::Value, range);
}
-Ref<IDBRequest> IDBTransaction::requestGetKey(JSGlobalObject& state, IDBIndex& index, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestGetKey(IDBIndex& index, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestGetValue");
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- return requestIndexRecord(state, index, IndexedDB::IndexRecordType::Key, range);
+ return requestIndexRecord(index, IndexedDB::IndexRecordType::Key, range);
}
-Ref<IDBRequest> IDBTransaction::requestIndexRecord(JSGlobalObject& state, IDBIndex& index, IndexedDB::IndexRecordType type, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestIndexRecord(IDBIndex& index, IndexedDB::IndexRecordType type, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestGetValue");
ASSERT(isActive());
@@ -1052,8 +1045,6 @@
ASSERT(!range.isNull);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::createIndexGet(*scriptExecutionContext(), index, type, *this);
addRequest(request.get());
@@ -1110,7 +1101,7 @@
completeNoncursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestCount(JSGlobalObject& state, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestCount(IDBObjectStore& objectStore, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestCount (IDBObjectStore)");
ASSERT(isActive());
@@ -1117,8 +1108,6 @@
ASSERT(!range.isNull);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), objectStore, *this);
addRequest(request.get());
@@ -1132,7 +1121,7 @@
return request;
}
-Ref<IDBRequest> IDBTransaction::requestCount(JSGlobalObject& state, IDBIndex& index, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestCount(IDBIndex& index, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestCount (IDBIndex)");
ASSERT(isActive());
@@ -1139,8 +1128,6 @@
ASSERT(!range.isNull);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), index, *this);
addRequest(request.get());
@@ -1171,7 +1158,7 @@
completeNoncursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestDeleteRecord(JSGlobalObject& state, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
+Ref<IDBRequest> IDBTransaction::requestDeleteRecord(IDBObjectStore& objectStore, const IDBKeyRangeData& range)
{
LOG(IndexedDB, "IDBTransaction::requestDeleteRecord");
ASSERT(isActive());
@@ -1178,8 +1165,6 @@
ASSERT(!range.isNull);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), objectStore, *this);
addRequest(request.get());
@@ -1209,14 +1194,12 @@
completeNoncursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestClearObjectStore(JSGlobalObject& state, IDBObjectStore& objectStore)
+Ref<IDBRequest> IDBTransaction::requestClearObjectStore(IDBObjectStore& objectStore)
{
LOG(IndexedDB, "IDBTransaction::requestClearObjectStore");
ASSERT(isActive());
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), objectStore, *this);
addRequest(request.get());
@@ -1249,7 +1232,7 @@
completeNoncursorRequest(request, resultData);
}
-Ref<IDBRequest> IDBTransaction::requestPutOrAdd(JSGlobalObject& state, IDBObjectStore& objectStore, RefPtr<IDBKey>&& key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
+Ref<IDBRequest> IDBTransaction::requestPutOrAdd(IDBObjectStore& objectStore, RefPtr<IDBKey>&& key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
{
LOG(IndexedDB, "IDBTransaction::requestPutOrAdd");
ASSERT(isActive());
@@ -1257,8 +1240,6 @@
ASSERT(objectStore.info().autoIncrement() || key);
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
- ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
-
auto request = IDBRequest::create(*scriptExecutionContext(), objectStore, *this);
addRequest(request.get());
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (284760 => 284761)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2021-10-24 17:37:41 UTC (rev 284761)
@@ -112,18 +112,18 @@
std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&);
void renameIndex(IDBIndex&, const String& newName);
- Ref<IDBRequest> requestPutOrAdd(JSC::JSGlobalObject&, IDBObjectStore&, RefPtr<IDBKey>&&, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
- Ref<IDBRequest> requestGetRecord(JSC::JSGlobalObject&, IDBObjectStore&, const IDBGetRecordData&);
- Ref<IDBRequest> requestGetAllObjectStoreRecords(JSC::JSGlobalObject&, IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count);
- Ref<IDBRequest> requestGetAllIndexRecords(JSC::JSGlobalObject&, IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count);
- Ref<IDBRequest> requestDeleteRecord(JSC::JSGlobalObject&, IDBObjectStore&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestClearObjectStore(JSC::JSGlobalObject&, IDBObjectStore&);
- Ref<IDBRequest> requestCount(JSC::JSGlobalObject&, IDBObjectStore&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestCount(JSC::JSGlobalObject&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestGetValue(JSC::JSGlobalObject&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestGetKey(JSC::JSGlobalObject&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestOpenCursor(JSC::JSGlobalObject&, IDBObjectStore&, const IDBCursorInfo&);
- Ref<IDBRequest> requestOpenCursor(JSC::JSGlobalObject&, IDBIndex&, const IDBCursorInfo&);
+ Ref<IDBRequest> requestPutOrAdd(IDBObjectStore&, RefPtr<IDBKey>&&, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
+ Ref<IDBRequest> requestGetRecord(IDBObjectStore&, const IDBGetRecordData&);
+ Ref<IDBRequest> requestGetAllObjectStoreRecords(IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count);
+ Ref<IDBRequest> requestGetAllIndexRecords(IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count);
+ Ref<IDBRequest> requestDeleteRecord(IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestClearObjectStore(IDBObjectStore&);
+ Ref<IDBRequest> requestCount(IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestCount(IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestGetValue(IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestGetKey(IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestOpenCursor(IDBObjectStore&, const IDBCursorInfo&);
+ Ref<IDBRequest> requestOpenCursor(IDBIndex&, const IDBCursorInfo&);
void iterateCursor(IDBCursor&, const IDBIterateCursorData&);
void deleteObjectStore(const String& objectStoreName);
@@ -180,7 +180,7 @@
void fireOnAbort();
void enqueueEvent(Ref<Event>&&);
- Ref<IDBRequest> requestIndexRecord(JSC::JSGlobalObject&, IDBIndex&, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestIndexRecord(IDBIndex&, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
void commitOnServer(IDBClient::TransactionOperation&, uint64_t pendingRequestCount);
void abortOnServerAndCancelRequests(IDBClient::TransactionOperation&);
@@ -221,7 +221,7 @@
void deleteIndexOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& indexName);
void didDeleteIndexOnServer(const IDBResultData&);
- Ref<IDBRequest> doRequestOpenCursor(JSC::JSGlobalObject&, Ref<IDBCursor>&&);
+ Ref<IDBRequest> doRequestOpenCursor(Ref<IDBCursor>&&);
void openCursorOnServer(IDBClient::TransactionOperation&, const IDBCursorInfo&);
void didOpenCursorOnServer(IDBRequest&, const IDBResultData&);
Modified: trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp (284760 => 284761)
--- trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp 2021-10-24 17:14:00 UTC (rev 284760)
+++ trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp 2021-10-24 17:37:41 UTC (rev 284761)
@@ -461,7 +461,6 @@
TransactionActivator activator(idbTransaction.get());
RefPtr<IDBRequest> idbRequest;
- auto* exec = context() ? context()->globalObject() : nullptr;
if (!m_indexName.isEmpty()) {
auto idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName);
if (!idbIndex) {
@@ -469,17 +468,13 @@
return;
}
- if (exec) {
- auto result = idbIndex->openCursor(*exec, m_idbKeyRange.get(), IDBCursorDirection::Next);
- if (!result.hasException())
- idbRequest = result.releaseReturnValue();
- }
+ auto result = idbIndex->openCursor(m_idbKeyRange.get(), IDBCursorDirection::Next);
+ if (!result.hasException())
+ idbRequest = result.releaseReturnValue();
} else {
- if (exec) {
- auto result = idbObjectStore->openCursor(*exec, m_idbKeyRange.get(), IDBCursorDirection::Next);
- if (!result.hasException())
- idbRequest = result.releaseReturnValue();
- }
+ auto result = idbObjectStore->openCursor(m_idbKeyRange.get(), IDBCursorDirection::Next);
+ if (!result.hasException())
+ idbRequest = result.releaseReturnValue();
}
if (!idbRequest) {
@@ -703,15 +698,11 @@
}
TransactionActivator activator(idbTransaction.get());
- RefPtr<IDBRequest> idbRequest;
- if (auto* exec = context() ? context()->globalObject() : nullptr) {
- auto result = idbObjectStore->clear(*exec);
- ASSERT(!result.hasException());
- if (result.hasException()) {
- m_requestCallback->sendFailure(makeString("Could not clear object store '", m_objectStoreName, "': ", static_cast<int>(result.releaseException().code())));
- return;
- }
- idbRequest = result.releaseReturnValue();
+ auto result = idbObjectStore->clear();
+ ASSERT(!result.hasException());
+ if (result.hasException()) {
+ m_requestCallback->sendFailure(makeString("Could not clear object store '", m_objectStoreName, "': ", static_cast<int>(result.releaseException().code())));
+ return;
}
idbTransaction->addEventListener(eventNames().completeEvent, ClearObjectStoreListener::create(m_requestCallback.copyRef()), false);