[Chromium] Remove cookie-related functions from PlatformSupport
https://bugs.webkit.org/show_bug.cgi?id=99340

Reviewed by Adam Barth.

Move cookie-related functions out of PlatformSupport and implement
new PlatformCookieJar interface via NetworkContext.

Source/WebCore:

* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* loader/CookieJar.cpp:
* loader/chromium/CookieJarChromium.cpp: Removed.
* platform/chromium/PlatformSupport.h:
(WebCore):
(PlatformSupport):
* platform/network/NetworkingContext.h:
(WebKit):
(NetworkingContext):
* platform/network/chromium/CookieJarChromium.cpp: Copied from Source/WebCore/loader/chromium/CookieJarChromium.cpp.
(WebCore::setCookiesFromDOM):
(WebCore::cookiesForDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostname):
(WebCore::deleteAllCookies):

Source/WebKit/chromium:

* WebKit.gyp:
* src/FrameNetworkingContextImpl.cpp: Added.
(WebKit):
(WebKit::FrameNetworkingContextImpl::cookieJar):
* src/FrameNetworkingContextImpl.h:
(FrameNetworkingContextImpl):
* src/PlatformSupport.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: [GTK] [WebKit2] Move GtkAuthenticationDialog to the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=101843

Reviewed by Gustavo Noronha Silva.

Make GtkAuthenticationDialog more general, so that it can be subclassed in
WebKit2. We cannot use the WebCore authentication-related classes directly there.

No new tests. This patch does not change behavior.

* platform/gtk/GtkAuthenticationDialog.cpp:
(WebCore::GtkAuthenticationDialog::GtkAuthenticationDialog): Remove an unused include and reorder
some field initializers.
(WebCore::GtkAuthenticationDialog::authenticate): Now handle both the okay and cancel case here. This
makes it simpler to subclass.
(WebCore::GtkAuthenticationDialog::authenticationDialogResponseCallback): Handle fetching the username
and password here, so that it can be shared with subclasses.
* platform/gtk/GtkAuthenticationDialog.h: Make some methods virtual and protected so they can be
subclasses.

Source/WebKit2: Move authentication dialog to the UIProcess

[GTK] [WebKit2] Move GtkAuthenticationDialog to the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=101843

Reviewed by Gustavo Noronha Silva.

Move the use of GtkAuthenticationDialog to the UIProcess along with the rest of
the GTK+ widgets. This will allow us to to embed the dialog into the WebView
in the future and to test authentication with the WebKit2 C API.

* GNUmakefile.list.am: Add the new class to the source list and remove the
GTK+-only WebFrameLoader implementation file.
* UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp: Added. A subclass of GtkAuthenticationDialog
which uses the WebKit2 classes to do the UIProcess-side authentication.
* UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h: Added.
* UIProcess/API/gtk/WebKitLoaderClient.cpp: Add a callback for didReceiveAuthenticationChallengeInFrame.
(didReceiveAuthenticationChallengeInFrame): Added.
(attachLoaderClientToView): Use the new callback.
* UIProcess/Authentication/AuthenticationChallengeProxy.h:
(WebKit::AuthenticationChallengeProxy::core): Add this getter for the WebCore class.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): Share the implementation
again.
* WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r134973.
http://trac.webkit.org/changeset/134973
https://bugs.webkit.org/show_bug.cgi?id=99340

Broke compile on at least Mac and Linux.

Source/WebCore:

* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* loader/CookieJar.cpp:
* loader/chromium/CookieJarChromium.cpp: Renamed from Source/WebKit/chromium/src/FrameNetworkingContextImpl.cpp.
(WebCore):
(WebCore::setCookies):
(WebCore::cookies):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostname):
(WebCore::deleteAllCookies):
* platform/chromium/PlatformSupport.h:
(WebCore):
(PlatformSupport):
* platform/network/NetworkingContext.h:
* platform/network/chromium/CookieJarChromium.cpp: Removed.

Source/WebKit/chromium:

