Modern IDB: A few cursor tests are flaky because JS wrappers are GC'ed.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jan 2016 18:42:00 +0000 (18:42 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jan 2016 18:42:00 +0000 (18:42 +0000)
commit96ae63727c2746e2b432313847f115110dac603a
treebc3e93901738f9f1cffc3e1e198253fb03a4f86d
parent1f56afaf3c72492d5dc82163c987dee298f68936
Modern IDB: A few cursor tests are flaky because JS wrappers are GC'ed.
https://bugs.webkit.org/show_bug.cgi?id=153038

Reviewed by Alex Christensen.

No new tests (Couldn't write a test that was any more reliable than "flaky", so fixing the existing flaky tests will do).

And IDBCursor has an associated IDBRequest that is re-used each time the IDBCursor iterates.

The normal ActiveDOMObject approach to prevent the IDBRequest's wrapper from being garbage collected was not good enough
because, while the IDBRequest may not currently be waiting on any activity, as long as its associated IDBCursor is still
reachable then the request might be reused in the future.

Fortunately there's an IDL allowance for "one object keeping another alive during GC" and that's JSCustomMarkFunction
combined with GenerateIsReachable.

Applying those to IDBCursor and IDBRequest fix this handily.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::isModernCursor):
* Modules/indexeddb/IDBCursor.idl:

* Modules/indexeddb/IDBRequest.idl:

* Modules/indexeddb/client/IDBCursorImpl.cpp:
(WebCore::IDBClient::IDBCursor::advance):
(WebCore::IDBClient::IDBCursor::continueFunction):
(WebCore::IDBClient::IDBCursor::uncheckedIterateCursor):
(WebCore::IDBClient::IDBCursor::uncheckedIteratorCursor): Deleted. Fixed the typo of this name.
* Modules/indexeddb/client/IDBCursorImpl.h:

* bindings/js/JSIDBCursorCustom.cpp: Added.
(WebCore::JSIDBCursor::visitAdditionalChildren):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCursor.h
Source/WebCore/Modules/indexeddb/IDBCursor.idl
Source/WebCore/Modules/indexeddb/IDBRequest.idl
Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSIDBCursorCustom.cpp [new file with mode: 0644]