summaryrefslogtreecommitdiff
path: root/Source/WebKit2
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
commit4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch)
tree7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/WebKit2
parent3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff)
downloadqtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/WebKit2')
-rw-r--r--Source/WebKit2/ChangeLog810
-rw-r--r--Source/WebKit2/Configurations/Base.xcconfig24
-rw-r--r--Source/WebKit2/Configurations/DebugRelease.xcconfig4
-rw-r--r--Source/WebKit2/DerivedSources.make3
-rw-r--r--Source/WebKit2/GNUmakefile.am2
-rw-r--r--Source/WebKit2/GNUmakefile.list.am7
-rw-r--r--Source/WebKit2/PlatformEfl.cmake61
-rw-r--r--Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp30
-rw-r--r--Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h2
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.cpp4
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.h2
-rw-r--r--Source/WebKit2/Shared/ShareableSurface.cpp2
-rw-r--r--Source/WebKit2/Shared/efl/PlatformCertificateInfo.h51
-rw-r--r--Source/WebKit2/Shared/mac/PasteboardTypes.mm2
-rw-r--r--Source/WebKit2/Shared/mac/WebEventFactory.mm6
-rw-r--r--Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp103
-rw-r--r--Source/WebKit2/Shared/soup/PlatformCertificateInfo.h (renamed from Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h)43
-rw-r--r--Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h38
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPagePrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EWebKit2.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp19
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp20
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp162
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h154
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h37
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_private.h34
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp16
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp103
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response.h101
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h35
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp139
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.h35
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp66
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h34
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp46
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp13
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp20
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp90
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h51
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp37
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h45
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp53
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp35
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp29
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h57
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp28
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp12
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp35
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h15
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h1
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp85
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp101
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp20
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem13
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem16
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.mm4
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm8
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm28
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp32
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp35
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h11
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml55
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html19
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp23
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp50
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h7
-rw-r--r--Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp14
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm8
-rw-r--r--Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp15
-rw-r--r--Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm4
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp36
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h9
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.h4
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp5
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h1
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp12
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h4
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp13
-rw-r--r--Source/WebKit2/UIProcess/mac/TextCheckerMac.mm6
-rw-r--r--Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm30
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMac.mm4
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm4
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp11
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h1
-rw-r--r--Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp39
-rw-r--r--Source/WebKit2/WebKit2Prefix.h2
-rw-r--r--Source/WebKit2/WebProcess/Cookies/WebCookieManager.h8
-rw-r--r--Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in4
-rw-r--r--Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp27
-rw-r--r--Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp224
-rw-r--r--Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h54
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp4
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm6
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp11
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h6
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h2
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h2
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm14
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp45
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h10
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp9
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp22
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm6
-rw-r--r--Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in2
-rw-r--r--Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp25
-rw-r--r--Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp10
-rw-r--r--Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm4
-rw-r--r--Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm4
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMac.mm10
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm8
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessShim.mm8
-rw-r--r--Source/WebKit2/win/WebKit2.def3
-rw-r--r--Source/WebKit2/win/WebKit2CFLite.def4
138 files changed, 3710 insertions, 370 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 7aefe8e0e..f9f6f1d91 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,813 @@
+2012-07-14 Eric Carlson <eric.carlson@apple.com>
+
+ Enable AVCF hardware video decoding
+ https://bugs.webkit.org/show_bug.cgi?id=90015
+ <rdar://problem/10770317>
+
+ Reviewed by Anders Carlsson.
+
+ * DerivedSources.make: Define HAVE_AVCF if necessary.
+
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit):
+ (WebKit::WebChromeClient::graphicsDeviceAdapter): New, return the layer tree host's
+ graphics adapter.
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ (WebChromeClient):
+ * WebProcess/WebPage/LayerTreeHost.h:
+ (WebCore):
+ (LayerTreeHost):
+ (WebKit::LayerTreeHost::graphicsDeviceAdapter): New, default implementation.
+
+ * WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h:
+ (LayerTreeHostCAWin):
+
+2012-07-13 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ [CMake] Proper handling of ENABLE_API_TESTS build option
+ https://bugs.webkit.org/show_bug.cgi?id=91221
+
+ Reviewed by Rob Buis.
+
+ Build unit tests only if ENABLE_API_TESTS is set.
+
+ * PlatformEfl.cmake:
+
+2012-07-13 Christophe Dumez <christophe.dumez@intel.com>
+
+ [EFL][WK2] Make new public Ewk headers as installable
+ https://bugs.webkit.org/show_bug.cgi?id=91232
+
+ Reviewed by Antonio Gomes.
+
+ Make new public Ewk headers installable.
+
+ * PlatformEfl.cmake:
+
+2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Implement disk cache in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=90797
+
+ Reviewed by Xan Lopez.
+
+ * WebProcess/gtk/WebProcessGtk.cpp:
+ (WebKit::getCacheDiskFreeSize): Use an ASSERT instead of an early
+ return since the cache feature is now always added to the session.
+ (WebKit::WebProcess::platformSetCacheModel): Get the cache from
+ the session and set the maximum cache size as computed by
+ calculateCacheSizes().
+ (WebKit::WebProcess::platformClearResourceCaches): Call
+ soup_cache_clear().
+ (WebKit::WebProcess::platformTerminate): Make sure all pending
+ data is saved to the disk before the web process finishes.
+ * WebProcess/gtk/WebProcessMainGtk.cpp:
+ (WebKit::WebProcessMainGtk): Create a SoupCache feature and add it
+ to the default SoupSession.
+
+2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Fix disk cache size computation in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=91226
+
+ Reviewed by Xan Lopez.
+
+ We are passing the free disk space value in bytes to
+ calculateCacheSizes() which expects values in MB.
+
+ * WebProcess/gtk/WebProcessGtk.cpp:
+ (WebKit::WebProcess::platformSetCacheModel):
+
+2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] WebKit2 crash when going back/forward
+ https://bugs.webkit.org/show_bug.cgi?id=91220
+
+ Reviewed by Xan Lopez.
+
+ For some reason when a page is loaded from the backforward list,
+ when the didCommitLoadForFrame callback is called for the main
+ frame, the callback didInitiateLoadForResource hasn't been called
+ yet, so we don't even have a main resource at that point. We were
+ assuming we always had a main resource with a response. For now we
+ just check whether we have a resource before trying to set the
+ certificate to fix the crash, but we need to figue out why this is
+ happening an how to properly fix it.
+
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp:
+ (didCommitLoadForFrame): Check whether we have a main resource
+ before setting the certificate.
+
+2012-07-13 Christophe Dumez <christophe.dumez@intel.com>
+
+ [EFL][WK2] Use eina stringsharing for Ewk_Web_Resource's url
+ https://bugs.webkit.org/show_bug.cgi?id=91200
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Use eina stringsharing for Ewk_Web_Resource's url
+ for consistency.
+
+ * UIProcess/API/efl/ewk_web_resource.cpp:
+ (_Ewk_Web_Resource):
+ (_Ewk_Web_Resource::_Ewk_Web_Resource):
+ (ewk_web_resource_unref):
+ (ewk_web_resource_url_get):
+ * UIProcess/API/efl/ewk_web_resource.h:
+
+2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] WebKitWebView::mouse-target-changed is not emitted when moved to/from edtiable content
+ https://bugs.webkit.org/show_bug.cgi?id=91216
+
+ Reviewed by Xan Lopez.
+
+ The problem is that the function to check whether two hit test
+ results are equal doesn't check the editable flag.
+
+ * UIProcess/API/gtk/WebKitHitTestResult.cpp:
+ (webkitHitTestResultCompare): Check also the editable flag.
+
+2012-07-13 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ [EFL] Add *explicit* keyword to constructor which has a parameter
+ https://bugs.webkit.org/show_bug.cgi?id=91207
+
+ Reviewed by Zoltan Herczeg.
+
+ Add *explicit* keyword to contructor which has a parameter in order to avoid implicit type conversion.
+
+ * WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h:
+ (WebFrameNetworkingContext::WebFrameNetworkingContext):
+
+2012-07-13 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Implement GraphicsSurface for Linux/GLX.
+ https://bugs.webkit.org/show_bug.cgi?id=90881
+
+ Add a GLX based GraphicsSurface implementation for Linux.
+
+ Reviewed by Noam Rosenthal.
+
+ * Shared/ShareableSurface.cpp:
+ (WebKit::ShareableSurface::create):
+ Only create a GraphicsSurface from a ShareableSurface::Handle
+ in case the Handle contains a valid GraphicsSurface token.
+ Otherwise fall back to creating a ShareableBitmap.
+ * UIProcess/LayerTreeCoordinatorProxy.cpp:
+ (WebKit::createLayerTileUniqueKey):
+ Create a unique key for a surface based on tileID and layerID.
+ (WebKit::LayerTreeCoordinatorProxy::updateTileForLayer):
+ Even when GraphicsSurface is enabled, not all ShareableSurfaces
+ will necessarily be backed by a GraphicsSurface. In case of
+ a ShareableSurface being backed by a ShareableBitmap instead,
+ the GraphicsSurface token will always be null.
+ So instead of using the GraphicsSurface token as a key for
+ storing surfaces in a map, we create a unique key from
+ layerID and tileID.
+ * UIProcess/LayerTreeCoordinatorProxy.h:
+ (LayerTreeCoordinatorProxy):
+
+2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add API to get HTTPS status to WebKit2 GTK+
+ https://bugs.webkit.org/show_bug.cgi?id=91100
+
+ Reviewed by Martin Robinson.
+
+ Add webkit_uri_response_get_https_status() to return
+ GTlsCertificate and GTlsCertificateFlags with information about
+ the SSL certificate and the possible errors with the certificate.
+
+ * GNUmakefile.list.am: Add new files to compilation.
+ * PlatformEfl.cmake: Ditto.
+ * Shared/efl/PlatformCertificateInfo.h: Removed.
+ * Shared/soup/PlatformCertificateInfo.cpp: Added.
+ (WebKit::PlatformCertificateInfo::PlatformCertificateInfo):
+ (WebKit::PlatformCertificateInfo::~PlatformCertificateInfo):
+ (WebKit::PlatformCertificateInfo::encode): Encode the
+ GTlsCertificate and GTlsCertificateFlags.
+ (WebKit::PlatformCertificateInfo::decode): Decode
+ PlatformCertificateInfo into a GTlsCertificate and GTlsCertificateFlags.
+ * Shared/soup/PlatformCertificateInfo.h: Renamed from Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h.
+ (WebKit::PlatformCertificateInfo::certificate): Return the certificate.
+ (WebKit::PlatformCertificateInfo::tlsErrors): Return the TLS errors
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp:
+ (didCommitLoadForFrame): Set the certificate of the current frame
+ to the response of the main resource.
+ * UIProcess/API/gtk/WebKitURIResponse.cpp:
+ (webkit_uri_response_get_https_status): Return GTlsCertificate and
+ GTlsCertificateFlags.
+ (webkitURIResponseSetCertificateInfo): Update the internal
+ ResourceResponse with the GTlsCertificate and GTlsCertificateFlags
+ of the given PlatformCertificateInfo.
+ * UIProcess/API/gtk/WebKitURIResponse.h:
+ * UIProcess/API/gtk/WebKitURIResponsePrivate.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
+ * UIProcess/API/gtk/tests/GNUmakefile.am:
+ * UIProcess/API/gtk/tests/TestMain.h:
+ (Test::getResourcesDir): Helper function to get the resources
+ directory of the WebKit2 API tests.
+ * UIProcess/API/gtk/tests/TestSSL.cpp: Added.
+ (testSSL):
+ (serverCallback):
+ (beforeAll):
+ (afterAll):
+ * UIProcess/API/gtk/tests/WebKitTestServer.cpp:
+ (WebKitTestServer::WebKitTestServer): Add support por SSL test
+ servers.
+ * UIProcess/API/gtk/tests/WebKitTestServer.h:
+ (WebKitTestServer): Add ssl parameter to create a HTTPS server.
+ * UIProcess/API/gtk/tests/resources/test-cert.pem: Added.
+ * UIProcess/API/gtk/tests/resources/test-key.pem: Added.
+
+2012-07-12 Christophe Dumez <christophe.dumez@intel.com>
+
+ [WK2][EFL] Facilitate debugging of the Web Process
+ https://bugs.webkit.org/show_bug.cgi?id=90768
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ The EFL port now checks if the WEB_PROCESS_CMD_PREFIX
+ environment variable is set and uses it as prefix
+ when spawning the Web process if it is. This is used
+ for debugging purposes with prefixes such as:
+ "xterm -title renderer -e gdb --args".
+
+ * UIProcess/Launcher/ProcessLauncher.h:
+ (LaunchOptions):
+ * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
+ (WebKit::ProcessLauncher::launchProcess):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::connect):
+
+2012-07-12 Timothy Hatcher <timothy@apple.com>
+
+ Make the "Inspect Element" context menu item appear in nightly builds again.
+
+ https://webkit.org/b/89323
+
+ Reviewed by Anders Carlsson.
+
+ * Shared/API/c/WKContextMenuItem.cpp:
+ (compatibleContextMenuItemTag): Added. Checks for the specific version of Safari 6 that needs the
+ tag fixed up to match values it expects.
+ (WKContextMenuItemGetTag): On Mac platforms call compatibleContextMenuItemTag to fix up the tag
+ before returning it.
+ * Shared/API/c/WKContextMenuItemTypes.h: Fix the order of the WKContextMenuItemTag enum
+ to be binary compatible with older versions of WebKit2.
+
+2012-07-12 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ [EFL] Port the test framework to WebKit 2
+ https://bugs.webkit.org/show_bug.cgi?id=90606
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ This port of EFL's WebKit 1 test framework uses a more gtest-ish
+ way of writing tests and it is based on a test fixture that loads a
+ page synchronously as convenience (if needed). This base fixture can be
+ easily extended by just inheriting from it.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: Added.
+ (EWK2UnitTest):
+ (EWK2UnitTest::onLoadProgress):
+ (EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase):
+ (EWK2UnitTest::EWK2UnitTestBase::SetUp):
+ (EWK2UnitTest::EWK2UnitTestBase::TearDown):
+ (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
+ * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: Added.
+ (EWK2UnitTest):
+ (EWK2UnitTestBase):
+ (EWK2UnitTest::EWK2UnitTestBase::setLoadProgress):
+ (EWK2UnitTest::EWK2UnitTestBase::webView):
+ * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: Added.
+ (EWK2UnitTest):
+ (EWK2UnitTest::EWK2UnitTestEnvironment::EWK2UnitTestEnvironment):
+ (EWK2UnitTest::EWK2UnitTestEnvironment::defaultTestPageUrl):
+ * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: Added.
+ (EWK2UnitTest):
+ (EWK2UnitTestEnvironment):
+ (EWK2UnitTest::EWK2UnitTestEnvironment::useX11Window):
+ (EWK2UnitTest::EWK2UnitTestEnvironment::defaultWidth):
+ (EWK2UnitTest::EWK2UnitTestEnvironment::defaultHeight):
+ * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp: Added.
+ (parseArguments):
+ (main):
+ * UIProcess/API/efl/tests/resources/default_test_page.html: Added.
+ * UIProcess/API/efl/tests/test_ewk2_view.cpp: Added.
+ (TEST_F):
+
+2012-07-12 Christophe Dumez <christophe.dumez@intel.com>
+
+ [WK2] Add missing Network Information API integration to WebContext and WebPage
+ https://bugs.webkit.org/show_bug.cgi?id=90781
+
+ Reviewed by Anders Carlsson.
+
+ Integrate Network Information API to WebPage, WebContext and
+ properly route messages to the WebNetworkInfoManagerProxy.
+ Without this, the Network Information tests are crashing for
+ WebKit2.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::WebContext):
+ (WebKit::WebContext::~WebContext):
+ (WebKit::WebContext::disconnectProcess):
+ (WebKit::WebContext::didReceiveMessage):
+ (WebKit::WebContext::didReceiveSyncMessage):
+ * UIProcess/WebContext.h:
+ (WebKit):
+ (WebContext):
+ (WebKit::WebContext::networkInfoManagerProxy):
+ * UIProcess/WebNetworkInfoManagerProxy.cpp:
+ (WebKit::WebNetworkInfoManagerProxy::didReceiveSyncMessage):
+ (WebKit):
+ * UIProcess/WebNetworkInfoManagerProxy.h:
+ (WebNetworkInfoManagerProxy):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didReceiveMessage):
+ (WebKit::WebProcessProxy::didReceiveSyncMessage):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+
+2012-07-12 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Move TextureMapperAnimation and texmap/LayerTransform to platform/graphics
+ https://bugs.webkit.org/show_bug.cgi?id=91111
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Include the new filenames.
+
+ * WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h:
+ (WebGraphicsLayer):
+
+2012-07-12 Adenilson Cavalcanti <cavalcantii@gmail.com>
+
+ [Qt][WK2] Implement web notifications support
+ https://bugs.webkit.org/show_bug.cgi?id=80702
+
+ Reviewed by Noam Rosenthal.
+
+ Adding a new type of permission request for Desktop Notifications (plus required code
+ to register the handle for this requests).
+
+ * UIProcess/API/qt/qwebpermissionrequest.cpp:
+ (QWebPermissionRequestPrivate::QWebPermissionRequestPrivate):
+ (QWebPermissionRequestPrivate):
+ (QWebPermissionRequest::create):
+ (QWebPermissionRequest::QWebPermissionRequest):
+ (QWebPermissionRequest::setAllow):
+ * UIProcess/API/qt/qwebpermissionrequest_p.h:
+ * UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml: Added.
+ * UIProcess/API/qt/tests/qmltests/common/notification.html: Added.
+ * UIProcess/qt/QtWebPageUIClient.cpp:
+ (WebKit::QtWebPageUIClient::QtWebPageUIClient):
+ (WebKit::QtWebPageUIClient::policyForNotificationPermissionRequest):
+ (WebKit):
+ * UIProcess/qt/QtWebPageUIClient.h:
+
+2012-07-12 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com>
+
+ [EFL][WK2] Browser crashes running BatteryStatus tests.
+ https://bugs.webkit.org/show_bug.cgi?id=91065
+
+ Reviewed by Kentaro Hara.
+
+ clientInfo was incorrectly casted to BatteryProviderEfl in helper
+ function. This patch fixes the issue.
+
+ * UIProcess/API/efl/BatteryProvider.cpp:
+ (toBatteryProvider):
+
+2012-07-12 Christophe Dumez <christophe.dumez@intel.com>
+
+ [EFL] [WK2] regression(r122411) Crashes in Ewk_View
+ https://bugs.webkit.org/show_bug.cgi?id=91068
+
+ Reviewed by Kentaro Hara.
+
+ Avoid using calloc() to allocate memory for structures
+ and use new operator instead. calloc() causes unwanted
+ behavior when allocing a structure which contains
+ non-pointer types (e.g. a HashMap) and leads to
+ crashes.
+
+ * UIProcess/API/efl/ewk_context.cpp:
+ (_Ewk_Context::_Ewk_Context):
+ * UIProcess/API/efl/ewk_intent.cpp:
+ (_Ewk_Intent):
+ (_Ewk_Intent::_Ewk_Intent):
+ (ewk_intent_unref):
+ (ewk_intent_new):
+ * UIProcess/API/efl/ewk_intent_service.cpp:
+ (_Ewk_Intent_Service):
+ (_Ewk_Intent_Service::_Ewk_Intent_Service):
+ (ewk_intent_service_unref):
+ (ewk_intent_service_new):
+ * UIProcess/API/efl/ewk_navigation_policy_decision.cpp:
+ (_Ewk_Navigation_Policy_Decision):
+ (_Ewk_Navigation_Policy_Decision::_Ewk_Navigation_Policy_Decision):
+ (ewk_navigation_policy_decision_free):
+ (ewk_navigation_policy_decision_new):
+ * UIProcess/API/efl/ewk_url_request.cpp:
+ (_Ewk_Url_Request):
+ (_Ewk_Url_Request::_Ewk_Url_Request):
+ (ewk_url_request_unref):
+ (ewk_url_request_new):
+ * UIProcess/API/efl/ewk_url_response.cpp:
+ (_Ewk_Url_Response):
+ (_Ewk_Url_Response::_Ewk_Url_Response):
+ (ewk_url_response_unref):
+ (ewk_url_response_new):
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_Ewk_View_Private_Data):
+ (_Ewk_View_Private_Data::_Ewk_View_Private_Data):
+ (_ewk_view_priv_new):
+ (_ewk_view_priv_del):
+ * UIProcess/API/efl/ewk_web_error.cpp:
+ (_Ewk_Web_Error):
+ (_Ewk_Web_Error::_Ewk_Web_Error):
+ (ewk_web_error_free):
+ (ewk_web_error_new):
+ * UIProcess/API/efl/ewk_web_resource.cpp:
+ (_Ewk_Web_Resource):
+ (_Ewk_Web_Resource::_Ewk_Web_Resource):
+ (ewk_web_resource_unref):
+ (ewk_web_resource_new):
+
+2012-07-11 Andras Becsi <andras.becsi@nokia.com>
+
+ [Qt][WK2] ASSERT: "!m_viewportItem->isMoving()" in QtViewportHandler::flickMoveEnded()
+ https://bugs.webkit.org/show_bug.cgi?id=90875
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Since MultiPointTouchArea and PinchArea use the childMouseEventFilter
+ method to filter touch events and because Flickable filters child mouse
+ events the canvas calls this function before propagating the touch event
+ to the WebView. Since Flickable does not accept touch events the canvas
+ tries to propagate a synthesized mouse event through the base class
+ childMouseEventFilter function which is accepted by Flickable and
+ interferes with the input events we send to Flicakble hence messes up
+ the internal state of the WebView.
+ This patch reimplements the virtual childMouseEventFilter method so that all
+ the mouse and touch events can be processed by WebKit before they arrive to
+ Flickable.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebView::childMouseEventFilter):
+ * UIProcess/API/qt/qquickwebview_p.h:
+
+2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Unreviewed. Fix GTK+ debug build after r122425.
+
+ * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp:
+ (webkitSoupCookieJarSqliteNew):
+
+2012-07-12 Sergio Villar Senin <svillar@igalia.com>
+
+ [WK2] Performance issue in FindController::findString
+ https://bugs.webkit.org/show_bug.cgi?id=78132
+
+ Reviewed by Anders Carlsson.
+
+ FindController should not unmark all text matches by default. It
+ will be done only if the string is not found or if
+ markAllTextMatches() is called. This will allow clients to look
+ for the next/previous without having to unmark() + mark() all the
+ text matches for every single search operation.
+
+ * UIProcess/API/gtk/WebKitFindController.cpp:
+ (webKitFindControllerPerform):
+ (webkit_find_controller_search_next):
+ (webkit_find_controller_search_previous):
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::updateFindUIAfterPageScroll):
+ (WebKit::FindController::findString):
+
+2012-07-12 Christophe Dumez <christophe.dumez@intel.com>
+
+ [WK2][EFL] Add policy client to Ewk_View
+ https://bugs.webkit.org/show_bug.cgi?id=90953
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Emit new "policy,decision,navigation" and "policy,decision,new,window"
+ on the Ewk_View when policy decisions should be taken by the client.
+
+ A new Ewk_Navigation_Policy_Decision type is introduced to provide
+ information about the navigation request and make a decision.
+ By default, the navigation request is accepted.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/ewk_navigation_policy_decision.cpp: Added.
+ (_Ewk_Navigation_Policy_Decision):
+ (ewk_navigation_policy_decision_free):
+ (ewk_navigation_policy_navigation_type_get):
+ (ewk_navigation_policy_mouse_button_get):
+ (ewk_navigation_policy_modifiers_get):
+ (ewk_navigation_policy_frame_name_get):
+ (ewk_navigation_policy_request_get):
+ (ewk_navigation_policy_decision_accept):
+ (ewk_navigation_policy_decision_reject):
+ (ewk_navigation_policy_decision_download):
+ (ewk_navigation_policy_decision_new):
+ * UIProcess/API/efl/ewk_navigation_policy_decision.h: Added.
+ * UIProcess/API/efl/ewk_navigation_policy_decision_private.h: Added.
+ * UIProcess/API/efl/ewk_private.h: Added.
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_base_add):
+ (ewk_view_navigation_policy_decision):
+ (ewk_view_new_window_policy_decision):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/ewk_view_policy_client.cpp: Added.
+ (toEwkView):
+ (decidePolicyForNavigationAction):
+ (decidePolicyForNewWindowAction):
+ (ewk_view_policy_client_attach):
+ * UIProcess/API/efl/ewk_view_policy_client_private.h: Added.
+ * UIProcess/API/efl/ewk_view_private.h:
+
+2012-07-11 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add webkit_cookie_manager_set_persistent_storage() to WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=83016
+
+ Reviewed by Martin Robinson.
+
+ Add a custom implementation of SoupCookieJarSqlite based on
+ libsoup code but using WebCore SQLite classes. SoupCookieJarSqlite
+ is part of libsoup-gnome, it's not a lot of code and it doesn't
+ change often, so it's better to simply have our own implementation
+ instead of making this important feature depend on an optional
+ dependency. There are plans to move the implementation to libsoup,
+ if that eventually happens we will remove our code to use libsoup
+ directly.
+
+ * GNUmakefile.am: Add new dirs to include path.
+ * GNUmakefile.list.am: Add new files to compilation.
+ * PlatformEfl.cmake: Ditto.
+ * Shared/soup/SoupCookiePersistentStorageType.h: Added.
+ * UIProcess/API/gtk/WebKitCookieManager.cpp:
+ (webkit_cookie_manager_set_persistent_storage): Set a persistent
+ storage for cookies.
+ * UIProcess/API/gtk/WebKitCookieManager.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols
+ * UIProcess/API/gtk/tests/TestCookieManager.cpp:
+ (testCookieManagerPersistentStorage):
+ (serverCallback):
+ (beforeAll):
+ (afterAll):
+ * UIProcess/WebCookieManagerProxy.h:
+ (WebCookieManagerProxy): Add setCookiePersistentStorage() method
+ when using soup.
+ * UIProcess/soup/WebCookieManagerProxySoup.cpp: Added.
+ (WebKit::WebCookieManagerProxy::setCookiePersistentStorage): Send
+ SetCookiePersistentStorage message to the web process.
+ * WebProcess/Cookies/WebCookieManager.h:
+ (WebCookieManager): Add setCookiePersistentStorage() method when
+ using soup.
+ * WebProcess/Cookies/WebCookieManager.messages.in: Add
+ SetCookiePersistentStorage message when using soup.
+ * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
+ (WebKit::WebCookieManager::setCookiePersistentStorage): Create a
+ new cookie jar for the given filename and storage type and add it
+ to the soup session.
+ * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp: Added.
+ (webkitSoupCookieJarSqliteOpenDatabase): Open SQLite database.
+ (webkitSoupCookieJarSqliteCreateTable): Create moz_cookies if it
+ doesn't exist.
+ (webkitSoupCookieJarSqliteLoad): Load the initial set of cookies
+ from the database.
+ (webkitSoupCookieJarSqliteInsertCookie): Insert a new cookie into
+ the database.
+ (webkitSoupCookieJarSqliteDeleteCookie): Delete an exising cookie
+ from the database.
+ (webkitSoupCookieJarSqliteChanged): Insert/delete cookies
+ depending on the change.
+ (webkitSoupCookieJarSqliteFinalize):
+ (webkit_soup_cookie_jar_sqlite_init):
+ (webkit_soup_cookie_jar_sqlite_class_init):
+ (webkitSoupCookieJarSqliteNew):
+ * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h: Added.
+
+2012-07-11 Christophe Dumez <christophe.dumez@intel.com>
+
+ [WK2][EFL] Ewk_View should provide more resource loading notifications
+ https://bugs.webkit.org/show_bug.cgi?id=90601
+
+ Reviewed by Antonio Gomes.
+
+ Add new "resource,request,sent", "resource,request,response",
+ "resource,request,failed" and "resource,request,finished" to
+ Ewk_View in order to notify the clients of the main resource
+ load state changes.
+
+ Introduce new Ewk_Url_Response type that is used to provide
+ information to the clients regarding the resource load
+ responses that are received.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/ewk_url_response.cpp: Added.
+ (_Ewk_Url_Response):
+ (ewk_url_response_ref):
+ (ewk_url_response_unref):
+ (ewk_url_response_url_get):
+ (ewk_url_response_status_code_get):
+ (ewk_url_response_mime_type_get):
+ (ewk_url_response_new):
+ * UIProcess/API/efl/ewk_url_response.h: Added.
+ * UIProcess/API/efl/ewk_url_response_private.h: Added.
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_Ewk_View_Private_Data):
+ (ewk_view_resource_load_initiated):
+ (ewk_view_resource_load_response):
+ (ewk_view_resource_load_failed):
+ (ewk_view_resource_load_finished):
+ (ewk_view_resource_request_sent):
+ (ewk_view_load_provisional_started):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/ewk_view_private.h:
+ * UIProcess/API/efl/ewk_view_resource_load_client.cpp:
+ (toEwkView):
+ (didInitiateLoadForResource):
+ (didSendRequestForResource):
+ (didReceiveResponseForResource):
+ (didFinishLoadForResource):
+ (didFailLoadForResource):
+ (ewk_view_resource_load_client_attach):
+
+2012-07-11 Mark Rowe <mrowe@apple.com>
+
+ Fix a logic error in the #if so that the correct code is compiled on Snow Leopard.
+
+ I introduced this in r122403 when I inverted the sense of the #if.
+
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+
+2012-07-11 Mark Rowe <mrowe@apple.com>
+
+ <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
+
+ Reviewed by Dan Bernstein.
+
+ The deployment target is already set to the version that we're targeting, and it's that setting
+ which determines which functionality from the SDK is available to us.
+
+ * Configurations/Base.xcconfig:
+
+2012-07-11 Mark Rowe <mrowe@apple.com>
+
+ <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists
+ but otherwise provides a compatibility implementation of it.
+ (-[WKFullScreenWindowController enterFullScreen:]): Call our new helper.
+
+2012-07-11 Mark Rowe <mrowe@apple.com>
+
+ <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros
+
+ This removal was handled by a script that translates the relevant macros in to the equivalent checks
+ using the system availability macros.
+
+ Reviewed by Filip Pizlo.
+
+ * Shared/DictionaryPopupInfo.cpp:
+ * Shared/DictionaryPopupInfo.h:
+ * Shared/mac/PasteboardTypes.mm:
+ * Shared/mac/WebEventFactory.mm:
+ * UIProcess/API/mac/PDFViewController.mm:
+ * UIProcess/API/mac/PageClientImpl.mm:
+ * UIProcess/API/mac/WKView.mm:
+ * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h:
+ * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm:
+ * UIProcess/Launcher/mac/EnvironmentVariables.cpp:
+ * UIProcess/Launcher/mac/EnvironmentVariables.h:
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/mac/TextCheckerMac.mm:
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ * UIProcess/mac/WebContextMac.mm:
+ * UIProcess/mac/WebPageProxyMac.mm:
+ * WebKit2Prefix.h:
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ * WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm:
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ * WebProcess/WebPage/WebPage.cpp:
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ * WebProcess/com.apple.WebProcess.sb.in:
+ * WebProcess/mac/KeychainItemShimMethods.mm:
+ * WebProcess/mac/SecItemShimMethods.mm:
+ * WebProcess/mac/WebProcessMac.mm:
+ * WebProcess/mac/WebProcessMainMac.mm:
+ * WebProcess/mac/WebProcessShim.mm:
+
+2012-07-11 Simon Fraser <simon.fraser@apple.com>
+
+ pagesPerView param is misnamed for WKPageSetPageLength()
+ https://bugs.webkit.org/show_bug.cgi?id=91033
+
+ Rubber-stamped by Dan Bernstein.
+
+ The name of the second parameter to WKPageSetPageLength(),
+ 'pagesPerView', was confusing; it's a page size (normally width)
+ in pixels.
+
+ * UIProcess/API/C/WKPagePrivate.h:
+
+2012-07-11 Anders Carlsson <andersca@apple.com>
+
+ Add -Wtautological-compare and -Wsign-compare warning flags
+ https://bugs.webkit.org/show_bug.cgi?id=90994
+
+ Reviewed by Mark Rowe.
+
+ * Configurations/Base.xcconfig:
+
+2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Qt][WK2] Test actual rendering results in API tests
+ https://bugs.webkit.org/show_bug.cgi?id=80609
+
+ Reviewed by Alexis Menard.
+
+ Added a very basic test to tst_QQuickWebView to make sure rendering actually occurs.
+
+ * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+ (tst_QQuickWebView):
+ (tst_QQuickWebView::basicRenderingSanity):
+
+2012-07-11 Mark Rowe <mrowe@apple.com>
+
+ Add a Mountain Lion version of libWebKitSystemInterface.a.
+
+ Reviewed by John Sullivan.
+
+ * Configurations/DebugRelease.xcconfig: Look for the library under its expected name.
+
+2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Qt] QRawWebView should notify when rendering is done, so that pixel results can be grabbed at the appropriate moment.
+ https://bugs.webkit.org/show_bug.cgi?id=90641
+
+ Reviewed by Jocelyn Turcotte.
+
+ Implement LayerTreeCoordinator::forceRepaint with logic equivalent to the one in
+ LayerTreeHostCA. If we flush the layers synchronously when forceRepaint is called,when
+ WKPageForceRepaint returns we are guaranteed to have an up-to-date image, as the visible
+ tiles are also synchronously updated.
+
+ * UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp:
+ (WebView::WebView):
+ (WebView::viewNeedsDisplay):
+ (WebView::frameLoaded):
+ (WebView):
+ (WebView::onRepaintDone):
+ (WebView::finishForceRepaint):
+ (WebView::finishFirstLayoutForFrame):
+ (tst_qrawwebview::doNoBackground1):
+ (tst_qrawwebview::doNoBackground2):
+ (tst_qrawwebview::doNoBackground3):
+ (tst_qrawwebview::run):
+ The test for QRawWebView has been updated to use the WebKit2 ForcePaint API prior to
+ generating the pixel results. This has exposed a timing bug in the test - setting the
+ transparentBackground property of a page has to be done before it's created. This has
+ been fixed in the test.
+
+ * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp:
+ (WebKit::LayerTreeCoordinator::forceRepaint):
+ (WebKit::LayerTreeCoordinator::performScheduledLayerFlush):
+ (WebKit):
+
+2012-07-11 MORITA Hajime <morrita@google.com>
+
+ WebCoreSupport needs objects each of which follows major WebCore objects
+ https://bugs.webkit.org/show_bug.cgi?id=88499
+
+ Reviewed by Alexey Proskuryakov.
+
+ Added exporting symbols.
+
+ * win/WebKit2.def:
+ * win/WebKit2CFLite.def:
+
2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r122318.
diff --git a/Source/WebKit2/Configurations/Base.xcconfig b/Source/WebKit2/Configurations/Base.xcconfig
index 0b06dea5f..0182371b9 100644
--- a/Source/WebKit2/Configurations/Base.xcconfig
+++ b/Source/WebKit2/Configurations/Base.xcconfig
@@ -24,7 +24,7 @@
#include "CompilerVersion.xcconfig"
COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION));
-COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors;
+COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare;
CLANG_WARN_CXX0X_EXTENSIONS = NO;
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
@@ -49,6 +49,7 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LINKER_DISPLAYS_MANGLED_NAMES = YES;
OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR);
@@ -96,15 +97,12 @@ DEAD_CODE_STRIPPING = YES;
SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit2.order;
-// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK.
-SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR));
-SDKROOT_1060_1050 = macosx10.5;
-SDKROOT_1070_1050 = macosx10.5;
-SDKROOT_1080_1050 = macosx10.5;
-SDKROOT_1090_1050 = macosx10.5;
-SDKROOT_1070_1060 = macosx10.6;
-SDKROOT_1080_1060 = macosx10.6;
-SDKROOT_1090_1060 = macosx10.6;
-SDKROOT_1080_1070 = macosx10.7;
-SDKROOT_1090_1070 = macosx10.7;
-SDKROOT_1090_1080 = macosx10.8;
+TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+TARGETING_SAME_OS_X_VERSION_1060_1060 = YES;
+TARGETING_SAME_OS_X_VERSION_1070_1070 = YES;
+TARGETING_SAME_OS_X_VERSION_1080_1080 = YES;
+TARGETING_SAME_OS_X_VERSION_1090_1090 = YES;
+
+// Don't build against an SDK unless we're targeting an older OS version.
+SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION));
+SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx;
diff --git a/Source/WebKit2/Configurations/DebugRelease.xcconfig b/Source/WebKit2/Configurations/DebugRelease.xcconfig
index 89be24a70..e5d40bff4 100644
--- a/Source/WebKit2/Configurations/DebugRelease.xcconfig
+++ b/Source/WebKit2/Configurations/DebugRelease.xcconfig
@@ -43,5 +43,5 @@ WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(TARGET_MAC
WEBKIT_SYSTEM_INTERFACE_LIBRARY_1050 = WebKitSystemInterfaceLeopard;
WEBKIT_SYSTEM_INTERFACE_LIBRARY_1060 = WebKitSystemInterfaceSnowLeopard;
WEBKIT_SYSTEM_INTERFACE_LIBRARY_1070 = WebKitSystemInterfaceLion;
-WEBKIT_SYSTEM_INTERFACE_LIBRARY_1080 = WebKitSystemInterfaceLion;
-WEBKIT_SYSTEM_INTERFACE_LIBRARY_1090 = WebKitSystemInterfaceLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_1080 = WebKitSystemInterfaceMountainLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_1090 = WebKitSystemInterfaceMountainLion;
diff --git a/Source/WebKit2/DerivedSources.make b/Source/WebKit2/DerivedSources.make
index ddb8e9a29..f1f5c2cec 100644
--- a/Source/WebKit2/DerivedSources.make
+++ b/Source/WebKit2/DerivedSources.make
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Apple Inc. All rights reserved.
+# Copyright (C) 2010, 2011, 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
@@ -146,5 +146,6 @@ all : HeaderDetection.h
HeaderDetection.h : DerivedSources.make
if [ -f "$(WEBKITLIBRARIESDIR)/include/WebKitQuartzCoreAdditions/WebKitQuartzCoreAdditionsBase.h" ] && [ ! -f "$(WEBKITLIBRARIESDIR)/include/cairo/cairo.h" ]; then echo "#define HAVE_WKQCA 1" > $@; else echo > $@; fi
+ if [ -f "$(WEBKITLIBRARIESDIR)/include/AVFoundationCF/AVCFBase.h" ]; then echo "#define HAVE_AVCF 1" >> $@; else echo >> $@; fi
endif # Windows_NT
diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am
index b0c0724da..3e2ecaee4 100644
--- a/Source/WebKit2/GNUmakefile.am
+++ b/Source/WebKit2/GNUmakefile.am
@@ -40,6 +40,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP
-I$(srcdir)/Source/WebKit2/Shared/Plugins \
-I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape \
-I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape/x11 \
+ -I$(srcdir)/Source/WebKit2/Shared/soup \
-I$(srcdir)/Source/WebKit2/UIProcess \
-I$(srcdir)/Source/WebKit2/UIProcess/API \
-I$(srcdir)/Source/WebKit2/UIProcess/API/C \
@@ -418,6 +419,7 @@ Programs_WebKitPluginProcess_CPPFLAGS = \
-I$(srcdir)/Source/WebKit2/UIProcess/Launcher \
-I$(srcdir)/Source/WebKit2/WebProcess/Plugins/ \
-I$(srcdir)/Source/WebKit2/WebProcess/Plugins/Netscape/ \
+ -I$(srcdir)/Source/WebKit2/Shared/soup \
-I$(top_builddir)/DerivedSources/WebKit2 \
-I$(top_builddir)/DerivedSources/WebKit2/include \
-I$(top_builddir)/DerivedSources/WebKit2/include/JavaScriptCore \
diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am
index d420afa22..e9348dee9 100644
--- a/Source/WebKit2/GNUmakefile.list.am
+++ b/Source/WebKit2/GNUmakefile.list.am
@@ -370,7 +370,6 @@ webkit2_sources += \
Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp \
Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp \
Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp \
- Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \
Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp \
Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp \
Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp \
@@ -427,6 +426,9 @@ webkit2_sources += \
Source/WebKit2/Shared/StatisticsData.cpp \
Source/WebKit2/Shared/StatisticsData.h \
Source/WebKit2/Shared/StringPairVector.h \
+ Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp \
+ Source/WebKit2/Shared/soup/PlatformCertificateInfo.h \
+ Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h \
Source/WebKit2/Shared/TextCheckerState.h \
Source/WebKit2/Shared/UserMessageCoders.h \
Source/WebKit2/Shared/UpdateInfo.cpp \
@@ -788,6 +790,7 @@ webkit2_sources += \
Source/WebKit2/UIProcess/ProcessModel.h \
Source/WebKit2/UIProcess/ResponsivenessTimer.cpp \
Source/WebKit2/UIProcess/ResponsivenessTimer.h \
+ Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp \
Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp \
Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h \
Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp \
@@ -910,6 +913,8 @@ webkit2_sources += \
Source/WebKit2/WebProcess/Cookies/WebCookieManager.h \
Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp \
Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp \
+ Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp \
+ Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h \
Source/WebKit2/WebProcess/Downloads/Download.cpp \
Source/WebKit2/WebProcess/Downloads/Download.h \
Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \
diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake
index bd07c3b39..9870e0e2e 100644
--- a/Source/WebKit2/PlatformEfl.cmake
+++ b/Source/WebKit2/PlatformEfl.cmake
@@ -27,6 +27,8 @@ LIST(APPEND WebKit2_SOURCES
Shared/efl/WebEventFactory.cpp
Shared/efl/WebCoreArgumentCodersEfl.cpp
+ Shared/soup/PlatformCertificateInfo.cpp
+
UIProcess/API/C/efl/WKView.cpp
UIProcess/API/C/soup/WKContextSoup.cpp
@@ -37,9 +39,12 @@ LIST(APPEND WebKit2_SOURCES
UIProcess/API/efl/ewk_context.cpp
UIProcess/API/efl/ewk_intent.cpp
UIProcess/API/efl/ewk_intent_service.cpp
+ UIProcess/API/efl/ewk_navigation_policy_decision.cpp
UIProcess/API/efl/ewk_url_request.cpp
+ UIProcess/API/efl/ewk_url_response.cpp
UIProcess/API/efl/ewk_view.cpp
UIProcess/API/efl/ewk_view_loader_client.cpp
+ UIProcess/API/efl/ewk_view_policy_client.cpp
UIProcess/API/efl/ewk_view_resource_load_client.cpp
UIProcess/API/efl/ewk_web_error.cpp
UIProcess/API/efl/ewk_web_resource.cpp
@@ -53,6 +58,7 @@ LIST(APPEND WebKit2_SOURCES
UIProcess/efl/WebPageProxyEfl.cpp
UIProcess/efl/WebPreferencesEfl.cpp
+ UIProcess/soup/WebCookieManagerProxySoup.cpp
UIProcess/soup/WebSoupRequestManagerClient.cpp
UIProcess/soup/WebSoupRequestManagerProxy.cpp
@@ -62,6 +68,7 @@ LIST(APPEND WebKit2_SOURCES
UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
+ WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
WebProcess/Downloads/efl/DownloadEfl.cpp
WebProcess/Downloads/efl/FileDownloaderEfl.cpp
@@ -96,6 +103,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform/network/soup"
"${WEBCORE_DIR}/svg/graphics"
"${WEBKIT2_DIR}/Shared/efl"
+ "${WEBKIT2_DIR}/Shared/soup"
"${WEBKIT2_DIR}/UIProcess/API/C/efl"
"${WEBKIT2_DIR}/UIProcess/API/C/soup"
"${WEBKIT2_DIR}/UIProcess/API/efl"
@@ -162,8 +170,61 @@ CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @O
SET (EWebKit2_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_view.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_error.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_resource.h"
)
INSTALL(FILES ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${EWebKit2_HEADERS} DESTINATION include/${WebKit2_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR})
+
+INCLUDE_DIRECTORIES(${THIRDPARTY_DIR}/gtest/include)
+
+SET(EWK2UnitTests_LIBRARIES
+ ${JavaScriptCore_LIBRARY_NAME}
+ ${WebCore_LIBRARY_NAME}
+ ${WebKit2_LIBRARY_NAME}
+ ${ECORE_LIBRARIES}
+ ${ECORE_EVAS_LIBRARIES}
+ ${EVAS_LIBRARIES}
+)
+
+IF (ENABLE_GLIB_SUPPORT)
+ LIST(APPEND EWK2UnitTests_LIBRARIES
+ ${Glib_LIBRARIES}
+ ${Gthread_LIBRARIES}
+ )
+ENDIF()
+
+SET(WEBKIT2_EFL_TEST_DIR "${WEBKIT2_DIR}/UIProcess/API/efl/tests")
+SET(TEST_RESOURCES_DIR ${WEBKIT2_EFL_TEST_DIR}/resources)
+
+ADD_DEFINITIONS(-DTEST_RESOURCES_DIR=\"${TEST_RESOURCES_DIR}\")
+
+ADD_LIBRARY(ewk2UnitTestUtils
+ ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestBase.cpp
+ ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestEnvironment.cpp
+ ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestMain.cpp
+)
+
+TARGET_LINK_LIBRARIES(ewk2UnitTestUtils ${EWK2UnitTests_LIBRARIES})
+
+# The "ewk" on the test name needs to be suffixed with "2", otherwise it
+# will clash with tests from the WebKit 1 test suite.
+SET(EWK2UnitTests_BINARIES
+ test_ewk2_view
+)
+
+IF (ENABLE_API_TESTS)
+ FOREACH (testName ${EWK2UnitTests_BINARIES})
+ ADD_EXECUTABLE(${testName} ${WEBKIT2_EFL_TEST_DIR}/${testName}.cpp)
+ ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName})
+ SET_TESTS_PROPERTIES(${testName} PROPERTIES TIMEOUT 60)
+ TARGET_LINK_LIBRARIES(${testName} ${EWK2UnitTests_LIBRARIES} ewk2UnitTestUtils gtest pthread)
+ ENDFOREACH ()
+ENDIF ()
diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
index f38368611..41134c971 100644
--- a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
+++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
@@ -32,6 +32,10 @@
#include "WKAPICast.h"
#include "WKContextMenuItemTypes.h"
+#if PLATFORM(MAC)
+#import <mach-o/dyld.h>
+#endif
+
using namespace WebCore;
using namespace WebKit;
@@ -80,10 +84,36 @@ WKContextMenuItemRef WKContextMenuItemSeparatorItem()
#endif
}
+#if PLATFORM(MAC)
+static WKContextMenuItemTag compatibleContextMenuItemTag(WKContextMenuItemTag tag)
+{
+ static bool needsWorkaround = ^bool {
+ const int32_t safariFrameworkVersionWithIncompatibleContextMenuItemTags = 0x02181900; // 536.25.0 (Safari 6.0)
+ return NSVersionOfRunTimeLibrary("Safari") == safariFrameworkVersionWithIncompatibleContextMenuItemTags;
+ }();
+
+ if (!needsWorkaround)
+ return tag;
+
+ // kWKContextMenuItemTagDictationAlternative was inserted before kWKContextMenuItemTagInspectElement.
+ // DictationAlternative is now at the end like it should have been. To be compatible we need to return
+ // InspectElement for DictationAlternative and shift InspectElement and after by one.
+ if (tag == kWKContextMenuItemTagDictationAlternative)
+ return kWKContextMenuItemTagInspectElement;
+ if (tag >= kWKContextMenuItemTagInspectElement && tag < kWKContextMenuItemBaseApplicationTag)
+ return tag + 1;
+ return tag;
+}
+#endif
+
WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef)
{
#if ENABLE(CONTEXT_MENUS)
+#if PLATFORM(MAC)
+ return compatibleContextMenuItemTag(toAPI(toImpl(itemRef)->data()->action()));
+#else
return toAPI(toImpl(itemRef)->data()->action());
+#endif
#else
return toAPI(ContextMenuItemTagNoAction);
#endif
diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
index b326794de..d53342663 100644
--- a/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
+++ b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
@@ -88,7 +88,6 @@ enum {
kWKContextMenuItemTagRightToLeft,
kWKContextMenuItemTagPDFSinglePageScrolling,
kWKContextMenuItemTagPDFFacingPagesScrolling,
- kWKContextMenuItemTagDictationAlternative,
kWKContextMenuItemTagInspectElement,
kWKContextMenuItemTagTextDirectionMenu,
kWKContextMenuItemTagTextDirectionDefault,
@@ -114,6 +113,7 @@ enum {
kWKContextMenuItemTagEnterVideoFullscreen,
kWKContextMenuItemTagMediaPlayPause,
kWKContextMenuItemTagMediaMute,
+ kWKContextMenuItemTagDictationAlternative,
kWKContextMenuItemBaseApplicationTag = 10000
};
typedef uint32_t WKContextMenuItemTag;
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
index 63221a535..0f9d06ca1 100644
--- a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
@@ -40,7 +40,7 @@ void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(fontInfo);
encoder->encodeEnum(type);
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
bool hadOptions = options;
encoder->encodeBool(hadOptions);
if (hadOptions)
@@ -56,7 +56,7 @@ bool DictionaryPopupInfo::decode(CoreIPC::ArgumentDecoder* decoder, DictionaryPo
return false;
if (!decoder->decodeEnum(result.type))
return false;
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
bool hadOptions;
if (!decoder->decodeBool(hadOptions))
return false;
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h
index 3814eced0..bcec04c45 100644
--- a/Source/WebKit2/Shared/DictionaryPopupInfo.h
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.h
@@ -52,7 +52,7 @@ struct DictionaryPopupInfo {
WebCore::FloatPoint origin;
FontInfo fontInfo;
Type type;
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
RetainPtr<CFDictionaryRef> options;
#endif
};
diff --git a/Source/WebKit2/Shared/ShareableSurface.cpp b/Source/WebKit2/Shared/ShareableSurface.cpp
index cf10e163f..2ef5a4bb9 100644
--- a/Source/WebKit2/Shared/ShareableSurface.cpp
+++ b/Source/WebKit2/Shared/ShareableSurface.cpp
@@ -149,9 +149,11 @@ ShareableSurface::~ShareableSurface()
PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle)
{
#if USE(GRAPHICS_SURFACE)
+ if (handle.graphicsSurfaceToken()) {
RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken);
if (surface)
return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface)));
+ }
#endif
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle.m_bitmapHandle);
diff --git a/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h b/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h
deleted file mode 100644
index 34771b71e..000000000
--- a/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Copyright (C) 2012 Samsung Electronics
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PlatformCertificateInfo_h
-#define PlatformCertificateInfo_h
-
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
-#include <WebCore/ResourceResponse.h>
-
-namespace WebKit {
-
-class PlatformCertificateInfo {
-public:
- PlatformCertificateInfo()
- {
- }
-
- explicit PlatformCertificateInfo(const WebCore::ResourceResponse&)
- {
- }
-
- void encode(CoreIPC::ArgumentEncoder*) const
- {
- }
-
- static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&)
- {
- return true;
- }
-};
-
-} // namespace WebKit
-
-#endif // PlatformCertificateInfo_h
diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.mm b/Source/WebKit2/Shared/mac/PasteboardTypes.mm
index 26cc6dcd5..090eb0290 100644
--- a/Source/WebKit2/Shared/mac/PasteboardTypes.mm
+++ b/Source/WebKit2/Shared/mac/PasteboardTypes.mm
@@ -44,7 +44,7 @@ static inline NSArray *retain(NSArray *array)
NSArray* PasteboardTypes::forEditing()
{
static NSArray *types = retain([NSArray arrayWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType,
-#ifdef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
NSPICTPboardType,
#endif
NSURLPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSColorPboardType, kUTTypePNG, nil]);
diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm
index 7c185248a..772c0f706 100644
--- a/Source/WebKit2/Shared/mac/WebEventFactory.mm
+++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm
@@ -199,7 +199,7 @@ static NSPoint pointForEvent(NSEvent *event, NSView *windowView)
static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
uint32_t phase = WebWheelEvent::PhaseNone;
if ([event phase] & NSEventPhaseBegan)
phase |= WebWheelEvent::PhaseBegan;
@@ -211,7 +211,7 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
phase |= WebWheelEvent::PhaseEnded;
if ([event phase] & NSEventPhaseCancelled)
phase |= WebWheelEvent::PhaseCancelled;
-#if !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
if ([event phase] & NSEventPhaseMayBegin)
phase |= WebWheelEvent::PhaseMayBegin;
#endif
@@ -226,7 +226,7 @@ static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event)
{
uint32_t phase = WebWheelEvent::PhaseNone;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if ([event momentumPhase] & NSEventPhaseBegan)
phase |= WebWheelEvent::PhaseBegan;
if ([event momentumPhase] & NSEventPhaseStationary)
diff --git a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp
new file mode 100644
index 000000000..c7baba3ee
--- /dev/null
+++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 "PlatformCertificateInfo.h"
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include "DataReference.h"
+#include <WebCore/ResourceResponse.h>
+#include <libsoup/soup.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PlatformCertificateInfo::PlatformCertificateInfo()
+ : m_tlsErrors(static_cast<GTlsCertificateFlags>(0))
+{
+}
+
+PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& response)
+ : m_certificate(response.soupMessageCertificate())
+ , m_tlsErrors(response.soupMessageTLSErrors())
+{
+}
+
+PlatformCertificateInfo::~PlatformCertificateInfo()
+{
+}
+
+void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ if (!m_certificate) {
+ encoder->encodeBool(false);
+ return;
+ }
+
+ GByteArray* certificateData = 0;
+ g_object_get(G_OBJECT(m_certificate.get()), "certificate", &certificateData, NULL);
+ if (!certificateData) {
+ encoder->encodeBool(false);
+ return;
+ }
+
+ encoder->encodeBool(true);
+ GRefPtr<GByteArray> certificate = adoptGRef(certificateData);
+ encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(certificate->data, certificate->len));
+ encoder->encode(static_cast<uint32_t>(m_tlsErrors));
+}
+
+bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& certificateInfo)
+{
+ bool hasCertificate;
+ if (!decoder->decode(hasCertificate))
+ return false;
+
+ if (!hasCertificate)
+ return true;
+
+ CoreIPC::DataReference certificateDataReference;
+ if (!decoder->decodeVariableLengthByteArray(certificateDataReference))
+ return false;
+
+ GByteArray* certificateData = g_byte_array_sized_new(certificateDataReference.size());
+ certificateData = g_byte_array_append(certificateData, certificateDataReference.data(), certificateDataReference.size());
+ GRefPtr<GByteArray> certificate = adoptGRef(certificateData);
+
+ GTlsBackend* backend = g_tls_backend_get_default();
+ certificateInfo.m_certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(g_tls_backend_get_certificate_type(backend), 0, 0,
+ "certificate", certificate.get(), NULL)));
+
+ uint32_t tlsErrors;
+ if (!decoder->decode(tlsErrors))
+ return false;
+ certificateInfo.m_tlsErrors = static_cast<GTlsCertificateFlags>(tlsErrors);
+
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h
index 989467e96..0e76a3e94 100644
--- a/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h
+++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h
@@ -27,30 +27,35 @@
#ifndef PlatformCertificateInfo_h
#define PlatformCertificateInfo_h
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
-#include <WebCore/ResourceResponse.h>
+#include <libsoup/soup.h>
+#include <wtf/gobject/GRefPtr.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebCore {
+class ResourceResponse;
+}
namespace WebKit {
class PlatformCertificateInfo {
public:
- PlatformCertificateInfo()
- {
- }
-
- explicit PlatformCertificateInfo(const WebCore::ResourceResponse&)
- {
- }
-
- void encode(CoreIPC::ArgumentEncoder*) const
- {
- }
-
- static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&)
- {
- return true;
- }
+ PlatformCertificateInfo();
+ explicit PlatformCertificateInfo(const WebCore::ResourceResponse&);
+ ~PlatformCertificateInfo();
+
+ GTlsCertificate* certificate() const { return m_certificate.get(); }
+ GTlsCertificateFlags tlsErrors() const { return m_tlsErrors; }
+
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&);
+
+private:
+ GRefPtr<GTlsCertificate> m_certificate;
+ GTlsCertificateFlags m_tlsErrors;
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h b/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h
new file mode 100644
index 000000000..9fc1c3cd3
--- /dev/null
+++ b/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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. ``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
+ * 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 SoupCookiePersistentStorageType_h
+#define SoupCookiePersistentStorageType_h
+
+namespace WebKit {
+
+enum SoupCookiePersistentStorageType {
+ SoupCookiePersistentStorageText,
+ SoupCookiePersistentStorageSQLite
+};
+
+} // namespace WebKit
+
+#endif // SoupCookiePersistentStorageType_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
index 129d3959b..4a13ae7a2 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
@@ -65,7 +65,7 @@ WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginati
WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns);
WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page);
-WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView);
+WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pageLength);
WK_EXPORT double WKPageGetPageLength(WKPageRef page);
WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page);
diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp
index 2bd55e211..18c9e1443 100644
--- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp
@@ -35,9 +35,9 @@
using namespace WebCore;
using namespace WebKit;
-static inline BatteryProviderEfl* toBatteryProvider(const void* clientInfo)
+static inline BatteryProvider* toBatteryProvider(const void* clientInfo)
{
- return static_cast<BatteryProviderEfl*>(const_cast<void*>(clientInfo));
+ return static_cast<BatteryProvider*>(const_cast<void*>(clientInfo));
}
static void startUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo)
diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
index 799d258e0..8fa90aeb9 100644
--- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
+++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
@@ -30,7 +30,9 @@
#include "ewk_context.h"
#include "ewk_intent.h"
#include "ewk_intent_service.h"
+#include "ewk_navigation_policy_decision.h"
#include "ewk_url_request.h"
+#include "ewk_url_response.h"
#include "ewk_view.h"
#include "ewk_web_error.h"
#include "ewk_web_resource.h"
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
index 791bc95f4..e1ccff23b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
@@ -35,9 +35,8 @@ struct _Ewk_Context {
#endif
_Ewk_Context(WKContextRef contextRef)
- {
- this->context = contextRef;
- }
+ : context(contextRef)
+ { }
};
WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
index 63b9ee364..ba923ee0b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
@@ -50,6 +50,17 @@ struct _Ewk_Intent {
const char* action;
const char* type;
const char* service;
+
+ _Ewk_Intent(WKIntentDataRef intentRef)
+ : __ref(1)
+#if ENABLE(WEB_INTENTS)
+ , wkIntent(intentRef)
+#endif
+ , action(0)
+ , type(0)
+ , service(0)
+ {
+ }
};
#define EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent_, ...) \
@@ -82,7 +93,7 @@ void ewk_intent_unref(Ewk_Intent* intent)
eina_stringshare_del(intent->action);
eina_stringshare_del(intent->type);
eina_stringshare_del(intent->service);
- free(intent);
+ delete intent;
#endif
}
@@ -192,11 +203,7 @@ Ewk_Intent* ewk_intent_new(WKIntentDataRef intentData)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(intentData, 0);
- Ewk_Intent* ewkIntent = static_cast<Ewk_Intent*>(calloc(1, sizeof(Ewk_Intent)));
- ewkIntent->__ref = 1;
- ewkIntent->wkIntent = intentData;
-
- return ewkIntent;
+ return new Ewk_Intent(intentData);
}
WKIntentDataRef ewk_intent_WKIntentDataRef_get(const Ewk_Intent* intent)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
index be9b84499..9395f421f 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
@@ -50,6 +50,18 @@ struct _Ewk_Intent_Service {
const char* href;
const char* title;
const char* disposition;
+
+ _Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef)
+ : __ref(1)
+#if ENABLE(WEB_INTENTS_TAG)
+ , wkService(serviceRef)
+#endif
+ , action(0)
+ , type(0)
+ , href(0)
+ , title(0)
+ , disposition(0)
+ { }
};
#define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \
@@ -84,7 +96,7 @@ void ewk_intent_service_unref(Ewk_Intent_Service* service)
eina_stringshare_del(service->href);
eina_stringshare_del(service->title);
eina_stringshare_del(service->disposition);
- free(service);
+ delete service;
#endif
}
@@ -168,10 +180,6 @@ Ewk_Intent_Service* ewk_intent_service_new(WKIntentServiceInfoRef wkService)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(wkService, 0);
- Ewk_Intent_Service* ewkIntentService = static_cast<Ewk_Intent_Service*>(calloc(1, sizeof(Ewk_Intent_Service)));
- ewkIntentService->__ref = 1;
- ewkIntentService->wkService = wkService;
-
- return ewkIntentService;
+ return new Ewk_Intent_Service(wkService);
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp
new file mode 100644
index 000000000..a21649d34
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp
@@ -0,0 +1,162 @@
+/*
+ * 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 "ewk_navigation_policy_decision.h"
+
+#include "WKAPICast.h"
+#include "WKFramePolicyListener.h"
+#include "WKRetainPtr.h"
+#include "ewk_navigation_policy_decision_private.h"
+#include "ewk_private.h"
+#include "ewk_url_request_private.h"
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Navigation_Policy_Decision
+ * @brief Contains the navigation policy decision data.
+ */
+struct _Ewk_Navigation_Policy_Decision {
+ WKRetainPtr<WKFramePolicyListenerRef> listener;
+ bool actedUponByClient;
+ Ewk_Navigation_Type navigationType;
+ Event_Mouse_Button mouseButton;
+ Event_Modifier_Keys modifiers;
+ Ewk_Url_Request* request;
+ const char* frameName;
+
+ _Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef _listener, Ewk_Navigation_Type _navigationType, Event_Mouse_Button _mouseButton, Event_Modifier_Keys _modifiers, Ewk_Url_Request* _request, const char* _frameName)
+ : listener(_listener)
+ , actedUponByClient(false)
+ , navigationType(_navigationType)
+ , mouseButton(_mouseButton)
+ , modifiers(_modifiers)
+ , request(_request)
+ , frameName(eina_stringshare_add(_frameName))
+ { }
+};
+
+void ewk_navigation_policy_decision_free(Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN(decision);
+
+ // This is the default choice for all policy decisions in WebPageProxy.cpp.
+ if (!decision->actedUponByClient)
+ WKFramePolicyListenerUse(decision->listener.get());
+
+ ewk_url_request_unref(decision->request);
+ eina_stringshare_del(decision->frameName);
+ delete decision;
+}
+
+Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(decision, EWK_NAVIGATION_TYPE_OTHER);
+
+ return decision->navigationType;
+}
+
+Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(decision, EVENT_MOUSE_BUTTON_NONE);
+
+ return decision->mouseButton;
+}
+
+Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(decision, static_cast<Event_Modifier_Keys>(0));
+
+ return decision->modifiers;
+}
+
+const char* ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(decision, 0);
+
+ return decision->frameName;
+}
+
+Ewk_Url_Request* ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(decision, 0);
+
+ return decision->request;
+}
+
+void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN(decision);
+
+ WKFramePolicyListenerUse(decision->listener.get());
+ decision->actedUponByClient = true;
+}
+
+void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN(decision);
+
+ WKFramePolicyListenerIgnore(decision->listener.get());
+ decision->actedUponByClient = true;
+}
+
+void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision* decision)
+{
+ EINA_SAFETY_ON_NULL_RETURN(decision);
+
+ WKFramePolicyListenerDownload(decision->listener.get());
+ decision->actedUponByClient = true;
+}
+
+// Ewk_Navigation_Type enum validation
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_LINK_ACTIVATED, kWKFrameNavigationTypeLinkClicked);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_FORM_SUBMITTED, kWKFrameNavigationTypeFormSubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_BACK_FORWARD, kWKFrameNavigationTypeBackForward);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_RELOAD, kWKFrameNavigationTypeReload);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_FORM_RESUBMITTED, kWKFrameNavigationTypeFormResubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_OTHER, kWKFrameNavigationTypeOther);
+
+// Event_Mouse_Button enum validation
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_NONE, kWKEventMouseButtonNoButton);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_LEFT, kWKEventMouseButtonLeftButton);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_MIDDLE, kWKEventMouseButtonMiddleButton);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_RIGHT, kWKEventMouseButtonRightButton);
+
+// Event_Modifier_Keys validation
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_SHIFT, kWKEventModifiersShiftKey);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_CTRL, kWKEventModifiersControlKey);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_ALT, kWKEventModifiersAltKey);
+COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_META, kWKEventModifiersMetaKey);
+
+Ewk_Navigation_Policy_Decision* ewk_navigation_policy_decision_new(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef request, const char* frameName, WKFramePolicyListenerRef listener)
+{
+ return new Ewk_Navigation_Policy_Decision(listener,
+ static_cast<Ewk_Navigation_Type>(navigationType),
+ static_cast<Event_Mouse_Button>(mouseButton),
+ static_cast<Event_Modifier_Keys>(modifiers),
+ ewk_url_request_new(request),
+ frameName);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h
new file mode 100644
index 000000000..7681a9f20
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file ewk_navigation_policy_decision.h
+ * @brief Describes the Ewk navigation policy decision API.
+ */
+
+#ifndef ewk_navigation_policy_decision_h
+#define ewk_navigation_policy_decision_h
+
+#include "ewk_url_request.h"
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Navigation_Policy_Decision */
+typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision;
+
+/// Enum containing navigation types
+typedef enum {
+ EWK_NAVIGATION_TYPE_LINK_ACTIVATED,
+ EWK_NAVIGATION_TYPE_FORM_SUBMITTED,
+ EWK_NAVIGATION_TYPE_BACK_FORWARD,
+ EWK_NAVIGATION_TYPE_RELOAD,
+ EWK_NAVIGATION_TYPE_FORM_RESUBMITTED,
+ EWK_NAVIGATION_TYPE_OTHER
+} Ewk_Navigation_Type;
+
+/// Enum containing button types
+typedef enum {
+ EVENT_MOUSE_BUTTON_NONE = -1,
+ EVENT_MOUSE_BUTTON_LEFT = 0,
+ EVENT_MOUSE_BUTTON_MIDDLE = 1,
+ EVENT_MOUSE_BUTTON_RIGHT = 2
+} Event_Mouse_Button;
+
+typedef enum {
+ EVENT_MODIFIER_KEY_SHIFT = 1 << 0,
+ EVENT_MODIFIER_KEY_CTRL = 1 << 1,
+ EVENT_MODIFIER_KEY_ALT = 1 << 2,
+ EVENT_MODIFIER_KEY_META = 1 << 3
+} Event_Modifier_Keys;
+
+/**
+ * Frees the given object.
+ *
+ * @param decision the policy decision object to free
+ */
+EAPI void ewk_navigation_policy_decision_free(Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Query type for this navigation policy decision.
+ *
+ * @param decision navigation policy decision object to query.
+ *
+ * @return the type of navigation.
+ */
+EAPI Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Query mouse button for this navigation policy decision.
+ *
+ * @param decision navigation policy decision object to query.
+ *
+ * @return the mouse button clicked to trigger the navigation.
+ */
+EAPI Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Query modifier keys for this navigation policy decision.
+ *
+ * @param decision navigation policy decision object to query.
+ *
+ * @return the modifier keys used when triggering the navigation.
+ */
+EAPI Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Query frame name for this navigation policy decision.
+ *
+ * The frame name is non-null for new window policy decisions only.
+ *
+ * @param decision navigation policy decision object to query.
+ *
+ * @return the frame name pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Query URL request for this navigation policy decision.
+ *
+ * @param decision navigation policy decision object to query.
+ *
+ * @return The URL request pointer or @c NULL in case of error.
+ */
+EAPI Ewk_Url_Request *ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Accepts the navigation request.
+ *
+ * The navigation will be accepted by default.
+ *
+ * @param decision navigation policy decision object to query.
+ */
+EAPI void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Rejects the navigation request.
+ *
+ * @param decision navigation policy decision object to query.
+ */
+EAPI void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision *decision);
+
+/**
+ * Triggers a download instead of navigating to the url.
+ *
+ * @param decision navigation policy decision object to query.
+ */
+EAPI void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision *decision);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_navigation_policy_decision_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h
new file mode 100644
index 000000000..abc8bedc0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h
@@ -0,0 +1,37 @@
+/*
+ * 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 ewk_navigation_policy_decision_private_h
+#define ewk_navigation_policy_decision_private_h
+
+#include "WKBase.h"
+#include "WKEvent.h"
+#include "WKPageLoadTypes.h"
+
+typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision;
+
+Ewk_Navigation_Policy_Decision* ewk_navigation_policy_decision_new(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef request, const char* frameName, WKFramePolicyListenerRef listener);
+
+#endif // ewk_navigation_policy_decision_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_private.h
new file mode 100644
index 000000000..86ca42d4e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_private.h
@@ -0,0 +1,34 @@
+/*
+ * 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 ewk_private_h
+#define ewk_private_h
+
+#include <wtf/Assertions.h>
+
+#define COMPILE_ASSERT_MATCHING_ENUM(ewkName, webcoreName) \
+ COMPILE_ASSERT(int(ewkName) == int(webcoreName), mismatchingEnums)
+
+#endif // ewk_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
index 0aa874bf7..f29a40e5d 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
@@ -48,6 +48,14 @@ struct _Ewk_Url_Request {
const char* url;
const char* first_party;
const char* http_method;
+
+ _Ewk_Url_Request(WKURLRequestRef requestRef)
+ : __ref(1)
+ , wkRequest(requestRef)
+ , url(0)
+ , first_party(0)
+ , http_method(0)
+ { }
};
#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \
@@ -77,7 +85,7 @@ void ewk_url_request_unref(Ewk_Url_Request* request)
eina_stringshare_del(request->url);
eina_stringshare_del(request->first_party);
eina_stringshare_del(request->http_method);
- free(request);
+ delete request;
}
const char* ewk_url_request_url_get(const Ewk_Url_Request* request)
@@ -119,9 +127,5 @@ Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef wkUrlRequest)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(wkUrlRequest, 0);
- Ewk_Url_Request* ewkUrlRequest = static_cast<Ewk_Url_Request*>(calloc(1, sizeof(Ewk_Url_Request)));
- ewkUrlRequest->__ref = 1;
- ewkUrlRequest->wkRequest = wkUrlRequest;
-
- return ewkUrlRequest;
+ return new Ewk_Url_Request(wkUrlRequest);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp
new file mode 100644
index 000000000..2ab129717
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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 "ewk_url_response.h"
+
+#include "ewk_url_response_private.h"
+#include <wtf/text/CString.h>
+
+/**
+ * \struct _Ewk_Url_Response
+ * @brief Contains the URL response data.
+ */
+struct _Ewk_Url_Response {
+ unsigned int __ref; /**< the reference count of the object */
+ WebCore::ResourceResponse coreResponse;
+
+ const char* url;
+ const char* mimeType;
+
+ _Ewk_Url_Response(const WebCore::ResourceResponse& _coreResponse)
+ : __ref(1)
+ , coreResponse(_coreResponse)
+ , url(0)
+ , mimeType(0)
+ { }
+};
+
+void ewk_url_response_ref(Ewk_Url_Response* response)
+{
+ EINA_SAFETY_ON_NULL_RETURN(response);
+ ++response->__ref;
+}
+
+void ewk_url_response_unref(Ewk_Url_Response* response)
+{
+ EINA_SAFETY_ON_NULL_RETURN(response);
+
+ if (--response->__ref)
+ return;
+
+ eina_stringshare_del(response->url);
+ eina_stringshare_del(response->mimeType);
+ delete response;
+}
+
+const char* ewk_url_response_url_get(const Ewk_Url_Response* response)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0);
+
+ Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response);
+ eina_stringshare_replace(&ewkResponse->url, response->coreResponse.url().string().utf8().data());
+
+ return response->url;
+}
+
+int ewk_url_response_status_code_get(const Ewk_Url_Response* response)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0);
+
+ return response->coreResponse.httpStatusCode();
+}
+
+const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0);
+
+ Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response);
+ eina_stringshare_replace(&ewkResponse->mimeType, response->coreResponse.mimeType().utf8().data());
+
+ return response->mimeType;
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Url_Response from a WebCore::ResourceResponse.
+ */
+Ewk_Url_Response* ewk_url_response_new(const WebCore::ResourceResponse& coreResponse)
+{
+ return new Ewk_Url_Response(coreResponse);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h
new file mode 100644
index 000000000..165e9a61c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file ewk_url_response.h
+ * @brief Describes the Ewk URL response API.
+ */
+
+#ifndef ewk_url_response_h
+#define ewk_url_response_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Url_Response */
+typedef struct _Ewk_Url_Response Ewk_Url_Response;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param response the URL response object to increase the reference count
+ */
+EAPI void ewk_url_response_ref(Ewk_Url_Response *response);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the URL request is freed.
+ *
+ * @param response the URL response object to decrease the reference count
+ */
+EAPI void ewk_url_response_unref(Ewk_Url_Response *response);
+
+/**
+ * Query URL for this response.
+ *
+ * @param response response object to query.
+ *
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_response_url_get(const Ewk_Url_Response *response);
+
+/**
+ * Query HTTP status code for this response.
+ *
+ * HTTP status code are defined by:
+ * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
+ *
+ * @param response response object to query.
+ *
+ * @return the HTTP status code.
+ */
+EAPI int ewk_url_response_status_code_get(const Ewk_Url_Response *response);
+
+/**
+ * Query MIME type for this response.
+ *
+ * @param response response object to query.
+ *
+ * @return the MIME type pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_response_mime_type_get(const Ewk_Url_Response *response);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_url_response_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h
new file mode 100644
index 000000000..32d563fdf
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h
@@ -0,0 +1,35 @@
+/*
+ * 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 ewk_url_response_private_h
+#define ewk_url_response_private_h
+
+#include <WebCore/ResourceResponse.h>
+
+typedef struct _Ewk_Url_Response Ewk_Url_Response;
+
+Ewk_Url_Response* ewk_url_response_new(const WebCore::ResourceResponse& resourceResponse);
+
+#endif // ewk_url_response_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index eb6b15bb5..eb1e5e7b2 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -32,8 +32,10 @@
#include "ewk_context_private.h"
#include "ewk_intent_private.h"
#include "ewk_view_loader_client_private.h"
+#include "ewk_view_policy_client_private.h"
#include "ewk_view_private.h"
#include "ewk_view_resource_load_client_private.h"
+#include "ewk_web_resource.h"
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -41,10 +43,18 @@ using namespace WebCore;
static const char EWK_VIEW_TYPE_STR[] = "EWK2_View";
+typedef HashMap<uint64_t, Ewk_Web_Resource*> LoadingResourcesMap;
+
struct _Ewk_View_Private_Data {
OwnPtr<PageClientImpl> pageClient;
const char* uri;
const char* title;
+ LoadingResourcesMap loadingResourcesMap;
+
+ _Ewk_View_Private_Data()
+ : uri(0)
+ , title(0)
+ { }
};
#define EWK_VIEW_TYPE_CHECK(ewkView, result) \
@@ -255,8 +265,7 @@ static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
{
- Ewk_View_Private_Data* priv =
- static_cast<Ewk_View_Private_Data*>(calloc(1, sizeof(Ewk_View_Private_Data)));
+ Ewk_View_Private_Data* priv = new Ewk_View_Private_Data;
if (!priv) {
EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data");
return 0;
@@ -273,7 +282,7 @@ static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
priv->pageClient = nullptr;
eina_stringshare_del(priv->uri);
eina_stringshare_del(priv->title);
- free(priv);
+ delete priv;
}
static void _ewk_view_smart_add(Evas_Object* ewkView)
@@ -495,6 +504,7 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou
priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView);
+ ewk_view_policy_client_attach(toAPI(priv->pageClient->page()), ewkView);
ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView);
return ewkView;
@@ -567,12 +577,96 @@ Eina_Bool ewk_view_stop(Evas_Object* ewkView)
*/
void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request)
{
- Ewk_Web_Resource_Request resourceRequest = {resource, request};
- // FIXME: We will need to store the resource and its identifier at some point
- // to get the resource back from the identifier on resource load finish.
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ Ewk_Web_Resource_Request resourceRequest = {resource, request, 0};
+
+ // Keep the resource internally to reuse it later.
+ ewk_web_resource_ref(resource);
+ priv->loadingResourcesMap.add(resourceIdentifier, resource);
+
evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest);
}
+/**
+ * @internal
+ * Received a response to a resource load request in the view.
+ *
+ * Emits signal: "resource,request,response" with pointer to resource response.
+ */
+void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ if (!priv->loadingResourcesMap.contains(resourceIdentifier))
+ return;
+
+ Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier);
+ Ewk_Web_Resource_Load_Response resourceLoadResponse = {resource, response};
+ evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse);
+}
+
+/**
+ * @internal
+ * Failed loading a resource in the view.
+ *
+ * Emits signal: "resource,request,finished" with pointer to the resource load error.
+ */
+void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ if (!priv->loadingResourcesMap.contains(resourceIdentifier))
+ return;
+
+ Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier);
+ Ewk_Web_Resource_Load_Error resourceLoadError = {resource, error};
+ evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError);
+}
+
+/**
+ * @internal
+ * Finished loading a resource in the view.
+ *
+ * Emits signal: "resource,request,finished" with pointer to the resource.
+ */
+void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ if (!priv->loadingResourcesMap.contains(resourceIdentifier))
+ return;
+
+ Ewk_Web_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier);
+ evas_object_smart_callback_call(ewkView, "resource,request,finished", resource);
+
+ ewk_web_resource_unref(resource);
+}
+
+/**
+ * @internal
+ * Request was sent for a resource in the view.
+ *
+ * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response.
+ */
+void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ if (!priv->loadingResourcesMap.contains(resourceIdentifier))
+ return;
+
+ Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier);
+ Ewk_Web_Resource_Request resourceRequest = {resource, request, redirectResponse};
+
+ evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest);
+}
+
const char* ewk_view_title_get(const Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
@@ -773,9 +867,42 @@ void ewk_view_load_provisional_redirect(Evas_Object* ewkView)
*/
void ewk_view_load_provisional_started(Evas_Object* ewkView)
{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ // The main frame started provisional load, we should clear
+ // the loadingResources HashMap to start clean.
+ LoadingResourcesMap::iterator it = priv->loadingResourcesMap.begin();
+ LoadingResourcesMap::iterator end = priv->loadingResourcesMap.end();
+ for ( ; it != end; ++it)
+ ewk_web_resource_unref(it->second);
+ priv->loadingResourcesMap.clear();
+
evas_object_smart_callback_call(ewkView, "load,provisional,started", 0);
}
+/**
+ * @internal
+ * Reports that a navigation policy decision should be taken.
+ *
+ * Emits signal: "policy,decision,navigation".
+ */
+void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision)
+{
+ evas_object_smart_callback_call(ewkView, "policy,decision,navigation", decision);
+}
+
+/**
+ * @internal
+ * Reports that a new window policy decision should be taken.
+ *
+ * Emits signal: "policy,decision,new,window".
+ */
+void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision)
+{
+ evas_object_smart_callback_call(ewkView, "policy,decision,new,window", decision);
+}
+
Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
index f6092a64e..58552ec7d 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
@@ -34,7 +34,13 @@
* - "load,provisional,failed", const Ewk_Web_Error*: view provisional load failed.
* - "load,provisional,redirect", void: view received redirect for provisional load.
* - "load,provisional,started", void: view started provisional load.
+ * - "policy,decision,navigation", Ewk_Navigation_Policy_Decision*: a navigation policy decision should be taken.
+ * - "policy,decision,new,window", Ewk_Navigation_Policy_Decision*: a new window policy decision should be taken.
+ * - "resource,request,failed", const Ewk_Web_Resource_Load_Error*: a resource failed loading.
+ * - "resource,request,finished", const Ewk_Web_Resource*: a resource finished loading.
* - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated.
+ * - "resource,request,response", Ewk_Web_Resource_Load_Response*: a response to a resource request was received.
+ * - "resource,request,sent", const Ewk_Web_Resource_Request*: a resource request was sent.
* - "title,changed", const char*: title of the main frame was changed.
*/
@@ -44,6 +50,8 @@
#include "ewk_context.h"
#include "ewk_intent.h"
#include "ewk_url_request.h"
+#include "ewk_url_response.h"
+#include "ewk_web_error.h"
#include "ewk_web_resource.h"
#include <Evas.h>
@@ -145,12 +153,35 @@ typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request;
/**
* @brief Structure containing details about a resource request.
- *
- * Details given about a resource is loaded.
*/
struct _Ewk_Web_Resource_Request {
Ewk_Web_Resource *resource; /**< resource being requested */
Ewk_Url_Request *request; /**< URL request for the resource */
+ Ewk_Url_Response *redirect_response; /**< Possible redirect response for the resource */
+};
+
+/// Creates a type name for _Ewk_Web_Resource_Load_Response.
+typedef struct _Ewk_Web_Resource_Load_Response Ewk_Web_Resource_Load_Response;
+
+/**
+ * @brief Structure containing details about a response to a resource request.
+ */
+struct _Ewk_Web_Resource_Load_Response {
+ Ewk_Web_Resource *resource; /**< resource requested */
+ Ewk_Url_Response *response; /**< resource load response */
+};
+
+/// Creates a type name for _Ewk_Web_Resource_Load_Error.
+typedef struct _Ewk_Web_Resource_Load_Error Ewk_Web_Resource_Load_Error;
+
+/**
+ * @brief Structure containing details about a resource load error.
+ *
+ * Details given about a resource load failure.
+ */
+struct _Ewk_Web_Resource_Load_Error {
+ Ewk_Web_Resource *resource; /**< resource that failed loading */
+ Ewk_Web_Error *error; /**< load error */
};
/**
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp
new file mode 100644
index 000000000..5f689e56d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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 "WKFrame.h"
+#include "ewk_navigation_policy_decision.h"
+#include "ewk_navigation_policy_decision_private.h"
+#include "ewk_view_policy_client_private.h"
+#include "ewk_view_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+static inline Evas_Object* toEwkView(const void* clientInfo)
+{
+ return static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+}
+
+static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ Ewk_Navigation_Policy_Decision* decision = ewk_navigation_policy_decision_new(navigationType, mouseButton, modifiers, request, 0, listener);
+ ewk_view_navigation_policy_decision(toEwkView(clientInfo), decision);
+ ewk_navigation_policy_decision_free(decision);
+}
+
+static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ Ewk_Navigation_Policy_Decision* decision = ewk_navigation_policy_decision_new(navigationType, mouseButton, modifiers, request, toImpl(frameName)->string().utf8().data(), listener);
+ ewk_view_new_window_policy_decision(toEwkView(clientInfo), decision);
+ ewk_navigation_policy_decision_free(decision);
+}
+
+void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
+{
+ WKPagePolicyClient policyClient;
+ memset(&policyClient, 0, sizeof(WKPagePolicyClient));
+ policyClient.version = kWKPagePolicyClientCurrentVersion;
+ policyClient.clientInfo = ewkView;
+ policyClient.decidePolicyForNavigationAction = decidePolicyForNavigationAction;
+ policyClient.decidePolicyForNewWindowAction = decidePolicyForNewWindowAction;
+
+ WKPageSetPagePolicyClient(pageRef, &policyClient);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h
new file mode 100644
index 000000000..c67248d96
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h
@@ -0,0 +1,34 @@
+/*
+ * 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 ewk_view_policy_client_private_h
+#define ewk_view_policy_client_private_h
+
+#include <Evas.h>
+#include <WebKit2/WKBase.h>
+
+void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView);
+
+#endif // ewk_view_policy_client_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
index f9f21136c..3c9ce94a7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
@@ -31,8 +31,10 @@ class IntSize;
}
typedef struct _Ewk_Url_Request Ewk_Url_Request;
+typedef struct _Ewk_Url_Response Ewk_Url_Response;
typedef struct _Ewk_Web_Error Ewk_Web_Error;
typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision;
#if ENABLE(WEB_INTENTS)
typedef struct _Ewk_Intent Ewk_Intent;
#endif
@@ -48,8 +50,14 @@ void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress);
void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error);
void ewk_view_load_provisional_redirect(Evas_Object* ewkView);
void ewk_view_load_provisional_started(Evas_Object* ewkView);
+void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision);
+void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision);
void ewk_view_title_changed(Evas_Object* ewkView, const char* title);
+void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error);
+void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier);
void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request);
+void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response);
+void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse);
Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp
index 6be39a208..505bbeddb 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp
@@ -31,29 +31,67 @@
#include "WKRetainPtr.h"
#include "WKURL.h"
#include "WKURLRequest.h"
+#include "WKURLResponse.h"
#include "ewk_url_request.h"
#include "ewk_url_request_private.h"
+#include "ewk_url_response.h"
+#include "ewk_url_response_private.h"
#include "ewk_view_private.h"
#include "ewk_view_resource_load_client_private.h"
+#include "ewk_web_error.h"
+#include "ewk_web_error_private.h"
#include "ewk_web_resource.h"
#include "ewk_web_resource_private.h"
#include <wtf/text/CString.h>
using namespace WebKit;
+static inline Evas_Object* toEwkView(const void* clientInfo)
+{
+ return static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+}
+
static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo)
{
- Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading);
WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
Ewk_Web_Resource* resource = ewk_web_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource);
Ewk_Url_Request* request = ewk_url_request_new(wkRequest);
- ewk_view_resource_load_initiated(ewkView, resourceIdentifier, resource, request);
+ ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource, request);
ewk_web_resource_unref(resource);
ewk_url_request_unref(request);
}
+static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo)
+{
+ Ewk_Url_Request* request = ewk_url_request_new(wkRequest);
+ Ewk_Url_Response* redirectResponse = ewk_url_response_new(toImpl(wkRedirectResponse)->resourceResponse());
+ ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request, redirectResponse);
+ ewk_url_request_unref(request);
+ ewk_url_response_unref(redirectResponse);
+}
+
+static void didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo)
+{
+ Ewk_Url_Response* response = ewk_url_response_new(toImpl(wkResponse)->resourceResponse());
+ ewk_view_resource_load_response(toEwkView(clientInfo), resourceIdentifier, response);
+ ewk_url_response_unref(response);
+}
+
+static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo)
+{
+ ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier);
+}
+
+static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo)
+{
+ Ewk_Web_Error* ewkError = ewk_web_error_new(wkError);
+ ewk_view_resource_load_failed(toEwkView(clientInfo), resourceIdentifier, ewkError);
+ ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier);
+ ewk_web_error_free(ewkError);
+}
+
void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
{
WKPageResourceLoadClient wkResourceLoadClient;
@@ -61,6 +99,10 @@ void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkVie
wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion;
wkResourceLoadClient.clientInfo = ewkView;
wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource;
+ wkResourceLoadClient.didSendRequestForResource = didSendRequestForResource;
+ wkResourceLoadClient.didReceiveResponseForResource = didReceiveResponseForResource;
+ wkResourceLoadClient.didFinishLoadForResource = didFinishLoadForResource;
+ wkResourceLoadClient.didFailLoadForResource = didFailLoadForResource;
WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
index 96b08d3e5..0ac75ab68 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
@@ -44,6 +44,12 @@ struct _Ewk_Web_Error {
const char* url;
const char* description;
+
+ _Ewk_Web_Error(WKErrorRef errorRef)
+ : wkError(errorRef)
+ , url(0)
+ , description(0)
+ { }
};
#define EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError_, ...) \
@@ -63,7 +69,7 @@ void ewk_web_error_free(Ewk_Web_Error *error)
eina_stringshare_del(error->url);
eina_stringshare_del(error->description);
- free(error);
+ delete error;
}
Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error)
@@ -122,8 +128,5 @@ Ewk_Web_Error* ewk_web_error_new(WKErrorRef error)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
- Ewk_Web_Error* ewkError = static_cast<Ewk_Web_Error*>(calloc(1, sizeof(Ewk_Web_Error)));
- ewkError->wkError = error;
-
- return ewkError;
+ return new Ewk_Web_Error(error);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
index ce1ddde65..44d9c2afc 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
@@ -31,8 +31,14 @@
struct _Ewk_Web_Resource {
unsigned int __ref; /**< the reference count of the object */
- CString url;
+ const char* url;
bool isMainResource;
+
+ _Ewk_Web_Resource(const char* _url, bool _isMainResource)
+ : __ref(1)
+ , url(eina_stringshare_add(_url))
+ , isMainResource(_isMainResource)
+ { }
};
void ewk_web_resource_ref(Ewk_Web_Resource* resource)
@@ -49,14 +55,15 @@ void ewk_web_resource_unref(Ewk_Web_Resource* resource)
if (--resource->__ref)
return;
- free(resource);
+ eina_stringshare_del(resource->url);
+ delete resource;
}
const char* ewk_web_resource_url_get(const Ewk_Web_Resource* resource)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0);
- return resource->url.data();
+ return resource->url;
}
/**
@@ -67,12 +74,7 @@ Ewk_Web_Resource* ewk_web_resource_new(const char* url, bool isMainResource)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
- Ewk_Web_Resource* resource = static_cast<Ewk_Web_Resource*>(calloc(1, sizeof(Ewk_Web_Resource)));
- resource->url = url;
- resource->isMainResource = isMainResource;
- resource->__ref = 1;
-
- return resource;
+ return new Ewk_Web_Resource(url, isMainResource);
}
Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource* resource)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h
index 6a3b0802b..3d78d4bc9 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h
@@ -61,7 +61,11 @@ EAPI void ewk_web_resource_unref(Ewk_Web_Resource *resource);
*
* @param resource resource object to query.
*
- * @return the URL pointer, that may be @c NULL.
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
*/
EAPI const char *ewk_web_resource_url_get(const Ewk_Web_Resource *resource);
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
new file mode 100644
index 000000000..b96643049
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+#include "EWK2UnitTestBase.h"
+
+#include "EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <wtf/UnusedParam.h>
+
+extern EWK2UnitTest::EWK2UnitTestEnvironment* environment;
+
+namespace EWK2UnitTest {
+
+static void onLoadProgress(void* userData, Evas_Object* webView, void* eventInfo)
+{
+ UNUSED_PARAM(webView);
+
+ EWK2UnitTestBase* test = static_cast<EWK2UnitTestBase*>(userData);
+ double progress = *static_cast<double*>(eventInfo);
+
+ test->setLoadProgress(progress);
+}
+
+EWK2UnitTestBase::EWK2UnitTestBase()
+ : m_loadProgress(0)
+ , m_ecoreEvas(0)
+ , m_webView(0)
+{
+}
+
+void EWK2UnitTestBase::SetUp()
+{
+ ASSERT_GT(ecore_evas_init(), 0);
+
+ unsigned int width = environment->defaultWidth();
+ unsigned int height = environment->defaultHeight();
+
+ if (environment->useX11Window())
+ m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0);
+ else
+ m_ecoreEvas = ecore_evas_buffer_new(width, height);
+
+ ecore_evas_show(m_ecoreEvas);
+ Evas* evas = ecore_evas_get(m_ecoreEvas);
+
+ m_webView = ewk_view_add(evas);
+ evas_object_resize(m_webView, width, height);
+ evas_object_show(m_webView);
+ evas_object_focus_set(m_webView, true);
+}
+
+void EWK2UnitTestBase::TearDown()
+{
+ evas_object_del(m_webView);
+ ecore_evas_free(m_ecoreEvas);
+ ecore_evas_shutdown();
+}
+
+void EWK2UnitTestBase::loadUrlSync(const char* url)
+{
+ m_loadProgress = 0;
+
+ evas_object_smart_callback_add(m_webView, "load,progress", onLoadProgress, this);
+ ewk_view_uri_set(m_webView, url);
+
+ while (m_loadProgress != 1)
+ ecore_main_loop_iterate();
+
+ evas_object_smart_callback_del(m_webView, "load,progress", onLoadProgress);
+}
+
+} // namespace EWK2UnitTest
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
new file mode 100644
index 000000000..794688140
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef EWK2UnitTestBase_h
+#define EWK2UnitTestBase_h
+
+#include <Ecore_Evas.h>
+#include <Evas.h>
+#include <gtest/gtest.h>
+
+namespace EWK2UnitTest {
+
+class EWK2UnitTestBase : public ::testing::Test {
+public:
+ void setLoadProgress(float progress) { m_loadProgress = progress; }
+ Evas_Object* webView() { return m_webView; }
+
+protected:
+ EWK2UnitTestBase();
+
+ virtual void SetUp();
+ virtual void TearDown();
+
+ void loadUrlSync(const char* url);
+
+private:
+ Evas_Object* m_webView;
+ Ecore_Evas* m_ecoreEvas;
+
+ float m_loadProgress;
+};
+
+} // namespace EWK2UnitTest
+
+#endif // EWK2UnitTestBase_h
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp
new file mode 100644
index 000000000..61cb53e0f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp
@@ -0,0 +1,37 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+#include "EWK2UnitTestEnvironment.h"
+
+namespace EWK2UnitTest {
+
+EWK2UnitTestEnvironment::EWK2UnitTestEnvironment(bool useX11Window)
+ : m_defaultWidth(800)
+ , m_defaultHeight(600)
+ , m_useX11Window(useX11Window)
+{
+}
+
+const char* EWK2UnitTestEnvironment::defaultTestPageUrl() const
+{
+ return "file://"TEST_RESOURCES_DIR"/default_test_page.html";
+}
+
+} // namespace EWK2UnitTest
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
new file mode 100644
index 000000000..9e076bea0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef EWK2UnitTestEnvironment_h
+#define EWK2UnitTestEnvironment_h
+
+#include <gtest/gtest.h>
+
+namespace EWK2UnitTest {
+
+class EWK2UnitTestEnvironment : public ::testing::Environment {
+public:
+ EWK2UnitTestEnvironment(bool useX11Window);
+
+ bool useX11Window() const { return m_useX11Window; }
+ const char* defaultTestPageUrl() const;
+
+ virtual unsigned int defaultWidth() const { return m_defaultWidth; }
+ virtual unsigned int defaultHeight() const { return m_defaultHeight; }
+
+private:
+ unsigned int m_defaultWidth;
+ unsigned int m_defaultHeight;
+
+ bool m_useX11Window;
+};
+
+} // namespace EWK2UnitTest
+
+#endif // EWK2UnitTestEnvironment_h
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp
new file mode 100644
index 000000000..06e9c069a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "EWK2UnitTestBase.h"
+#include "EWK2UnitTestEnvironment.h"
+#include <getopt.h>
+#include <gtest/gtest.h>
+
+using namespace EWK2UnitTest;
+
+EWK2UnitTestEnvironment* environment = 0;
+
+static bool parseArguments(int argc, char** argv)
+{
+ int useX11Window = 0;
+
+ static const option options[] = {
+ {"useX11Window", no_argument, &useX11Window, 1},
+ {0, 0, 0, 0}
+ };
+
+ while (getopt_long(argc, argv, "", options, 0) != -1) { }
+
+ return useX11Window;
+}
+
+int main(int argc, char** argv)
+{
+ bool useX11Window = parseArguments(argc, argv);
+
+ ::testing::InitGoogleTest(&argc, argv);
+
+ environment = new EWK2UnitTestEnvironment(useX11Window);
+ testing::AddGlobalTestEnvironment(environment);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html
new file mode 100644
index 000000000..edd81e732
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html
@@ -0,0 +1,6 @@
+<HTML>
+<BODY>
+<H2 align="center">EFL Unit Tests</H2>
+<H2 align="center">Default Testing Web Page</H2>
+</BODY>
+</HTML>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
new file mode 100644
index 000000000..8ee134d35
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <gtest/gtest.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+TEST_F(EWK2UnitTestBase, ewk_view_uri_get)
+{
+ loadUrlSync(environment->defaultTestPageUrl());
+ EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl());
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
index 7d8a10e1f..8790c7cbf 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "WebKitCookieManager.h"
+#include "SoupCookiePersistentStorageType.h"
+#include "WebCookieManagerProxy.h"
#include "WebKitCookieManagerPrivate.h"
#include "WebKitEnumTypes.h"
#include <wtf/gobject/GRefPtr.h>
@@ -41,6 +43,9 @@ static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT)
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite);
+
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS, kWKHTTPCookieAcceptPolicyAlways);
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NEVER, kWKHTTPCookieAcceptPolicyNever);
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain);
@@ -104,6 +109,30 @@ WebKitCookieManager* webkitCookieManagerCreate(WKCookieManagerRef wkCookieManage
}
/**
+ * webkit_cookie_manager_set_persistent_storage:
+ * @cookie_manager: a #WebKitCookieManager
+ * @filename: the filename to read to/write from
+ * @storage: a #WebKitCookiePersistentStorage
+ *
+ * Set the @filename where non-session cookies are stored persistently using
+ * @storage as the format to read/write the cookies.
+ * Cookies are initially read from @filename to create an initial set of cookies.
+ * Then, non-session cookies will be written to @filename when the WebKitCookieManager::changed
+ * signal is emitted.
+ * By default, @cookie_manager doesn't store the cookies persistenly, so you need to call this
+ * method to keep cookies saved across sessions.
+ */
+void webkit_cookie_manager_set_persistent_storage(WebKitCookieManager* manager, const char* filename, WebKitCookiePersistentStorage storage)
+{
+ g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager));
+ g_return_if_fail(filename);
+
+ WKCookieManagerStopObservingCookieChanges(manager->priv->wkCookieManager.get());
+ toImpl(manager->priv->wkCookieManager.get())->setCookiePersistentStorage(String::fromUTF8(filename), storage);
+ WKCookieManagerStartObservingCookieChanges(manager->priv->wkCookieManager.get());
+}
+
+/**
* webkit_cookie_manager_set_accept_policy:
* @cookie_manager: a #WebKitCookieManager
* @policy: a #WebKitCookieAcceptPolicy
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h
index 2472d96a2..28dfe28ef 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h
@@ -42,6 +42,20 @@ typedef struct _WebKitCookieManagerClass WebKitCookieManagerClass;
typedef struct _WebKitCookieManagerPrivate WebKitCookieManagerPrivate;
/**
+ * WebKitCookiePersistentStorage:
+ * @WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT: Cookies are stored in a text
+ * file in the Mozilla "cookies.txt" format.
+ * @WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE: Cookies are stored in a SQLite
+ * file in the current Mozilla format.
+ *
+ * Enum values used to denote the cookie persistent storage types.
+ */
+typedef enum {
+ WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT,
+ WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE
+} WebKitCookiePersistentStorage;
+
+/**
* WebKitCookieAcceptPolicy:
* @WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS: Accept all cookies unconditionally.
* @WEBKIT_COOKIE_POLICY_ACCEPT_NEVER: Reject all cookies unconditionally.
@@ -69,37 +83,42 @@ WEBKIT_API GType
webkit_cookie_manager_get_type (void);
WEBKIT_API void
-webkit_cookie_manager_set_accept_policy (WebKitCookieManager *cookie_manager,
- WebKitCookieAcceptPolicy policy);
+webkit_cookie_manager_set_persistent_storage (WebKitCookieManager *cookie_manager,
+ const gchar *filename,
+ WebKitCookiePersistentStorage storage);
+
+WEBKIT_API void
+webkit_cookie_manager_set_accept_policy (WebKitCookieManager *cookie_manager,
+ WebKitCookieAcceptPolicy policy);
WEBKIT_API void
-webkit_cookie_manager_get_accept_policy (WebKitCookieManager *cookie_manager,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
+webkit_cookie_manager_get_accept_policy (WebKitCookieManager *cookie_manager,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
WEBKIT_API WebKitCookieAcceptPolicy
-webkit_cookie_manager_get_accept_policy_finish (WebKitCookieManager *cookie_manager,
- GAsyncResult *result,
- GError **error);
+webkit_cookie_manager_get_accept_policy_finish (WebKitCookieManager *cookie_manager,
+ GAsyncResult *result,
+ GError **error);
WEBKIT_API void
-webkit_cookie_manager_get_domains_with_cookies (WebKitCookieManager *cookie_manager,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
+webkit_cookie_manager_get_domains_with_cookies (WebKitCookieManager *cookie_manager,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
WEBKIT_API gchar **
-webkit_cookie_manager_get_domains_with_cookies_finish (WebKitCookieManager *cookie_manager,
- GAsyncResult *result,
- GError **error);
+webkit_cookie_manager_get_domains_with_cookies_finish (WebKitCookieManager *cookie_manager,
+ GAsyncResult *result,
+ GError **error);
WEBKIT_API void
-webkit_cookie_manager_delete_cookies_for_domain (WebKitCookieManager *cookie_manager,
- const gchar *domain);
+webkit_cookie_manager_delete_cookies_for_domain (WebKitCookieManager *cookie_manager,
+ const gchar *domain);
WEBKIT_API void
-webkit_cookie_manager_delete_all_cookies (WebKitCookieManager *cookie_manager);
+webkit_cookie_manager_delete_all_cookies (WebKitCookieManager *cookie_manager);
G_END_DECLS
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
index 360137e16..56be3c767 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
@@ -48,6 +48,7 @@ enum {
typedef enum {
FindOperation,
+ FindNextPrevOperation,
CountOperation
} WebKitFindControllerOperation;
@@ -345,17 +346,22 @@ static void webKitFindControllerPerform(WebKitFindController* findController, We
WKRetainPtr<WKStringRef> wkSearchText(AdoptWK, WKStringCreateWithUTF8CString(findController->priv->searchText.data()));
WKPageRef wkPage = getWKPageFromWebKitWebView(findController->priv->webView);
- if (operation == FindOperation) {
- // Unconditionally highlight text matches. WK1 API was forcing
- // clients to enable/disable highlighting. Since most of them
- // (all?) where using highlighting we decided to simplify the
- // WK2 API and unconditionally show highlights.
- wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight);
- WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount);
+ if (operation == CountOperation) {
+ WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount);
return;
}
- WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount);
+ if (operation == FindOperation)
+ // Unconditionally highlight text matches when the search
+ // starts. WK1 API was forcing clients to enable/disable
+ // highlighting. Since most of them (all?) where using that
+ // feature we decided to simplify the WK2 API and
+ // unconditionally show highlights. Both search_next() and
+ // search_prev() should not enable highlighting to avoid an
+ // extra unmarkAllTextMatches() + markAllTextMatches()
+ wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight);
+
+ WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount);
}
static inline void webKitFindControllerSetSearchData(WebKitFindController* findController, const gchar* searchText, guint32 findOptions, guint maxMatchCount)
@@ -415,7 +421,8 @@ void webkit_find_controller_search_next(WebKitFindController* findController)
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
findController->priv->findOptions = findController->priv->findOptions & ~WEBKIT_FIND_OPTIONS_BACKWARDS;
- webKitFindControllerPerform(findController, FindOperation);
+ findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight;
+ webKitFindControllerPerform(findController, FindNextPrevOperation);
}
/**
@@ -432,7 +439,8 @@ void webkit_find_controller_search_previous(WebKitFindController* findController
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
findController->priv->findOptions = findController->priv->findOptions | WEBKIT_FIND_OPTIONS_BACKWARDS;
- webKitFindControllerPerform(findController, FindOperation);
+ findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight;
+ webKitFindControllerPerform(findController, FindNextPrevOperation);
}
/**
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
index 034768cb0..8115d63dd 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
@@ -277,7 +277,8 @@ static bool stringIsEqualToCString(const String& string, const CString& cString)
bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, WKHitTestResultRef wkHitTestResult)
{
WebKitHitTestResultPrivate* priv = hitTestResult->priv;
- return stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteLinkURL(), priv->linkURI)
+ return WKHitTestResultIsContentEditable(wkHitTestResult) == webkit_hit_test_result_context_is_editable(hitTestResult)
+ && stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteLinkURL(), priv->linkURI)
&& stringIsEqualToCString(toImpl(wkHitTestResult)->linkTitle(), priv->linkTitle)
&& stringIsEqualToCString(toImpl(wkHitTestResult)->linkLabel(), priv->linkLabel)
&& stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteImageURL(), priv->imageURI)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
index e30e51d46..8cd149c5b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
@@ -22,6 +22,7 @@
#include "WebKitLoaderClient.h"
#include "WebKitBackForwardListPrivate.h"
+#include "WebKitURIResponsePrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include <wtf/gobject/GOwnPtr.h>
@@ -64,7 +65,16 @@ static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED);
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(clientInfo);
+ WebKitWebResource* resource = webkit_web_view_get_main_resource(webView);
+ if (resource) {
+ // We might not have a resource if this load is a content replacement.
+ // FIXME: For some reason, when going back/forward this callback is emitted even before
+ // didInitiateLoadForResource(), so we don't have a main resource at this point either.
+ webkitURIResponseSetCertificateInfo(webkit_web_resource_get_response(resource), WKFrameGetCertificateInfo(frame));
+ }
+
+ webkitWebViewLoadChanged(webView, WEBKIT_LOAD_COMMITTED);
}
static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
index 93f83c2de..43ec3338d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "WebKitURIResponse.h"
+#include "PlatformCertificateInfo.h"
+#include "WebCertificateInfo.h"
#include "WebKitPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include <glib/gi18n-lib.h>
@@ -34,6 +36,7 @@ enum {
PROP_MIME_TYPE
};
+using namespace WebKit;
using namespace WebCore;
G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT)
@@ -202,6 +205,31 @@ const gchar* webkit_uri_response_get_mime_type(WebKitURIResponse* response)
return response->priv->mimeType.data();
}
+/**
+ * webkit_uri_response_get_https_status:
+ * @response: a #WebKitURIResponse
+ * @certificate: (out) (transfer none): return location for a #GTlsCertificate
+ * @errors: (out): return location for a #GTlsCertificateFlags the verification status of @certificate
+ *
+ * Retrieves the #GTlsCertificate associated with the @response connection,
+ * and the #GTlsCertificateFlags showing what problems, if any, have been found
+ * with that certificate.
+ * If the response connection is not HTTPS, this function returns %FALSE.
+ *
+ * Returns: %TRUE if @response connection uses HTTPS or %FALSE otherwise.
+ */
+gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsCertificate** certificate, GTlsCertificateFlags* errors)
+{
+ g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), FALSE);
+
+ if (certificate)
+ *certificate = response->priv->resourceResponse.soupMessageCertificate();
+ if (errors)
+ *errors = response->priv->resourceResponse.soupMessageTLSErrors();
+
+ return !!response->priv->resourceResponse.soupMessageCertificate();
+}
+
WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse)
{
WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL));
@@ -213,3 +241,10 @@ const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIR
{
return uriResponse->priv->resourceResponse;
}
+
+void webkitURIResponseSetCertificateInfo(WebKitURIResponse* response, WKCertificateInfoRef wkCertificate)
+{
+ const PlatformCertificateInfo& certificateInfo = toImpl(wkCertificate)->platformCertificateInfo();
+ response->priv->resourceResponse.setSoupMessageCertificate(certificateInfo.certificate());
+ response->priv->resourceResponse.setSoupMessageTLSErrors(certificateInfo.tlsErrors());
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
index 0cc6c8959..19705921a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
@@ -24,7 +24,7 @@
#ifndef WebKitURIResponse_h
#define WebKitURIResponse_h
-#include <glib-object.h>
+#include <gio/gio.h>
#include <webkit2/WebKitDefines.h>
G_BEGIN_DECLS
@@ -56,16 +56,21 @@ WEBKIT_API GType
webkit_uri_response_get_type (void);
WEBKIT_API const gchar *
-webkit_uri_response_get_uri (WebKitURIResponse *response);
+webkit_uri_response_get_uri (WebKitURIResponse *response);
WEBKIT_API guint
-webkit_uri_response_get_status_code (WebKitURIResponse *response);
+webkit_uri_response_get_status_code (WebKitURIResponse *response);
WEBKIT_API guint64
-webkit_uri_response_get_content_length (WebKitURIResponse *response);
+webkit_uri_response_get_content_length (WebKitURIResponse *response);
WEBKIT_API const gchar *
-webkit_uri_response_get_mime_type (WebKitURIResponse *response);
+webkit_uri_response_get_mime_type (WebKitURIResponse *response);
+
+WEBKIT_API gboolean
+webkit_uri_response_get_https_status (WebKitURIResponse *response,
+ GTlsCertificate **certificate,
+ GTlsCertificateFlags *errors);
G_END_DECLS
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
index c2dc49c17..957c9ce77 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
@@ -31,5 +31,6 @@
WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse&);
const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse*);
+void webkitURIResponseSetCertificateInfo(WebKitURIResponse*, WKCertificateInfoRef);
#endif // WebKitURIResponsePrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
index ed66eb479..f5c84753c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
@@ -315,6 +315,7 @@ webkit_uri_response_get_uri
webkit_uri_response_get_status_code
webkit_uri_response_get_content_length
webkit_uri_response_get_mime_type
+webkit_uri_response_get_https_status
<SUBSECTION Standard>
WebKitURIResponseClass
@@ -636,7 +637,9 @@ webkit_find_controller_get_type
<SECTION>
<FILE>WebKitCookieManager</FILE>
WebKitCookieManager
+WebKitCookiePersistentStorage
WebKitCookieAcceptPolicy
+webkit_cookie_manager_set_persistent_storage
webkit_cookie_manager_set_accept_policy
webkit_cookie_manager_get_accept_policy
webkit_cookie_manager_get_accept_policy_finish
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
index 058a613f1..919202522 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
@@ -9,6 +9,7 @@ TEST_PROGS += \
Programs/WebKit2APITests/TestLoaderClient \
Programs/WebKit2APITests/TestPrinting \
Programs/WebKit2APITests/TestResources \
+ Programs/WebKit2APITests/TestSSL \
Programs/WebKit2APITests/TestWebKitVersion \
Programs/WebKit2APITests/TestWebKitFindController \
Programs/WebKit2APITests/TestWebKitPolicyClient \
@@ -174,4 +175,10 @@ Programs_WebKit2APITests_TestContextMenu_CPPFLAGS = $(webkit2_tests_cppflags)
Programs_WebKit2APITests_TestContextMenu_LDADD = $(webkit2_tests_ldadd)
Programs_WebKit2APITests_TestContextMenu_LDFLAGS = $(webkit2_tests_ldflags)
+Programs_WebKit2APITests_TestSSL_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp
+Programs_WebKit2APITests_TestSSL_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestSSL_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestSSL_LDFLAGS = $(webkit2_tests_ldflags)
+
endif # ENABLE_WEBKIT2
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp
index 1ddfd82bf..2fe8998b5 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp
@@ -21,8 +21,10 @@
#include "WebKitTestServer.h"
#include "WebViewTest.h"
+#include <glib/gstdio.h>
static WebKitTestServer* kServer;
+static char* kTempDirectory;
static const char* kFirstPartyDomain = "127.0.0.1";
static const char* kThirdPartyDomain = "localhost";
@@ -58,6 +60,30 @@ public:
{
g_strfreev(m_domains);
g_signal_handlers_disconnect_matched(m_cookieManager, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+ if (m_cookiesTextFile)
+ g_unlink(m_cookiesTextFile.get());
+ if (m_cookiesSQLiteFile)
+ g_unlink(m_cookiesSQLiteFile.get());
+ }
+
+ void setPersistentStorage(WebKitCookiePersistentStorage storage)
+ {
+ const char* filename = 0;
+ switch (storage) {
+ case WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT:
+ if (!m_cookiesTextFile)
+ m_cookiesTextFile.set(g_build_filename(kTempDirectory, "cookies.txt", NULL));
+ filename = m_cookiesTextFile.get();
+ break;
+ case WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE:
+ if (!m_cookiesSQLiteFile)
+ m_cookiesSQLiteFile.set(g_build_filename(kTempDirectory, "cookies.db", NULL));
+ filename = m_cookiesSQLiteFile.get();
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ webkit_cookie_manager_set_persistent_storage(m_cookieManager, filename, storage);
}
static void getAcceptPolicyReadyCallback(GObject* object, GAsyncResult* result, gpointer userData)
@@ -129,6 +155,8 @@ public:
char** m_domains;
bool m_cookiesChanged;
bool m_finishLoopWhenCookiesChange;
+ GOwnPtr<char> m_cookiesTextFile;
+ GOwnPtr<char> m_cookiesSQLiteFile;
};
static void testCookieManagerAcceptPolicy(CookieManagerTest* test, gconstpointer)
@@ -204,6 +232,54 @@ static void testCookieManagerCookiesChanged(CookieManagerTest* test, gconstpoint
g_assert(test->m_cookiesChanged);
}
+static void testCookieManagerPersistentStorage(CookieManagerTest* test, gconstpointer)
+{
+ test->setAcceptPolicy(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);
+
+ // Text storage using a new file.
+ test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
+ char** domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 0);
+
+ test->loadURI(kServer->getURIForPath("/index.html").data());
+ test->waitUntilLoadFinished();
+ g_assert(test->m_cookiesChanged);
+ domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 2);
+
+
+ // SQLite storage using a new file.
+ test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
+ domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 0);
+
+ test->loadURI(kServer->getURIForPath("/index.html").data());
+ test->waitUntilLoadFinished();
+ g_assert(test->m_cookiesChanged);
+ domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 2);
+
+ // Text storage using an existing file.
+ test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
+ domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 2);
+ test->deleteAllCookies();
+ g_assert_cmpint(g_strv_length(test->getDomains()), ==, 0);
+
+ // SQLite storage with an existing file.
+ test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
+ domains = test->getDomains();
+ g_assert(domains);
+ g_assert_cmpint(g_strv_length(domains), ==, 2);
+ test->deleteAllCookies();
+ g_assert_cmpint(g_strv_length(test->getDomains()), ==, 0);
+}
+
static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
{
if (message->method != SOUP_METHOD_GET) {
@@ -214,10 +290,10 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
soup_message_set_status(message, SOUP_STATUS_OK);
if (g_str_equal(path, "/index.html")) {
char* indexHtml = g_strdup_printf(kIndexHtmlFormat, soup_server_get_port(server));
- soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar");
+ soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar; Max-Age=60");
soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, indexHtml, strlen(indexHtml));
} else if (g_str_equal(path, "/image.png"))
- soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux");
+ soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60");
else
g_assert_not_reached();
soup_message_body_complete(message->response_body);
@@ -228,12 +304,17 @@ void beforeAll()
kServer = new WebKitTestServer();
kServer->run(serverCallback);
+ kTempDirectory = g_dir_make_tmp("WebKit2Tests-XXXXXX", 0);
+ g_assert(kTempDirectory);
+
CookieManagerTest::add("WebKitCookieManager", "accept-policy", testCookieManagerAcceptPolicy);
CookieManagerTest::add("WebKitCookieManager", "delete-cookies", testCookieManagerDeleteCookies);
CookieManagerTest::add("WebKitCookieManager", "cookies-changed", testCookieManagerCookiesChanged);
+ CookieManagerTest::add("WebKitCookieManager", "persistent-storage", testCookieManagerPersistentStorage);
}
void afterAll()
{
delete kServer;
+ g_rmdir(kTempDirectory);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h
index 6929c3595..6fe9de86d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h
@@ -75,6 +75,12 @@ public:
return resourcesDir.get();
}
+ static CString getResourcesDir()
+ {
+ GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit2", "UIProcess", "API", "gtk", "tests", "resources", NULL));
+ return resourcesDir.get();
+ }
+
void addLogFatalFlag(unsigned flag)
{
unsigned fatalMask = g_log_set_always_fatal(static_cast<GLogLevelFlags>(G_LOG_FATAL_MASK));
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp
new file mode 100644
index 000000000..40e9fbeee
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "LoadTrackingTest.h"
+#include "WebKitTestServer.h"
+#include <gtk/gtk.h>
+
+static WebKitTestServer* kServer;
+static const char* indexHTML = "<html><body>Testing WebKit2GTK+ SSL</body></htmll>";
+
+class SSLTest: public LoadTrackingTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(SSLTest);
+
+ SSLTest()
+ : m_tlsErrors(static_cast<GTlsCertificateFlags>(0))
+ {
+ }
+
+ virtual void loadCommitted()
+ {
+ WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView);
+ g_assert(resource);
+ WebKitURIResponse* response = webkit_web_resource_get_response(resource);
+ g_assert(response);
+
+ GTlsCertificate* certificate = 0;
+ webkit_uri_response_get_https_status(response, &certificate, &m_tlsErrors);
+ m_certificate = certificate;
+ }
+
+ void waitUntilLoadFinished()
+ {
+ m_certificate = 0;
+ m_tlsErrors = static_cast<GTlsCertificateFlags>(0);
+ LoadTrackingTest::waitUntilLoadFinished();
+ }
+
+ GRefPtr<GTlsCertificate> m_certificate;
+ GTlsCertificateFlags m_tlsErrors;
+};
+
+static void testSSL(SSLTest* test, gconstpointer)
+{
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ g_assert(test->m_certificate);
+ // We always expect errors because we are using a self-signed certificate,
+ // but only G_TLS_CERTIFICATE_UNKNOWN_CA flags should be present.
+ g_assert(test->m_tlsErrors);
+ g_assert_cmpuint(test->m_tlsErrors, ==, G_TLS_CERTIFICATE_UNKNOWN_CA);
+
+ // Non HTTPS loads shouldn't have a certificate nor errors.
+ test->loadHtml(indexHTML, 0);
+ test->waitUntilLoadFinished();
+ g_assert(!test->m_certificate);
+ g_assert(!test->m_tlsErrors);
+}
+
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+ if (message->method != SOUP_METHOD_GET) {
+ soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+ return;
+ }
+
+ soup_message_set_status(message, SOUP_STATUS_OK);
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, indexHTML, strlen(indexHTML));
+ soup_message_body_complete(message->response_body);
+}
+
+void beforeAll()
+{
+ kServer = new WebKitTestServer(WebKitTestServer::ServerHTTPS);
+ kServer->run(serverCallback);
+
+ SSLTest::add("WebKitWebView", "ssl", testSSL);
+}
+
+void afterAll()
+{
+ delete kServer;
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp
index 55a93de87..98b4a9a2b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp
@@ -20,12 +20,26 @@
#include "config.h"
#include "WebKitTestServer.h"
+#include "TestMain.h"
#include <wtf/gobject/GOwnPtr.h>
-WebKitTestServer::WebKitTestServer()
- : m_soupServer(adoptGRef(soup_server_new(SOUP_SERVER_PORT, 0, NULL)))
- , m_baseURI(soup_uri_new("http://127.0.0.1/"))
+WebKitTestServer::WebKitTestServer(ServerType type)
{
+ GOwnPtr<char> sslCertificateFile;
+ GOwnPtr<char> sslKeyFile;
+ if (type == ServerHTTPS) {
+ CString resourcesDir = Test::getResourcesDir();
+ sslCertificateFile.set(g_build_filename(resourcesDir.data(), "test-cert.pem", NULL));
+ sslKeyFile.set(g_build_filename(resourcesDir.data(), "test-key.pem", NULL));
+ }
+
+ GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT));
+ soup_address_resolve_sync(address.get(), 0);
+
+ m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_INTERFACE, address.get(),
+ SOUP_SERVER_SSL_CERT_FILE, sslCertificateFile.get(),
+ SOUP_SERVER_SSL_KEY_FILE, sslKeyFile.get(), NULL));
+ m_baseURI = type == ServerHTTPS ? soup_uri_new("https://127.0.0.1/") : soup_uri_new("http://127.0.0.1/");
soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer.get()));
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h
index 9f00349e0..d4626f6b1 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h
@@ -27,7 +27,13 @@
class WebKitTestServer {
public:
- WebKitTestServer();
+
+ enum ServerType {
+ ServerHTTP,
+ ServerHTTPS
+ };
+
+ WebKitTestServer(ServerType type = ServerHTTP);
virtual ~WebKitTestServer();
SoupURI* baseURI() { return m_baseURI; }
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem
new file mode 100644
index 000000000..b34301f25
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE-----
+MIIB9jCCAV+gAwIBAgIJALeuXBo+vwz9MA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV
+BAMMCTEyNy4wLjAuMTAeFw0xMjA3MTIxMjQ4MjRaFw0yMjA3MTAxMjQ4MjRaMBQx
+EjAQBgNVBAMMCTEyNy4wLjAuMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
+0TUzOQxHBIKDD2mkuq+tU92mQvDZg73B0G+Nhr2T2G6MbcLqIwjg1QYtBZWJ83tZ
+xMMEfiweHLF85Z9ohavAgxJlKG7YmvZO79KkFpmjV2W5CVRm0eYMPnzmxNCoaYqo
+DLl0zsH6KZOLPKu/fX4eDX9XpAP1f83hWB1UFBmHKN8CAwEAAaNQME4wHQYDVR0O
+BBYEFDHv5ZQ1BdmhzTsDUEoY55EXyUdKMB8GA1UdIwQYMBaAFDHv5ZQ1BdmhzTsD
+UEoY55EXyUdKMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAh3qMBx7v
+jSodMf3OyTqTLE7deLnmnCeBVpgzxRZEoizcGqYcjiqO27i5N5Z6KVQsnITnLiyC
+mUtuR5KnF69uTKUw4m/ugZe5whjig5Mq2l410KVK6EeG4tdLlfXR+wi4U5K4KjP6
+p4nchQUXLa2zcbJn+VBexJn6/9wdhr+DUGY=
+-----END CERTIFICATE-----
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem
new file mode 100644
index 000000000..9036222ce
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem
@@ -0,0 +1,16 @@
+-----BEGIN PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANE1MzkMRwSCgw9p
+pLqvrVPdpkLw2YO9wdBvjYa9k9hujG3C6iMI4NUGLQWVifN7WcTDBH4sHhyxfOWf
+aIWrwIMSZShu2Jr2Tu/SpBaZo1dluQlUZtHmDD585sTQqGmKqAy5dM7B+imTizyr
+v31+Hg1/V6QD9X/N4VgdVBQZhyjfAgMBAAECgYB2QwOUsRsIMprRwJ9tJNfvO7G7
+z5i1/zOrlxPC4jHMPBnIBlICwgcOhLI4oOLdr5H8R12n0VqoT7DRwP396iwlJipF
+iO1heDMn/8z8LPGwkCK/+ck04rMDksxWIdMwYKBXt9ahnJ/xRLzQ1/3AJiAGnoe5
+/QLXQweofd4mmfsjKQJBAO2CwT7uMP6nMjXgtVMJq5QP8UbeCS1sEOPJJbHuDxJB
+/HePQHBjq4kzG6CL4oO7T+5fDv4g+fIIHzuXerZ0imsCQQDhfmiTIc9OucEIfg6/
+ms0JiKSmWc+qoiOCtrILuQvFoNwJRciQANqeJs6wpaDvevSUvBLGfG/7b3HvaE5X
+iqBdAkBEQIvp2qcHtuJN60oQF7pPrRknxUyb2e8sljQX4pJAK+gyL19ULMAxiBdL
+Vod8VYqNtJFpY+6Pp9fZ1xjzb6ALAkEA4JzrDAw0lQXA+3WduUw4ixOadr2ldyG0
+36KebcDwsfZO18m0Q4UmPz0Gy7zgN0wxzuochaw0W6+iPUiYKOlEXQJBAMWQrPlu
+rrinoZS2f8doJ9BNNUa+RNpMug6UXc55qoUJlyiXEh+tu4AaMOtxuGIyC0sAcuw6
+XdAPVPXKd7Mne70=
+-----END PRIVATE KEY-----
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
index 91fcf34b2..6a02f562d 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -504,7 +504,7 @@ bool PDFViewController::forwardScrollWheelEvent(NSEvent *wheelEvent)
return true;
}
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static IMP oldPDFViewScrollView_scrollWheel;
static WKPDFView *findEnclosingWKPDFView(NSView *view)
@@ -557,7 +557,7 @@ NSBundle* PDFViewController::pdfKitBundle()
if (![pdfKitBundle load])
LOG_ERROR("Couldn't load PDFKit.framework");
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (Class pdfViewScrollViewClass = [pdfKitBundle classNamed:@"PDFViewScrollView"]) {
if (Method scrollWheel = class_getInstanceMethod(pdfViewScrollViewClass, @selector(scrollWheel:)))
oldPDFViewScrollView_scrollWheel = method_setImplementation(scrollWheel, reinterpret_cast<IMP>(PDFViewScrollView_scrollWheel));
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 457ce921f..b31946b3c 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -472,7 +472,7 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale
NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// Convert to screen coordinates.
textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
@@ -487,7 +487,7 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale
void PageClientImpl::dismissDictionaryLookupPanel()
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
WKHideWordDefinitionWindow();
#endif
}
@@ -519,7 +519,7 @@ String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAl
void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
#endif
@@ -527,7 +527,7 @@ void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType res
void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
NSArray *trackingAreas = [m_wkView trackingAreas];
NSUInteger count = [trackingAreas count];
ASSERT(count == 1);
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index e883215fd..27f233b69 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -104,7 +104,7 @@
@end
@interface NSWindow (WKNSWindowDetails)
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
- (NSRect)_growBoxRect;
- (id)_growBoxOwner;
- (void)_setShowOpaqueGrowBoxForOwner:(id)owner;
@@ -957,7 +957,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
- (void)displayIfNeeded
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// FIXME: We should remove this code when <rdar://problem/9362085> is resolved. In the meantime,
// it is necessary to disable scren updates so we get a chance to redraw the corners before this
// display is visible.
@@ -969,7 +969,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
[super displayIfNeeded];
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (shouldMaskWindow) {
[window _maskRoundedBottomCorners:_data->_windowBottomCornerIntersectionRect];
NSEnableScreenUpdates();
@@ -1666,7 +1666,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
_data->_page->dragUpdated(&dragData, [[draggingInfo draggingPasteboard] name]);
WebCore::DragSession dragSession = _data->_page->dragSession();
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
NSInteger numberOfValidItemsForDrop = dragSession.numberOfItemsToBeAccepted;
NSDraggingFormation draggingFormation = NSDraggingFormationNone;
if (dragSession.mouseIsOverFileInput && numberOfValidItemsForDrop > 0)
@@ -1778,7 +1778,7 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb
}
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
- (BOOL)_ownsWindowGrowBox
{
NSWindow* window = [self window];
@@ -1888,7 +1888,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
[self removeWindowObservers];
[self addWindowObserversForWindow:window];
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
if ([currentWindow _growBoxOwner] == self)
[currentWindow _setShowOpaqueGrowBoxForOwner:nil];
#endif
@@ -1927,7 +1927,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
_data->_endGestureMonitor = nil;
}
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
WKHideWordDefinitionWindow();
#endif
}
@@ -2209,7 +2209,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (float)_intrinsicDeviceScaleFactor
{
NSWindow *window = [self window];
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (window)
return [window backingScaleFactor];
return [[NSScreen mainScreen] backingScaleFactor];
@@ -2234,7 +2234,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
return NO;
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
- (void)quickLookWithEvent:(NSEvent *)event
{
NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil];
@@ -2865,7 +2865,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
- (void)_didChangeScrollbarsForMainFrame
{
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
[self _updateGrowBoxForWindowFrameChange];
#endif
}
@@ -2906,7 +2906,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
- (void)_cacheWindowBottomCornerRect
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// FIXME: We should remove this code when <rdar://problem/9362085> is resolved.
NSWindow *window = [self window];
if (!window)
@@ -2967,7 +2967,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
// Legacy style scrollbars have design details that rely on tracking the mouse all the time.
NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy)
options |= NSTrackingActiveAlways;
else
@@ -3009,7 +3009,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
return self;
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
- (BOOL)wantsUpdateLayer
{
return [self _shouldUseTiledDrawingArea];
@@ -3095,7 +3095,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
+ (void)hideWordDefinitionWindow
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
WKHideWordDefinitionWindow();
#endif
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 046d80339..25bf2e7df 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -1655,6 +1655,38 @@ void QQuickWebView::platformInitialize()
WTF::initializeMainThread();
}
+bool QQuickWebView::childMouseEventFilter(QQuickItem* item, QEvent* event)
+{
+ if (!isVisible() || !isEnabled() || !s_flickableViewportEnabled)
+ return QQuickFlickable::childMouseEventFilter(item, event);
+
+ // This function is used by MultiPointTouchArea and PinchArea to filter
+ // touch events, thus to hinder the canvas from sending synthesized
+ // mouse events to the Flickable implementation we need to reimplement
+ // childMouseEventFilter and filter incoming touch events as well.
+
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ mousePressEvent(static_cast<QMouseEvent*>(event));
+ return event->isAccepted();
+ case QEvent::MouseMove:
+ mouseMoveEvent(static_cast<QMouseEvent*>(event));
+ return event->isAccepted();
+ case QEvent::MouseButtonRelease:
+ mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ return event->isAccepted();
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ touchEvent(static_cast<QTouchEvent*>(event));
+ return event->isAccepted();
+ default:
+ break;
+ }
+
+ return QQuickFlickable::childMouseEventFilter(item, event);
+}
+
void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
{
Q_D(QQuickWebView);
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
index e2c8c0dad..ceaab68a0 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
@@ -168,6 +168,7 @@ Q_SIGNALS:
void navigationRequested(QWebNavigationRequest* request);
protected:
+ virtual bool childMouseEventFilter(QQuickItem*, QEvent*);
virtual void geometryChanged(const QRectF&, const QRectF&);
virtual void componentComplete();
virtual void keyPressEvent(QKeyEvent*);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp
index c4c1af825..45697a22b 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp
@@ -25,13 +25,13 @@
#include <WebKit2/WKBase.h>
#include <WebKit2/WKRetainPtr.h>
-
class QWebPermissionRequestPrivate : public QSharedData {
public:
- QWebPermissionRequestPrivate(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest)
+ QWebPermissionRequestPrivate(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef geo = 0, WKNotificationPermissionRequestRef notify = 0, QWebPermissionRequest::RequestType reqType = QWebPermissionRequest::Geolocation)
: origin(securityOrigin)
- , type(QWebPermissionRequest::Geolocation)
- , request(permissionRequest)
+ , geolocationRequest(geo)
+ , notificationRequest(notify)
+ , type(reqType)
, allow(false)
{
WKRetainPtr<WKStringRef> url = adoptWK(WKSecurityOriginCopyProtocol(origin.get()));
@@ -48,8 +48,9 @@ public:
}
WKRetainPtr<WKSecurityOriginRef> origin;
+ WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationRequest;
+ WKRetainPtr<WKNotificationPermissionRequestRef> notificationRequest;
QWebPermissionRequest::RequestType type;
- WKRetainPtr<WKGeolocationPermissionRequestRef> request;
QtWebSecurityOrigin securityInfo;
bool allow;
};
@@ -59,9 +60,18 @@ QWebPermissionRequest* QWebPermissionRequest::create(WKSecurityOriginRef origin,
return new QWebPermissionRequest(origin, request);
}
-QWebPermissionRequest::QWebPermissionRequest(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest, QObject* parent)
+QWebPermissionRequest* QWebPermissionRequest::create(WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request)
+{
+ return new QWebPermissionRequest(origin, 0, request, QWebPermissionRequest::Notification);
+}
+
+QWebPermissionRequest::QWebPermissionRequest(WKSecurityOriginRef securityOrigin
+ , WKGeolocationPermissionRequestRef geo
+ , WKNotificationPermissionRequestRef notify
+ , QWebPermissionRequest::RequestType type
+ , QObject* parent)
: QObject(parent)
- , d(new QWebPermissionRequestPrivate(securityOrigin, permissionRequest))
+ , d(new QWebPermissionRequestPrivate(securityOrigin, geo, notify, type))
{
}
@@ -80,9 +90,16 @@ void QWebPermissionRequest::setAllow(bool accepted)
switch (type()) {
case Geolocation: {
if (accepted)
- WKGeolocationPermissionRequestAllow(d->request.get());
+ WKGeolocationPermissionRequestAllow(d->geolocationRequest.get());
+ else
+ WKGeolocationPermissionRequestDeny(d->geolocationRequest.get());
+ break;
+ }
+ case Notification: {
+ if (accepted)
+ WKNotificationPermissionRequestAllow(d->notificationRequest.get());
else
- WKGeolocationPermissionRequestDeny(d->request.get());
+ WKNotificationPermissionRequestDeny(d->notificationRequest.get());
break;
}
default:
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h
index 4708b71a6..000252bdb 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h
@@ -26,6 +26,7 @@
#include <QtCore/QObject>
#include <QtCore/qshareddata.h>
#include <WebKit2/WKGeolocationPermissionRequest.h>
+#include <WebKit2/WKNotificationPermissionRequest.h>
#include <WebKit2/WKSecurityOrigin.h>
class QWebPermissionRequestPrivate;
@@ -39,10 +40,12 @@ class QWEBKIT_EXPORT QWebPermissionRequest : public QObject {
public:
enum RequestType {
- Geolocation
+ Geolocation,
+ Notification
};
static QWebPermissionRequest* create(WKSecurityOriginRef, WKGeolocationPermissionRequestRef);
+ static QWebPermissionRequest* create(WKSecurityOriginRef, WKNotificationPermissionRequestRef);
virtual ~QWebPermissionRequest();
RequestType type() const;
@@ -54,7 +57,11 @@ public Q_SLOTS:
private:
friend class QWebPermissionRequestPrivate;
- QWebPermissionRequest(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest, QObject* parent = 0);
+ QWebPermissionRequest(WKSecurityOriginRef securityOrigin
+ , WKGeolocationPermissionRequestRef geo = 0
+ , WKNotificationPermissionRequestRef notify = 0
+ , QWebPermissionRequest::RequestType type = Geolocation
+ , QObject* parent = 0);
private:
QExplicitlySharedDataPointer<QWebPermissionRequestPrivate> d;
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml
new file mode 100644
index 000000000..aa432f60c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+
+WebView {
+ id: webView
+ width: 200
+ height: 200
+
+ property bool expectedPermission: false
+
+ SignalSpy {
+ id: spy
+ target: experimental
+ signalName: "permissionRequested"
+ }
+
+ experimental.onPermissionRequested: {
+ // Must be false by default
+ if (!permission.allow) {
+ permission.allow = true
+ } else {
+ console.log("Fail: permission must be set to false")
+ }
+
+ if (permission.type == PermissionRequest.Notification) {
+ console.log("Permission is Desktop Notification")
+ }
+ }
+
+ TestCase {
+ name: "WebViewDesktopNotificationPermission"
+
+ // Delayed windowShown to workaround problems with Qt5 in debug mode.
+ when: false
+ Timer {
+ running: parent.windowShown
+ repeat: false
+ interval: 1
+ onTriggered: parent.when = true
+ }
+
+ function init() {
+ spy.clear()
+ }
+
+ function test_permissionRequest() {
+ compare(spy.count, 0)
+ webView.url = Qt.resolvedUrl("../common/notification.html")
+ spy.wait()
+ compare(spy.count, 1)
+ }
+ }
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html
new file mode 100644
index 000000000..b53533eb0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <title>Desktop Notification Permission test</title>
+ <script>
+ requestPermission = function(cb) {
+ window.webkitNotifications.requestPermission(function() {
+ if (cb)
+ cb(window.webkitNotifications.checkPermission() == 0);
+ });
+ }
+ requestPermission()
+ </script>
+</head>
+
+<body>
+ Desktop Notification test
+</body>
+
+</html>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
index 4d9ce7ba1..a81778270 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
@@ -58,6 +58,7 @@ private slots:
void transparentWebViews();
void inputMethod();
+ void basicRenderingSanity();
private:
void prepareWebViewComponent();
@@ -329,6 +330,28 @@ void tst_QQuickWebView::multipleWebViews()
QTest::qWait(200);
}
+void tst_QQuickWebView::basicRenderingSanity()
+{
+ showWebView();
+ webView()->setSize(QSizeF(300, 400));
+
+ webView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"#00ff00\"></body></html>")));
+ QVERIFY(waitForLoadSucceeded(webView()));
+
+ // We have to explicitly move the window into the screen, otherwise it's not rendered.
+ m_window->setGeometry(0, 0, 300, 400);
+ m_window->show();
+ // This should not crash.
+ webView()->setVisible(true);
+ QTest::qWait(200);
+ QImage grabbedWindow = m_window->grabFrameBuffer();
+ QRgb testColor = qRgba(0, 0xff, 0, 0xff);
+ QVERIFY(grabbedWindow.pixel(10, 10) == testColor);
+ QVERIFY(grabbedWindow.pixel(100, 10) == testColor);
+ QVERIFY(grabbedWindow.pixel(10, 100) == testColor);
+ QVERIFY(grabbedWindow.pixel(100, 100) == testColor);
+}
+
void tst_QQuickWebView::titleUpdate()
{
QSignalSpy titleSpy(webView(), SIGNAL(titleChanged()));
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
index 9f6888180..b322bacd4 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
@@ -58,15 +58,16 @@ static WKPageGroupRef webPageGroup(const QString& name)
class WebView : public QObject, public QRawWebViewClient {
Q_OBJECT
public:
- WebView(const QSize& size)
+ WebView(const QSize& size, bool transparent = false)
{
WKPageLoaderClient loaderClient;
memset(&loaderClient, 0, sizeof(WKPageLoaderClient));
loaderClient.clientInfo = this;
- loaderClient.didFinishLoadForFrame = WebView::finishLoadForFrame;
+ loaderClient.didFirstVisuallyNonEmptyLayoutForFrame = WebView::finishFirstLayoutForFrame;
m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this);
WKPageSetPageLoaderClient(m_webView->pageRef(), &loaderClient);
+ m_webView->setTransparentBackground(transparent);
m_webView->create();
WKPageSetUseFixedLayout(m_webView->pageRef(), true);
@@ -91,8 +92,6 @@ public:
virtual void viewNeedsDisplay(const QRect&)
{
m_webView->paint(QMatrix4x4(), 1, 0);
- if (m_frameLoaded)
- emit loaded();
}
virtual void viewRequestedScroll(const QPoint&) { }
@@ -103,7 +102,26 @@ public:
virtual void doneWithKeyEvent(const QKeyEvent*, bool wasHandled) { }
virtual void doneWithTouchEvent(const QTouchEvent*, bool wasHandled) { }
- static void finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
+ void frameLoaded()
+ {
+ m_frameLoaded = true;
+ WKPageForceRepaint(m_webView->pageRef(), this, finishForceRepaint);
+ }
+
+ void onRepaintDone()
+ {
+ emit loaded();
+ }
+
+ static void finishForceRepaint(WKErrorRef, void* context)
+ {
+ static_cast<WebView*>(context)->onRepaintDone();
+ }
+
+ static void finishFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+ {
+ static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded();
+ }
signals:
void loaded();
@@ -113,12 +131,6 @@ private:
bool m_frameLoaded;
};
-void WebView::finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- WebView* obj = static_cast<WebView*>(const_cast<void*>(clientInfo));
- obj->m_frameLoaded = true;
-}
-
static bool compareImages(const QImage& i1, const QImage& i2, int count)
{
if (i1.size() != i2.size())
@@ -169,37 +181,31 @@ void tst_qrawwebview::doPaint(const QSize& size)
void tst_qrawwebview::doNoBackground1(const QSize& size)
{
- WebView view(size);
- view.setTransparentBackground(true);
+ WebView view(size, true);
view.load(m_baseUrl + "/redsquare.html");
view.load(m_baseUrl + "/bluesquare.html");
}
void tst_qrawwebview::doNoBackground2(const QSize& size)
{
- WebView view1(size);
- view1.setTransparentBackground(true);
+ WebView view1(size, true);
view1.load(m_baseUrl + "/redsquare.html");
- WebView view2(size);
- view2.setTransparentBackground(true);
+ WebView view2(size, true);
view2.load(m_baseUrl + "/bluesquare.html");
}
void tst_qrawwebview::doNoBackground3(const QSize& size)
{
- WebView view1(size);
- view1.setTransparentBackground(false);
+ WebView view1(size, false);
view1.load(m_baseUrl + "/redsquare.html");
- WebView view2(size);
- view2.setTransparentBackground(true);
+ WebView view2(size, true);
view2.load(m_baseUrl + "/bluesquare.html");
}
void tst_qrawwebview::run(PaintMethod method, const QString& expectation)
{
-
QWindow window;
window.setSurfaceType(QSurface::OpenGLSurface);
window.setGeometry(0, 0, 200, 200);
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
index bc1f867f3..75b2f27a6 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
@@ -31,6 +31,10 @@
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
+#ifndef NDEBUG
+#include <wtf/text/WTFString.h>
+#endif
+
namespace WebKit {
class ProcessLauncher : public ThreadSafeRefCounted<ProcessLauncher> {
@@ -54,6 +58,9 @@ public:
cpu_type_t architecture;
bool executableHeap;
#endif
+#ifndef NDEBUG
+ String processCmdPrefix;
+#endif
};
static PassRefPtr<ProcessLauncher> create(Client* client, const LaunchOptions& launchOptions)
diff --git a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp
index 14111a2d7..86dddbf61 100644
--- a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp
@@ -70,7 +70,19 @@ void ProcessLauncher::launchProcess()
executablePath = String(executablePathPtr);
}
String fullPath = executablePath + "/" + processName;
- execl(fullPath.utf8().data(), processName.utf8().data(), socket.utf8().data(), static_cast<char*>(0));
+#ifndef NDEBUG
+ if (m_launchOptions.processCmdPrefix.isEmpty())
+#endif
+ execl(fullPath.utf8().data(), processName.utf8().data(), socket.utf8().data(), static_cast<char*>(0));
+#ifndef NDEBUG
+ else {
+ String cmd = makeString(m_launchOptions.processCmdPrefix, ' ', fullPath, ' ', socket);
+ if (system(cmd.utf8().data()) == -1) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ }
+#endif
} else if (pid > 0) { // parent process;
close(sockets[0]);
m_processIdentifier = pid;
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h
index 311e59087..00b73a92a 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h
+++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h
@@ -26,7 +26,7 @@
#ifndef DynamicLinkerEnvironmentExtractor_h
#define DynamicLinkerEnvironmentExtractor_h
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#include <mach/machine.h>
#include <wtf/Noncopyable.h>
@@ -61,6 +61,6 @@ private:
} // namespace WebKit
-#endif // BUILDING_ON_SNOW_LEOPARD
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
#endif // DynamicLinkerEnvironmentExtractor_h
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm
index bfc270c69..6f35280a0 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm
@@ -26,7 +26,7 @@
#include "config.h"
#include "DynamicLinkerEnvironmentExtractor.h"
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#include "EnvironmentVariables.h"
#include <mach-o/loader.h>
@@ -201,4 +201,4 @@ void DynamicLinkerEnvironmentExtractor::getExtractedEnvironmentVariables(Environ
} // namespace WebKit
-#endif // BUILDING_ON_SNOW_LEOPARD
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp
index 72979f8f7..be0f909eb 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp
@@ -136,7 +136,7 @@ void EnvironmentVariables::copyEnvironmentVariables()
m_environmentPointer = m_environmentVariables.data();
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
const char* EnvironmentVariables::preexistingProcessServiceNameKey()
{
@@ -148,6 +148,6 @@ const char* EnvironmentVariables::preexistingProcessTypeKey()
return "WEBKIT_PREEXISTING_PROCESS_TYPE";
}
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h
index 33829398d..ff4ab1060 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h
+++ b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h
@@ -46,7 +46,7 @@ public:
char** environmentPointer() const { return m_environmentPointer; }
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static const char* preexistingProcessServiceNameKey();
static const char* preexistingProcessTypeKey();
#endif
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index dc839c84f..fab9c24f8 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -80,7 +80,7 @@ void ProcessLauncher::launchProcess()
pid_t processIdentifier = 0;
EnvironmentVariables environmentVariables;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static const char* preexistingProcessServiceName = environmentVariables.get(EnvironmentVariables::preexistingProcessServiceNameKey());
ProcessType preexistingProcessType;
if (preexistingProcessServiceName)
@@ -160,7 +160,7 @@ void ProcessLauncher::launchProcess()
// Start suspended so we can set up the termination notification handler.
flags |= POSIX_SPAWN_START_SUSPENDED;
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static const int allowExecutableHeapFlag = 0x2000;
if (m_launchOptions.executableHeap)
flags |= allowExecutableHeapFlag;
@@ -168,7 +168,7 @@ void ProcessLauncher::launchProcess()
posix_spawnattr_setflags(&attr, flags);
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], architecture);
environmentExtractor.getExtractedEnvironmentVariables(environmentVariables);
#endif
@@ -211,7 +211,7 @@ void ProcessLauncher::launchProcess()
listeningPort = MACH_PORT_NULL;
processIdentifier = 0;
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
}
#endif
diff --git a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp
index 3b0214344..dad90934c 100644
--- a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp
+++ b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp
@@ -61,15 +61,24 @@ void LayerTreeCoordinatorProxy::createTileForLayer(int layerID, int tileID, cons
updateTileForLayer(layerID, tileID, targetRect, updateInfo);
}
+static inline uint64_t createLayerTileUniqueKey(int layerID, int tileID)
+{
+ uint64_t key = layerID;
+ key <<= 32;
+ key |= tileID;
+ return key;
+}
+
void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo)
{
RefPtr<ShareableSurface> surface;
#if USE(GRAPHICS_SURFACE)
- uint32_t token = updateInfo.surfaceHandle.graphicsSurfaceToken();
- HashMap<uint32_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token);
+ uint64_t key = createLayerTileUniqueKey(layerID, tileID);
+
+ HashMap<uint64_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(key);
if (it == m_surfaces.end()) {
surface = ShareableSurface::create(updateInfo.surfaceHandle);
- m_surfaces.add(token, surface);
+ m_surfaces.add(key, surface);
} else
surface = it->second;
#else
diff --git a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h
index b4e7b7ce2..c0edb6658 100644
--- a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h
+++ b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h
@@ -79,7 +79,7 @@ protected:
DrawingAreaProxy* m_drawingAreaProxy;
RefPtr<WebLayerTreeRenderer> m_renderer;
#if USE(GRAPHICS_SURFACE)
- HashMap<uint32_t, RefPtr<ShareableSurface> > m_surfaces;
+ HashMap<uint64_t, RefPtr<ShareableSurface> > m_surfaces;
#endif
};
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index 290451a4b..3486de437 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -35,7 +35,7 @@
#import <spawn.h>
#import <wtf/text/CString.h>
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import <QuartzCore/CARemoteLayerServer.h>
#endif
@@ -120,7 +120,7 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa
{
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort];
#else
mach_port_t renderServerPort = WKInitializeRenderServer();
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 5c55636d6..381a25603 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -70,6 +70,10 @@
#include "WebBatteryManagerProxy.h"
#endif
+#if ENABLE(NETWORK_INFO)
+#include "WebNetworkInfoManagerProxy.h"
+#endif
+
#if USE(SOUP)
#include "WebSoupRequestManagerProxy.h"
#endif
@@ -143,6 +147,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_iconDatabase(WebIconDatabase::create(this))
, m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this))
, m_mediaCacheManagerProxy(WebMediaCacheManagerProxy::create(this))
+#if ENABLE(NETWORK_INFO)
+ , m_networkInfoManagerProxy(WebNetworkInfoManagerProxy::create(this))
+#endif
, m_notificationManagerProxy(WebNotificationManagerProxy::create(this))
, m_pluginSiteDataManager(WebPluginSiteDataManager::create(this))
, m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this))
@@ -210,6 +217,11 @@ WebContext::~WebContext()
m_mediaCacheManagerProxy->invalidate();
m_mediaCacheManagerProxy->clearContext();
+
+#if ENABLE(NETWORK_INFO)
+ m_networkInfoManagerProxy->invalidate();
+ m_networkInfoManagerProxy->clearContext();
+#endif
m_notificationManagerProxy->invalidate();
m_notificationManagerProxy->clearContext();
@@ -418,6 +430,9 @@ void WebContext::disconnectProcess(WebProcessProxy* process)
m_geolocationManagerProxy->invalidate();
m_keyValueStorageManagerProxy->invalidate();
m_mediaCacheManagerProxy->invalidate();
+#if ENABLE(NETWORK_INFO)
+ m_networkInfoManagerProxy->invalidate();
+#endif
m_notificationManagerProxy->invalidate();
m_resourceCacheManagerProxy->invalidate();
#if USE(SOUP)
@@ -782,6 +797,13 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
m_mediaCacheManagerProxy->didReceiveMessage(connection, messageID, arguments);
return;
}
+
+#if ENABLE(NETWORK_INFO)
+ if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) {
+ m_networkInfoManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
if (messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()) {
m_notificationManagerProxy->didReceiveMessage(connection, messageID, arguments);
@@ -835,6 +857,13 @@ void WebContext::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC:
m_iconDatabase->didReceiveSyncMessage(connection, messageID, arguments, reply);
return;
}
+
+#if ENABLE(NETWORK_INFO)
+ if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) {
+ m_networkInfoManagerProxy->didReceiveSyncMessage(connection, messageID, arguments, reply);
+ return;
+ }
+#endif
switch (messageID.get<WebContextLegacyMessage::Kind>()) {
case WebContextLegacyMessage::PostSynchronousMessage: {
@@ -940,9 +969,12 @@ bool WebContext::httpPipeliningEnabled() const
#endif
}
-void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> prpCallback)
+void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> callback)
{
- RefPtr<DictionaryCallback> callback = prpCallback;
+ if (!m_process) {
+ callback->invalidate();
+ return;
+ }
uint64_t callbackID = callback->callbackID();
m_dictionaryCallbacks.set(callbackID, callback.get());
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index a777dd317..f01561031 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -57,6 +57,9 @@ class WebGeolocationManagerProxy;
class WebIconDatabase;
class WebKeyValueStorageManagerProxy;
class WebMediaCacheManagerProxy;
+#if ENABLE(NETWORK_INFO)
+class WebNetworkInfoManagerProxy;
+#endif
class WebNotificationManagerProxy;
class WebPageGroup;
class WebPageProxy;
@@ -166,6 +169,9 @@ public:
WebIconDatabase* iconDatabase() const { return m_iconDatabase.get(); }
WebKeyValueStorageManagerProxy* keyValueStorageManagerProxy() const { return m_keyValueStorageManagerProxy.get(); }
WebMediaCacheManagerProxy* mediaCacheManagerProxy() const { return m_mediaCacheManagerProxy.get(); }
+#if ENABLE(NETWORK_INFO)
+ WebNetworkInfoManagerProxy* networkInfoManagerProxy() const { return m_networkInfoManagerProxy.get(); }
+#endif
WebNotificationManagerProxy* notificationManagerProxy() const { return m_notificationManagerProxy.get(); }
WebPluginSiteDataManager* pluginSiteDataManager() const { return m_pluginSiteDataManager.get(); }
WebResourceCacheManagerProxy* resourceCacheManagerProxy() const { return m_resourceCacheManagerProxy.get(); }
@@ -314,6 +320,9 @@ private:
RefPtr<WebIconDatabase> m_iconDatabase;
RefPtr<WebKeyValueStorageManagerProxy> m_keyValueStorageManagerProxy;
RefPtr<WebMediaCacheManagerProxy> m_mediaCacheManagerProxy;
+#if ENABLE(NETWORK_INFO)
+ RefPtr<WebNetworkInfoManagerProxy> m_networkInfoManagerProxy;
+#endif
RefPtr<WebNotificationManagerProxy> m_notificationManagerProxy;
RefPtr<WebPluginSiteDataManager> m_pluginSiteDataManager;
RefPtr<WebResourceCacheManagerProxy> m_resourceCacheManagerProxy;
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
index 7dc20d52e..cf1c15b05 100644
--- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
@@ -70,6 +70,10 @@ public:
void startObservingCookieChanges();
void stopObservingCookieChanges();
+#if USE(SOUP)
+ void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
+#endif
+
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
bool shouldTerminate(WebProcessProxy*) const;
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
index 4abe2d68d..9bacced06 100644
--- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
@@ -72,6 +72,11 @@ void WebNetworkInfoManagerProxy::didReceiveMessage(CoreIPC::Connection* connecti
didReceiveWebNetworkInfoManagerProxyMessage(connection, messageID, arguments);
}
+void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, WTF::OwnPtr<CoreIPC::ArgumentEncoder>& reply)
+{
+ didReceiveSyncWebNetworkInfoManagerProxyMessage(connection, messageID, arguments, reply);
+}
+
void WebNetworkInfoManagerProxy::startUpdating()
{
if (m_isUpdating)
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
index 660cba9b7..b7298553c 100644
--- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
@@ -59,6 +59,7 @@ public:
void providerDidChangeNetworkInformation(const WTF::AtomicString& eventType, WebNetworkInfo*);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&);
private:
explicit WebNetworkInfoManagerProxy(WebContext*);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 85709ef20..17cc2f425 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1981,7 +1981,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
// FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
// FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
m_pageClient->resetTextInputState();
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// FIXME: Should this be moved inside resetTextInputState()?
dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
m_pageClient->dismissDictionaryLookupPanel();
@@ -2551,7 +2551,7 @@ void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
void WebPageProxy::pageDidScroll()
{
m_uiClient.pageDidScroll(this);
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
#endif
}
@@ -3530,7 +3530,7 @@ void WebPageProxy::processDidCrash()
m_touchEventQueue.clear();
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
m_pageClient->dismissDictionaryLookupPanel();
#endif
@@ -3905,7 +3905,7 @@ void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)
isShowing = TextChecker::substitutionsPanelIsShowing();
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
{
m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
@@ -3925,11 +3925,11 @@ void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const Stri
{
m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
}
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void WebPageProxy::handleAlternativeTextUIResult(const String& result)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (!isClosed())
process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
#endif
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 57ab86c24..6c7e68811 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -949,12 +949,12 @@ private:
#if PLATFORM(MAC)
void substitutionsPanelIsShowing(bool&);
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
void dismissCorrectionPanel(int32_t reason);
void dismissCorrectionPanelSoon(int32_t reason, String& result);
void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#if USE(DICTATION_ALTERNATIVES)
void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 03412766d..7838d643f 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -287,7 +287,7 @@ messages -> WebPageProxy {
#if PLATFORM(MAC)
SubstitutionsPanelIsShowing() -> (bool isShowing)
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
# Autocorrection messages
ShowCorrectionPanel(int32_t panelType, WebCore::FloatRect boundingBoxOfReplacedString, String replacedString, String replacementString, Vector<String> alternativeReplacementStrings)
DismissCorrectionPanel(int32_t reason)
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index 152a72e6f..54e0ec39b 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -110,6 +110,11 @@ void WebProcessProxy::connect()
launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture;
launchOptions.executableHeap = false;
#endif
+#ifndef NDEBUG
+ const char* webProcessCmdPrefix = getenv("WEB_PROCESS_CMD_PREFIX");
+ if (webProcessCmdPrefix && *webProcessCmdPrefix)
+ launchOptions.processCmdPrefix = String::fromUTF8(webProcessCmdPrefix);
+#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
}
}
@@ -316,6 +321,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
|| messageID.is<CoreIPC::MessageClassWebIconDatabase>()
|| messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()
+#if ENABLE(NETWORK_INFO)
+ || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()
+#endif
|| messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()
#if USE(SOUP)
|| messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>()
@@ -343,7 +351,10 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
return;
}
- if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
+ if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
+#if ENABLE(NETWORK_INFO)
+ || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()
+#endif
|| messageID.is<CoreIPC::MessageClassDownloadProxy>() || messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
m_context->didReceiveSyncMessage(connection, messageID, arguments, reply);
return;
diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
index 20a63ea03..6da8a4301 100644
--- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -30,7 +30,7 @@
#import <WebCore/NotImplemented.h>
#import <wtf/RetainPtr.h>
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
@interface NSSpellChecker (WebNSSpellCheckerDetails)
- (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography;
@end
@@ -65,7 +65,7 @@ static void initializeState()
textCheckerState.isAutomaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled];
textCheckerState.isAutomaticTextReplacementEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticTextReplacementEnabled];
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled])
textCheckerState.isAutomaticSpellingCorrectionEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled];
#endif
@@ -372,7 +372,7 @@ void TextChecker::updateSpellingUIWithGrammarString(int64_t, const String& badGr
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
NSString* language = nil;
NSOrthography* orthography = nil;
NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
index e9579ab9e..5293c4889 100644
--- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
+++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
@@ -62,20 +62,19 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1;
- (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration;
@end
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
-@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)aRect;
-@end
-
-@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)rect
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
{
- NSRect frame = [self frame];
+ return [window convertRectToScreen:rect];
+}
+#else
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
+{
+ NSRect frame = [window frame];
rect.origin.x += frame.origin.x;
rect.origin.y += frame.origin.y;
return rect;
}
-@end
#endif
@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
@@ -217,8 +216,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
screen = [NSScreen mainScreen];
NSRect screenFrame = [screen frame];
- NSRect webViewFrame = [[_webView window] convertRectToScreen:
- [_webView convertRect:[_webView frame] toView:nil]];
+ NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
// Flip coordinate system:
webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame);
@@ -295,14 +293,14 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
WKWindowSetClipRect([self window], windowBounds);
NSWindow *webWindow = [_webViewPlaceholder.get() window];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
// behavior here, making sure to reset the animation behavior afterward.
NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
[webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
#endif
[webWindow orderOut:self];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
[webWindow setAnimationBehavior:animationBehavior];
#endif
@@ -352,7 +350,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
[self _updateMenuAndDockForFullScreen];
NSWindow* webWindow = [_webViewPlaceholder.get() window];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
// behavior here, making sure to reset the animation behavior afterward.
NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
@@ -368,7 +366,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
} else
[webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
[webWindow setAnimationBehavior:animationBehavior];
#endif
@@ -460,7 +458,7 @@ static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*
- (void)_updateMenuAndDockForFullScreen
{
// NSApplicationPresentationOptions is available on > 10.6 only:
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
NSScreen* fullScreenScreen = [[self window] screen];
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
index 438183a23..fcd004e23 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
@@ -33,7 +33,7 @@
#import <WebCore/PlatformPasteboard.h>
#import <sys/param.h>
-#if HAVE(HOSTED_CORE_ANIMATION) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if HAVE(HOSTED_CORE_ANIMATION) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import <QuartzCore/CARemoteLayerServer.h>
#endif
@@ -99,7 +99,7 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
#endif
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort];
#else
mach_port_t renderServerPort = WKInitializeRenderServer();
diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
index 96712bf0c..c5fe33586 100644
--- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
@@ -63,7 +63,7 @@ namespace WebKit {
#error Unknown architecture
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
static String macOSXVersionString()
{
@@ -98,7 +98,7 @@ static String macOSXVersionString()
return String::format("%d", major);
}
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
static String userVisibleWebKitVersionString()
{
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index 648119486..2236d37ee 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
@@ -118,6 +118,7 @@ void QtWebPageEventHandler::handleMouseMoveEvent(QMouseEvent* ev)
static QPointF lastPos = QPointF();
QTransform fromItemTransform = m_webPage->transformFromItem();
QPointF webPagePoint = fromItemTransform.map(ev->localPos());
+ ev->accept();
if (lastPos == webPagePoint)
return;
lastPos = webPagePoint;
@@ -139,6 +140,7 @@ void QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev)
m_previousClickButton = ev->button();
}
+ ev->accept();
m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, m_clickCount));
m_lastClick = webPagePoint;
@@ -147,6 +149,7 @@ void QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev)
void QtWebPageEventHandler::handleMouseReleaseEvent(QMouseEvent* ev)
{
+ ev->accept();
QTransform fromItemTransform = m_webPage->transformFromItem();
m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, /*eventClickCount*/ 0));
}
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp
index 6d3447b05..39e1e3d21 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp
@@ -48,6 +48,7 @@ QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView)
uiClient.mouseDidMoveOverElement = mouseDidMoveOverElement;
uiClient.exceededDatabaseQuota = exceededDatabaseQuota;
uiClient.decidePolicyForGeolocationPermissionRequest = policyForGeolocationPermissionRequest;
+ uiClient.decidePolicyForNotificationPermissionRequest = policyForNotificationPermissionRequest;
WKPageSetPageUIClient(pageRef, &uiClient);
}
@@ -161,4 +162,14 @@ void QtWebPageUIClient::policyForGeolocationPermissionRequest(WKPageRef page, WK
toQtWebPageUIClient(clientInfo)->permissionRequest(req);
}
+void QtWebPageUIClient::policyForNotificationPermissionRequest(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request, const void *clientInfo)
+{
+ if (!request)
+ return;
+
+ QWebPermissionRequest* req = QWebPermissionRequest::create(origin, request);
+ toQtWebPageUIClient(clientInfo)->permissionRequest(req);
+}
+
} // namespace WebKit
+
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h
index cdd7e407d..e8aaa826b 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h
@@ -59,6 +59,7 @@ private:
static void mouseDidMoveOverElement(WKPageRef, WKHitTestResultRef, WKEventModifiers, WKTypeRef userData, const void* clientInfo);
static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo);
static void policyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKGeolocationPermissionRequestRef, const void*);
+ static void policyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef, const void*);
QQuickWebView* m_webView;
QUrl m_lastHoveredURL;
diff --git a/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp
new file mode 100644
index 000000000..08914ed81
--- /dev/null
+++ b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 "WebCookieManagerProxy.h"
+
+#include "WebContext.h"
+#include "WebCookieManagerMessages.h"
+
+namespace WebKit {
+
+void WebCookieManagerProxy::setCookiePersistentStorage(const String& storagePath, uint32_t storageType)
+{
+ m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::SetCookiePersistentStorage(storagePath, storageType));
+}
+
+}
diff --git a/Source/WebKit2/WebKit2Prefix.h b/Source/WebKit2/WebKit2Prefix.h
index ebc0a499f..4deb6299a 100644
--- a/Source/WebKit2/WebKit2Prefix.h
+++ b/Source/WebKit2/WebKit2Prefix.h
@@ -32,7 +32,7 @@
#if PLATFORM(MAC)
-#ifndef BUILDING_ON_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#define ENABLE_WEB_PROCESS_SANDBOX 1
#endif
diff --git a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h
index c0bd1f3d1..cf78a114e 100644
--- a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h
+++ b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h
@@ -30,6 +30,10 @@
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
+#if USE(SOUP)
+#include "SoupCookiePersistentStorageType.h"
+#endif
+
namespace CoreIPC {
class ArgumentDecoder;
class Connection;
@@ -63,6 +67,10 @@ private:
void startObservingCookieChanges();
void stopObservingCookieChanges();
+#if USE(SOUP)
+ void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
+#endif
+
void didReceiveWebCookieManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
};
diff --git a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in
index 15de9b6c3..0ae1155c0 100644
--- a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in
+++ b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in
@@ -33,4 +33,8 @@
void StartObservingCookieChanges()
void StopObservingCookieChanges()
+
+#if USE(SOUP)
+ SetCookiePersistentStorage(WTF::String storagePath, uint32_t storageType)
+#endif
}
diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
index da218087a..9b3fbaf16 100644
--- a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
+++ b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
@@ -26,8 +26,12 @@
#include "config.h"
#include "WebCookieManager.h"
+#include "WebKitSoupCookieJarSqlite.h"
#include <WebCore/CookieJarSoup.h>
+#include <WebCore/ResourceHandle.h>
#include <libsoup/soup.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
using namespace WebCore;
@@ -77,4 +81,27 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
return policy;
}
+void WebCookieManager::setCookiePersistentStorage(const String& storagePath, uint32_t storageType)
+{
+ GRefPtr<SoupCookieJar> jar;
+ switch (storageType) {
+ case SoupCookiePersistentStorageText:
+ jar = adoptGRef(soup_cookie_jar_text_new(storagePath.utf8().data(), FALSE));
+ break;
+ case SoupCookiePersistentStorageSQLite:
+ jar = adoptGRef(webkitSoupCookieJarSqliteNew(storagePath));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ SoupCookieJar* currentJar = WebCore::soupCookieJar();
+ soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(currentJar));
+ SoupSession* session = ResourceHandle::defaultSession();
+ soup_session_remove_feature(session, SOUP_SESSION_FEATURE(currentJar));
+ soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar.get()));
+
+ WebCore::setSoupCookieJar(jar.get());
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
new file mode 100644
index 000000000..b60584c22
--- /dev/null
+++ b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitSoupCookieJarSqlite.h"
+
+#include <WebCore/SQLiteDatabase.h>
+#include <WebCore/SQLiteStatement.h>
+#include <WebCore/SQLiteTransaction.h>
+#include <libsoup/soup.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/MathExtras.h>
+
+using namespace WebCore;
+
+struct _WebKitSoupCookieJarSqlitePrivate {
+ String databasePath;
+ SQLiteDatabase database;
+ bool isLoading;
+};
+
+G_DEFINE_TYPE(WebKitSoupCookieJarSqlite, webkit_soup_cookie_jar_sqlite, SOUP_TYPE_COOKIE_JAR)
+
+enum {
+ ColumnID,
+ ColumnName,
+ ColumnValue,
+ ColumnHost,
+ ColumnPath,
+ ColumnExpiry,
+ ColumnLastAccess,
+ ColumnSecure,
+ ColumnHTTPOnly
+};
+
+static bool webkitSoupCookieJarSqliteOpenDatabase(WebKitSoupCookieJarSqlite* sqliteJar)
+{
+ WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv;
+ if (priv->database.isOpen())
+ return true;
+
+ ASSERT(!priv->databasePath.isEmpty());
+ if (!priv->database.open(priv->databasePath)) {
+ g_warning("Can't open database %s", priv->databasePath.utf8().data());
+ return false;
+ }
+
+ priv->database.setSynchronous(SQLiteDatabase::SyncOff);
+ priv->database.executeCommand("PRAGMA secure_delete = 1;");
+
+ return true;
+}
+
+static bool webkitSoupCookieJarSqliteCreateTable(WebKitSoupCookieJarSqlite* sqliteJar)
+{
+ WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv;
+ if (priv->database.tableExists("moz_cookies"))
+ return true;
+
+ if (!priv->database.executeCommand("CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT, expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER)")) {
+ g_warning("Failed to create table moz_cookies: (%i) - %s", priv->database.lastError(), priv->database.lastErrorMsg());
+ priv->database.close();
+
+ return false;
+ }
+
+ return true;
+}
+
+static void webkitSoupCookieJarSqliteLoad(WebKitSoupCookieJarSqlite* sqliteJar)
+{
+ if (!webkitSoupCookieJarSqliteOpenDatabase(sqliteJar))
+ return;
+ if (!webkitSoupCookieJarSqliteCreateTable(sqliteJar))
+ return;
+
+ WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv;
+ priv->isLoading = true;
+ SQLiteStatement query(priv->database, "SELECT id, name, value, host, path, expiry, lastAccessed, isSecure, isHttpOnly FROM moz_cookies;");
+ if (query.prepare() != SQLResultOk) {
+ g_warning("Failed to prepare all cookies query");
+ priv->isLoading = false;
+ return;
+ }
+
+ SoupCookieJar* jar = SOUP_COOKIE_JAR(sqliteJar);
+ time_t now = floorf(currentTime());
+ int result;
+ while ((result = query.step()) == SQLResultRow) {
+ int expireTime = query.getColumnInt(ColumnExpiry);
+ if (now >= expireTime)
+ continue;
+
+ SoupCookie* cookie = soup_cookie_new(query.getColumnText(ColumnName).utf8().data(), query.getColumnText(ColumnValue).utf8().data(),
+ query.getColumnText(ColumnHost).utf8().data(), query.getColumnText(ColumnPath).utf8().data(),
+ expireTime - now <= G_MAXINT ? expireTime - now : G_MAXINT);
+ if (query.getColumnInt(ColumnSecure))
+ soup_cookie_set_secure(cookie, TRUE);
+ if (query.getColumnInt(ColumnHTTPOnly))
+ soup_cookie_set_http_only(cookie, TRUE);
+
+ soup_cookie_jar_add_cookie(jar, cookie);
+ }
+
+ if (result != SQLResultDone)
+ g_warning("Error reading cookies from database");
+ priv->isLoading = false;
+}
+
+static bool webkitSoupCookieJarSqliteInsertCookie(WebKitSoupCookieJarSqlite* sqliteJar, SoupCookie* cookie)
+{
+ WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv;
+ SQLiteStatement query(priv->database, "INSERT INTO moz_cookies VALUES(NULL, ?, ?, ?, ?, ?, NULL, ?, ?);");
+ if (query.prepare() != SQLResultOk) {
+ g_warning("Failed to prepare insert cookies query");
+ return false;
+ }
+
+ query.bindText(1, String::fromUTF8(cookie->name));
+ query.bindText(2, String::fromUTF8(cookie->value));
+ query.bindText(3, String::fromUTF8(cookie->domain));
+ query.bindText(4, String::fromUTF8(cookie->path));
+ query.bindInt(5, static_cast<int64_t>(soup_date_to_time_t(cookie->expires)));
+ query.bindInt(6, cookie->secure);
+ query.bindInt(7, cookie->http_only);
+ if (query.step() != SQLResultDone) {
+ g_warning("Error adding cookie (name=%s, domain=%s) to database", cookie->name, cookie->name);
+ return false;
+ }
+
+ return true;
+}
+
+static bool webkitSoupCookieJarSqliteDeleteCookie(WebKitSoupCookieJarSqlite* sqliteJar, SoupCookie* cookie)
+{
+ WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv;
+ SQLiteStatement query(priv->database, "DELETE FROM moz_cookies WHERE name = (?) AND host = (?);");
+ if (query.prepare() != SQLResultOk) {
+ g_warning("Failed to prepare delete cookies query");
+ return false;
+ }
+
+ query.bindText(1, String::fromUTF8(cookie->name));
+ query.bindText(2, String::fromUTF8(cookie->domain));
+ if (query.step() != SQLResultDone) {
+ g_warning("Error deleting cookie (name=%s, domain=%s) from database", cookie->name, cookie->name);
+ return false;
+ }
+
+ return true;
+}
+
+static void webkitSoupCookieJarSqliteChanged(SoupCookieJar* jar, SoupCookie* oldCookie, SoupCookie* newCookie)
+{
+ WebKitSoupCookieJarSqlite* sqliteJar = WEBKIT_SOUP_COOKIE_JAR_SQLITE(jar);
+ if (sqliteJar->priv->isLoading)
+ return;
+ if (!webkitSoupCookieJarSqliteOpenDatabase(sqliteJar))
+ return;
+ if (!oldCookie && (!newCookie || !newCookie->expires))
+ return;
+ if (!webkitSoupCookieJarSqliteCreateTable(sqliteJar))
+ return;
+
+ SQLiteTransaction updateTransaction(sqliteJar->priv->database);
+ updateTransaction.begin();
+
+ if (oldCookie && !webkitSoupCookieJarSqliteDeleteCookie(sqliteJar, oldCookie))
+ return;
+
+ if (newCookie && newCookie->expires && !webkitSoupCookieJarSqliteInsertCookie(sqliteJar, newCookie))
+ return;
+
+ updateTransaction.commit();
+}
+
+static void webkitSoupCookieJarSqliteFinalize(GObject* object)
+{
+ WEBKIT_SOUP_COOKIE_JAR_SQLITE(object)->priv->~WebKitSoupCookieJarSqlitePrivate();
+ G_OBJECT_CLASS(webkit_soup_cookie_jar_sqlite_parent_class)->finalize(object);
+}
+
+static void webkit_soup_cookie_jar_sqlite_init(WebKitSoupCookieJarSqlite* sqliteJar)
+{
+ WebKitSoupCookieJarSqlitePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(sqliteJar, WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqlitePrivate);
+ sqliteJar->priv = priv;
+ new (priv) WebKitSoupCookieJarSqlitePrivate();
+}
+
+static void webkit_soup_cookie_jar_sqlite_class_init(WebKitSoupCookieJarSqliteClass* sqliteJarClass)
+{
+ SoupCookieJarClass* cookieJarClass = SOUP_COOKIE_JAR_CLASS(sqliteJarClass);
+ cookieJarClass->changed = webkitSoupCookieJarSqliteChanged;
+
+ GObjectClass* gObjectClass = G_OBJECT_CLASS(sqliteJarClass);
+ gObjectClass->finalize = webkitSoupCookieJarSqliteFinalize;
+
+ g_type_class_add_private(sqliteJarClass, sizeof(WebKitSoupCookieJarSqlitePrivate));
+}
+
+SoupCookieJar* webkitSoupCookieJarSqliteNew(const String& databasePath)
+{
+ ASSERT(!databasePath.isEmpty());
+ WebKitSoupCookieJarSqlite* sqliteJar = WEBKIT_SOUP_COOKIE_JAR_SQLITE(g_object_new(WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, NULL));
+ sqliteJar->priv->databasePath = databasePath;
+ webkitSoupCookieJarSqliteLoad(sqliteJar);
+ return SOUP_COOKIE_JAR(sqliteJar);
+}
diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h
new file mode 100644
index 000000000..86a09044d
--- /dev/null
+++ b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitSoupCookieJarSqlite_h
+#define WebKitSoupCookieJarSqlite_h
+
+#include <libsoup/soup-cookie-jar.h>
+#include <wtf/text/WTFString.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE (webkit_soup_cookie_jar_sqlite_get_type())
+#define WEBKIT_SOUP_COOKIE_JAR_SQLITE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqlite))
+#define WEBKIT_IS_SOUP_COOKIE_JAR_SQLITE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE))
+#define WEBKIT_SOUP_COOKIE_JAR_SQLITE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqliteClass))
+#define WEBKIT_IS_SOUP_COOKIE_JAR_SQLITE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE))
+#define WEBKIT_SOUP_COOKIE_JAR_SQLITE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqliteClass))
+
+typedef struct _WebKitSoupCookieJarSqlite WebKitSoupCookieJarSqlite;
+typedef struct _WebKitSoupCookieJarSqliteClass WebKitSoupCookieJarSqliteClass;
+typedef struct _WebKitSoupCookieJarSqlitePrivate WebKitSoupCookieJarSqlitePrivate;
+
+struct _WebKitSoupCookieJarSqlite {
+ SoupCookieJar parent;
+
+ WebKitSoupCookieJarSqlitePrivate* priv;
+};
+
+struct _WebKitSoupCookieJarSqliteClass {
+ SoupCookieJarClass parentClass;
+};
+
+GType webkit_soup_cookie_jar_sqlite_get_type();
+SoupCookieJar* webkitSoupCookieJarSqliteNew(const String& databasePath);
+
+G_END_DECLS
+
+#endif // WebKitSoupCookieJarSqlite.h
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index 759765dce..d40db796e 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -38,7 +38,7 @@
#include <WebCore/SharedBuffer.h>
#include <utility>
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#include "NetscapeSandboxFunctions.h"
#endif
@@ -507,7 +507,7 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
*(NPBool*)value = true;
break;
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && ENABLE(PLUGIN_PROCESS)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 && ENABLE(PLUGIN_PROCESS)
case WKNVSandboxFunctions:
{
*(WKNSandboxFunctions **)value = netscapeSandboxFunctions();
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
index 775e3caf6..afcc6456c 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
@@ -28,7 +28,7 @@
#if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS)
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import "PluginProcess.h"
#import "NetscapePluginModule.h"
@@ -103,7 +103,7 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths
if (profile.isNull())
exit(EX_NOPERM);
-#if !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
// Use private temporary and cache directories.
String systemDirectorySuffix = "com.apple.WebKit.PluginProcess+" + PluginProcess::shared().netscapePluginModule()->module()->bundleIdentifier();
setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0);
@@ -190,6 +190,6 @@ NPError WKN_FileStopAccessing(const char* path)
return NPERR_NO_ERROR;
}
-#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#endif // ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 729fc11cf..33370bdef 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -696,6 +696,15 @@ void WebChromeClient::scheduleCompositingLayerSync()
#endif
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+WebCore::GraphicsDeviceAdapter* WebChromeClient::graphicsDeviceAdapter() const
+{
+ if (!m_page->drawingArea())
+ return 0;
+ return m_page->drawingArea()->layerTreeHost()->graphicsDeviceAdapter();
+}
+#endif
+
#if ENABLE(TOUCH_EVENTS)
void WebChromeClient::needTouchEvents(bool needTouchEvents)
{
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index 44eccffe8..e3b3a5e84 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -189,6 +189,10 @@ private:
}
#endif
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+ virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE;
+#endif
+
#if ENABLE(TOUCH_EVENTS)
virtual void needTouchEvents(bool) OVERRIDE;
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 03d599d91..092ec68d1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -375,7 +375,7 @@ void WebEditorClient::textWillBeDeletedInTextField(Element* element)
bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType type) const
{
// This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions.
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
return type != TextCheckingTypeSpelling;
#else
return true;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
index d4ed31140..fbadd2f5e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
@@ -135,7 +135,7 @@ private:
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) OVERRIDE;
virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) OVERRIDE;
virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) OVERRIDE;
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<WebCore::TextCheckingResult>& results) OVERRIDE;
#endif
virtual void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) OVERRIDE;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h
index cfb509eae..c22213391 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h
@@ -38,7 +38,7 @@ public:
}
private:
- WebFrameNetworkingContext(WebKit::WebFrame* frame)
+ explicit WebFrameNetworkingContext(WebKit::WebFrame* frame)
: WebCore::FrameNetworkingContext(frame->coreFrame())
{
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 99fd1cd19..eb1049212 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -37,7 +37,7 @@ void InitWebCoreSystemInterface(void)
dispatch_once(&initOnce, ^{
INIT(AdvanceDefaultButtonPulseAnimation);
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
#endif
INIT(CopyCFLocalizationPreferredName);
@@ -117,7 +117,7 @@ void InitWebCoreSystemInterface(void)
INIT(SetMetadataURL);
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
INIT(IOSurfaceContextCreate);
INIT(IOSurfaceContextCreateImage);
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
@@ -156,23 +156,23 @@ void InitWebCoreSystemInterface(void)
INIT(CopyCFURLResponseSuggestedFilename);
INIT(SetCFURLResponseMIMEType);
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
INIT(CreateVMPressureDispatchOnMainQueue);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
INIT(GetMacOSXVersionString);
INIT(ExecutableWasLinkedOnOrBeforeLion);
#endif
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
INIT(CGPathAddRoundedRect);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
INIT(CFURLRequestAllowAllPostCaching);
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS)
INIT(FilterIsManagedSession);
INIT(FilterCreateInstance);
INIT(FilterRelease);
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 8955709ce..a3d1d8feb 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -97,6 +97,8 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin
bool shouldShowOverlay = false;
if (!found) {
+ m_webPage->corePage()->unmarkAllTextMatches();
+
// Clear the selection.
if (selectedFrame)
selectedFrame->selection()->clear();
@@ -114,6 +116,7 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin
if (maxMatchCount == numeric_limits<unsigned>::max())
--maxMatchCount;
+ m_webPage->corePage()->unmarkAllTextMatches();
matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1);
// Check if we have more matches than allowed.
@@ -152,8 +155,6 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin
void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
{
- m_webPage->corePage()->unmarkAllTextMatches();
-
bool found = m_webPage->corePage()->findString(string, core(options));
m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(WTF::bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount));
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
index f3e8735e5..ae099d15c 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
@@ -174,7 +174,10 @@ void LayerTreeCoordinator::scrollNonCompositedContents(const WebCore::IntRect& s
void LayerTreeCoordinator::forceRepaint()
{
+ // We need to schedule another flush, otherwise the forced paint might cancel a later expected flush.
+ // This is aligned with LayerTreeHostCA.
scheduleLayerFlush();
+ flushPendingLayerChanges();
}
void LayerTreeCoordinator::sizeDidChange(const WebCore::IntSize& newSize)
@@ -231,13 +234,27 @@ void LayerTreeCoordinator::setPageOverlayOpacity(float value)
bool LayerTreeCoordinator::flushPendingLayerChanges()
{
+ m_shouldSyncFrame = false;
bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
if (m_pageOverlayLayer)
m_pageOverlayLayer->syncCompositingStateForThisLayerOnly();
m_rootLayer->syncCompositingStateForThisLayerOnly();
- return didSync;
+
+ if (m_shouldSyncRootLayer) {
+ m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toWebGraphicsLayer(m_rootLayer.get())->id()));
+ m_shouldSyncRootLayer = false;
+ }
+
+ if (!m_shouldSyncFrame)
+ return didSync;
+
+ m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame());
+ m_waitingForUIProcess = true;
+ m_shouldSyncFrame = false;
+
+ return true;
}
void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& info)
@@ -246,6 +263,7 @@ void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& inf
m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidChangeScrollPosition(m_visibleContentsRect.location()));
m_shouldSendScrollPositionUpdate = false;
}
+
m_shouldSyncFrame = true;
m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerState(id, info));
}
@@ -344,25 +362,16 @@ void LayerTreeCoordinator::performScheduledLayerFlush()
if (!m_isValid)
return;
- m_shouldSyncFrame = false;
- flushPendingLayerChanges();
- if (!m_shouldSyncFrame)
- return;
+ if (flushPendingLayerChanges())
+ didPerformScheduledLayerFlush();
+}
- if (m_shouldSyncRootLayer) {
- m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toWebGraphicsLayer(m_rootLayer.get())->id()));
- m_shouldSyncRootLayer = false;
+void LayerTreeCoordinator::didPerformScheduledLayerFlush()
+{
+ if (m_notifyAfterScheduledLayerFlush) {
+ static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();
+ m_notifyAfterScheduledLayerFlush = false;
}
-
- m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame());
- m_waitingForUIProcess = true;
-
- if (!m_notifyAfterScheduledLayerFlush)
- return;
-
- // Let the drawing area know that we've done a flush of the layer changes.
- static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();
- m_notifyAfterScheduledLayerFlush = false;
}
void LayerTreeCoordinator::layerFlushTimerFired(Timer<LayerTreeCoordinator>*)
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h
index bc449f46a..9b5154c36 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h
@@ -104,7 +104,7 @@ private:
bool flushPendingLayerChanges();
void cancelPendingLayerFlush();
void performScheduledLayerFlush();
- void sendLayersToUI();
+ void didPerformScheduledLayerFlush();
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h
index 649c9a950..9ce8ecdad 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h
@@ -23,9 +23,9 @@
#include "FloatPoint3D.h"
#include "GraphicsLayer.h"
+#include "GraphicsLayerTransform.h"
#include "Image.h"
#include "IntSize.h"
-#include "LayerTransform.h"
#include "ShareableBitmap.h"
#include "TiledBackingStore.h"
#include "TiledBackingStoreClient.h"
@@ -165,7 +165,7 @@ private:
RefPtr<Image> m_image;
GraphicsLayer* m_maskTarget;
FloatRect m_needsDisplayRect;
- LayerTransform m_layerTransform;
+ GraphicsLayerTransform m_layerTransform;
bool m_inUpdateMode : 1;
bool m_shouldUpdateVisibleRect: 1;
bool m_shouldSyncLayerState: 1;
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
index b49cc90bd..368230cc9 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -41,6 +41,10 @@ class FloatPoint;
class IntRect;
class IntSize;
class GraphicsLayer;
+
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+struct GraphicsDeviceAdapter;
+#endif
}
namespace WebKit {
@@ -97,6 +101,10 @@ public:
virtual void setLayerHostingMode(LayerHostingMode) { }
#endif
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+ virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; }
+#endif
+
protected:
explicit LayerTreeHost(WebPage*);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 37d1e0702..2cb290e50 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -130,6 +130,10 @@
#include "WebBatteryClient.h"
#endif
+#if ENABLE(NETWORK_INFO)
+#include "WebNetworkInfoClient.h"
+#endif
+
#if ENABLE(WEB_INTENTS)
#include "IntentData.h"
#endif
@@ -276,6 +280,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
WebCore::provideDeviceMotionTo(m_page.get(), new DeviceMotionClientQt);
WebCore::provideDeviceOrientationTo(m_page.get(), new DeviceOrientationClientQt);
#endif
+#if ENABLE(NETWORK_INFO)
+ WebCore::provideNetworkInfoTo(m_page.get(), new WebNetworkInfoClient(this));
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
WebCore::provideNotification(m_page.get(), new WebNotificationClient(this));
#endif
@@ -3091,7 +3098,7 @@ bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
return platformCanHandleRequest(request);
}
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void WebPage::handleAlternativeTextUIResult(const String& result)
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index b9dac9137..d234a1da4 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -520,7 +520,7 @@ public:
void unmarkAllMisspellings();
void unmarkAllBadGrammar();
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void handleAlternativeTextUIResult(const String&);
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 38f36c2bf..75f7245f5 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -277,7 +277,7 @@ messages -> WebPage {
FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area)
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
HandleAlternativeTextUIResult(String result)
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp
index b086aa5ae..7252ad68b 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp
@@ -36,6 +36,7 @@
#include <WebCore/GraphicsLayerCA.h>
#include <WebCore/LayerChangesFlusher.h>
#include <WebCore/PlatformCALayer.h>
+#include <WebCore/SoftLinking.h>
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebKitQuartzCoreAdditions/WKCACFImage.h>
#include <WebKitQuartzCoreAdditions/WKCACFView.h>
@@ -43,9 +44,15 @@
#include <wtf/MainThread.h>
#ifdef DEBUG_ALL
-#pragma comment(lib, "WebKitQuartzCoreAdditions_debug")
+#define MODULE_NAME "WebKitQuartzCoreAdditions_debug"
#else
-#pragma comment(lib, "WebKitQuartzCoreAdditions")
+#define MODULE_NAME "WebKitQuartzCoreAdditions"
+#endif
+
+#pragma comment(lib, MODULE_NAME)
+
+#if USE(AVFOUNDATION)
+SOFT_LINK_LOADED_LIBRARY(MODULE_NAME, WKCACFViewGetD3DDevice9, IDirect3DDevice9*, _cdecl, (WKCACFViewRef view))
#endif
using namespace WebCore;
@@ -258,6 +265,17 @@ void LayerTreeHostCAWin::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
LayerTreeHostCA::setRootCompositingLayer(graphicsLayer);
}
+#if USE(AVFOUNDATION)
+WebCore::GraphicsDeviceAdapter* LayerTreeHostCAWin::graphicsDeviceAdapter() const
+{
+ if (!WKCACFViewGetD3DDevice9Ptr())
+ return 0;
+
+ return reinterpret_cast<GraphicsDeviceAdapter*>(WKCACFViewGetD3DDevice9Ptr()(m_view.get()));
+}
+#endif
+
} // namespace WebKit
+
#endif // HAVE(WKQCA)
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h
index 3d8d88513..c994a88b5 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h
+++ b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h
@@ -49,6 +49,10 @@ public:
static PassRefPtr<LayerTreeHostCAWin> create(WebPage*);
virtual ~LayerTreeHostCAWin();
+#if USE(AVFOUNDATION)
+ virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE;
+#endif
+
private:
explicit LayerTreeHostCAWin(WebPage*);
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index 22eede843..43d381ecd 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -481,7 +481,7 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
NSDictionary *options = nil;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// As context, we are going to use the surrounding paragraph of text.
VisiblePosition paragraphStart = startOfParagraph(position);
VisiblePosition paragraphEnd = endOfParagraph(position);
@@ -513,7 +513,7 @@ void WebPage::performDictionaryLookupForSelection(DictionaryPopupInfo::Type type
NSDictionary *options = nil;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
VisiblePosition selectionStart = selection.visibleStart();
VisiblePosition selectionEnd = selection.visibleEnd();
@@ -564,7 +564,7 @@ void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Fr
dictionaryPopupInfo.type = type;
dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style->fontMetrics().ascent() * pageScaleFactor()));
dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
dictionaryPopupInfo.options = (CFDictionaryRef)options;
#endif
diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
index b38c23c6c..c501e8f5b 100644
--- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
+++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
@@ -93,7 +93,7 @@
(allow file*
(subpath "/private/var/db/mds/system"))
-#if !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
(if (positive? (string-length (param "DARWIN_USER_CACHE_DIR")))
(allow file* (subpath (param "DARWIN_USER_CACHE_DIR"))))
#else
diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
index f4566d3cb..d8d0167f3 100644
--- a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
+++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
@@ -47,8 +47,7 @@ namespace WebKit {
static uint64_t getCacheDiskFreeSize(SoupCache* cache)
{
- if (!cache)
- return 0;
+ ASSERT(cache);
GOwnPtr<char> cacheDir;
g_object_get(G_OBJECT(cache), "cache-dir", &cacheDir.outPtr(), NULL);
@@ -89,8 +88,8 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
unsigned long urlCacheDiskCapacity = 0;
SoupSession* session = WebCore::ResourceHandle::defaultSession();
- SoupCache* cache = reinterpret_cast<SoupCache*>(soup_session_get_feature(session, SOUP_TYPE_CACHE));
- uint64_t diskFreeSize = getCacheDiskFreeSize(cache);
+ SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE));
+ uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
uint64_t memSize = getMemorySize();
calculateCacheSizes(cacheModel, memSize, diskFreeSize,
@@ -101,15 +100,17 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
WebCore::memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
WebCore::pageCache()->setCapacity(pageCacheCapacity);
- if (cache) {
- if (urlCacheDiskCapacity > soup_cache_get_max_size(cache))
- soup_cache_set_max_size(cache, urlCacheDiskCapacity);
- }
+ if (urlCacheDiskCapacity > soup_cache_get_max_size(cache))
+ soup_cache_set_max_size(cache, urlCacheDiskCapacity);
}
-void WebProcess::platformClearResourceCaches(ResourceCachesToClear)
+void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
{
- notImplemented();
+ if (cachesToClear == InMemoryResourceCachesOnly)
+ return;
+
+ SoupSession* session = WebCore::ResourceHandle::defaultSession();
+ soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)));
}
void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*)
@@ -119,6 +120,10 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
void WebProcess::platformTerminate()
{
+ SoupSession* session = WebCore::ResourceHandle::defaultSession();
+ SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE));
+ soup_cache_flush(cache);
+ soup_cache_dump(cache);
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
index 45b8581b6..199957f43 100644
--- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
+++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
@@ -27,6 +27,8 @@
#include "config.h"
#include "WebProcessMainGtk.h"
+#define LIBSOUP_USE_UNSTABLE_REQUEST_API
+
#include "WebAuthDialog.h"
#include "WKBase.h"
#include <WebCore/GtkAuthenticationDialog.h>
@@ -34,9 +36,12 @@
#include <WebCore/RunLoop.h>
#include <WebKit2/WebProcess.h>
#include <gtk/gtk.h>
+#include <libsoup/soup-cache.h>
#include <runtime/InitializeThreading.h>
#include <unistd.h>
#include <wtf/MainThread.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
using namespace WebCore;
@@ -70,6 +75,11 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
SOUP_SESSION_SSL_STRICT, FALSE, NULL);
+ GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL));
+ GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER));
+ soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get()));
+ soup_cache_load(soupCache.get());
+
RunLoop::run();
return 0;
diff --git a/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm b/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm
index 3f229a1b6..5759aa52f 100644
--- a/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm
+++ b/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm
@@ -26,7 +26,7 @@
#import "config.h"
#import "KeychainItemShimMethods.h"
-#if USE(SECURITY_FRAMEWORK) && defined(BUILDING_ON_SNOW_LEOPARD)
+#if USE(SECURITY_FRAMEWORK) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
#import "BlockingResponseMap.h"
#import "SecKeychainItemRequestData.h"
@@ -229,4 +229,4 @@ void initializeKeychainItemShim()
} // namespace WebKit
-#endif // USE(SECURITY_FRAMEWORK) && defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // USE(SECURITY_FRAMEWORK) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
diff --git a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
index cfe33adc3..50cbb587a 100644
--- a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
+++ b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
@@ -26,7 +26,7 @@
#import "config.h"
#import "SecItemShimMethods.h"
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import "BlockingResponseMap.h"
#import "SecItemRequestData.h"
@@ -119,4 +119,4 @@ void initializeSecItemShim()
} // namespace WebKit
-#endif // !BUILDING_ON_SNOW_LEOPARD
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
index 69f4fb10b..0a8c0a489 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
@@ -45,7 +45,7 @@
#import <objc/runtime.h>
#import <stdio.h>
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
#import "KeychainItemShimMethods.h"
#else
#import "SecItemShimMethods.h"
@@ -185,7 +185,7 @@ static void initializeSandbox(const WebProcessCreationParameters& parameters)
return;
}
-#if !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
// Use private temporary and cache directories.
String systemDirectorySuffix = "com.apple.WebProcess+" + parameters.uiProcessBundleIdentifier;
setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0);
@@ -281,7 +281,7 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
void WebProcess::initializeShim()
{
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
initializeKeychainItemShim();
#else
initializeSecItemShim();
@@ -299,14 +299,14 @@ void WebProcess::platformTerminate()
void WebProcess::secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData& response)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
didReceiveSecItemResponse(requestID, response);
#endif
}
void WebProcess::secKeychainItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecKeychainItemResponseData& response)
{
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
didReceiveSecKeychainItemResponse(requestID, response);
#endif
}
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index 48ac2f338..1b67fc6c2 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -47,7 +47,7 @@
#import <wtf/text/CString.h>
#import <wtf/text/StringBuilder.h>
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t);
#endif
@@ -73,7 +73,7 @@ int WebProcessMain(const CommandLine& commandLine)
String serviceName = commandLine["servicename"];
String clientExecutable;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
clientExecutable = commandLine["client-executable"];
#endif
@@ -89,7 +89,7 @@ int WebProcessMain(const CommandLine& commandLine)
return 2;
}
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
else {
mach_port_name_t publishedService;
mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &publishedService);
@@ -141,7 +141,7 @@ int WebProcessMain(const CommandLine& commandLine)
return EXIT_FAILURE;
}
}
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
String localization = commandLine["localization"];
RetainPtr<CFStringRef> cfLocalization(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessShim.mm b/Source/WebKit2/WebProcess/mac/WebProcessShim.mm
index 6d694419b..99166e689 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessShim.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessShim.mm
@@ -33,7 +33,7 @@
namespace WebKit {
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern "C" void WebKitWebProcessSecItemShimInitialize(const WebProcessSecItemShimCallbacks&);
@@ -70,9 +70,9 @@ void WebKitWebProcessSecItemShimInitialize(const WebProcessSecItemShimCallbacks&
secItemShimCallbacks = callbacks;
}
-#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
extern "C" void WebKitWebProcessKeychainItemShimInitialize(const WebProcessKeychainItemShimCallbacks&);
@@ -121,6 +121,6 @@ void WebKitWebProcessKeychainItemShimInitialize(const WebProcessKeychainItemShim
keychainItemShimCallbacks = callbacks;
}
-#endif // defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
} // namespace WebKit
diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def
index 864f6ec59..4c742953c 100644
--- a/Source/WebKit2/win/WebKit2.def
+++ b/Source/WebKit2/win/WebKit2.def
@@ -255,6 +255,9 @@ EXPORTS
?utf8@String@WTF@@QBE?AVCString@2@_N@Z
?view@Document@WebCore@@QBEPAVFrameView@2@XZ
?willDetachPage@FrameDestructionObserver@WebCore@@UAEXXZ
+ ??1ContextDestructionObserver@WebCore@@MAE@XZ
+ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ
+ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z
?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z
?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z
?webkitWillEnterFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z
diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def
index dfcbcdd03..fb51f6223 100644
--- a/Source/WebKit2/win/WebKit2CFLite.def
+++ b/Source/WebKit2/win/WebKit2CFLite.def
@@ -148,6 +148,9 @@ EXPORTS
??0String@WTF@@QAE@PB_W@Z
??1FrameDestructionObserver@WebCore@@MAE@XZ
??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
+ ??1ContextDestructionObserver@WebCore@@MAE@XZ
+ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ
+ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
@@ -261,6 +264,7 @@ EXPORTS
?setAllowsRoundingHacks@TextRun@WebCore@@SAX_N@Z
?profilerEnabled@InspectorController@WebCore@@QAE_NXZ
?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z
+ ??1ContextDestructionObserver@WebCore@@MAE@XZ
?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@U?$PtrHash@PAVStringImpl@WTF@@@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z
?removeURLSchemeRegisteredAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z