IndexedDB: Implement custom bindings for parsing options
https://bugs.webkit.org/show_bug.cgi?id=96614

Patch by Michael Pruett <michael@68k.org> on 2012-12-18
Reviewed by Darin Adler.

Parsing the options dictionary in IDBDatabase.createObjectStore()
and IDBObjectStore.createIndex() requires custom bindings in JSC.

Tests: storage/indexeddb/*

* GNUmakefile.list.am:
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore):
(WebCore):
* Modules/indexeddb/IDBDatabase.h:
(IDBDatabase):
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):
(WebCore):
* Modules/indexeddb/IDBObjectStore.h:
(IDBObjectStore):
* Modules/indexeddb/IDBObjectStore.idl:
* UseJSC.cmake:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::idbKeyPathFromValue): Added utility function for converting a JSValue to an IDBKeyPath.
(WebCore):
* bindings/js/IDBBindingUtilities.h:
(WebCore):
* bindings/js/JSIDBDatabaseCustom.cpp: Added.
(WebCore):
(WebCore::JSIDBDatabase::createObjectStore):
* bindings/js/JSIDBObjectStoreCustom.cpp: Added.
(WebCore):
(WebCore::JSIDBObjectStore::createIndex):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] pull in the CDM module recently added to media
https://bugs.webkit.org/show_bug.cgi?id=105360

Unreiviewed build fix, but sanity checked by ddorwin.

* DEPS:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
EventSource should support CORS
https://bugs.webkit.org/show_bug.cgi?id=61862

Patch by Per-Erik Brodin <per-erik.brodin@ericsson.com> on 2012-12-18
Reviewed by Alexey Proskuryakov.

Source/WebCore:

Enabled CORS in EventSource with optional constructor argument to
indicate whether credentials should be included or not, as per the spec.
Added didFailAccessControlCheck to ThreadableLoaderClient to be able to
properly distinguish CORS failures from other errors.

Tests: http/tests/eventsource/eventsource-cors-basic.html
       http/tests/eventsource/eventsource-cors-no-server.html
       http/tests/eventsource/eventsource-cors-with-credentials.html

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
(WebCore::DocumentThreadableLoader::didReceiveResponse):
(WebCore::DocumentThreadableLoader::preflightFailure):
* loader/ThreadableLoaderClient.h:
(WebCore::ThreadableLoaderClient::didFailAccessControlCheck):
* loader/ThreadableLoaderClientWrapper.h:
(WebCore::ThreadableLoaderClientWrapper::didFailAccessControlCheck):
(ThreadableLoaderClientWrapper):
* loader/WorkerThreadableLoader.cpp:
(WebCore::workerContextDidFailAccessControlCheck):
(WebCore):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
* loader/WorkerThreadableLoader.h:
(MainThreadBridge):
* page/EventSource.cpp:
(WebCore::EventSource::EventSource):
(WebCore::EventSource::create):
(WebCore::EventSource::connect):
(WebCore::EventSource::withCredentials):
(WebCore):
(WebCore::EventSource::didReceiveResponse):
(WebCore::EventSource::didFailAccessControlCheck):
(WebCore::EventSource::didFailRedirectCheck):
(WebCore::EventSource::abortConnectionAttempt):
(WebCore::EventSource::parseEventStreamLine):
(WebCore::EventSource::createMessageEvent):
* page/EventSource.h:
(WebCore):
(EventSource):
(WebCore::EventSource::refEventTarget):
(WebCore::EventSource::derefEventTarget):
* page/EventSource.idl:

LayoutTests:

Added new CORS tests for EventSource. Modified existing test to verify
that the new constructor argument can be passed to the constructor.

* fast/eventsource/eventsource-constructor-expected.txt:
* fast/eventsource/eventsource-constructor.html:
* fast/js/constructor-length.html:
* http/tests/eventsource/eventsource-cors-basic-expected.txt: Added.
* http/tests/eventsource/eventsource-cors-basic.html: Added.
* http/tests/eventsource/eventsource-cors-no-server-expected.txt: Added.
* http/tests/eventsource/eventsource-cors-no-server.html: Added.
* http/tests/eventsource/eventsource-cors-with-credentials-expected.txt: Added.
* http/tests/eventsource/eventsource-cors-with-credentials.html: Added.
* http/tests/eventsource/resources/es-cors-basic.php: Added.
* http/tests/eventsource/resources/es-cors-credentials.php: Added.
* platform/blackberry/fast/js/constructor-length-expected.txt:
* platform/chromium/fast/js/constructor-length-expected.txt:
* platform/gtk/fast/js/constructor-length-expected.txt:
* platform/mac/fast/js/constructor-length-expected.txt:
* platform/qt/fast/js/constructor-length-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Bug 105344 - [BlackBerry] Make single line text edits touch scrollable.
https://bugs.webkit.org/show_bug.cgi?id=105344

Patch by Genevieve Mak <gmak@rim.com> on 2012-12-18
Reviewed by Antonio Gomes.

Reviewed Internally by Mike Fenton.
We don't need to check the overflow for editable layers because there's
no need for overflow to be set by the content.
PR #231776

* WebKitSupport/InRegionScrollableArea.cpp:
(BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Initial refactoring of database functionality into the manager and server.
https://bugs.webkit.org/show_bug.cgi?id=104748.

Reviewed by Brady Eidson.

This is not a complete refactor, but a stepping stone on the way to isolating
script side database activity from the SQL backend.

No new tests.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Modules/webdatabase/AbstractDatabase.cpp:
(WebCore):
(WebCore::updateGuidVersionMap):
(WebCore::guidForOriginAndName):
(WebCore::AbstractDatabase::AbstractDatabase):
(WebCore::AbstractDatabase::maximumSize):
* Modules/webdatabase/AbstractDatabase.h:
(AbstractDatabase):
- Moved isAvailable() and setIsAvailable() to the DatabaseManager.
* Modules/webdatabase/AbstractDatabaseServer.h:
(AbstractDatabaseServer):
* Modules/webdatabase/DBBackendServer.cpp: Added.
(WebCore::DBBackend::Server::initialize):
(WebCore::DBBackend::Server::setClient):
(WebCore::DBBackend::Server::databaseDirectoryPath):
(WebCore::DBBackend::Server::setDatabaseDirectoryPath):
(WebCore::DBBackend::Server::fullPathForDatabase):
(WebCore::DBBackend::Server::hasEntryForOrigin):
(WebCore::DBBackend::Server::origins):
(WebCore::DBBackend::Server::databaseNamesForOrigin):
(WebCore::DBBackend::Server::detailsForNameAndOrigin):
(WebCore::DBBackend::Server::usageForOrigin):
(WebCore::DBBackend::Server::quotaForOrigin):
(WebCore::DBBackend::Server::setQuota):
(WebCore::DBBackend::Server::deleteAllDatabases):
(WebCore::DBBackend::Server::deleteOrigin):
(WebCore::DBBackend::Server::deleteDatabase):
(WebCore::DBBackend::Server::scheduleNotifyDatabaseChanged):
(WebCore::DBBackend::Server::databaseChanged):
(WebCore::DBBackend::Server::closeDatabasesImmediately):
(WebCore::DBBackend::Server::interruptAllDatabasesForContext):
(WebCore::DBBackend::Server::canEstablishDatabase):
(WebCore::DBBackend::Server::addOpenDatabase):
(WebCore::DBBackend::Server::removeOpenDatabase):
(WebCore::DBBackend::Server::setDatabaseDetails):
(WebCore::DBBackend::Server::getMaxSizeForDatabase):
- Refactored all calls to the DatabaseTracker to go thru the DBBackend::Server.
* Modules/webdatabase/DBBackendServer.h:
* Modules/webdatabase/DOMWindowWebDatabase.cpp:
(WebCore::DOMWindowWebDatabase::openDatabase):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::close):
(WebCore::Database::maximumSize):
* Modules/webdatabase/Database.h:
(Database):
- Moved the openDatabase() factory method to the DatabaseManager.
- Removed the unused deliverPendingCallback() prototype.
* Modules/webdatabase/DatabaseBasicTypes.h: Added.
- A place to define some common basic types used by the database module.
* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::databaseExceededQuota):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::DatabaseManager):
(WebCore::DatabaseManager::initialize):
(WebCore::DatabaseManager::setClient):
(WebCore::DatabaseManager::databaseDirectoryPath):
(WebCore::DatabaseManager::setDatabaseDirectoryPath):
(WebCore::DatabaseManager::isAvailable):
(WebCore::DatabaseManager::setIsAvailable):
(DatabaseCreationCallbackTask):
(WebCore::DatabaseCreationCallbackTask::create):
(WebCore::DatabaseCreationCallbackTask::performTask):
(WebCore::DatabaseCreationCallbackTask::DatabaseCreationCallbackTask):
(WebCore::DatabaseManager::openDatabase):
(WebCore::DatabaseManager::openDatabaseSync):
(WebCore::DatabaseManager::setHasOpenDatabases):
(WebCore::DatabaseManager::fullPathForDatabase):
(WebCore::DatabaseManager::hasEntryForOrigin):
(WebCore::DatabaseManager::origins):
(WebCore::DatabaseManager::databaseNamesForOrigin):
(WebCore::DatabaseManager::detailsForNameAndOrigin):
(WebCore::DatabaseManager::usageForOrigin):
(WebCore::DatabaseManager::quotaForOrigin):
(WebCore::DatabaseManager::setQuota):
(WebCore::DatabaseManager::deleteAllDatabases):
(WebCore::DatabaseManager::deleteOrigin):
(WebCore::DatabaseManager::deleteDatabase):
(WebCore::DatabaseManager::scheduleNotifyDatabaseChanged):
(WebCore::DatabaseManager::databaseChanged):
(WebCore::DatabaseManager::closeDatabasesImmediately):
(WebCore::DatabaseManager::interruptAllDatabasesForContext):
(WebCore::DatabaseManager::canEstablishDatabase):
(WebCore::DatabaseManager::addOpenDatabase):
(WebCore::DatabaseManager::removeOpenDatabase):
(WebCore::DatabaseManager::setDatabaseDetails):
(WebCore::DatabaseManager::getMaxSizeForDatabase):
* Modules/webdatabase/DatabaseManager.h:
(DatabaseManager):
* Modules/webdatabase/DatabaseSync.cpp:
(WebCore::DatabaseSync::~DatabaseSync):
(WebCore::DatabaseSync::closeImmediately):
* Modules/webdatabase/DatabaseSync.h:
(DatabaseSync):
- Moved the openDatabaseSync() factory method to the DatabaseManager.
* Modules/webdatabase/DatabaseTask.h:
* Modules/webdatabase/SQLResultSet.h:
* Modules/webdatabase/SQLStatementSync.h:
* Modules/webdatabase/SQLTransaction.h:
* Modules/webdatabase/SQLTransactionClient.cpp:
(WebCore::SQLTransactionClient::didCommitWriteTransaction):
(WebCore::SQLTransactionClient::didExecuteStatement):
(WebCore::SQLTransactionClient::didExceedQuota):
* Modules/webdatabase/SQLTransactionSync.h:
* Modules/webdatabase/WorkerContextWebDatabase.cpp:
(WebCore::WorkerContextWebDatabase::openDatabase):
(WebCore::WorkerContextWebDatabase::openDatabaseSync):
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138085 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode incorrectly checks for non-array array storage when it should be checking for array array storage
https://bugs.webkit.org/show_bug.cgi?id=105365

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore: 

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode):

LayoutTests: 

* fast/js/dfg-ensure-array-storage-on-window-expected.txt: Added.
* fast/js/dfg-ensure-array-storage-on-window.html: Added.
* fast/js/indexed-setter-on-global-object-expected.txt: Added.
* fast/js/indexed-setter-on-global-object.html: Added.
* fast/js/script-tests/dfg-ensure-array-storage-on-window.js: Added.
(foo):
* fast/js/script-tests/indexed-setter-on-global-object.js: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the test description.
        
Rubber stamped by Mark Hahnenberg.

* fast/js/script-tests/dfg-ensure-array-storage-on-window.js:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixed bad merge in "Initial refactoring of database functionality into the manager and server".
https://bugs.webkit.org/show_bug.cgi?id=104748.

Not reviewed.

No new tests.

* Modules/webdatabase/DBBackendServer.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disable the SimplifyMarkup API test, wich asserts in debug builds.
Tracked by https://bugs.webkit.org/show_bug.cgi?id=105370.

* TestWebKitAPI/Tests/mac/SimplifyMarkup.mm:
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rebaseline some tests on Lion.

* platform/mac-lion/fast/text/decorations-with-text-combine-expected.txt: Added.
* platform/mac-lion/fast/text/orientation-sideways-expected.txt: Added.
* platform/mac-lion/fast/writing-mode/broken-ideographic-font-expected.txt:
* platform/mac-lion/fast/writing-mode/vertical-baseline-alignment-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
New baseline for Acid3 test.

* platform/mac/http/tests/misc/acid3-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Remove temporary backwards compatible interface code (from r137724).
https://bugs.webkit.org/show_bug.cgi?id=105205

Patch by David Dorwin <ddorwin@chromium.org> on 2012-12-18
Reviewed by James Robinson.

* public/WebMediaPlayerClient.h:
* src/WebMediaPlayerClientImpl.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Skip two asserting tests in Debug.

* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Input elements with default touch handlers don't update handler counts when changing documents
https://bugs.webkit.org/show_bug.cgi?id=105334

Reviewed by James Robinson.

Source/WebCore: 

When an Input element with default touch event handlers changes documents, it failed to
update the touch event handler sets in both the old and new document. This patch fixes this
case.

Test: fast/events/touch/touch-input-element-change-documents.html

* dom/Document.h:
(WebCore::Document::didRemoveTouchEventTargetNode) This function makes sense when touch
handling is enabled, regardless of whether we're tracking the rects.
* dom/Document.cpp:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement): Switch from didRemoveTouchEventHandler to
didRemoveTouchEventTargetNode, since we don't care about counts in the destructor.
(WebCore::HTMLInputElement::updateType): Fixing incorrect indentation.
(WebCore::HTMLInputElement::didMoveToNewDocument): Adding the node to the new document and
removing it from the old.

LayoutTests: 

* fast/events/touch/touch-input-element-change-documents-expected.txt: Added.
* fast/events/touch/touch-input-element-change-documents.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Create a context client
https://bugs.webkit.org/show_bug.cgi?id=105316
<rdar://problem/12901762>

Reviewed by Brady Eidson.

Web contexts already have clients related to downloads or history.
Miscellaneous callbacks can be grouped into a generic client for the
web context.

* UIProcess/API/C/WKContext.cpp:
(WKContextSetClient): Set the client for the context.
* UIProcess/API/C/WKContext.h: Define a new, empty WKContextClient.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::initializeClient):
* UIProcess/WebContext.h: Add a variable for the new client. Move the
download client so that all the clients are grouped together.
(WebKit::WebContext::client): Returns the context client.
* UIProcess/WebContextClient.cpp: Added. Currently empty, but will be
filled out in a pending patch.
* UIProcess/WebContextClient.h: Added.

Add WebContextClient.{h,cpp}.
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Minor improvements to HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=105353

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2012-12-18
Reviewed by Eric Carlson.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canPlayType):
(WebCore::createFileURLForApplicationCacheResource):
(WebCore::stringForNetworkState):
(WebCore::HTMLMediaElement::preload):
(WebCore::HTMLMediaElement::getPluginProxyParams):
Use ASCIILiteral for literal strings becoming WTFStrings.

(WebCore::HTMLMediaElement::setLoop):
By going through setAttribute, parseAttribute would already take care of
updating the disable sleep, so the call here is not needed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a JSScriptRef API to JSC so that we can allow API users to avoid the full cost of reparsing everytime the execute a script.
https://bugs.webkit.org/show_bug.cgi?id=105340

Reviewed by Gavin Barraclough.

This patch adds a (currently private) API to allow users of the JSC API to create a JSScript object
that references a reusable version of the script that they wish to evaluate.  This can help us avoid
numeorus copies that are otherwise induced by our existing API and gives us an opaque object that we
can hang various caches off.  Currently this is simply a simple SourceProvider, but in future we may
be able to add more caching without requiring new/replacement APIs.

* API/JSScriptRef.cpp: Added.
* API/JSScriptRefPrivate.h: Added.
* API/tests/testapi.c:
  Add tests for new APIs.
* JavaScriptCore.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Remove extra call to doFatFingers.
https://bugs.webkit.org/show_bug.cgi?id=105347

Patch by Genevieve Mak <gmak@rim.com> on 2012-12-18
Reviewed by Rob Buis.

Reviewed Internally by Mike Fenton.
Now that we do fat fingers on touch start, we don't need this anymore.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::touchEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][AC] Fix assertion failures for AC with clutter
https://bugs.webkit.org/show_bug.cgi?id=105039

Patch by ChangSeok Oh <shivamidow@gmail.com> on 2012-12-18
Reviewed by Gustavo Noronha Silva.

AcceleratedCompositingContext could be a client of GraphicsLayerClutter
not only RenderLayerBacking. So inserting ASSERT_NOT_REACH in notifyFlushRequired()
causes a crash by calling GraphicsLayerClutter::noteLayerPropertyChanged in debug build.
And also I added flushCompositingStateIncludingSubframes taken from
AcceleratedCompositingContextGL to flushAndRenderLayers(). If not so,
ASSERT(!needsLayout()) failed in FrameView::paintContents() too in debug build.

* WebCoreSupport/AcceleratedCompositingContextClutter.cpp:
(WebKit::AcceleratedCompositingContext::flushAndRenderLayers): Add updateLayoutAndStyleIfNeededRecursive()
(WebKit::AcceleratedCompositingContext::notifyAnimationStarted): Removed ASSERT_NOT_REACHED()
(WebKit::AcceleratedCompositingContext::notifyFlushRequired): Removed ASSERT_NOT_REACHED()

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138100 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/mac: Add SPI to WebKit1 WebFrame for node conversion to JSValueRef
https://bugs.webkit.org/show_bug.cgi?id=105262

Reviewed by Anders Carlsson.

* WebView/WebFrame.mm:
(-[WebFrame jsWrapper:forWorld:]): Added. Takes a DOMNode and WebScriptWorld and provides a JSValueRef
for the WebCore::Node in that particular WebScriptWorld.
* WebView/WebFramePrivate.h:

Tools: Test for https://bugs.webkit.org/show_bug.cgi?id=105262
Add SPI to WebKit1 WebFrame for node conversion to JSValueRef

Reviewed by Anders Carlsson.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added file Tests/mac/JSWrapperForNodeInWebFrame.mm.mm
* TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm.mm: Added.
(TestWebKitAPI::TEST): Tests for the correct JS wrapper for a DOMNode, provided a WebScriptWorld.
Loads html with a single div element. In an isolated world, creates a property on that node.
Also, in the standard world, creates a different property on that node.  Then tests for 4 things:
    - Existence of the isolated property in the isolated world.
    - Existence of the standard property in the standard world.
    - Non-existence of the isolated property in the standard world.
    - Non-existence of the standard property in the isolated world.



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