Changeset 243348 in webkit
- Timestamp:
- Mar 21, 2019, 5:03:31 PM (7 years ago)
- Location:
- trunk
- Files:
- 
      - 1 added
- 20 edited
 
 - 
          
  LayoutTests/ChangeLog (modified) (1 diff)
- 
          
  LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
- 
          
  LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt (modified) (2 diffs)
- 
          
  LayoutTests/imported/w3c/web-platform-tests/IndexedDB/keygenerator-inject-expected.txt (modified) (1 diff)
- 
          
  LayoutTests/imported/w3c/web-platform-tests/IndexedDB/keypath-exceptions-expected.txt (added)
- 
          
  LayoutTests/imported/w3c/web-platform-tests/IndexedDB/wasm-module-value-expected.txt (modified) (1 diff)
- 
          
  LayoutTests/storage/indexeddb/clone-exception-expected.txt (modified) (3 diffs)
- 
          
  LayoutTests/storage/indexeddb/clone-exception-private-expected.txt (modified) (3 diffs)
- 
          
  LayoutTests/storage/indexeddb/exceptions-expected.txt (modified) (3 diffs)
- 
          
  LayoutTests/storage/indexeddb/exceptions-private-expected.txt (modified) (3 diffs)
- 
          
  LayoutTests/storage/indexeddb/objectstore-basics-expected.txt (modified) (1 diff)
- 
          
  LayoutTests/storage/indexeddb/objectstore-basics-private-expected.txt (modified) (1 diff)
- 
          
  LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt (modified) (1 diff)
- 
          
  LayoutTests/storage/indexeddb/structured-clone-expected.txt (modified) (2 diffs)
- 
          
  LayoutTests/storage/indexeddb/structured-clone-private-expected.txt (modified) (2 diffs)
- 
          
  LayoutTests/storage/indexeddb/wasm-exceptions-expected.txt (modified) (1 diff)
- 
          
  Source/WebCore/ChangeLog (modified) (1 diff)
- 
          
  Source/WebCore/Modules/indexeddb/IDBFactory.cpp (modified) (1 diff)
- 
          
  Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (modified) (1 diff)
- 
          
  Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (modified) (1 diff)
- 
          
  Source/WebCore/bindings/js/IDBBindingUtilities.cpp (modified) (3 diffs)
 
Legend:
- Unmodified
- Added
- Removed
- 
      trunk/LayoutTests/ChangeLogr243347 r243348 1 2019-03-21 Sihui Liu <sihui_liu@apple.com> 2 3 Fix key path extraction code in IndexedDB to check own property 4 https://bugs.webkit.org/show_bug.cgi?id=196099 5 6 Reviewed by Ryosuke Niwa. 7 8 Rebaseline the tests because we will have same exception but different exception messages after the patch. 9 10 * storage/indexeddb/clone-exception-expected.txt: 11 * storage/indexeddb/clone-exception-private-expected.txt: 12 * storage/indexeddb/exceptions-expected.txt: 13 * storage/indexeddb/exceptions-private-expected.txt: 14 * storage/indexeddb/objectstore-basics-expected.txt: 15 * storage/indexeddb/objectstore-basics-private-expected.txt: 16 * storage/indexeddb/objectstore-basics-workers-expected.txt: 17 * storage/indexeddb/structured-clone-expected.txt: 18 * storage/indexeddb/structured-clone-private-expected.txt: 19 * storage/indexeddb/wasm-exceptions-expected.txt: 20 1 21 2019-03-21 Simon Fraser <simon.fraser@apple.com> 2 22 
