[Mac] media/track/track-mode.html sometimes trigger InvalidStateError
https://bugs.webkit.org/show_bug.cgi?id=115045

Reviewed by Alexey Proskuryakov.

* media/track/track-mode.html: Don't assume that the video element is ready for seeking
    after a 100ms timeout.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149197 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebKit2] CustomProtocolManager's m_registeredSchemes HashSet can be accessed by multiple threads
https://bugs.webkit.org/show_bug.cgi?id=115267

Reviewed by Alexey Proskuryakov.

* Shared/Network/CustomProtocols/CustomProtocolManager.h: Added a Mutex to protect m_registeredSchemes.
* Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm:
(WebKit::CustomProtocolManager::registerScheme): Acquired the mutex before accessing m_registeredSchemes.
(WebKit::CustomProtocolManager::unregisterScheme): Ditto.
(WebKit::CustomProtocolManager::supportsScheme): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        [WK2] Remove NetworkResourceLoader::cleanupOnMainThread
        https://bugs.webkit.org/show_bug.cgi?id=115268

        Reviewed by Brady Eidson.

        All cleanup() callers are now on main thread, and this indirection only complicates debugging.

        * NetworkProcess/NetworkResourceLoader.cpp:
        (WebKit::NetworkResourceLoader::connectionToWebProcessDidClose):
        (WebKit::NetworkResourceLoader::abortInProgressLoad):
        (WebKit::NetworkResourceLoader::didFinishLoading):
        (WebKit::NetworkResourceLoader::didFail):
        * NetworkProcess/NetworkResourceLoader.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Crash due to null items from getDOMStorageItems
https://bugs.webkit.org/show_bug.cgi?id=115176

Patch by Konrad Piascik <kpiascik@blackberry.com> on 2013-04-26
Reviewed by Joseph Pecoraro.

Source/WebCore:

findStorageArea was returning a null storageArea causing the items
input paramater to not be set.  This was happening without any error
being set at all.  Set an error to prevent a crash when we try to
convert the result to a JSON string.

Added tests to check if session and local storage are empty that
they are still functional.

* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::getDOMStorageItems):

LayoutTests:

Tests to check that if local and session storage are empty
that they still work corerctly.

* inspector/storage-panel-dom-storage-empty-expected.txt: Added.
* inspector/storage-panel-dom-storage-empty.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the copyright years after r149057

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-04-26

* page/DiagnosticLoggingKeys.cpp: I accidentally removed a year from
the copyright in r149057.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add Runtime.parse to the Inspector protocol.

This will be used to parse console expressions for errors
before evaluating them fully.

https://webkit.org/b/115242

Reviewed by Oliver Hunt.

* ForwardingHeaders/parser/ParserError.h: Added.
* inspector/Inspector.json:
* inspector/InspectorRuntimeAgent.cpp:
(WebCore::InspectorRuntimeAgent::parse):
* inspector/InspectorRuntimeAgent.h:
(InspectorRuntimeAgent):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change RenderMeter::valueRatio() visibility to public
https://bugs.webkit.org/show_bug.cgi?id=115266

This function is currently unused.
However, it is necessary to implement a RenderTheme capable of rendering Meter elements.

Patch by Daker Fernandes Pinheiro <daker.pinheiro@openbossa.org> on 2013-04-26
Reviewed by Alexis Menard.

No new tests, because no behaviour is changed.

