IndexedDB: Avoid crashing when deleting indexes
https://bugs.webkit.org/show_bug.cgi?id=108356

Reviewed by Tony Chang.

Source/WebCore:

It is reasonable that the backend aborts a transaction before
the frontend is aware, depending on the timing of events. This
allows the transactionId to be invalid rather than asserting.

Test: storage/indexeddb/createIndex-after-failure.html

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::createObjectStore):
(WebCore::IDBDatabaseBackendImpl::deleteObjectStore):
(WebCore::IDBDatabaseBackendImpl::createIndex):
(WebCore::IDBDatabaseBackendImpl::deleteIndex):
(WebCore::IDBDatabaseBackendImpl::get):
(WebCore::IDBDatabaseBackendImpl::put):
(WebCore::IDBDatabaseBackendImpl::setIndexKeys):
(WebCore::IDBDatabaseBackendImpl::setIndexesReady):
(WebCore::IDBDatabaseBackendImpl::openCursor):
(WebCore::IDBDatabaseBackendImpl::count):
(WebCore::IDBDatabaseBackendImpl::deleteRange):
(WebCore::IDBDatabaseBackendImpl::clear):

LayoutTests:

This test works on an edge case around the asynchronous
creation/deletion of indexes that used to crash. It doesn't fail/crash even
without this patch but was the test condition that uncovered the overall problem
before https://bugs.webkit.org/show_bug.cgi?id=107311 changed the timing of
some of the events.

* storage/indexeddb/createIndex-after-failure.html: Added.
* storage/indexeddb/resources/createIndex-after-failure.js: Added.
(sleep):
(prepareDatabase):
(deleteIndexAfterGet):
* storage/indexeddb/resources/shared.js:
(.requests.forEach):
(waitForRequests):

* storage/indexeddb/createIndex-after-failure.html: Added.
* storage/indexeddb/resources/createIndex-after-failure.js: Added.
(prepareDatabase):
(deleteIndexAfterGet):
* storage/indexeddb/resources/shared.js:
(.requests.forEach):
(waitForRequests):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Support 'auto' sized grid items
https://bugs.webkit.org/show_bug.cgi?id=103332

Reviewed by Tony Chang.

Source/WebCore:

Tests: fast/css-grid-layout/auto-content-resolution-columns.html
       fast/css-grid-layout/auto-content-resolution-rows.html

The specification interprets 'auto' as minmax(min-content, max-content).
Because we stored the grid definitions as an 'auto' length, we wouldn't
handle it properly during layout.

This change makes us do the translation when we query the information for
layout.

* rendering/style/GridTrackSize.h:
(WebCore::GridTrackSize::minTrackBreadth):
(WebCore::GridTrackSize::maxTrackBreadth):
Translate 'auto' to minmax(min-content, max-content). This works as getComputedStyle
still sees the GridTrackSize as a single length and thus query length() instead of the
individual component of minmax().

LayoutTests:

* fast/css-grid-layout/auto-content-resolution-columns-expected.txt: Added.
* fast/css-grid-layout/auto-content-resolution-columns.html: Added.
* fast/css-grid-layout/auto-content-resolution-rows-expected.txt: Added.
* fast/css-grid-layout/auto-content-resolution-rows.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement WheelEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=108303

Reviewed by Adam Barth.

Source/WebCore:

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

Test: fast/events/constructors/wheel-event-constructor.html

* dom/WheelEvent.cpp:
(WebCore::WheelEventInit::WheelEventInit):
(WebCore):
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWheelEvent):
* dom/WheelEvent.h:
(WheelEventInit):
(WebCore):
(WheelEvent):
(WebCore::WheelEvent::create):
(WebCore::WheelEvent::wheelDelta):
(WebCore::WheelEvent::wheelDeltaX):
(WebCore::WheelEvent::wheelDeltaY):
(WebCore::WheelEvent::rawDeltaX):
(WebCore::WheelEvent::rawDeltaY):
(WebCore::WheelEvent::granularity):
(WebCore::WheelEvent::webkitDirectionInvertedFromDevice):
(WebCore::WheelEvent::isHorizontal):
* dom/WheelEvent.idl:

Source/WebKit/chromium:

This patch just renames an enum value to avoid style check error.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::scrollBy):

LayoutTests:

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

Test: fast/events/constructors/wheel-event-constructor.html

* fast/events/constructors/wheel-event-constructor-expected.txt: Added.
* fast/events/constructors/wheel-event-constructor.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][UNIX] g_spawn_sync() generates warning in PluginProcessProxy::scanPlugin()
https://bugs.webkit.org/show_bug.cgi?id=108371

Patch by Christophe Dumez <dchris@gmail.com> on 2013-01-30
Reviewed by Martin Robinson.

g_spawn_sync() was sometimes displaying a warning about the SIGCHLD
signal disposition not being set to SIG_DFL, despite the fix in r133755.
The reason was that the code was only setting the disposition to SIG_DFL
if the previous disposition was SIG_IGN.

In this patch, we set the SIGCHLD signal disposition to SIG_DFL, no
matter what its previous disposition was. Also, the signal disposition
is now restored to its previous state after the call to g_spawn_sync()
to avoid side effects. Finally, we now use SIGCHLD instead of SIDCLD
since this is the more compatible POSIX name.

* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::spawnProcessSync):
(WebKit):
(WebKit::PluginProcessProxy::scanPlugin):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DatabaseContext should implement ThreadSafeRefCounted.
https://bugs.webkit.org/show_bug.cgi?id=108285.

Reviewed by Alexey Proskuryakov.

DatabaseManager::interruptAllDatabasesForContext() can ref a
DatabaseContext from another thread. Hence, the DatabaseContext needs
to be a ThreadSafeRefCounted instead of a RefCounted.

No new tests.

* Modules/webdatabase/DatabaseContext.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Objective-C API: JSContext's dealloc causes ASSERT due to ordering of releases
https://bugs.webkit.org/show_bug.cgi?id=107978

Reviewed by Filip Pizlo.

We need to add the Identifier table save/restore in JSContextGroupRelease so that we 
have the correct table if we end up destroying the JSGlobalData/Heap.

* API/JSContextRef.cpp:
(JSContextGroupRelease):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove MessageID parameter from generated message receivers
https://bugs.webkit.org/show_bug.cgi?id=108379

