WebKit Bugzilla
Attachment 372803 Details for
Bug 198738
: REGRESSION (r244436): IndexedDB Uint8Array returned as ArrayBuffer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198738-20190624143032.patch (text/plain), 10.73 KB, created by
Sihui Liu
on 2019-06-24 14:30:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2019-06-24 14:30:34 PDT
Size:
10.73 KB
patch
obsolete
>Subversion Revision: 246709 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 80896f8e9f86f52bb683773c1f23577bb9458c6b..2409375add27964817a0943c645173cf10b0772e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-06-24 Sihui Liu <sihui_liu@apple.com> >+ >+ REGRESSION (r244436): IndexedDB Uint8Array returned as ArrayBuffer >+ https://bugs.webkit.org/show_bug.cgi?id=198738 >+ <rdar://problem/51614053> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In InexedDB, two binary keys are the same as long as their data is the same. >+ >+ Modified tests: storage/indexeddb/key-type-binary.html >+ storage/indexeddb/key-type-binary-private.html >+ >+ * bindings/js/IDBBindingUtilities.cpp: >+ (WebCore::injectIDBKeyIntoScriptValue): >+ * bindings/js/SerializedScriptValue.cpp: >+ (WebCore::CloneDeserializer::readArrayBufferView): >+ > 2019-06-21 Sihui Liu <sihui_liu@apple.com> > > openDatabase should return an empty object when WebSQL is disabled >diff --git a/Source/WebCore/bindings/js/IDBBindingUtilities.cpp b/Source/WebCore/bindings/js/IDBBindingUtilities.cpp >index ad9234c7cd9e2458f6764cc90c439db17f24da23..1a625539c67c3a6d10ae008ade13024d74b6abdd 100644 >--- a/Source/WebCore/bindings/js/IDBBindingUtilities.cpp >+++ b/Source/WebCore/bindings/js/IDBBindingUtilities.cpp >@@ -327,11 +327,9 @@ bool injectIDBKeyIntoScriptValue(ExecState& exec, const IDBKeyData& keyData, JSV > return false; > > // Do not set if object already has the correct property value. >- auto jsKey = toJS(exec, *exec.lexicalGlobalObject(), key.get()); > JSValue existingKey; >- if (get(exec, parent, keyPathElements.last(), existingKey) && existingKey == jsKey) >+ if (get(exec, parent, keyPathElements.last(), existingKey) && !key->compare(createIDBKeyFromValue(exec, existingKey))) > return true; >- > if (!set(exec, parent, keyPathElements.last(), toJS(exec, *exec.lexicalGlobalObject(), key.get()))) > return false; > >diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >index c4600f859d28e3635c98e5124075493a54602db5..965ece394b9832604a343bb2863b14be74fb87b4 100644 >--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp >+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >@@ -2136,7 +2136,7 @@ private: > RefPtr<ArrayBuffer> arrayBuffer = toPossiblySharedArrayBuffer(vm, arrayBufferObj); > switch (arrayBufferViewSubtag) { > case DataViewTag: >- arrayBufferView = getJSValue(DataView::create(WTFMove(arrayBuffer), byteOffset, length).get()); >+ arrayBufferView = toJS(m_exec, m_globalObject, DataView::create(WTFMove(arrayBuffer), byteOffset, length).get()); > return true; > case Int8ArrayTag: > arrayBufferView = toJS(m_exec, m_globalObject, Int8Array::tryCreate(WTFMove(arrayBuffer), byteOffset, length).get()); >diff --git a/LayoutTests/storage/indexeddb/key-type-binary-expected.txt b/LayoutTests/storage/indexeddb/key-type-binary-expected.txt >index ee0e3e44aa10228c92b3bbb702f0d2d3ba65a5e3..2c22cf4d8818058385b42a3e79b112ecc37cd2f8 100644 >--- a/LayoutTests/storage/indexeddb/key-type-binary-expected.txt >+++ b/LayoutTests/storage/indexeddb/key-type-binary-expected.txt >@@ -8,6 +8,7 @@ indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self. > indexedDB.deleteDatabase(dbname) > indexedDB.open(dbname) > db.createObjectStore('store'); >+db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'}); > > > testBinaryKeys1(): >@@ -53,6 +54,60 @@ store.put('value', new Float64Array([1,2,3])) > store.put('value', new Uint8Array([1,2,3]).buffer) > > store.put('value', new DataView(new Uint8Array([1,2,3]).buffer)) >+ >+testBinaryKeys3(): >+trans = db.transaction('storeWithKeyPath', 'readwrite') >+store = trans.objectStore('storeWithKeyPath') >+ >+binary = new Uint8ClampedArray([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint16Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int8Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int16Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Float32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Float64Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint8Array([1,2,3]).buffer >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new DataView(new Uint8Array([1,2,3]).buffer) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt b/LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt >index ee0e3e44aa10228c92b3bbb702f0d2d3ba65a5e3..2c22cf4d8818058385b42a3e79b112ecc37cd2f8 100644 >--- a/LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt >+++ b/LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt >@@ -8,6 +8,7 @@ indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self. > indexedDB.deleteDatabase(dbname) > indexedDB.open(dbname) > db.createObjectStore('store'); >+db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'}); > > > testBinaryKeys1(): >@@ -53,6 +54,60 @@ store.put('value', new Float64Array([1,2,3])) > store.put('value', new Uint8Array([1,2,3]).buffer) > > store.put('value', new DataView(new Uint8Array([1,2,3]).buffer)) >+ >+testBinaryKeys3(): >+trans = db.transaction('storeWithKeyPath', 'readwrite') >+store = trans.objectStore('storeWithKeyPath') >+ >+binary = new Uint8ClampedArray([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint16Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int8Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int16Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Int32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Float32Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Float64Array([1,2,3]) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new Uint8Array([1,2,3]).buffer >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true >+ >+binary = new DataView(new Uint8Array([1,2,3]).buffer) >+store.put({ binary }) >+request = store.get(binary) >+PASS binary.constructor === request.result.binary.constructor is true > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/storage/indexeddb/resources/key-type-binary.js b/LayoutTests/storage/indexeddb/resources/key-type-binary.js >index c3f23f5118952ef100f8ca8764adb3c57bbb6f72..63318edd1131e6fdb048e30497f00955aa2c39ee 100644 >--- a/LayoutTests/storage/indexeddb/resources/key-type-binary.js >+++ b/LayoutTests/storage/indexeddb/resources/key-type-binary.js >@@ -11,6 +11,7 @@ function prepareDatabase() > db = event.target.result; > event.target.transaction.onabort = unexpectedAbortCallback; > objectStore = evalAndLog("db.createObjectStore('store');"); >+ objectStoreWithKeyPath = evalAndLog("db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'});"); > debug(""); > } > >@@ -46,29 +47,54 @@ function testBinaryKeys1() > trans.oncomplete = testBinaryKeys2; > } > >+const cases = [ >+ "new Uint8ClampedArray([1,2,3])", >+ "new Uint16Array([1,2,3])", >+ "new Uint32Array([1,2,3])", >+ "new Int8Array([1,2,3])", >+ "new Int16Array([1,2,3])", >+ "new Int32Array([1,2,3])", >+ "new Float32Array([1,2,3])", >+ "new Float64Array([1,2,3])", >+ "new Uint8Array([1,2,3]).buffer", >+ "new DataView(new Uint8Array([1,2,3]).buffer)" >+]; >+ > function testBinaryKeys2() > { > preamble(); > evalAndLog("trans = db.transaction('store', 'readwrite')"); > evalAndLog("store = trans.objectStore('store')"); > >- var cases = [ >- "new Uint8ClampedArray([1,2,3])", >- "new Uint16Array([1,2,3])", >- "new Uint32Array([1,2,3])", >- "new Int8Array([1,2,3])", >- "new Int16Array([1,2,3])", >- "new Int32Array([1,2,3])", >- "new Float32Array([1,2,3])", >- "new Float64Array([1,2,3])", >- "new Uint8Array([1,2,3]).buffer", >- "new DataView(new Uint8Array([1,2,3]).buffer)" >- ]; >- > cases.forEach(function(testCase) { > debug(""); > evalAndLog("store.put('value', " + testCase + ")"); > }); > >- finishJSTest(); >+ trans.oncomplete = testBinaryKeys3; > } >+ >+function runTest(testNumber) { >+ debug(""); >+ evalAndLog("binary = " + cases[testNumber]); >+ evalAndLog("store.put({ binary })"); >+ evalAndLog("request = store.get(binary)"); >+ request.onsuccess = ()=>{ >+ shouldBeTrue("binary.constructor === request.result.binary.constructor"); >+ >+ if (++testNumber == cases.length) >+ finishJSTest(); >+ else >+ runTest(testNumber); >+ } >+ request.onerror = unexpectedErrorCallback; >+} >+ >+function testBinaryKeys3() >+{ >+ preamble(); >+ evalAndLog("trans = db.transaction('storeWithKeyPath', 'readwrite')"); >+ evalAndLog("store = trans.objectStore('storeWithKeyPath')"); >+ >+ runTest(0); >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198738
:
371805
|
371806
|
372785
|
372792
|
372796
|
372798
|
372800
| 372803