- 
      trunk/LayoutTests/imported/w3c/ChangeLogr243322 r243348 1 2019-03-21 Sihui Liu <sihui_liu@apple.com> 2 3 Fix key path extraction code in IndexedDB to check own property 4 https://bugs.webkit.org/show_bug.cgi?id=196099 5 6 Reviewed by Ryosuke Niwa. 7 8 Updated test expectations to PASS. 9 10 * web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt: 11 * web-platform-tests/IndexedDB/keygenerator-inject-expected.txt: 12 * web-platform-tests/IndexedDB/keypath-exceptions-expected.txt: Added. 13 * web-platform-tests/IndexedDB/wasm-module-value-expected.txt: 14 15 2019-03-21 Sihui Liu <sihui_liu@apple.com> 16 17 Fix three IDB WPT tests 18 https://bugs.webkit.org/show_bug.cgi?id=196099 19 20 Reviewed by Ryosuke Niwa. 21 22 Updated test expectations to PASS. 23 24 * web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt: 25 * web-platform-tests/IndexedDB/keygenerator-inject-expected.txt: 26 * web-platform-tests/IndexedDB/keypath-exceptions-expected.txt: Added. 27 1 28 2019-03-21 Youenn Fablet <youenn@apple.com> 2 29 
- 
      trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txtr234125 r243348 1 1 2 FAIL IDBFactory cmp() static with throwing/invalid keys assert_throws: first key conversion with invalid key should throw DataError function "() => { 3 receiver[method](invalid_key, throwing_key('getter 2')); 4 }" threw object "getter 2: throwing from getter" that is not a DOMException DataError: property "code" is equal to undefined, expected 0 2 PASS IDBFactory cmp() static with throwing/invalid keys 5 3 PASS IDBCursor continue() method with throwing/invalid keys 6 4 PASS IndexedDB: Exceptions thrown during key conversion … … 9 7 PASS IDBKeyRange lowerBound() static with throwing/invalid keys 10 8 PASS IDBKeyRange upperBound() static with throwing/invalid keys 11 FAIL IDBKeyRange bound() static with throwing/invalid keys assert_throws: first key conversion with invalid key should throw DataError function "() => { 12 receiver[method](invalid_key, throwing_key('getter 2')); 13 }" threw object "getter 2: throwing from getter" that is not a DOMException DataError: property "code" is equal to undefined, expected 0 14 FAIL IDBObjectStore add() method with throwing/invalid keys assert_throws: key conversion with throwing getter should rethrow function "() => { 15 out_of_line[method]('value', throwing_key('getter')); 16 }" threw object "DataCloneError: Failed to store record in an IDBObjectStore: An object could not be cloned." ("DataCloneError") expected object "[object Object]" ("getter") 17 FAIL IDBObjectStore put() method with throwing/invalid keys assert_throws: key conversion with throwing getter should rethrow function "() => { 18 out_of_line[method]('value', throwing_key('getter')); 19 }" threw object "DataCloneError: Failed to store record in an IDBObjectStore: An object could not be cloned." ("DataCloneError") expected object "[object Object]" ("getter") 9 PASS IDBKeyRange bound() static with throwing/invalid keys 10 PASS IDBObjectStore add() method with throwing/invalid keys 11 PASS IDBObjectStore put() method with throwing/invalid keys 20 12 PASS IDBObjectStore delete() method with throwing/invalid keys 21 13 PASS IDBObjectStore get() method with throwing/invalid keys 
- 
      trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/keygenerator-inject-expected.txtr213882 r243348 4 4 PASS Key is injected into value - multi-segment path, partially populated 5 5 PASS put() throws if key cannot be injected - single segment path 6 FAIL put() throws if key cannot be injected - multi-segment path assert_throws: Key path should be checked against value function "() => { 7 store.put({a: {b: 123} }); 8 }" did not throw 6 PASS put() throws if key cannot be injected - multi-segment path 9 7 
- 
      trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/wasm-module-value-expected.txtr232641 r243348 1 1 2 FAIL WebAssembly module as an IndexedDB value Failed to store record in an IDBObjectStore: An object couldnot be cloned.3 FAIL WebAssembly module in a JavaScript object IndexedDB value Failed to store record in an IDBObjectStore: An object couldnot be cloned.4 FAIL WebAssembly module in an IndexedDB value with an inline key Failed to store record in an IDBObjectStore: An object couldnot be cloned.2 FAIL WebAssembly module as an IndexedDB value The object can not be cloned. 3 FAIL WebAssembly module in a JavaScript object IndexedDB value The object can not be cloned. 4 FAIL WebAssembly module in an IndexedDB value with an inline key The object can not be cloned. 5 5 