* rendering/RenderMeter.h:
(RenderMeter):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Crashes under ResourceHandle::continueDidReceiveResponse when loading blobs
        https://bugs.webkit.org/show_bug.cgi?id=115273

        Reviewed by Anders Carlsson.

        Covered by multiple existing tests (when using NetworkProcess), including:
        - http/tests/fileapi/blob-url-in-subframe.html
        - http/tests/fileapi/create-blob-url-from-data-url.html

        * NetworkProcess/NetworkResourceLoader.cpp:
        (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
        Work around BlobResourceHandle badness.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make stack tracing more robust
https://bugs.webkit.org/show_bug.cgi?id=115272

Reviewed by Geoffrey Garen.

CallFrame already handles stack walking confusion robustly,
so we should make sure that the actual walk handles that as well.

* interpreter/Interpreter.cpp:
(JSC::getCallerInfo):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Check for valid element in elementTouched
https://bugs.webkit.org/show_bug.cgi?id=115205

Patch by Nima Ghanavatian <nghanavatian@blackberry.com> on 2013-04-26
Reviewed by Rob Buis.

Internally reviewed by Genevieve Mak.

PR 331546
We might receive a null ptr from nodeAsElementIfApplicable which
is passed in here. Check to make sure it's valid before using.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::elementTouched):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Layer-backed WebViews don't repaint content outside the visible area
https://bugs.webkit.org/show_bug.cgi?id=115275

Reviewed by Beth Dakin.

Source/WebCore:

Export ScrollView::setPaintsEntireContents(bool).

* WebCore.exp.in:

Source/WebKit/mac:

When a client of WebView makes the WebView be layer-backed, then
AppKit propagaes the layer-backing down to the WebHTMLView (but
no further).

In this situation, we had a bug where content that was not
in the visible content rect would not get repainted, because
WebCore clips repaints to the visible rect.

Fix by calling ScrollView::setPaintsEntireContents(bool) from
-[WebHTMLView setLayer:], saying that we need
to paint the entire contents if we have a layer.

* WebView/WebHTMLView.mm:
(-[WebHTMLView setLayer:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Inspector window is often blank when opened
https://bugs.webkit.org/show_bug.cgi?id=115220
<rdar://problem/13735496>

Reviewed by Tim Horton.

After disabling tiled scrolling and accelerated drawing in r149006, the
Inspector window was often missing its content after opening. This only
happened when the user has a preference on disk to use accelerated drawing
in the Inspector.

The missing content was caused by a failure to connect the correct contextID
for remote layer hosting. On window creation, we hook up a context using
WindowServer layer hosting (the default), but then switch back to app-hosted
layers for the Inspector window. This switching happens in didUpdateBackingStoreState(),
but that can be re-entered via its call to sendUpdateBackingStoreState(). In
that cause, on unwinding the stack it would call enterAcceleratedCompositingMode()
with a stale layerTreeContext.

Fix by moving the code that exits/enters accelerated compositing mode to before
the call to sendUpdateBackingStoreState() that can cause re-entrancy. That avoids
use of a possibly stale layerTreeContext.

* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disable sub-pixel layout on mac.
https://bugs.webkit.org/show_bug.cgi?id=114999.

Reviewed by Simon Fraser.

* Configurations/FeatureDefines.xcconfig:
* WebCore.exp.in: 
Export symbol needed to be added for IntRect(const LayoutRect&) constructor, 
which is now being used in pixelSnappedIntRect(const LayoutRect&) in LayoutRect.h after disabling sub-pixel layout.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Rebaseline a bunch of tests and run optimize-baselines after disabling sub-pixel layout on mac.
https://bugs.webkit.org/show_bug.cgi?id=114999.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Downloads need to be converted from the NSURLConnection, not canceled and restarted, when using the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=115277
<rdar://problem/12890184>

Reviewed by Sam Weinig.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
Ask the download manager to convert the main resource load to a download.

* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
Add new message.

* NetworkProcess/NetworkResourceLoader.h:
(WebKit::NetworkResourceLoader::handle):
Add getter.

* Shared/Downloads/mac/DownloadMac.mm:
(dispatchOnMainThread):
Helper function that ensures that a given block is called on the main thread.

(-[WKDownloadAsDelegate downloadDidBegin:]):
(-[WKDownloadAsDelegate download:didReceiveAuthenticationChallenge:]):
(-[WKDownloadAsDelegate download:didReceiveResponse:]):
(-[WKDownloadAsDelegate download:didReceiveDataOfLength:]):
(-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]):
(-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]):
(-[WKDownloadAsDelegate download:didCreateDestination:]):
(-[WKDownloadAsDelegate downloadDidFinish:]):
(-[WKDownloadAsDelegate download:didFailWithError:]):
Use dispatchOnMainThread.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
Remove code that cancels the current load and starts a new download.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::convertMainResourceLoadToDownload):
Send the ConvertMainResourceLoadToDownload message to the network process.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        [WK2] WKContextClient doesn't need to be versioned yet
        https://bugs.webkit.org/show_bug.cgi?id=115279

        Reviewed by Anders Carlsson.

        * Shared/APIClientTraits.cpp:
        * Shared/APIClientTraits.h:
        * UIProcess/API/C/WKContext.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore ObjC bridge is missing support for bool type