* WebKit.gyp:
* src/FrameNetworkingContextImpl.h:
* src/PlatformSupport.cpp:
(WebCore::getCookieJar):
(WebCore):
(WebCore::PlatformSupport::setCookies):
(WebCore::PlatformSupport::cookies):
(WebCore::PlatformSupport::cookieRequestHeaderFieldValue):
(WebCore::PlatformSupport::rawCookies):
(WebCore::PlatformSupport::deleteCookie):
(WebCore::PlatformSupport::cookiesEnabled):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Update RTCPeerConnection states to match the latest editors draft
https://bugs.webkit.org/show_bug.cgi?id=102382

Reviewed by Adam Barth.

Source/Platform:

Adding a callback for the new RTCPeerConnection::iceGatheringState.

* chromium/public/WebRTCPeerConnectionHandlerClient.h:
(WebKit::WebRTCPeerConnectionHandlerClient::didChangeICEGatheringState):

Source/WebCore:

Updating readyState & iceState, and adding iceGatheringState.
Also safeguarding the event timer callback.

Patch covered by existing tests.

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::RTCPeerConnection):
(WebCore::RTCPeerConnection::createOffer):
(WebCore::RTCPeerConnection::createAnswer):
(WebCore::RTCPeerConnection::setLocalDescription):
(WebCore::RTCPeerConnection::localDescription):
(WebCore::RTCPeerConnection::setRemoteDescription):
(WebCore::RTCPeerConnection::remoteDescription):
(WebCore::RTCPeerConnection::updateIce):
(WebCore::RTCPeerConnection::addIceCandidate):
(WebCore::RTCPeerConnection::readyState):
(WebCore::RTCPeerConnection::iceGatheringState):
(WebCore):
(WebCore::RTCPeerConnection::iceState):
(WebCore::RTCPeerConnection::addStream):
(WebCore::RTCPeerConnection::close):
(WebCore::RTCPeerConnection::didChangeIceGatheringState):
(WebCore::RTCPeerConnection::stop):
(WebCore::RTCPeerConnection::changeReadyState):
(WebCore::RTCPeerConnection::scheduledEventTimerFired):
* Modules/mediastream/RTCPeerConnection.h:
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* dom/EventNames.h:
(WebCore):
* platform/mediastream/RTCPeerConnectionHandlerClient.h:
(RTCPeerConnectionHandlerClient):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::didChangeICEGatheringState):
(WebCore):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Source/WebKit/chromium:

Updating readyState & iceState, and adding iceGatheringState.

* src/AssertMatchingEnums.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] adjusting expectations for checkerboard.html

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Fix regression causing checkerboard flicker after app wake-up
https://bugs.webkit.org/show_bug.cgi?id=102526

Patch by Adam Treat <atreat@rim.com> on 2012-11-16
Reviewed by George Staikos.
PR 245027

The webkit patch for 219976 introduced an undesirable behavior change
resulting in a regression where there was checkerboard flickering on
resuming from an inactive application state.  This patch restores the
previous behavior and fixes the regression.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStore::createBackingStoreMemory):
(BlackBerry::WebKit::BackingStore::releaseBackingStoreMemory):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r134867.
http://trac.webkit.org/changeset/134867
https://bugs.webkit.org/show_bug.cgi?id=102544

Broke security fuzzier test (heap-buffer-overflow) (Requested
by bfulgham on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-11-16

* platform/audio/Biquad.cpp:
(WebCore::Biquad::process):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] FCC doesn't work in textarea
https://bugs.webkit.org/show_bug.cgi?id=102088

Reviewed by Antonio Gomes.

Remove the cancel button specializations, it was needed at some point but hitting it
works just as well without it. This unbreaks FCC in textarea's.

* WebKitSupport/FatFingers.cpp:
(BlackBerry::WebKit::FatFingers::isElementClickable):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
String::fromUTF8() should take advantage of the ASCII check in convertUTF8ToUTF16()
https://bugs.webkit.org/show_bug.cgi?id=100577