- 
      trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txtr195181 r243348 13 13 PASS code is 25 14 14 PASS ename is 'DataCloneError' 15 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.15 Exception message: The object can not be cloned. 16 16 17 17 doSecondOpen(): … … 23 23 PASS code is 25 24 24 PASS ename is 'DataCloneError' 25 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.25 Exception message: The object can not be cloned. 26 26 27 27 doThirdOpen(): … … 33 33 PASS code is 25 34 34 PASS ename is 'DataCloneError' 35 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.35 Exception message: The object can not be cloned. 36 36 PASS successfullyParsed is true 37 37 
- 
      trunk/LayoutTests/storage/indexeddb/clone-exception-private-expected.txtr195394 r243348 13 13 PASS code is 25 14 14 PASS ename is 'DataCloneError' 15 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.15 Exception message: The object can not be cloned. 16 16 17 17 doSecondOpen(): … … 23 23 PASS code is 25 24 24 PASS ename is 'DataCloneError' 25 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.25 Exception message: The object can not be cloned. 26 26 27 27 doThirdOpen(): … … 33 33 PASS code is 25 34 34 PASS ename is 'DataCloneError' 35 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.35 Exception message: The object can not be cloned. 36 36 PASS successfullyParsed is true 37 37 
- 
      trunk/LayoutTests/storage/indexeddb/exceptions-expected.txtr210148 r243348 160 160 PASS Exception was thrown. 161 161 PASS code is DOMException.DATA_CLONE_ERR 162 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.162 Exception message: The object can not be cloned. 163 163 164 164 IDBObjectStore.clear() … … 273 273 PASS Exception was thrown. 274 274 PASS code is DOMException.DATA_CLONE_ERR 275 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.275 Exception message: The object can not be cloned. 276 276 db.close() 277 277 ro_transaction.oncomplete = transactionComplete … … 505 505 PASS Exception was thrown. 506 506 PASS code is DOMException.DATA_CLONE_ERR 507 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.507 Exception message: The object can not be cloned. 508 508 The transaction this IDBCursor belongs to is not active. 509 509 Expecting exception from cursorFromInactiveTransaction.update({}) 
- 
      trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txtr210148 r243348 160 160 PASS Exception was thrown. 161 161 PASS code is DOMException.DATA_CLONE_ERR 162 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.162 Exception message: The object can not be cloned. 163 163 164 164 IDBObjectStore.clear() … … 273 273 PASS Exception was thrown. 274 274 PASS code is DOMException.DATA_CLONE_ERR 275 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.275 Exception message: The object can not be cloned. 276 276 db.close() 277 277 ro_transaction.oncomplete = transactionComplete … … 505 505 PASS Exception was thrown. 506 506 PASS code is DOMException.DATA_CLONE_ERR 507 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.507 Exception message: The object can not be cloned. 508 508 The transaction this IDBCursor belongs to is not active. 509 509 Expecting exception from cursorFromInactiveTransaction.update({}) 
- 
      trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txtr195181 r243348 95 95 PASS Exception was thrown. 96 96 PASS code is DOMException.DATA_CLONE_ERR 97 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.97 Exception message: The object can not be cloned. 98 98 Try to insert data where key path yields a Date key: 99 99 store.add({x: testDateB, y: 'value'}, 'key') 
- 
      trunk/LayoutTests/storage/indexeddb/objectstore-basics-private-expected.txtr195247 r243348 95 95 PASS Exception was thrown. 96 96 PASS code is DOMException.DATA_CLONE_ERR 97 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.97 Exception message: The object can not be cloned. 98 98 Try to insert data where key path yields a Date key: 99 99 store.add({x: testDateB, y: 'value'}, 'key') 
- 
      trunk/LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txtr200521 r243348 96 96 PASS [Worker] Exception was thrown. 97 97 PASS [Worker] code is DOMException.DATA_CLONE_ERR 98 [Worker] Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.98 [Worker] Exception message: The object can not be cloned. 99 99 [Worker] Try to insert data where key path yields a Date key: 100 100 [Worker] store.add({x: testDateB, y: 'value'}, 'key') 
