fix(indexeddb): complete native key and upgrade handle integration

Create requests after key conversion and reject transactions invalidated by author code. Preserve transaction-owned wrapper identities across borrowed methods and keep the stronger key-range regression coverage.
This commit is contained in:
ldm0
2026-11-20 22:47:58 +08:00
parent 55c9a85804
commit 72dbce9a08
@@ -23,7 +23,7 @@ async function upgradeHandleProbe(name = 'upgrade-handles-' + Math.random()) {
db = opening.result; tx = opening.transaction;
store = tx.objectStore('s');
alias = peer.IDBTransaction.prototype.objectStore.call(tx, 's');
if (frame) check('borrowed method preserves wrapper creation realm', Object.getPrototypeOf(alias) === peer.IDBObjectStore.prototype);
if (frame) check('borrowed method preserves transaction object identity and realm', alias === store && Object.getPrototypeOf(alias) === IDBObjectStore.prototype);
for (const source of [store, alias]) equal('initial index names', Array.from(source.indexNames), ['old']);
indexes = [store.index('old'), alias.index('old'),
peer.IDBObjectStore.prototype.index.call(store, 'old'),
@@ -38,7 +38,7 @@ async function upgradeHandleProbe(name = 'upgrade-handles-' + Math.random()) {
check('new index is immediately found', source.index('transient').name === 'transient');
}
check('local metadata keeps receiver realm', Object.getPrototypeOf(store.indexNames) === DOMStringList.prototype);
check('foreign metadata keeps receiver realm', Object.getPrototypeOf(alias.indexNames) === peer.DOMStringList.prototype);
check('borrowed method metadata keeps transaction realm', Object.getPrototypeOf(alias.indexNames) === DOMStringList.prototype);
store.deleteIndex('old');
for (const index of indexes) equal('deleteIndex invalidates all index realms', errorName(() => index.get(1)), 'InvalidStateError');
for (const source of [store, alias]) equal('deleted index lookup', errorName(() => source.index('old')), 'NotFoundError');