Reviewed by Oliver Hunt.

Passed in ASCII flag to convertUTF8ToUTF16() and if try, create an 8 bit string from the original arguments.
Relanding after fix to https://bugs.webkit.org/show_bug.cgi?id=102482.

* wtf/text/WTFString.cpp:
(WTF::String::fromUTF8):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] key event's location does not work on Windows platform.
https://bugs.webkit.org/show_bug.cgi?id=89742

Patch by Takashi Sakamoto <tasak@google.com> on 2012-11-15
Reviewed by Brent Fulgham.

Modified keyDownCallback to use lparam to specify left-hand keys or
right-hand keys.

* DumpRenderTree/win/EventSender.cpp:
(makeKeyDataForScanCode):
Given a virtual keycode, generate scancode and extended key bit of
lparam.
(keyDownCallback):
Use lparam for left-hand and right-hand keys, because Windows doesn't
directly provide a virtual keycode which distinguishes between
left-hand and right-hand. For example, when control key is pressed,
wparam has VK_CONTROL, neither VK_RCONTROL nor VK_LCONTROL.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Sync with Windows test expectations.

* platform/wincairo/TestExpectations: Update to match Windows.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
StyleResolver: Only input elements need equal "readonly" attribute for style sharing.
<http://webkit.org/b/102536>

Reviewed by Antti Koivisto.

Move the comparison of the "readonly" attribute into canShareStyleWithControl() since it's only
relevant for sharing style between <input> elements.

Also skip attribute comparisons for form control elements that share the same ElementAttributeData.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithControl):
(WebCore::haveIdenticalStyleAffectingAttributes):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r129644): User StyleSheet not applying
https://bugs.webkit.org/show_bug.cgi?id=102110

Reviewed by Andreas Kling.

Source/WebCore: 

Injected stylesheets added as UserStyleAuthorLevel fail to apply. r129644 implicitly assumed that
such things don't exists but on Chromium addUserStyleSheet() confusingly uses them.
        
The patch adds injected author stylesheets to DocumentStyleSheetCollection::activeStyleSheets().
It also generally cleans up the code around injected and user stylesheets.

Tests: userscripts/user-script-and-stylesheet.html
       userscripts/user-stylesheet-invalidate.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::collectRulesFromUserStyleSheets):
(WebCore::collectCSSOMWrappers):
* css/StyleResolver.h:
(StyleResolver):
* dom/Document.cpp:
(WebCore::Document::setCompatibilityMode):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::injectedUserStyleSheets):
(WebCore):
(WebCore::DocumentStyleSheetCollection::injectedAuthorStyleSheets):
(WebCore::DocumentStyleSheetCollection::updateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::documentUserStyleSheets):
(DocumentStyleSheetCollection):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):
(WebCore::PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames):
* page/PageGroup.h:
(PageGroup):

LayoutTests: 

* userscripts/user-stylesheet-invalidate-expected.txt: Added.
* userscripts/user-stylesheet-invalidate.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
For single element arrays use the pointer into the CFDataRef instead of copying data
https://bugs.webkit.org/show_bug.cgi?id=102306
<rdar://problem/12267471>

Reviewed by Alexey Proskuryakov.

We generally copy the data received from CFNetwork into our own buffers. But if the
CFArrayRef has exactly one CFDataRef inside it, then we can just hold on to the CFDataRef
and access its memory directly and avoid making a copy.

This also moves the creation of PurgeableBuffer from CachedResource to SharedBuffer.
SharedBuffer::createPurgeableBuffer() will avoid creating PurgeableBuffer when the
SharedBuffer is backed by a NSData/CFDataRef and when we want to optimize and directly use
the memory in the data array.

No new tests because no change in functionality.