- 
      trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txtr195181 r243348 783 783 PASS Exception was thrown. 784 784 PASS code is DOMException.DATA_CLONE_ERR 785 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.785 Exception message: The object can not be cloned. 786 786 Expecting exception from store.put(new Function, 'key') 787 787 PASS Exception was thrown. 788 788 PASS code is DOMException.DATA_CLONE_ERR 789 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.789 Exception message: The object can not be cloned. 790 790 791 791 Other host object types: … … 793 793 PASS Exception was thrown. 794 794 PASS code is DOMException.DATA_CLONE_ERR 795 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.795 Exception message: The object can not be cloned. 796 796 Expecting exception from store.put(document, 'key') 797 797 PASS Exception was thrown. 798 798 PASS code is DOMException.DATA_CLONE_ERR 799 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.799 Exception message: The object can not be cloned. 800 800 Expecting exception from store.put(document.body, 'key') 801 801 PASS Exception was thrown. 802 802 PASS code is DOMException.DATA_CLONE_ERR 803 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.803 Exception message: The object can not be cloned. 804 804 PASS successfullyParsed is true 805 805 
- 
      trunk/LayoutTests/storage/indexeddb/structured-clone-private-expected.txtr195394 r243348 783 783 PASS Exception was thrown. 784 784 PASS code is DOMException.DATA_CLONE_ERR 785 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.785 Exception message: The object can not be cloned. 786 786 Expecting exception from store.put(new Function, 'key') 787 787 PASS Exception was thrown. 788 788 PASS code is DOMException.DATA_CLONE_ERR 789 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.789 Exception message: The object can not be cloned. 790 790 791 791 Other host object types: … … 793 793 PASS Exception was thrown. 794 794 PASS code is DOMException.DATA_CLONE_ERR 795 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.795 Exception message: The object can not be cloned. 796 796 Expecting exception from store.put(document, 'key') 797 797 PASS Exception was thrown. 798 798 PASS code is DOMException.DATA_CLONE_ERR 799 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.799 Exception message: The object can not be cloned. 800 800 Expecting exception from store.put(document.body, 'key') 801 801 PASS Exception was thrown. 802 802 PASS code is DOMException.DATA_CLONE_ERR 803 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.803 Exception message: The object can not be cloned. 804 804 PASS successfullyParsed is true 805 805 
- 
      trunk/LayoutTests/storage/indexeddb/wasm-exceptions-expected.txtr215353 r243348 12 12 PASS Exception was thrown. 13 13 PASS code is DOMException.DATA_CLONE_ERR 14 Exception message: Failed to store record in an IDBObjectStore: An object couldnot be cloned.14 Exception message: The object can not be cloned. 15 15 PASS successfullyParsed is true 16 16 
- 
      trunk/Source/WebCore/ChangeLogr243346 r243348 1 2019-03-21 Sihui Liu <sihui_liu@apple.com> 2 3 Fix key path extraction code in IndexedDB to check own property 4 https://bugs.webkit.org/show_bug.cgi?id=196099 5 6 Reviewed by Ryosuke Niwa. 7 8 Covered by existing tests. 9 10 * Modules/indexeddb/IDBFactory.cpp: 11 (WebCore::IDBFactory::cmp): 12 We don't need to check the second parameters if the first is already invalid. 13 14 * Modules/indexeddb/IDBKeyRange.cpp: 15 (WebCore::IDBKeyRange::bound): 16 Ditto. 17 18 * Modules/indexeddb/IDBObjectStore.cpp: 19 (WebCore::IDBObjectStore::putOrAdd): 20 we should not clear the exception during serialization because the execeptions may be explicitly thrown by parameters. 21 22 * bindings/js/IDBBindingUtilities.cpp: 23 (WebCore::get): 24 Fix implementation according to https://www.w3.org/TR/IndexedDB-2/#extract-key-from-value. 25 26 (WebCore::canInjectNthValueOnKeyPath): 27 Check the last identifier. 28 1 29 2019-03-21 Antoine Quint <graouts@apple.com> 2 30 