https://bugs.webkit.org/show_bug.cgi?id=115276

Reviewed by Geoffrey Garen.

Added code to handle conversion between ObjC and JS booleans.

* bridge/objc/objc_instance.mm:
(ObjcInstance::invokeObjcMethod):
* bridge/objc/objc_utility.h:
* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertValueToObjcValue):
(JSC::Bindings::convertObjcValueToValue):
(JSC::Bindings::objcValueTypeForType):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-04-26  Simon Cooper  <scooper@apple.com>

        Permit ~/Library or ~/Library/Preferences to be symlinks
        https://bugs.webkit.org/show_bug.cgi?id=115142
        <rdar://problem/12953603>

        Reviewed by Alexey Proskuryakov.

        Pass in two new parameters which are the resolved paths to ~/Library
        and ~/Library/Preferences. Added new expansion functions and
        substituted the new functions for home-regex, home-subpath and
        home-literal for places referencing resources in "~/Library" or
        "~/Library/Preferences".

        * Resources/PlugInSandboxProfiles/com.apple.QuickTime Plugin.plugin.sb:
        * Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb:
        * Resources/PlugInSandboxProfiles/com.apple.ist.ds.appleconnect.webplugin.sb:
        * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player.plugin.sb:
        * Resources/PlugInSandboxProfiles/com.microsoft.SilverlightPlugin.sb:
        * Resources/PlugInSandboxProfiles/com.oracle.java.JavaAppletPlugin.sb:
        * Shared/mac/ChildProcessMac.mm:
        (WebKit::ChildProcess::initializeSandbox):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149217 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix.

* platform/LayoutUnit.h:
(WebCore::LayoutUnit::LayoutUnit):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add methods to add a user style sheet to the WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=99081

Reviewed by Carlos Garcia Campos, Gustavo Noronha Silva, and Benjamin Poulain.

Add methods to WebKitWebViewGroup to add and remove user style sheets.
This allows clients to inject style sheets into pages with a set of
rules for when those style sheets apply.

* UIProcess/API/gtk/WebKitWebViewGroup.cpp:
(toImmutableArray): Added this helper which converts the GList* parameters into
ImmutableArrays for use with the WebKit2 internal API.
(webkit_web_view_group_add_user_style_sheet): Added new API for adding a style sheet.
(webkit_web_view_group_remove_all_user_style_sheets): Add new API for clearing out all style sheets.
* UIProcess/API/gtk/WebKitWebViewGroup.h: Added new method declarations.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Added new API to the documentation.
* UIProcess/API/gtk/tests/TestWebKitWebViewGroup.cpp: Added a test for the new API.
(isStyleSheetInjectedForURLAtPath): Function to check whether the style sheet has been injected for a given URL.
(fillURLListFromPaths): Helper which converts paths passed via varargs into a whitelist or blacklist.
(removeOldInjectedStyleSheetsAndResetLists): Function to start afresh.
(testWebViewGroupInjectedStyleSheet): The actual test.
(serverCallback): Server callback for use with the test. We cannot use loadHTML or
loadAlternateHTML, because that checks the whitelist and blacklist against about:blank.
(beforeAll): Initialize the server and new test.
(afterAll): Clean up the server.

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