Changeset 242986 in webkit
- Timestamp:
- Mar 14, 2019, 7:24:55 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
LayoutTests/storage/indexeddb/connection-leak-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/connection-leak-private-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/cursor-leak-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/cursor-leak-private-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/cursor-request-cycle-expected.txt (modified) (2 diffs)
-
LayoutTests/storage/indexeddb/cursor-request-cycle-private-expected.txt (modified) (2 diffs)
-
LayoutTests/storage/indexeddb/request-leak-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/request-leak-private-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/resources/cursor-request-cycle.js (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBCursor.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/indexeddb/IDBCursor.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBRequest.cpp (modified) (10 diffs)
-
Source/WebCore/Modules/indexeddb/IDBRequest.h (modified) (3 diffs)
-
Source/WebCore/bindings/js/JSIDBRequestCustom.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/JSValueInWrappedObject.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r242979 r242986 1 2019-03-14 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: re-enable some leak tests 4 https://bugs.webkit.org/show_bug.cgi?id=194806 5 6 Reviewed by Geoffrey Garen. 7 8 * TestExpectations: 9 * platform/win/TestExpectations: 10 * storage/indexeddb/connection-leak-expected.txt: 11 * storage/indexeddb/connection-leak-private-expected.txt: 12 * storage/indexeddb/cursor-leak-expected.txt: 13 * storage/indexeddb/cursor-leak-private-expected.txt: 14 * storage/indexeddb/cursor-request-cycle-expected.txt: 15 * storage/indexeddb/cursor-request-cycle-private-expected.txt: 16 * storage/indexeddb/request-leak-expected.txt: 17 * storage/indexeddb/request-leak-private-expected.txt: 18 * storage/indexeddb/resources/cursor-request-cycle.js: 19 1 20 2019-03-14 Simon Fraser <simon.fraser@apple.com> 2 21 -
trunk/LayoutTests/TestExpectations
r242714 r242986 1531 1531 # With Modern IDB and the in-memory backing store, that should change. 1532 1532 storage/indexeddb/open-db-private-browsing.html [ Failure ] 1533 1534 # Relies on internals.observeGC1535 storage/indexeddb/connection-leak-private.html [ Skip ]1536 storage/indexeddb/connection-leak.html [ Skip ]1537 storage/indexeddb/cursor-leak-private.html [ Failure ]1538 storage/indexeddb/cursor-leak.html [ Skip ]1539 storage/indexeddb/cursor-request-cycle-private.html [ Failure ]1540 storage/indexeddb/cursor-request-cycle.html [ Skip ]1541 storage/indexeddb/delete-closed-database-object-private.html [ Skip ]1542 storage/indexeddb/delete-closed-database-object.html [ Skip ]1543 storage/indexeddb/request-leak-private.html [ Failure ]1544 storage/indexeddb/request-leak.html [ Failure ]1545 1533 1546 1534 webkit.org/b/154619 storage/indexeddb/odd-strings.html [ Skip ] -
trunk/LayoutTests/platform/win/TestExpectations
r242911 r242986 4279 4279 storage/indexeddb/result-request-cycle.html [ Skip ] 4280 4280 storage/indexeddb/value-cursor-cycle.html [ Skip ] 4281 storage/indexeddb/connection-leak-private.html [ Skip ] 4282 storage/indexeddb/connection-leak.html [ Skip ] 4283 storage/indexeddb/cursor-leak-private.html [ Skip ] 4284 storage/indexeddb/cursor-leak.html [ Skip ] 4285 storage/indexeddb/cursor-request-cycle-private.html [ Skip ] 4286 storage/indexeddb/cursor-request-cycle.html [ Skip ] 4287 storage/indexeddb/delete-closed-database-object-private.html [ Skip ] 4288 storage/indexeddb/delete-closed-database-object.html [ Skip ] 4289 storage/indexeddb/request-leak-private.html [ Skip ] 4290 storage/indexeddb/request-leak.html [ Skip ] 4281 4291 4282 4292 webkit.org/b/194711 fast/replaced/encrypted-pdf-as-object-and-embed.html [ Failure ] -
trunk/LayoutTests/storage/indexeddb/connection-leak-expected.txt
r163963 r242986 4 4 5 5 6 dbname = "connection-leak.html"7 6 8 7 doFirstOpen(): -
trunk/LayoutTests/storage/indexeddb/connection-leak-private-expected.txt
r195394 r242986 4 4 5 5 6 dbname = "connection-leak.html"7 6 8 7 doFirstOpen(): -
trunk/LayoutTests/storage/indexeddb/cursor-leak-expected.txt
r163963 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "cursor-leak.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) -
trunk/LayoutTests/storage/indexeddb/cursor-leak-private-expected.txt
r195394 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "cursor-leak.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) -
trunk/LayoutTests/storage/indexeddb/cursor-request-cycle-expected.txt
r163963 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "cursor-request-cycle.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) … … 41 40 gc() 42 41 PASS cursorObservation.wasCollected is false 42 PASS cursorRequestObservation.wasCollected is false 43 43 finalRequest = store.get(0) 44 44 -
trunk/LayoutTests/storage/indexeddb/cursor-request-cycle-private-expected.txt
r195394 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "cursor-request-cycle.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) … … 41 40 gc() 42 41 PASS cursorObservation.wasCollected is false 42 PASS cursorRequestObservation.wasCollected is false 43 43 finalRequest = store.get(0) 44 44 -
trunk/LayoutTests/storage/indexeddb/request-leak-expected.txt
r163963 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "request-leak.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) -
trunk/LayoutTests/storage/indexeddb/request-leak-private-expected.txt
r195394 r242986 6 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; 7 7 8 dbname = "request-leak.html"9 8 indexedDB.deleteDatabase(dbname) 10 9 indexedDB.open(dbname) -
trunk/LayoutTests/storage/indexeddb/resources/cursor-request-cycle.js
r195299 r242986 67 67 evalAndLog("gc()"); 68 68 shouldBeFalse("cursorObservation.wasCollected"); 69 shouldBeFalse("cursorRequestObservation.wasCollected"); 69 70 70 71 evalAndLog("finalRequest = store.get(0)"); -
trunk/Source/WebCore/ChangeLog
r242985 r242986 1 2019-03-14 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: re-enable some leak tests 4 https://bugs.webkit.org/show_bug.cgi?id=194806 5 6 Reviewed by Geoffrey Garen. 7 8 Protected JSIDBCursor object when advance/continue request on IDBCursor is not finished, because after the 9 advance operation completes on success, we need to return the same JSIDBCursor object as before the advance, 10 and during the wait for advance operation to complete, we need to return error as the result. 11 12 Covered by existing tests. 13 14 * Modules/indexeddb/IDBCursor.cpp: 15 (WebCore::IDBCursor::setGetResult): 16 (WebCore::IDBCursor::clearWrappers): 17 * Modules/indexeddb/IDBCursor.h: 18 * Modules/indexeddb/IDBRequest.cpp: 19 (WebCore::IDBRequest::stop): 20 (WebCore::IDBRequest::setResult): 21 (WebCore::IDBRequest::setResultToStructuredClone): 22 (WebCore::IDBRequest::setResultToUndefined): 23 (WebCore::IDBRequest::willIterateCursor): 24 (WebCore::IDBRequest::didOpenOrIterateCursor): 25 (WebCore::IDBRequest::clearWrappers): 26 * Modules/indexeddb/IDBRequest.h: 27 (WebCore::IDBRequest::cursorWrapper): 28 * bindings/js/JSIDBRequestCustom.cpp: 29 (WebCore::JSIDBRequest::visitAdditionalChildren): 30 * bindings/js/JSValueInWrappedObject.h: 31 (WebCore::JSValueInWrappedObject::JSValueInWrappedObject): 32 (WebCore::JSValueInWrappedObject::operator=): 33 (WebCore::JSValueInWrappedObject::clear): 34 1 35 2019-03-14 Shawn Roberts <sroberts@apple.com> 2 36 -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
r241196 r242986 310 310 } 311 311 312 void IDBCursor::setGetResult(IDBRequest&, const IDBGetResult& getResult)312 bool IDBCursor::setGetResult(IDBRequest& request, const IDBGetResult& getResult) 313 313 { 314 314 LOG(IndexedDB, "IDBCursor::setGetResult - current key %s", getResult.keyData().loggingString().substring(0, 100).utf8().data()); 315 315 ASSERT(&effectiveObjectStore().transaction().database().originThread() == &Thread::current()); 316 317 auto* context = request.scriptExecutionContext(); 318 if (!context) 319 return false; 320 321 VM& vm = context->vm(); 322 JSLockHolder lock(vm); 316 323 317 324 m_keyWrapper = { }; … … 327 334 328 335 m_gotValue = false; 329 return ;336 return false; 330 337 } 331 338 … … 339 346 340 347 m_gotValue = true; 348 return true; 349 } 350 351 void IDBCursor::clearWrappers() 352 { 353 m_keyWrapper.clear(); 354 m_primaryKeyWrapper.clear(); 355 m_valueWrapper.clear(); 341 356 } 342 357 -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h
r241196 r242986 75 75 void setRequest(IDBRequest& request) { m_request = makeWeakPtr(&request); } 76 76 void clearRequest() { m_request.clear(); } 77 void clearWrappers(); 77 78 IDBRequest* request() { return m_request.get(); } 78 79 79 voidsetGetResult(IDBRequest&, const IDBGetResult&);80 bool setGetResult(IDBRequest&, const IDBGetResult&); 80 81 81 82 virtual bool isKeyCursorWithValue() const { return false; } -
trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
r242818 r242986 278 278 removeAllEventListeners(); 279 279 280 clearWrappers(); 281 280 282 m_contextStopped = true; 281 283 } … … 369 371 return; 370 372 371 auto* state = context->execState();372 if (!state)373 return;374 375 373 VM& vm = context->vm(); 376 374 JSLockHolder lock(vm); … … 387 385 return; 388 386 389 auto* state = context->execState();390 if (!state)391 return;392 393 387 VM& vm = context->vm(); 394 388 JSLockHolder lock(vm); … … 405 399 return; 406 400 407 auto* state = context->execState();408 if (!state)409 return;410 411 401 VM& vm = context->vm(); 412 402 JSLockHolder lock(vm); … … 423 413 return; 424 414 415 VM& vm = context->vm(); 416 JSLockHolder lock(vm); 425 417 m_result = number; 426 418 m_resultWrapper = { }; … … 437 429 return; 438 430 439 auto* state = context->execState();440 if (!state)441 return;442 443 431 VM& vm = context->vm(); 444 432 JSLockHolder lock(vm); … … 451 439 ASSERT(&originThread() == &Thread::current()); 452 440 441 auto* context = scriptExecutionContext(); 442 if (!context) 443 return; 444 445 VM& vm = context->vm(); 446 JSLockHolder lock(vm); 453 447 m_result = NullResultType::Undefined; 454 448 m_resultWrapper = { }; … … 477 471 m_hasPendingActivity = true; 478 472 m_result = NullResultType::Empty; 473 474 auto* context = scriptExecutionContext(); 475 if (!context) 476 return; 477 478 VM& vm = context->vm(); 479 JSLockHolder lock(vm); 480 481 if (m_resultWrapper) 482 m_cursorWrapper = m_resultWrapper; 479 483 m_resultWrapper = { }; 480 484 m_readyState = ReadyState::Pending; … … 488 492 ASSERT(m_pendingCursor); 489 493 494 auto* context = scriptExecutionContext(); 495 if (!context) 496 return; 497 498 VM& vm = context->vm(); 499 JSLockHolder lock(vm); 500 490 501 m_result = NullResultType::Empty; 491 502 m_resultWrapper = { }; 492 503 493 504 if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) { 494 m_pendingCursor->setGetResult(*this, resultData.getResult()); 505 if (m_pendingCursor->setGetResult(*this, resultData.getResult()) && m_cursorWrapper) 506 m_resultWrapper = m_cursorWrapper; 495 507 if (resultData.getResult().isDefined()) 496 508 m_result = m_pendingCursor; … … 537 549 ASSERT(&originThread() == &Thread::current()); 538 550 551 auto* context = scriptExecutionContext(); 552 if (!context) 553 return; 554 555 VM& vm = context->vm(); 556 JSLockHolder lock(vm); 557 539 558 m_result = RefPtr<IDBDatabase> { WTFMove(database) }; 540 559 m_resultWrapper = { }; 541 560 } 542 561 562 void IDBRequest::clearWrappers() 563 { 564 auto* context = scriptExecutionContext(); 565 if (!context) 566 return; 567 VM& vm = context->vm(); 568 JSLockHolder lock(vm); 569 570 m_resultWrapper.clear(); 571 m_cursorWrapper.clear(); 572 573 WTF::switchOn(m_result, 574 [] (RefPtr<IDBCursor>& cursor) { cursor->clearWrappers(); }, 575 [] (const auto&) { } 576 ); 577 } 578 579 543 580 } // namespace WebCore 544 581 -
trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h
r242818 r242986 79 79 ExceptionOr<Result> result() const; 80 80 JSValueInWrappedObject& resultWrapper() { return m_resultWrapper; } 81 JSValueInWrappedObject& cursorWrapper() { return m_cursorWrapper; } 81 82 82 83 using Source = Variant<RefPtr<IDBObjectStore>, RefPtr<IDBIndex>, RefPtr<IDBCursor>>; … … 166 167 void onSuccess(); 167 168 169 void clearWrappers(); 170 168 171 IDBCursor* resultCursor(); 169 172 … … 172 175 173 176 JSValueInWrappedObject m_resultWrapper; 177 JSValueInWrappedObject m_cursorWrapper; 174 178 Result m_result; 175 179 Optional<Source> m_source; -
trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp
r241196 r242986 76 76 auto& request = wrapped(); 77 77 request.resultWrapper().visit(visitor); 78 request.cursorWrapper().visit(visitor); 78 79 } 79 80 -
trunk/Source/WebCore/bindings/js/JSValueInWrappedObject.h
r228260 r242986 37 37 public: 38 38 JSValueInWrappedObject(JSC::JSValue = { }); 39 JSValueInWrappedObject(const JSValueInWrappedObject&); 39 40 operator JSC::JSValue() const; 40 41 explicit operator bool() const; 42 JSValueInWrappedObject& operator=(const JSValueInWrappedObject& other); 41 43 void visit(JSC::SlotVisitor&) const; 44 void clear(); 42 45 43 46 private: … … 67 70 68 71 inline JSValueInWrappedObject::JSValueInWrappedObject(JSC::JSValue value) 72 : m_value(makeValue(JSC::JSValue(value))) 73 { 74 } 75 76 inline JSValueInWrappedObject::JSValueInWrappedObject(const JSValueInWrappedObject& value) 69 77 : m_value(makeValue(value)) 70 78 { … … 85 93 } 86 94 95 inline JSValueInWrappedObject& JSValueInWrappedObject::operator=(const JSValueInWrappedObject& other) 96 { 97 m_value = makeValue(JSC::JSValue(other)); 98 return *this; 99 } 100 87 101 inline void JSValueInWrappedObject::visit(JSC::SlotVisitor& visitor) const 88 102 { … … 92 106 visitor.append(value); 93 107 }); 108 } 109 110 inline void JSValueInWrappedObject::clear() 111 { 112 WTF::switchOn(m_value, [] (Weak& value) { 113 value.clear(); 114 }, [] (auto&) { }); 94 115 } 95 116
Note:
See TracChangeset
for help on using the changeset viewer.