- 
      trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cppr239461 r243348 124 124 { 125 125 auto first = scriptValueToIDBKey(execState, firstValue); 126 if (!first->isValid()) 127 return Exception { DataError, "Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key."_s }; 128 126 129 auto second = scriptValueToIDBKey(execState, secondValue); 127 128 if (!first->isValid() || !second->isValid()) 130 if (!second->isValid()) 129 131 return Exception { DataError, "Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key."_s }; 130 132 
- 
      trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cppr228218 r243348 93 93 { 94 94 auto lower = scriptValueToIDBKey(state, lowerValue); 95 if (!lower->isValid()) 96 return Exception { DataError }; 95 97 auto upper = scriptValueToIDBKey(state, upperValue); 96 97 if (!lower->isValid() || !upper->isValid()) 98 if (!upper->isValid()) 98 99 return Exception { DataError }; 99 100 if (upper->isLessThan(lower.get())) 
- 
      trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cppr243163 r243348 341 341 342 342 auto serializedValue = SerializedScriptValue::create(state, value); 343 if (UNLIKELY(scope.exception())) { 344 // Clear the DOM exception from the serializer so we can give a more targeted exception. 345 scope.clearException(); 346 343 if (UNLIKELY(scope.exception())) 347 344 return Exception { DataCloneError, "Failed to store record in an IDBObjectStore: An object could not be cloned."_s }; 348 }349 345 350 346 bool privateBrowsingEnabled = false; 
- 
      trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cppr238632 r243348 38 38 #include "IDBValue.h" 39 39 #include "IndexKey.h" 40 #include "JSBlob.h" 40 41 #include "JSDOMBinding.h" 41 42 #include "JSDOMConvertDate.h" 42 43 #include "JSDOMConvertNullable.h" 44 #include "JSFile.h" 43 45 #include "Logging.h" 44 46 #include "MessagePort.h" … … 62 64 if (!object.isObject()) 63 65 return false; 66 67 auto* obj = asObject(object); 64 68 Identifier identifier = Identifier::fromString(&exec.vm(), keyPathElement); 65 if (!asObject(object)->hasProperty(&exec, identifier)) 66 return false; 67 result = asObject(object)->get(&exec, identifier); 69 auto& vm = exec.vm(); 70 if (obj->inherits<JSArray>(vm) && keyPathElement == "length") { 71 result = obj->get(&exec, identifier); 72 return true; 73 } 74 if (obj->inherits<JSBlob>(vm) && (keyPathElement == "size" || keyPathElement == "type")) { 75 if (keyPathElement == "size") { 76 result = jsNumber(jsCast<JSBlob*>(obj)->wrapped().size()); 77 return true; 78 } 79 if (keyPathElement == "type") { 80 result = jsString(&vm, jsCast<JSBlob*>(obj)->wrapped().type()); 81 return true; 82 } 83 } 84 if (obj->inherits<JSFile>(vm)) { 85 if (keyPathElement == "name") { 86 result = jsString(&vm, jsCast<JSFile*>(obj)->wrapped().name()); 87 return true; 88 } 89 if (keyPathElement == "lastModified") { 90 result = jsNumber(jsCast<JSFile*>(obj)->wrapped().lastModified()); 91 return true; 92 } 93 if (keyPathElement == "lastModifiedDate") { 94 result = jsDate(exec, jsCast<JSFile*>(obj)->wrapped().lastModified()); 95 return true; 96 } 97 } 98 99 PropertyDescriptor descriptor; 100 if (!obj->getOwnPropertyDescriptor(&exec, identifier, descriptor)) 101 return false; 102 if (!descriptor.enumerable()) 103 return false; 104 105 result = obj->get(&exec, identifier); 68 106 return true; 69 107 } … … 256 294 257 295 ASSERT(index <= keyPathElements.size()); 258 for (size_t i = 0; i < index; ++i) {296 for (size_t i = 0; i <= index; ++i) { 259 297 JSValue parentValue(currentValue); 260 298 const String& keyPathElement = keyPathElements[i]; 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  