Reviewed by Beth Dakin.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
(WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
* NetworkProcess/NetworkConnectionToWebProcess.h:
(NetworkConnectionToWebProcess):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didReceiveMessage):
* NetworkProcess/NetworkProcess.h:
(NetworkProcess):
* PluginProcess/PluginControllerProxy.h:
(PluginControllerProxy):
* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::didReceiveMessage):
* PluginProcess/PluginProcess.h:
(PluginProcess):
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::didReceiveMessage):
(WebKit::WebProcessConnection::didReceiveSyncMessage):
* PluginProcess/WebProcessConnection.h:
(WebProcessConnection):
* Scripts/webkit2/messages.py:
(generate_message_handler):
* Scripts/webkit2/messages_unittest.py:
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::didReceiveMessage):
* Shared/Authentication/AuthenticationManager.h:
(AuthenticationManager):
* Shared/Network/CustomProtocols/CustomProtocolManager.h:
(CustomProtocolManager):
* Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm:
(WebKit::CustomProtocolManager::didReceiveMessage):
* Shared/Plugins/NPObjectMessageReceiver.h:
(NPObjectMessageReceiver):
* Shared/Plugins/NPRemoteObjectMap.cpp:
(WebKit::NPRemoteObjectMap::didReceiveSyncMessage):
* Shared/WebConnection.cpp:
(WebKit::WebConnection::didReceiveMessage):
* Shared/WebConnection.h:
(WebConnection):
* Shared/mac/SecItemShim.cpp:
(WebKit::SecItemShim::didReceiveMessageOnConnectionWorkQueue):
* Shared/mac/SecItemShim.h:
(SecItemShim):
* SharedWorkerProcess/SharedWorkerProcess.cpp:
(WebKit::SharedWorkerProcess::didReceiveMessage):
* SharedWorkerProcess/SharedWorkerProcess.h:
(SharedWorkerProcess):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::didReceiveMessage):
(WebKit::DownloadProxy::didReceiveSyncMessage):
* UIProcess/Downloads/DownloadProxy.h:
(DownloadProxy):
* UIProcess/DrawingAreaProxy.h:
(DrawingAreaProxy):
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
(CustomProtocolManagerProxy):
* UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
(WebKit::CustomProtocolManagerProxy::didReceiveMessage):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveMessage):
* UIProcess/Network/NetworkProcessProxy.h:
(NetworkProcessProxy):
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didReceiveMessage):
* UIProcess/Plugins/PluginProcessProxy.h:
(PluginProcessProxy):
* UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp:
(WebKit::SharedWorkerProcessProxy::didReceiveMessage):
* UIProcess/SharedWorkers/SharedWorkerProcessProxy.h:
(SharedWorkerProcessProxy):
* UIProcess/WebApplicationCacheManagerProxy.cpp:
(WebKit::WebApplicationCacheManagerProxy::didReceiveMessage):
* UIProcess/WebApplicationCacheManagerProxy.h:
(WebApplicationCacheManagerProxy):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::didReceiveMessage):
(WebKit::WebContext::didReceiveSyncMessage):
* UIProcess/WebContext.h:
(WebContext):
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::didReceiveMessage):
* UIProcess/WebCookieManagerProxy.h:
(WebCookieManagerProxy):
* UIProcess/WebDatabaseManagerProxy.cpp:
(WebKit::WebDatabaseManagerProxy::didReceiveMessage):
* UIProcess/WebDatabaseManagerProxy.h:
(WebDatabaseManagerProxy):
* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::didReceiveMessage):
(WebKit::WebFullScreenManagerProxy::didReceiveSyncMessage):
* UIProcess/WebFullScreenManagerProxy.h:
(WebFullScreenManagerProxy):
* UIProcess/WebInspectorProxy.h:
(WebInspectorProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveMessage):
(WebKit::WebPageProxy::didReceiveSyncMessage):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveMessage):
(WebKit::WebProcessProxy::didReceiveSyncMessage):
(WebKit::WebProcessProxy::didReceiveMessageOnConnectionWorkQueue):
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):
* UIProcess/mac/RemoteLayerTreeHost.h:
(RemoteLayerTreeHost):
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::didReceiveMessage):
* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue):
* UIProcess/mac/SecItemShimProxy.h:
(SecItemShimProxy):
* WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:
(WebKit::WebApplicationCacheManager::didReceiveMessage):
* WebProcess/ApplicationCache/WebApplicationCacheManager.h:
(WebApplicationCacheManager):
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::didReceiveMessage):
* WebProcess/Cookies/WebCookieManager.h:
(WebCookieManager):
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::didReceiveMessage):
* WebProcess/FullScreen/WebFullScreenManager.h:
(WebFullScreenManager):
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
(WebKit::NetworkProcessConnection::didReceiveSyncMessage):
* WebProcess/Network/WebResourceLoader.h:
(WebResourceLoader):
* WebProcess/Plugins/PluginProcessConnection.cpp:
(WebKit::PluginProcessConnection::didReceiveMessage):
(WebKit::PluginProcessConnection::didReceiveSyncMessage):
* WebProcess/Plugins/PluginProcessConnection.h:
(PluginProcessConnection):
* WebProcess/Plugins/PluginProxy.h:
(PluginProxy):
* WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
(WebKit::WebDatabaseManager::didReceiveMessage):
* WebProcess/WebCoreSupport/WebDatabaseManager.h:
(WebDatabaseManager):
* WebProcess/WebPage/DrawingArea.h:
(DrawingArea):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::didReceiveMessageOnConnectionWorkQueue):
* WebProcess/WebPage/EventDispatcher.h:
(EventDispatcher):
* WebProcess/WebPage/WebInspector.h:
(WebInspector):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didReceiveMessage):
(WebKit::WebPage::didReceiveSyncMessage):
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage):
(WebKit::WebProcess::didReceiveMessageOnConnectionWorkQueue):
* WebProcess/WebProcess.h:
(WebProcess):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141322 268f45cc-cd09-0410-ab3c-d52691b4dbfc