Changeset 246770 in webkit
- Timestamp:
- Jun 24, 2019 4:45:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/storage/indexeddb/key-type-binary-expected.txt
r208349 r246770 9 9 indexedDB.open(dbname) 10 10 db.createObjectStore('store'); 11 db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'}); 11 12 12 13 … … 54 55 55 56 store.put('value', new DataView(new Uint8Array([1,2,3]).buffer)) 57 58 testBinaryKeys3(): 59 trans = db.transaction('storeWithKeyPath', 'readwrite') 60 store = trans.objectStore('storeWithKeyPath') 61 62 binary = new Uint8ClampedArray([1,2,3]) 63 store.put({ binary }) 64 request = store.get(binary) 65 PASS binary.constructor === request.result.binary.constructor is true 66 67 binary = new Uint16Array([1,2,3]) 68 store.put({ binary }) 69 request = store.get(binary) 70 PASS binary.constructor === request.result.binary.constructor is true 71 72 binary = new Uint32Array([1,2,3]) 73 store.put({ binary }) 74 request = store.get(binary) 75 PASS binary.constructor === request.result.binary.constructor is true 76 77 binary = new Int8Array([1,2,3]) 78 store.put({ binary }) 79 request = store.get(binary) 80 PASS binary.constructor === request.result.binary.constructor is true 81 82 binary = new Int16Array([1,2,3]) 83 store.put({ binary }) 84 request = store.get(binary) 85 PASS binary.constructor === request.result.binary.constructor is true 86 87 binary = new Int32Array([1,2,3]) 88 store.put({ binary }) 89 request = store.get(binary) 90 PASS binary.constructor === request.result.binary.constructor is true 91 92 binary = new Float32Array([1,2,3]) 93 store.put({ binary }) 94 request = store.get(binary) 95 PASS binary.constructor === request.result.binary.constructor is true 96 97 binary = new Float64Array([1,2,3]) 98 store.put({ binary }) 99 request = store.get(binary) 100 PASS binary.constructor === request.result.binary.constructor is true 101 102 binary = new Uint8Array([1,2,3]).buffer 103 store.put({ binary }) 104 request = store.get(binary) 105 PASS binary.constructor === request.result.binary.constructor is true 106 107 binary = new DataView(new Uint8Array([1,2,3]).buffer) 108 store.put({ binary }) 109 request = store.get(binary) 110 PASS binary.constructor === request.result.binary.constructor is true 56 111 PASS successfullyParsed is true 57 112 -
trunk/LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt
r208349 r246770 9 9 indexedDB.open(dbname) 10 10 db.createObjectStore('store'); 11 db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'}); 11 12 12 13 … … 54 55 55 56 store.put('value', new DataView(new Uint8Array([1,2,3]).buffer)) 57 58 testBinaryKeys3(): 59 trans = db.transaction('storeWithKeyPath', 'readwrite') 60 store = trans.objectStore('storeWithKeyPath') 61 62 binary = new Uint8ClampedArray([1,2,3]) 63 store.put({ binary }) 64 request = store.get(binary) 65 PASS binary.constructor === request.result.binary.constructor is true 66 67 binary = new Uint16Array([1,2,3]) 68 store.put({ binary }) 69 request = store.get(binary) 70 PASS binary.constructor === request.result.binary.constructor is true 71 72 binary = new Uint32Array([1,2,3]) 73 store.put({ binary }) 74 request = store.get(binary) 75 PASS binary.constructor === request.result.binary.constructor is true 76 77 binary = new Int8Array([1,2,3]) 78 store.put({ binary }) 79 request = store.get(binary) 80 PASS binary.constructor === request.result.binary.constructor is true 81 82 binary = new Int16Array([1,2,3]) 83 store.put({ binary }) 84 request = store.get(binary) 85 PASS binary.constructor === request.result.binary.constructor is true 86 87 binary = new Int32Array([1,2,3]) 88 store.put({ binary }) 89 request = store.get(binary) 90 PASS binary.constructor === request.result.binary.constructor is true 91 92 binary = new Float32Array([1,2,3]) 93 store.put({ binary }) 94 request = store.get(binary) 95 PASS binary.constructor === request.result.binary.constructor is true 96 97 binary = new Float64Array([1,2,3]) 98 store.put({ binary }) 99 request = store.get(binary) 100 PASS binary.constructor === request.result.binary.constructor is true 101 102 binary = new Uint8Array([1,2,3]).buffer 103 store.put({ binary }) 104 request = store.get(binary) 105 PASS binary.constructor === request.result.binary.constructor is true 106 107 binary = new DataView(new Uint8Array([1,2,3]).buffer) 108 store.put({ binary }) 109 request = store.get(binary) 110 PASS binary.constructor === request.result.binary.constructor is true 56 111 PASS successfullyParsed is true 57 112 -
trunk/LayoutTests/storage/indexeddb/resources/key-type-binary.js
r208349 r246770 12 12 event.target.transaction.onabort = unexpectedAbortCallback; 13 13 objectStore = evalAndLog("db.createObjectStore('store');"); 14 objectStoreWithKeyPath = evalAndLog("db.createObjectStore('storeWithKeyPath', {keyPath: 'binary'});"); 14 15 debug(""); 15 16 } … … 47 48 } 48 49 50 const cases = [ 51 "new Uint8ClampedArray([1,2,3])", 52 "new Uint16Array([1,2,3])", 53 "new Uint32Array([1,2,3])", 54 "new Int8Array([1,2,3])", 55 "new Int16Array([1,2,3])", 56 "new Int32Array([1,2,3])", 57 "new Float32Array([1,2,3])", 58 "new Float64Array([1,2,3])", 59 "new Uint8Array([1,2,3]).buffer", 60 "new DataView(new Uint8Array([1,2,3]).buffer)" 61 ]; 62 49 63 function testBinaryKeys2() 50 64 { … … 53 67 evalAndLog("store = trans.objectStore('store')"); 54 68 55 var cases = [56 "new Uint8ClampedArray([1,2,3])",57 "new Uint16Array([1,2,3])",58 "new Uint32Array([1,2,3])",59 "new Int8Array([1,2,3])",60 "new Int16Array([1,2,3])",61 "new Int32Array([1,2,3])",62 "new Float32Array([1,2,3])",63 "new Float64Array([1,2,3])",64 "new Uint8Array([1,2,3]).buffer",65 "new DataView(new Uint8Array([1,2,3]).buffer)"66 ];67 68 69 cases.forEach(function(testCase) { 69 70 debug(""); … … 71 72 }); 72 73 73 finishJSTest();74 trans.oncomplete = testBinaryKeys3; 74 75 } 76 77 function runTest(testNumber) { 78 debug(""); 79 evalAndLog("binary = " + cases[testNumber]); 80 evalAndLog("store.put({ binary })"); 81 evalAndLog("request = store.get(binary)"); 82 request.onsuccess = ()=>{ 83 shouldBeTrue("binary.constructor === request.result.binary.constructor"); 84 85 if (++testNumber == cases.length) 86 finishJSTest(); 87 else 88 runTest(testNumber); 89 } 90 request.onerror = unexpectedErrorCallback; 91 } 92 93 function testBinaryKeys3() 94 { 95 preamble(); 96 evalAndLog("trans = db.transaction('storeWithKeyPath', 'readwrite')"); 97 evalAndLog("store = trans.objectStore('storeWithKeyPath')"); 98 99 runTest(0); 100 } -
trunk/Source/WebCore/ChangeLog
r246768 r246770 1 2019-06-24 Sihui Liu <sihui_liu@apple.com> 2 3 REGRESSION (r244436): IndexedDB Uint8Array returned as ArrayBuffer 4 https://bugs.webkit.org/show_bug.cgi?id=198738 5 <rdar://problem/51614053> 6 7 Reviewed by Brady Eidson. 8 9 In InexedDB, two binary keys are the same as long as their data is the same. 10 11 Modified tests: storage/indexeddb/key-type-binary.html 12 storage/indexeddb/key-type-binary-private.html 13 14 * bindings/js/IDBBindingUtilities.cpp: 15 (WebCore::injectIDBKeyIntoScriptValue): 16 * bindings/js/SerializedScriptValue.cpp: 17 (WebCore::CloneDeserializer::readArrayBufferView): 18 1 19 2019-06-24 Sihui Liu <sihui_liu@apple.com> 2 20 -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
r244436 r246770 328 328 329 329 // Do not set if object already has the correct property value. 330 auto jsKey = toJS(exec, *exec.lexicalGlobalObject(), key.get());331 330 JSValue existingKey; 332 if (get(exec, parent, keyPathElements.last(), existingKey) && existingKey == jsKey)331 if (get(exec, parent, keyPathElements.last(), existingKey) && !key->compare(createIDBKeyFromValue(exec, existingKey))) 333 332 return true; 334 335 333 if (!set(exec, parent, keyPathElements.last(), toJS(exec, *exec.lexicalGlobalObject(), key.get()))) 336 334 return false; -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r244115 r246770 2137 2137 switch (arrayBufferViewSubtag) { 2138 2138 case DataViewTag: 2139 arrayBufferView = getJSValue(DataView::create(WTFMove(arrayBuffer), byteOffset, length).get());2139 arrayBufferView = toJS(m_exec, m_globalObject, DataView::create(WTFMove(arrayBuffer), byteOffset, length).get()); 2140 2140 return true; 2141 2141 case Int8ArrayTag:
Note: See TracChangeset
for help on using the changeset viewer.