* loader/ResourceBuffer.cpp:
(WebCore::ResourceBuffer::createPurgeableBuffer): Added.
* loader/ResourceBuffer.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::makePurgeable):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::createPurgeableBuffer): Added.
(WebCore::SharedBuffer::data):
* platform/SharedBuffer.h:
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::platformData): Use reinterpret_cast instead of C-style cast.
(WebCore::SharedBuffer::maybeTransferPlatformData): Use reinterpret_cast instead of C-style cast.
(WebCore::SharedBuffer::singleDataArrayBuffer): Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rebaselined run-bindings-tests.
https://bugs.webkit.org/show_bug.cgi?id=102523

Patch by Byungwoo Lee <bw80.lee@samsung.com> on 2012-11-16
Reviewed by Dimitri Glazkov.

Expected results need to be updated after r134931

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter):
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrSetter):
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Propagate DOMRequestState to IndexedDB binding utility functions
https://bugs.webkit.org/show_bug.cgi?id=102430

Patch by Michael Pruett <michael@68k.org> on 2012-11-16
Reviewed by Adam Barth.

DOMRequestState is currently propagated to some but not all of
the IndexedDB binding utility functions. In order to implement
these functions for JSC, this state must be propagated to all
of the utility functions.

Source/WebCore:

Tests: storage/indexeddb/*

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::setValueReady):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::generateIndexKeysForValue):
(WebCore::IDBObjectStore::put):
(WebCore):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::dispatchEvent):
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::requestState):
(IDBRequest):
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromScriptValueAndKeyPath):
(WebCore::serializeIDBValue):
(WebCore::injectIDBKeyIntoScriptValue):
* bindings/v8/IDBBindingUtilities.h:
(WebCore):

Source/WebKit/chromium:

* tests/IDBBindingUtilitiesTest.cpp:
(WebKit::checkKeyFromValueAndKeyPathInternal):
(WebKit::injectKey):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=102540
[BlackBerry] Checkerboard flicker when pinch zooming out on google.com/nwshp

Patch by Adam Treat <atreat@rim.com> on 2012-11-16
Reviewed by George Staikos.
PR 245827

Disable updates to the backingstore tile matrix when backingstore updates
are disabled.  This prevents changes to the tile matrix when we are in the
middle of a pinch zoom which can cause checkebroard flickering.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
(BlackBerry::WebKit::BackingStorePrivate::resumeBackingStoreUpdates):
(BlackBerry::WebKit::BackingStorePrivate::setBackingStoreRect):
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::renderVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::renderBackingStore):
(BlackBerry::WebKit::BackingStorePrivate::updateTileMatrixIfNeeded):
(BlackBerry::WebKit::BackingStorePrivate::contentsSizeChanged):
(BlackBerry::WebKit::BackingStorePrivate::orientationChanged):
* Api/BackingStore_p.h:
(BlackBerry::WebKit::BackingStorePrivate::setTileMatrixNeedsUpdate):
(BackingStorePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r134986.
http://trac.webkit.org/changeset/134986
https://bugs.webkit.org/show_bug.cgi?id=102110

Triggered ASSERT in fast/frames/seamless/seamless-inherited-
origin.html.

Source/WebCore:

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::addAuthorRulesAndCollectUserRulesFromSheets):
(WebCore::collectCSSOMWrappers):
* css/StyleResolver.h:
(StyleResolver):
* dom/Document.cpp:
(WebCore::Document::setCompatibilityMode):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::pageGroupUserSheets):
(WebCore):
(WebCore::DocumentStyleSheetCollection::clearPageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::updatePageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h:
(DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::documentUserSheets):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):
(WebCore::PageGroup::resetUserStyleCacheInAllFrames):
* page/PageGroup.h:
(PageGroup):

LayoutTests:

* userscripts/user-stylesheet-invalidate-expected.txt: Removed.
* userscripts/user-stylesheet-invalidate.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for WinCE after r133688.

Use numeric_limits<uint32_t>::max() instead of UINT32_MAX.

* runtime/CodeCache.h:
(JSC::CacheMap::CacheMap):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for WinCE after r134936.

* platform/network/win/CookieJarWin.cpp:
(WebCore::cookieRequestHeaderFieldValue):

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