diff options
Diffstat (limited to 'Source/WebKit2/WebProcess')
24 files changed, 471 insertions, 45 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index e40c898c7..3355d086d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -46,6 +46,7 @@ class InjectedBundleBackForwardList; class InjectedBundleBackForwardListItem; class InjectedBundleDOMWindowExtension; class InjectedBundleHitTestResult; +class InjectedBundleIntentRequest; class InjectedBundleNavigationAction; class InjectedBundleNodeHandle; class InjectedBundleRangeHandle; @@ -63,6 +64,7 @@ WK_ADD_API_MAPPING(WKBundleDOMWindowExtensionRef, InjectedBundleDOMWindowExtensi WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame) WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult) WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector) +WK_ADD_API_MAPPING(WKBundleIntentRequestRef, InjectedBundleIntentRequest) WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction) WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle) WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp new file mode 100644 index 000000000..81c95c6c5 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKBundleIntentRequest.h" + +#if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntentRequest.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebIntentData.h" + +using namespace WebKit; +#endif + +WKTypeID WKBundleIntentRequestGetTypeID() +{ +#if ENABLE(WEB_INTENTS) + return toAPI(InjectedBundleIntentRequest::APIType); +#else + return 0; +#endif +} + +WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef requestRef) +{ +#if ENABLE(WEB_INTENTS) + RefPtr<WebIntentData> webIntentData = toImpl(requestRef)->intent(); + return toAPI(webIntentData.release().leakRef()); +#else + return 0; +#endif +} + +void WKBundleIntentRequestPostResult(WKBundleIntentRequestRef requestRef, WKSerializedScriptValueRef serializedDataRef) +{ +#if ENABLE(WEB_INTENTS) + return toImpl(requestRef)->postResult(toImpl(serializedDataRef)); +#endif +} + +void WKBundleIntentRequestPostFailure(WKBundleIntentRequestRef requestRef, WKSerializedScriptValueRef serializedDataRef) +{ +#if ENABLE(WEB_INTENTS) + return toImpl(requestRef)->postFailure(toImpl(serializedDataRef)); +#endif +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h new file mode 100644 index 000000000..b18136d13 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBundleIntentRequest_h +#define WKBundleIntentRequest_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleIntentRequestGetTypeID(); + +WK_EXPORT WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef request); + +WK_EXPORT void WKBundleIntentRequestPostResult(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); +WK_EXPORT void WKBundleIntentRequestPostFailure(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleIntentRequest_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 07841d7cc..2ae22371d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -31,6 +31,7 @@ #include "InjectedBundleNodeHandle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" +#include "WebFrame.h" #include "WebFullScreenManager.h" #include "WebImage.h" #include "WebPage.h" @@ -45,6 +46,10 @@ #include <WebCore/KURL.h> #include <WebCore/Page.h> +#if ENABLE(WEB_INTENTS) +#include "WebIntentData.h" +#endif + using namespace WebKit; WKTypeID WKBundlePageGetTypeID() @@ -124,6 +129,11 @@ void WKBundlePageDidExitFullScreen(WKBundlePageRef pageRef) #endif } +void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef pageRef, WKBundlePageDiagnosticLoggingClient* client) +{ + toImpl(pageRef)->initializeInjectedBundleDiagnosticLoggingClient(client); +} + WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef pageRef) { return toAPI(toImpl(pageRef)->pageGroup()); @@ -300,6 +310,13 @@ double WKBundlePageGetBackingScaleFactor(WKBundlePageRef pageRef) return toImpl(pageRef)->deviceScaleFactor(); } +void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKIntentDataRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + toImpl(pageRef)->deliverIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->store()); +#endif +} + #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef) { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index f70d5b36b..aa8609244 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -109,7 +109,7 @@ typedef void (*WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallb typedef void (*WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); typedef void (*WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); typedef bool (*WKBundlePageShouldForceUniversalAccessFromLocalURLCallback)(WKBundlePageRef, WKStringRef url, const void* clientInfo); -typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo); typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo); struct WKBundlePageLoaderClient { @@ -354,6 +354,18 @@ typedef struct WKBundlePageFullScreenClient WKBundlePageFullScreenClient; enum { kWKBundlePageFullScreenClientCurrentVersion = 1 }; +// MessageTrace client +typedef void (*WKBundlePageDiagnosticLoggingCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef description, WKStringRef success, const void* clientInfo); + +struct WKBundlePageDiagnosticLoggingClient { + int version; + const void * clientInfo; + WKBundlePageDiagnosticLoggingCallback logDiagnosticMessage; +}; +typedef struct WKBundlePageDiagnosticLoggingClient WKBundlePageDiagnosticLoggingClient; + +enum { kWKBundlePageDiagnosticLoggingClientCurrentVersion = 0 }; + WK_EXPORT void WKBundlePageWillEnterFullScreen(WKBundlePageRef page); WK_EXPORT void WKBundlePageDidEnterFullScreen(WKBundlePageRef page); WK_EXPORT void WKBundlePageWillExitFullScreen(WKBundlePageRef page); @@ -368,8 +380,8 @@ WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePag WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClient* client); WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClient* client); WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client); - WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClient* client); +WK_EXPORT void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef page, WKBundlePageDiagnosticLoggingClient* client); WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page); @@ -392,6 +404,8 @@ WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBun WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page); +WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent); + #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp new file mode 100644 index 000000000..5ccb19cad --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InjectedBundleIntentRequest.h" + +#if ENABLE(WEB_INTENTS) +#include <WebCore/IntentRequest.h> +#include <WebSerializedScriptValue.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<InjectedBundleIntentRequest> InjectedBundleIntentRequest::create(IntentRequest* request) +{ + return adoptRef(new InjectedBundleIntentRequest(request)); +} + +InjectedBundleIntentRequest::InjectedBundleIntentRequest(IntentRequest* request) + : m_intentRequest(request) +{ +} + +void InjectedBundleIntentRequest::postResult(WebSerializedScriptValue* data) +{ + m_intentRequest->postResult(static_cast<SerializedScriptValue*>(data->internalRepresentation())); +} + +void InjectedBundleIntentRequest::postFailure(WebSerializedScriptValue* data) +{ + m_intentRequest->postFailure(static_cast<SerializedScriptValue*>(data->internalRepresentation())); +} + +PassRefPtr<WebIntentData> InjectedBundleIntentRequest::intent() const +{ + return WebIntentData::create(IntentData(m_intentRequest->intent())); +} + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h new file mode 100644 index 000000000..b5870d9a2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundleIntentRequest_h +#define InjectedBundleIntentRequest_h + +#if ENABLE(WEB_INTENTS) + +#include "APIObject.h" +#include "WebIntentData.h" +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class IntentRequest; +} + +namespace WebKit { + +class WebSerializedScriptValue; + +class InjectedBundleIntentRequest : public APIObject { +public: + static const Type APIType = TypeBundleIntentRequest; + + static PassRefPtr<InjectedBundleIntentRequest> create(WebCore::IntentRequest*); + + void postResult(WebSerializedScriptValue*); + void postFailure(WebSerializedScriptValue*); + + PassRefPtr<WebIntentData> intent() const; + +private: + explicit InjectedBundleIntentRequest(WebCore::IntentRequest*); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::IntentRequest> m_intentRequest; +}; + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) + +#endif // InjectedBundleIntentRequest_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp new file mode 100644 index 000000000..6f264cb62 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InjectedBundlePageDiagnosticLoggingClient.h" + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +namespace WebKit { + +void InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessage(WebPage* page, const String& message, const String& description, const String& success) +{ + if (!m_client.logDiagnosticMessage) + return; + m_client.logDiagnosticMessage(toAPI(page), toCopiedAPI(message), toCopiedAPI(description), toCopiedAPI(success), m_client.clientInfo); +} + +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h new file mode 100644 index 000000000..e79e81a03 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundlePageDiagnosticLoggingClient_h +#define InjectedBundlePageDiagnosticLoggingClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include <JavaScriptCore/JSBase.h> +#include <wtf/Forward.h> + +namespace WebKit { + +class APIObject; +class InjectedBundleHitTestResult; +class WebContextMenuItemData; +class WebPage; + +class InjectedBundlePageDiagnosticLoggingClient : public APIClient<WKBundlePageDiagnosticLoggingClient, kWKBundlePageDiagnosticLoggingClientCurrentVersion> { +public: + void logDiagnosticMessage(WebPage*, const String& message, const String& description, const String& success); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageDiagnosticLoggingClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp index 74f8efb1d..a6a06123f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp @@ -34,7 +34,7 @@ #include <wtf/text/WTFString.h> #if ENABLE(WEB_INTENTS) -#include "WebIntentData.h" +#include "InjectedBundleIntentRequest.h" #endif #if ENABLE(WEB_INTENTS_TAG) #include "WebIntentServiceInfo.h" @@ -195,13 +195,13 @@ void InjectedBundlePageLoaderClient::didDetectXSSForFrame(WebPage* page, WebFram } #if ENABLE(WEB_INTENTS) -void InjectedBundlePageLoaderClient::didReceiveIntentForFrame(WebPage* page, WebFrame* frame, WebIntentData* intent, RefPtr<APIObject>& userData) +void InjectedBundlePageLoaderClient::didReceiveIntentForFrame(WebPage* page, WebFrame* frame, InjectedBundleIntentRequest* intentRequest, RefPtr<APIObject>& userData) { if (!m_client.didReceiveIntentForFrame) return; WKTypeRef userDataToPass = 0; - m_client.didReceiveIntentForFrame(toAPI(page), toAPI(frame), toAPI(intent), &userDataToPass, m_client.clientInfo); + m_client.didReceiveIntentForFrame(toAPI(page), toAPI(frame), toAPI(intentRequest), &userDataToPass, m_client.clientInfo); userData = adoptRef(toImpl(userDataToPass)); } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h index 403037e12..81d9be44d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h @@ -47,7 +47,7 @@ class InjectedBundleBackForwardListItem; class WebPage; class WebFrame; #if ENABLE(WEB_INTENTS) -class WebIntentData; +class InjectedBundleIntentRequest; #endif #if ENABLE(WEB_INTENTS_TAG) class WebIntentServiceInfo; @@ -72,7 +72,7 @@ public: void didDetectXSSForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); #if ENABLE(WEB_INTENTS) - void didReceiveIntentForFrame(WebPage*, WebFrame*, WebIntentData*, RefPtr<APIObject>& userData); + void didReceiveIntentForFrame(WebPage*, WebFrame*, InjectedBundleIntentRequest*, RefPtr<APIObject>& userData); #endif #if ENABLE(WEB_INTENTS_TAG) void registerIntentServiceForFrame(WebPage*, WebFrame*, WebIntentServiceInfo*, RefPtr<APIObject>& userData); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp b/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp index a2a61d47d..9cc8c06a7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp @@ -42,7 +42,7 @@ bool InjectedBundle::load(APIObject* initializationUserData) return false; } if (!eina_module_load(m_platformBundle)) { - EINA_LOG_CRIT("Error loading the injected bundle: %s", m_path.utf8().data()); + EINA_LOG_CRIT("Error loading the injected bundle from %s: %s", m_path.utf8().data(), eina_error_msg_get(eina_error_get())); eina_module_free(m_platformBundle); m_platformBundle = 0; return false; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 470c162bb..072a69c9c 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -1180,12 +1180,14 @@ void PluginView::scheduleWindowedPluginGeometryUpdate(const WindowGeometry& geom #if PLATFORM(MAC) void PluginView::pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus) { - m_webPage->send(Messages::WebPageProxy::PluginFocusOrWindowFocusChanged(m_plugin->pluginComplexTextInputIdentifier(), pluginHasFocusAndWindowHasFocus)); + if (m_webPage) + m_webPage->send(Messages::WebPageProxy::PluginFocusOrWindowFocusChanged(m_plugin->pluginComplexTextInputIdentifier(), pluginHasFocusAndWindowHasFocus)); } void PluginView::setComplexTextInputState(PluginComplexTextInputState pluginComplexTextInputState) { - m_webPage->send(Messages::WebPageProxy::SetPluginComplexTextInputState(m_plugin->pluginComplexTextInputIdentifier(), pluginComplexTextInputState)); + if (m_webPage) + m_webPage->send(Messages::WebPageProxy::SetPluginComplexTextInputState(m_plugin->pluginComplexTextInputIdentifier(), pluginComplexTextInputState)); } mach_port_t PluginView::compositingRenderServerPort() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 33370bdef..3af596626 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -440,7 +440,7 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con if (frame->page()->mainFrame() != frame) return; -#if PLATFORM(QT) +#if PLATFORM(QT) || (PLATFORM(EFL) && USE(TILED_BACKING_STORE)) if (m_page->useFixedLayout()) { // The below method updates the size(). m_page->resizeToContentsIfNeeded(); @@ -483,7 +483,7 @@ bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObjec void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { - ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag)); + ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag)); ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion); HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element); @@ -635,6 +635,15 @@ void WebChromeClient::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) m_page->send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves)); } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +void WebChromeClient::scheduleAnimation() +{ +#if USE(UI_SIDE_COMPOSITING) + m_page->drawingArea()->layerTreeHost()->scheduleAnimation(); +#endif +} +#endif + void WebChromeClient::formStateDidChange(const Node*) { notImplemented(); @@ -773,4 +782,12 @@ void WebChromeClient::numWheelEventHandlersChanged(unsigned count) m_page->numWheelEventHandlersChanged(count); } +void WebChromeClient::logDiagnosticMessage(const String& message, const String& description, const String& success) +{ + if (!m_page->corePage()->settings()->diagnosticLoggingEnabled()) + return; + + m_page->injectedBundleDiagnosticLoggingClient().logDiagnosticMessage(m_page, message, description, success); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 383eeac3e..f40d4b174 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -162,6 +162,9 @@ private: virtual void setCursor(const WebCore::Cursor&) OVERRIDE; virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + virtual void scheduleAnimation() OVERRIDE; +#endif // Notification that the given form element has changed. This function // will be called frequently, so handling should be very fast. @@ -219,6 +222,8 @@ private: virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE; + virtual void logDiagnosticMessage(const String& message, const String& description, const String& success) OVERRIDE; + String m_cachedToolTip; mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; mutable bool m_cachedMainFrameHasHorizontalScrollbar; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 918e74acd..fbb824974 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -74,8 +74,8 @@ #include <WebCore/WindowFeatures.h> #if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntentRequest.h" #include "IntentData.h" -#include "WebIntentData.h" #include <WebCore/IntentRequest.h> #endif @@ -1364,11 +1364,10 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { - const String mimeType = "application/x-java-applet"; - RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, mimeType, false); + RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, appletElement->serviceType(), false); if (!plugin) { if (WebPage* webPage = m_frame->page()) - webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(mimeType)); + webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(appletElement->serviceType())); } return plugin.release(); } @@ -1562,20 +1561,11 @@ void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest> request) if (!webPage) return; - IntentData intentData; - Intent* coreIntent = request->intent(); - ASSERT(coreIntent); - intentData.action = coreIntent->action(); - intentData.type = coreIntent->type(); - intentData.service = coreIntent->service(); - intentData.data = coreIntent->data()->data(); - intentData.extras = coreIntent->extras(); - intentData.suggestions = coreIntent->suggestions(); - RefPtr<APIObject> userData; - RefPtr<WebIntentData> webIntent = WebIntentData::create(intentData); - webPage->injectedBundleLoaderClient().didReceiveIntentForFrame(webPage, m_frame, webIntent.get(), userData); + RefPtr<InjectedBundleIntentRequest> bundleIntentRequest = InjectedBundleIntentRequest::create(request.get()); + webPage->injectedBundleLoaderClient().didReceiveIntentForFrame(webPage, m_frame, bundleIntentRequest.get(), userData); + IntentData intentData(request->intent()); webPage->send(Messages::WebPageProxy::DidReceiveIntentForFrame(m_frame->frameID(), intentData, InjectedBundleUserMessageEncoder(userData.get()))); } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp index a3b9a1391..ae3994422 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp @@ -356,6 +356,10 @@ void LayerTreeCoordinator::performScheduledLayerFlush() { if (m_isSuspended || m_waitingForUIProcess) return; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) + // Make sure that any previously registered animation callbacks are being executed before we flush the layers. + m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); +#endif m_webPage->layoutIfNeeded(); @@ -544,6 +548,13 @@ void LayerTreeCoordinator::setVisibleContentsRect(const IntRect& rect, float sca m_shouldSendScrollPositionUpdate = true; } +#if USE(UI_SIDE_COMPOSITING) +void LayerTreeCoordinator::scheduleAnimation() +{ + scheduleLayerFlush(); +} +#endif + void LayerTreeCoordinator::renderNextFrame() { m_waitingForUIProcess = false; diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h index 9b5154c36..7f6038005 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h @@ -86,6 +86,9 @@ public: virtual void syncFixedLayers(); virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, ShareableSurface::Handle&, WebCore::IntPoint&); +#if USE(UI_SIDE_COMPOSITING) + virtual void scheduleAnimation() OVERRIDE; +#endif protected: explicit LayerTreeCoordinator(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp index 581491245..19ce4d031 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp @@ -320,6 +320,8 @@ void WebGraphicsLayer::setContentsNeedsDisplay() setContentsToImage(0); setContentsToImage(image.get()); m_canvasNeedsDisplay = true; + if (client()) + client()->notifySyncRequired(this); } void WebGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer) diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h index 368230cc9..1372f2a29 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h @@ -105,6 +105,10 @@ public: virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } #endif +#if USE(UI_SIDE_COMPOSITING) + virtual void scheduleAnimation() = 0; +#endif + protected: explicit LayerTreeHost(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 9571ffbaa..59d3bc5cb 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -419,6 +419,11 @@ void WebPage::initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenCli } #endif +void WebPage::initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient* client) +{ + m_logDiagnosticMessageClient.initialize(client); +} + PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters) { String pluginPath; @@ -2086,6 +2091,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setShouldRespectImageOrientation(store.getBoolValueForKey(WebPreferencesKey::shouldRespectImageOrientationKey())); + settings->setDiagnosticLoggingEnabled(store.getBoolValueForKey(WebPreferencesKey::diagnosticLoggingEnabledKey())); + platformPreferencesDidChange(store); if (m_drawingArea) @@ -2145,6 +2152,10 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt) if (command.execute(evt)) return true; + // Don't allow text insertion for nodes that cannot edit. + if (!frame->editor()->canEdit()) + return false; + // Don't insert null or control characters as they can result in unexpected behaviour if (evt->charCode() < ' ') return false; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 1b7708a4c..e3257a33a 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -35,6 +35,7 @@ #if ENABLE(CONTEXT_MENUS) #include "InjectedBundlePageContextMenuClient.h" #endif +#include "InjectedBundlePageDiagnosticLoggingClient.h" #include "InjectedBundlePageEditorClient.h" #include "InjectedBundlePageFormClient.h" #include "InjectedBundlePageFullScreenClient.h" @@ -248,6 +249,7 @@ public: #if ENABLE(FULLSCREEN_API) void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClient*); #endif + void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient*); #if ENABLE(CONTEXT_MENUS) InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; } @@ -258,6 +260,7 @@ public: InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; } InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; } InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; } + InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; } #if ENABLE(FULLSCREEN_API) InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; } #endif @@ -474,6 +477,10 @@ public: bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } #endif +#if ENABLE(WEB_INTENTS) + void deliverIntentToFrame(uint64_t frameID, const IntentData&); +#endif + void replaceSelectionWithText(WebCore::Frame*, const String&); void clearSelection(); @@ -652,10 +659,6 @@ private: void runJavaScriptInMainFrame(const String&, uint64_t callbackID); void forceRepaint(uint64_t callbackID); -#if ENABLE(WEB_INTENTS) - void deliverIntentToFrame(uint64_t frameID, const IntentData&); -#endif - void preferencesDidChange(const WebPreferencesStore&); void platformPreferencesDidChange(const WebPreferencesStore&); void updatePreferences(const WebPreferencesStore&); @@ -811,6 +814,7 @@ private: #if ENABLE(FULLSCREEN_API) InjectedBundlePageFullScreenClient m_fullScreenClient; #endif + InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient; #if USE(TILED_BACKING_STORE) WebCore::IntSize m_viewportSize; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index 2254152ca..4dffb6edd 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -144,15 +144,9 @@ bool TiledCoreAnimationDrawingArea::forceRepaintAsync(uint64_t callbackID) if (m_layerTreeStateIsFrozen) return false; - // FIXME: It is possible for the drawing area to be destroyed before the bound block - // is invoked, so grab a reference to the web page here so we can access the drawing area through it. - // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition). - // A better fix would be to make sure that we keep the drawing area alive if there are outstanding calls. - WebPage* webPage = m_webPage; dispatchAfterEnsuringUpdatedScrollPosition(bind(^{ - if (DrawingArea* drawingArea = webPage->drawingArea()) - drawingArea->forceRepaint(); - webPage->send(Messages::WebPageProxy::VoidCallback(callbackID)); + m_webPage->drawingArea()->forceRepaint(); + m_webPage->send(Messages::WebPageProxy::VoidCallback(callbackID)); })); return true; } @@ -230,13 +224,23 @@ void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(c m_layerFlushScheduler.suspend(); Function<void ()> function = functionRef; + + // It is possible for the drawing area to be destroyed before the bound block + // is invoked, so grab a reference to the web page here so we can access the drawing area through it. + // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition). + WebPage* webPage = m_webPage; + ScrollingThread::dispatchBarrier(bind(^{ + DrawingArea* drawingArea = webPage->drawingArea(); + if (!drawingArea) + return; + function(); if (!m_layerTreeStateIsFrozen) m_layerFlushScheduler.resume(); - m_webPage->deref(); + webPage->deref(); })); } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 0a8c0a489..18765047b 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -62,6 +62,9 @@ #define SANDBOX_NAMED_EXTERNAL 0x0003 extern "C" int sandbox_init_with_parameters(const char *profile, uint64_t flags, const char *const parameters[], char **errorbuf); +// Define this to 1 to bypass the sandbox for debugging purposes. +#define DEBUG_BYPASS_SANDBOX 0 + #endif using namespace WebCore; @@ -180,10 +183,11 @@ static void appendReadwriteSandboxDirectory(Vector<const char*>& vector, const c static void initializeSandbox(const WebProcessCreationParameters& parameters) { #if ENABLE(WEB_PROCESS_SANDBOX) - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisableSandbox"]) { - WTFLogAlways("Bypassing sandbox due to DisableSandbox user default.\n"); - return; - } + +#if DEBUG_BYPASS_SANDBOX + WTFLogAlways("Bypassing web process sandbox.\n"); + return; +#endif #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Use private temporary and cache directories. |