summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
commit5ef7c8a6a70875d4430752d146bdcb069605d71d (patch)
treef6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit2/UIProcess
parentdecad929f578d8db641febc8740649ca6c574638 (diff)
downloadqtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIntentData.cpp24
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIntentData.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h3
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp32
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp13
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp48
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp92
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp46
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp21
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp44
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp23
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html29
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html9
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp183
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp81
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp118
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp116
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp42
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h18
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp26
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp150
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h14
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp146
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp40
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp75
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp19
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp32
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h5
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm13
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp30
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/util.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/util.h4
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp4
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp4
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h2
-rw-r--r--Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp3
-rw-r--r--Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h2
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp233
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h57
-rw-r--r--Source/WebKit2/UIProcess/WebContext.messages.in15
-rw-r--r--Source/WebKit2/UIProcess/WebIntentData.cpp16
-rw-r--r--Source/WebKit2/UIProcess/WebIntentData.h16
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp433
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp96
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.h16
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.messages.in7
-rw-r--r--Source/WebKit2/UIProcess/WebTextChecker.cpp14
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp68
-rw-r--r--Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp24
-rw-r--r--Source/WebKit2/UIProcess/qt/QtDialogRunner.h2
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebContext.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h2
80 files changed, 1697 insertions, 935 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp
index 7a92db54c..92e61871c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp
@@ -31,6 +31,7 @@
#include "WKAPICast.h"
#include "WKDictionary.h"
#include "WKString.h"
+#include "WebSerializedScriptValue.h"
#if ENABLE(WEB_INTENTS)
#include "WebIntentData.h"
@@ -47,27 +48,6 @@ WKTypeID WKIntentDataGetTypeID()
#endif
}
-WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionaryRef)
-{
-#if ENABLE(WEB_INTENTS)
- IntentData intentData;
- WKStringRef action = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("action")));
- ASSERT(action);
- intentData.action = toImpl(action)->string();
- WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("type")));
- ASSERT(type);
- intentData.type = toImpl(type)->string();
- WKSerializedScriptValueRef data = static_cast<WKSerializedScriptValueRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("data")));
- if (data)
- intentData.data = toImpl(data)->dataReference().vector();
-
- RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
- return toAPI(webIntentData.release().leakRef());
-#else
- return 0;
-#endif
-}
-
WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef)
{
#if ENABLE(WEB_INTENTS)
@@ -104,7 +84,7 @@ WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef)
#endif
}
-WKStringRef WKIntentDataCopyExtra(WKIntentDataRef intentRef, WKStringRef key)
+WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key)
{
#if ENABLE(WEB_INTENTS)
return toCopiedAPI(toImpl(intentRef)->extra(toWTFString(key)));
diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.h b/Source/WebKit2/UIProcess/API/C/WKIntentData.h
index 1f809ec8d..caf1b459f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKIntentData.h
+++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.h
@@ -34,13 +34,11 @@ extern "C" {
WK_EXPORT WKTypeID WKIntentDataGetTypeID();
-WK_EXPORT WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionary);
-
WK_EXPORT WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef);
WK_EXPORT WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef);
WK_EXPORT WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef);
WK_EXPORT WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef);
-WK_EXPORT WKStringRef WKIntentDataCopyExtra(WKIntentDataRef intentRef, WKStringRef key);
+WK_EXPORT WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key);
WK_EXPORT WKDictionaryRef WKIntentDataCopyExtras(WKIntentDataRef intentRef);
#ifdef __cplusplus
diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
index c6f7a661c..6a7c53e8f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,3 +47,12 @@ WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef p
{
return toAPI(toImpl(parametersRef)->acceptMIMETypes().leakRef());
}
+
+WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parametersRef)
+{
+#if ENABLE(MEDIA_CAPTURE)
+ return toCopiedAPI(toImpl(parametersRef)->capture());
+#else
+ return 0;
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h
index 64577bad9..ddcaae265 100644
--- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h
+++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,6 +43,8 @@ WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParameters
WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parameters);
+WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp
index d2681203c..ea43df167 100644
--- a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp
+++ b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp
@@ -100,3 +100,8 @@ WKEinaSharedString& WKEinaSharedString::operator=(const char* str)
eina_stringshare_replace(&m_string, str);
return *this;
}
+
+bool WKEinaSharedString::operator==(const char* str) const
+{
+ return (!str || !m_string) ? (str == m_string) : !strcmp(m_string, str);
+}
diff --git a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h
index 83f661418..68d76f4ea 100644
--- a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h
+++ b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h
@@ -52,6 +52,9 @@ public:
ALWAYS_INLINE bool operator==(const WKEinaSharedString& other) const { return this->m_string == other.m_string; }
ALWAYS_INLINE bool operator!=(const WKEinaSharedString& other) const { return !(*this == other); }
+ bool operator==(const char* str) const;
+ ALWAYS_INLINE bool operator!=(const char* str) const { return !(*this == str); }
+
ALWAYS_INLINE operator const char* () const { return m_string; }
ALWAYS_INLINE bool isNull() const { return !m_string; }
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
index 5b8e2d7ea..acf8d5645 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
@@ -128,7 +128,8 @@ unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List* list)
*/
void ewk_back_forward_list_changed(Ewk_Back_Forward_List* list, WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems)
{
- addItemToWrapperCache(list, wkAddedItem); // Puts new item to the cache.
+ if (wkAddedItem) // Checking also here to avoid EINA_SAFETY_ON_NULL_RETURN_VAL warnings.
+ addItemToWrapperCache(list, wkAddedItem); // Puts new item to the cache.
const size_t removedItemsSize = wkRemovedItems ? WKArrayGetSize(wkRemovedItems) : 0;
for (size_t i = 0; i < removedItemsSize; ++i) {
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp
index a8586b23d..871187d2a 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp
@@ -39,16 +39,13 @@ using namespace WebKit;
struct _Ewk_Back_Forward_List_Item {
unsigned int __ref; /**< the reference count of the object */
WKRetainPtr<WKBackForwardListItemRef> wkItem;
- WKEinaSharedString uri;
- WKEinaSharedString title;
- WKEinaSharedString originalUri;
+ mutable WKEinaSharedString uri;
+ mutable WKEinaSharedString title;
+ mutable WKEinaSharedString originalUri;
_Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef)
: __ref(1)
, wkItem(itemRef)
- , uri(AdoptWK, WKBackForwardListItemCopyURL(itemRef))
- , title(AdoptWK, WKBackForwardListItemCopyTitle(itemRef))
- , originalUri(AdoptWK, WKBackForwardListItemCopyOriginalURL(itemRef))
{ }
~_Ewk_Back_Forward_List_Item()
@@ -57,6 +54,17 @@ struct _Ewk_Back_Forward_List_Item {
}
};
+#define EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem_, ...) \
+ if (!(item)) { \
+ EINA_LOG_CRIT("item is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(item)->wkItem) { \
+ EINA_LOG_CRIT("item->wkItem is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKBackForwardListItemRef wkItem_ = (item)->wkItem.get()
+
void ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item* item)
{
EINA_SAFETY_ON_NULL_RETURN(item);
@@ -75,21 +83,27 @@ void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item* item)
const char* ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item* item)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+ EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
+
+ item->uri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem));
return item->uri;
}
const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+ EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
+
+ item->title = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyTitle(wkItem));
return item->title;
}
const char* ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item* item)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+ EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
+
+ item->originalUri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(wkItem));
return item->originalUri;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp
index c41681071..a27abc40d 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp
@@ -28,6 +28,7 @@
#include "DownloadProxy.h"
#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
#include "WKRetainPtr.h"
#include "WebURLRequest.h"
#include "ewk_download_job_private.h"
@@ -50,8 +51,8 @@ struct _Ewk_Download_Job {
double startTime;
double endTime;
uint64_t downloaded; /**< length already downloaded */
- const char* destination;
- const char* suggestedFilename;
+ WKEinaSharedString destination;
+ WKEinaSharedString suggestedFilename;
_Ewk_Download_Job(DownloadProxy* download, Evas_Object* ewkView)
: __ref(1)
@@ -63,8 +64,6 @@ struct _Ewk_Download_Job {
, startTime(-1)
, endTime(-1)
, downloaded(0)
- , destination(0)
- , suggestedFilename(0)
{ }
~_Ewk_Download_Job()
@@ -74,8 +73,6 @@ struct _Ewk_Download_Job {
ewk_url_request_unref(request);
if (response)
ewk_url_response_unref(response);
- eina_stringshare_del(destination);
- eina_stringshare_del(suggestedFilename);
}
};
@@ -159,7 +156,7 @@ Eina_Bool ewk_download_job_destination_set(Ewk_Download_Job* download, const cha
EINA_SAFETY_ON_NULL_RETURN_VAL(download, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(destination, false);
- eina_stringshare_replace(&download->destination, destination);
+ download->destination = destination;
return true;
}
@@ -236,7 +233,7 @@ void ewk_download_job_suggested_filename_set(Ewk_Download_Job* download, const c
{
EINA_SAFETY_ON_NULL_RETURN(download);
- eina_stringshare_replace(&download->suggestedFilename, suggestedFilename);
+ download->suggestedFilename = suggestedFilename;
}
/**
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
index 856179346..ed5950311 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
@@ -29,6 +29,7 @@
#include "WKAPICast.h"
#include "WKArray.h"
#include "WKDictionary.h"
+#include "WKEinaSharedString.h"
#include "WKIntentData.h"
#include "WKRetainPtr.h"
#include "WKString.h"
@@ -47,26 +48,23 @@ struct _Ewk_Intent {
#if ENABLE(WEB_INTENTS)
WKRetainPtr<WKIntentDataRef> wkIntent;
#endif
- const char* action;
- const char* type;
- const char* service;
+ WKEinaSharedString action;
+ WKEinaSharedString type;
+ WKEinaSharedString service;
_Ewk_Intent(WKIntentDataRef intentRef)
: __ref(1)
#if ENABLE(WEB_INTENTS)
, wkIntent(intentRef)
+ , action(AdoptWK, WKIntentDataCopyAction(intentRef))
+ , type(AdoptWK, WKIntentDataCopyType(intentRef))
+ , service(AdoptWK, WKIntentDataCopyService(intentRef))
#endif
- , action(0)
- , type(0)
- , service(0)
{ }
~_Ewk_Intent()
{
ASSERT(!__ref);
- eina_stringshare_del(action);
- eina_stringshare_del(type);
- eina_stringshare_del(service);
}
};
@@ -103,47 +101,23 @@ void ewk_intent_unref(Ewk_Intent* intent)
const char* ewk_intent_action_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->action, toImpl(wkAction.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->action;
-#else
- return 0;
-#endif
}
const char* ewk_intent_type_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->type, toImpl(wkType.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->type;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKURLRef> wkService(AdoptWK, WKIntentDataCopyService(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->service, toImpl(wkService.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->service;
-#else
- return 0;
-#endif
}
Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent)
@@ -171,7 +145,7 @@ const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key)
EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
WKRetainPtr<WKStringRef> keyRef = adoptWK(WKStringCreateWithUTF8CString(key));
- WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtra(wkIntent, keyRef.get()));
+ WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtraValue(wkIntent, keyRef.get()));
String value = toImpl(wkValue.get())->string();
if (value.isEmpty())
return 0;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
index 18422b757..19215724b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
@@ -28,6 +28,7 @@
#include "IntentServiceInfo.h"
#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
#include "WKIntentServiceInfo.h"
#include "WKRetainPtr.h"
#include "WKURL.h"
@@ -42,49 +43,30 @@ using namespace WebKit;
*/
struct _Ewk_Intent_Service {
unsigned int __ref; /**< the reference count of the object */
-#if ENABLE(WEB_INTENTS_TAG)
- WKRetainPtr<WKIntentServiceInfoRef> wkService;
-#endif
- const char* action;
- const char* type;
- const char* href;
- const char* title;
- const char* disposition;
+
+ WKEinaSharedString action;
+ WKEinaSharedString type;
+ WKEinaSharedString href;
+ WKEinaSharedString title;
+ WKEinaSharedString disposition;
_Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef)
: __ref(1)
#if ENABLE(WEB_INTENTS_TAG)
- , wkService(serviceRef)
+ , action(AdoptWK, WKIntentServiceInfoCopyAction(serviceRef))
+ , type(AdoptWK, WKIntentServiceInfoCopyType(serviceRef))
+ , href(AdoptWK, WKIntentServiceInfoCopyHref(serviceRef))
+ , title(AdoptWK, WKIntentServiceInfoCopyTitle(serviceRef))
+ , disposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceRef))
#endif
- , action(0)
- , type(0)
- , href(0)
- , title(0)
- , disposition(0)
{ }
~_Ewk_Intent_Service()
{
ASSERT(!__ref);
- eina_stringshare_del(action);
- eina_stringshare_del(type);
- eina_stringshare_del(href);
- eina_stringshare_del(title);
- eina_stringshare_del(disposition);
}
};
-#define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \
- if (!(service)) { \
- EINA_LOG_CRIT("service is NULL."); \
- return __VA_ARGS__; \
- } \
- if (!(service)->wkService) { \
- EINA_LOG_CRIT("service->wkService is NULL."); \
- return __VA_ARGS__; \
- } \
- WKIntentServiceInfoRef wkService_ = (service)->wkService.get()
-
void ewk_intent_service_ref(Ewk_Intent_Service* service)
{
#if ENABLE(WEB_INTENTS_TAG)
@@ -107,77 +89,37 @@ void ewk_intent_service_unref(Ewk_Intent_Service* service)
const char* ewk_intent_service_action_get(const Ewk_Intent_Service* service)
{
-#if ENABLE(WEB_INTENTS_TAG)
- EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
-
- WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(wkService));
- Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
- eina_stringshare_replace(&ewkIntentService->action, toImpl(wkAction.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
return service->action;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_type_get(const Ewk_Intent_Service* service)
{
-#if ENABLE(WEB_INTENTS_TAG)
- EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
-
- WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(wkService));
- Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
- eina_stringshare_replace(&ewkIntentService->type, toImpl(wkType.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
return service->type;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_href_get(const Ewk_Intent_Service* service)
{
-#if ENABLE(WEB_INTENTS_TAG)
- EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
-
- WKRetainPtr<WKURLRef> wkHref(AdoptWK, WKIntentServiceInfoCopyHref(wkService));
- Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
- eina_stringshare_replace(&ewkIntentService->href, toImpl(wkHref.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
return service->href;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_title_get(const Ewk_Intent_Service* service)
{
-#if ENABLE(WEB_INTENTS_TAG)
- EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
-
- WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(wkService));
- Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
- eina_stringshare_replace(&ewkIntentService->title, toImpl(wkTitle.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
return service->title;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_disposition_get(const Ewk_Intent_Service* service)
{
-#if ENABLE(WEB_INTENTS_TAG)
- EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
-
- WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(wkService));
- Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
- eina_stringshare_replace(&ewkIntentService->disposition, toImpl(wkDisposition.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
return service->disposition;
-#else
- return 0;
-#endif
}
#if ENABLE(WEB_INTENTS_TAG)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp
index ae725d74a..190810962 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp
@@ -27,6 +27,7 @@
#include "ewk_navigation_policy_decision.h"
#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
#include "WKFramePolicyListener.h"
#include "WKRetainPtr.h"
#include "ewk_navigation_policy_decision_private.h"
@@ -47,7 +48,7 @@ struct _Ewk_Navigation_Policy_Decision {
Event_Mouse_Button mouseButton;
Event_Modifier_Keys modifiers;
Ewk_Url_Request* request;
- const char* frameName;
+ WKEinaSharedString 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)
: __ref(1)
@@ -57,7 +58,7 @@ struct _Ewk_Navigation_Policy_Decision {
, mouseButton(_mouseButton)
, modifiers(_modifiers)
, request(_request)
- , frameName(eina_stringshare_add(_frameName))
+ , frameName(_frameName)
{ }
~_Ewk_Navigation_Policy_Decision()
@@ -69,7 +70,6 @@ struct _Ewk_Navigation_Policy_Decision {
WKFramePolicyListenerUse(listener.get());
ewk_url_request_unref(request);
- eina_stringshare_del(frameName);
}
};
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
index f209952fe..5816b2feb 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
@@ -27,7 +27,7 @@
#include "ewk_url_request.h"
#include "WKAPICast.h"
-#include "WKRetainPtr.h"
+#include "WKEinaSharedString.h"
#include "WKURL.h"
#include "WKURLRequest.h"
#include "WebURLRequest.h"
@@ -42,40 +42,24 @@ using namespace WebKit;
*/
struct _Ewk_Url_Request {
unsigned int __ref; /**< the reference count of the object */
- WKRetainPtr<WKURLRequestRef> wkRequest;
- const char* url;
- const char* first_party;
- const char* http_method;
+ WKEinaSharedString url;
+ WKEinaSharedString first_party;
+ WKEinaSharedString http_method;
_Ewk_Url_Request(WKURLRequestRef requestRef)
: __ref(1)
- , wkRequest(requestRef)
- , url(0)
- , first_party(0)
- , http_method(0)
+ , url(AdoptWK, WKURLRequestCopyURL(requestRef))
+ , first_party(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef))
+ , http_method(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef))
{ }
~_Ewk_Url_Request()
{
ASSERT(!__ref);
- eina_stringshare_del(url);
- eina_stringshare_del(first_party);
- eina_stringshare_del(http_method);
}
};
-#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \
- if (!(request)) { \
- EINA_LOG_CRIT("request is NULL."); \
- return __VA_ARGS__; \
- } \
- if (!(request)->wkRequest) { \
- EINA_LOG_CRIT("request->wkRequest is NULL."); \
- return __VA_ARGS__; \
- } \
- WKURLRequestRef wkRequest_ = (request)->wkRequest.get()
-
void ewk_url_request_ref(Ewk_Url_Request* request)
{
EINA_SAFETY_ON_NULL_RETURN(request);
@@ -94,31 +78,21 @@ void ewk_url_request_unref(Ewk_Url_Request* request)
const char* ewk_url_request_url_get(const Ewk_Url_Request* request)
{
- EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
-
- WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
- Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
- eina_stringshare_replace(&ewkRequest->url, toImpl(wkUrl.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
return request->url;
}
const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request)
{
- EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
-
- Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
- eina_stringshare_replace(&ewkRequest->first_party, toImpl(wkRequest)->resourceRequest().firstPartyForCookies().string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
return request->first_party;
}
const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request)
{
- EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
-
- Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
- eina_stringshare_replace(&ewkRequest->http_method, toImpl(wkRequest)->resourceRequest().httpMethod().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
return request->http_method;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp
index 8f9f5366a..8d0a8ee30 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp
@@ -26,9 +26,14 @@
#include "config.h"
#include "ewk_url_response.h"
+#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
+#include "WKURLResponse.h"
#include "ewk_url_response_private.h"
#include <wtf/text/CString.h>
+using namespace WebKit;
+
/**
* \struct _Ewk_Url_Response
* @brief Contains the URL response data.
@@ -37,21 +42,19 @@ struct _Ewk_Url_Response {
unsigned int __ref; /**< the reference count of the object */
WebCore::ResourceResponse coreResponse;
- const char* url;
- const char* mimeType;
+ WKEinaSharedString url;
+ WKEinaSharedString mimeType;
_Ewk_Url_Response(const WebCore::ResourceResponse& _coreResponse)
: __ref(1)
, coreResponse(_coreResponse)
- , url(0)
- , mimeType(0)
+ , url(AdoptWK, WKURLResponseCopyURL(toAPI(coreResponse)))
+ , mimeType(AdoptWK, WKURLResponseCopyMIMEType(toAPI(coreResponse)))
{ }
~_Ewk_Url_Response()
{
ASSERT(!__ref);
- eina_stringshare_del(url);
- eina_stringshare_del(mimeType);
}
};
@@ -75,9 +78,6 @@ 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;
}
@@ -92,9 +92,6 @@ 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;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index 7d8b1ce05..ce7f7b454 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -26,6 +26,7 @@
#include "NativeWebWheelEvent.h"
#include "PageClientImpl.h"
#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
#include "WKFindOptions.h"
#include "WKRetainPtr.h"
#include "WKString.h"
@@ -73,11 +74,11 @@ struct _Ewk_View_Private_Data {
OwnPtr<EflViewportHandler> viewportHandler;
#endif
- const char* uri;
- const char* title;
- const char* theme;
- const char* customEncoding;
- const char* cursorGroup;
+ WKEinaSharedString uri;
+ WKEinaSharedString title;
+ WKEinaSharedString theme;
+ WKEinaSharedString customEncoding;
+ WKEinaSharedString cursorGroup;
Evas_Object* cursorObject;
LoadingResourcesMap loadingResourcesMap;
Ewk_Back_Forward_List* backForwardList;
@@ -93,12 +94,7 @@ struct _Ewk_View_Private_Data {
#endif
_Ewk_View_Private_Data()
- : uri(0)
- , title(0)
- , theme(0)
- , customEncoding(0)
- , cursorGroup(0)
- , cursorObject(0)
+ : cursorObject(0)
, backForwardList(0)
#ifdef HAVE_ECORE_X
, isUsingEcoreX(false)
@@ -112,10 +108,6 @@ struct _Ewk_View_Private_Data {
~_Ewk_View_Private_Data()
{
- eina_stringshare_del(uri);
- eina_stringshare_del(title);
- eina_stringshare_del(theme);
- eina_stringshare_del(customEncoding);
_ewk_view_priv_loading_resources_clear(loadingResourcesMap);
if (cursorObject)
@@ -771,10 +763,12 @@ void ewk_view_uri_update(Evas_Object* ewkView)
if (activeURL.isEmpty())
return;
- if (!eina_stringshare_replace(&priv->uri, activeURL.utf8().data()))
+ if (priv->uri == activeURL.utf8().data())
return;
- evas_object_smart_callback_call(ewkView, "uri,changed", static_cast<void*>(const_cast<char*>(priv->uri)));
+ priv->uri = activeURL.utf8().data();
+ const char* callbackArgument = static_cast<const char*>(priv->uri);
+ evas_object_smart_callback_call(ewkView, "uri,changed", const_cast<char*>(callbackArgument));
}
Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri)
@@ -933,7 +927,7 @@ const char* ewk_view_title_get(const Evas_Object* ewkView)
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
CString title = priv->pageClient->page()->pageTitle().utf8();
- eina_stringshare_replace(&priv->title, title.data());
+ priv->title = title.data();
return priv->title;
}
@@ -1032,10 +1026,10 @@ void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- if (!eina_stringshare_replace(&priv->theme, path))
- return;
-
- priv->pageClient->page()->setThemePath(path);
+ if (priv->theme != path) {
+ priv->theme = path;
+ priv->pageClient->page()->setThemePath(path);
+ }
}
const char* ewk_view_theme_get(const Evas_Object* ewkView)
@@ -1381,7 +1375,7 @@ const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
if (customEncoding.isEmpty())
return 0;
- eina_stringshare_replace(&priv->customEncoding, customEncoding.utf8().data());
+ priv->customEncoding = customEncoding.utf8().data();
return priv->customEncoding;
}
@@ -1391,8 +1385,8 @@ Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char*
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
- if (eina_stringshare_replace(&priv->customEncoding, encoding))
- priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String());
+ priv->customEncoding = encoding;
+ priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String());
return true;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
index 423f9e143..6064cf855 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
@@ -42,7 +42,7 @@
* when done to continue with the form submission. If the last reference is removed on a
* #Ewk_Form_Submission_Request and the form has not been submitted yet,
* ewk_form_submission_request_submit() will be called automatically.
- * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request.
+ * - "intent,request,new", Ewk_Intent*: reports new Web intent request.
* - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
* - "load,error", const Ewk_Web_Error*: reports main frame load failed.
* - "load,finished", void: reports load finished.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
index e6e3eb891..70380bdd2 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
@@ -27,6 +27,7 @@
#include "ewk_web_error.h"
#include "ErrorsEfl.h"
+#include "WKEinaSharedString.h"
#include "WKString.h"
#include "WKURL.h"
#include "ewk_web_error_private.h"
@@ -41,19 +42,17 @@ using namespace WebKit;
struct _Ewk_Web_Error {
WKRetainPtr<WKErrorRef> wkError;
- const char* url;
- const char* description;
+ WKEinaSharedString url;
+ WKEinaSharedString description;
_Ewk_Web_Error(WKErrorRef errorRef)
: wkError(errorRef)
- , url(0)
- , description(0)
+ , url(AdoptWK, WKErrorCopyFailingURL(errorRef))
+ , description(AdoptWK, WKErrorCopyLocalizedDescription(errorRef))
{ }
~_Ewk_Web_Error()
{
- eina_stringshare_del(url);
- eina_stringshare_del(description);
}
};
@@ -97,11 +96,7 @@ Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error)
const char* ewk_web_error_url_get(const Ewk_Web_Error* error)
{
- EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
-
- WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKErrorCopyFailingURL(wkError));
- Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
- eina_stringshare_replace(&ewkError->url, toImpl(wkUrl.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
return error->url;
}
@@ -115,11 +110,7 @@ int ewk_web_error_code_get(const Ewk_Web_Error* error)
const char* ewk_web_error_description_get(const Ewk_Web_Error* error)
{
- EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
-
- WKRetainPtr<WKStringRef> wkDescription(AdoptWK, WKErrorCopyLocalizedDescription(wkError));
- Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
- eina_stringshare_replace(&ewkError->description, toImpl(wkDescription.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
return error->description;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
index e0d728a9e..355592df4 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
@@ -26,24 +26,24 @@
#include "config.h"
#include "ewk_web_resource.h"
+#include "WKEinaSharedString.h"
#include "ewk_web_resource_private.h"
#include <wtf/text/CString.h>
struct _Ewk_Web_Resource {
unsigned int __ref; /**< the reference count of the object */
- const char* url;
+ WKEinaSharedString url;
bool isMainResource;
- _Ewk_Web_Resource(const char* _url, bool _isMainResource)
+ _Ewk_Web_Resource(const char* url, bool isMainResource)
: __ref(1)
- , url(eina_stringshare_add(_url))
- , isMainResource(_isMainResource)
+ , url(url)
+ , isMainResource(isMainResource)
{ }
~_Ewk_Web_Resource()
{
ASSERT(!__ref);
- eina_stringshare_del(url);
}
};
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
index 4069e25fa..39bc5a4db 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
@@ -112,4 +112,12 @@ void EWK2UnitTestBase::waitUntilTitleChangedTo(const char* expectedTitle)
evas_object_smart_callback_del(m_webView, "title,changed", onTitleChanged);
}
+void EWK2UnitTestBase::mouseClick(int x, int y)
+{
+ Evas* evas = evas_object_evas_get(m_webView);
+ evas_event_feed_mouse_move(evas, x, y, 0, 0);
+ evas_event_feed_mouse_down(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
+ evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
} // namespace EWK2UnitTest
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
index 64b9bce60..29d55bee4 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
@@ -38,6 +38,7 @@ protected:
void loadUrlSync(const char* url);
void waitUntilTitleChangedTo(const char* expectedTitle);
+ void mouseClick(int x, int y);
private:
Evas_Object* m_webView;
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
index edd81e732..5d1e00856 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html
+++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html
@@ -1,4 +1,5 @@
<HTML>
+<title>Default Testing Web Page</title>
<BODY>
<H2 align="center">EFL Unit Tests</H2>
<H2 align="center">Default Testing Web Page</H2>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html
new file mode 100644
index 000000000..7b06cbec9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html
@@ -0,0 +1,29 @@
+<html>
+<head>
+<title>Web intent request test</title>
+<script type="text/javascript">
+var clickCount = 0;
+
+function buttonClicked() {
+ if (clickCount == 0) {
+ var testIntent = new WebKitIntent(
+ {"action": "action1",
+ "type": "mime/type1",
+ "service": "http://service1.com/",
+ "extras": {"key1": "value1", "key2": "value2"}});
+ navigator.webkitStartActivity(testIntent);
+ } else if (clickCount == 1) {
+ var testIntent = new WebKitIntent(
+ {"action": "action2",
+ "type": "mime/type2",
+ "suggestions": ["http://service1.com/", "http://service2.com/"]});
+ navigator.webkitStartActivity(testIntent);
+ }
+ clickCount++;
+}
+</script>
+</head>
+<body>
+<input type="button" id="button" value="Start Web Intent" onmouseup="buttonClicked()" style="position: absolute; top: 0px; left: 0px;"/>
+</body>
+</html>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html
new file mode 100644
index 000000000..1d9fa2a33
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>Web Intent service registration test</title>
+</head>
+ <body>
+ <intent action="action" type="type" title="Title" href="http://example.com/service" disposition="inline"></intent>
+ Registered Intent Service.
+ </body>
+</html>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp
new file mode 100644
index 000000000..af10981ec
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp
@@ -0,0 +1,183 @@
+/*
+ * 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 "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include "UnitTestUtils/EWK2UnitTestServer.h"
+#include "WKEinaSharedString.h"
+#include <EWebKit2.h>
+#include <gtest/gtest.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+using namespace EWK2UnitTest;
+using namespace WTF;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static const char title1[] = "Page1";
+static const char title2[] = "Page2";
+
+static void serverCallbackNavigation(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);
+
+ Eina_Strbuf* body = eina_strbuf_new();
+ eina_strbuf_append_printf(body, "<html><title>%s</title><body>%s</body></html>", path + 1, path + 1);
+ const size_t bodyLength = eina_strbuf_length_get(body);
+ soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(body), bodyLength);
+ eina_strbuf_free(body);
+
+ soup_message_body_complete(message->response_body);
+}
+
+static inline void checkItem(Ewk_Back_Forward_List_Item* item, const char* title, const char* uri, const char* originalURI)
+{
+ ASSERT_TRUE(item);
+ EXPECT_STREQ(uri, ewk_back_forward_list_item_uri_get(item));
+ EXPECT_STREQ(title, ewk_back_forward_list_item_title_get(item));
+ EXPECT_STREQ(originalURI, ewk_back_forward_list_item_original_uri_get(item));
+}
+
+static inline WKEinaSharedString urlFromTitle(EWK2UnitTestServer* httpServer, const char* title)
+{
+ Eina_Strbuf* path = eina_strbuf_new();
+ eina_strbuf_append_printf(path, "/%s", title);
+ WKEinaSharedString res = httpServer->getURIForPath(eina_strbuf_string_get(path)).data();
+ eina_strbuf_free(path);
+
+ return res;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_back_forward_list_current_item_get)
+{
+ const char* url = environment->defaultTestPageUrl();
+ loadUrlSync(url);
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
+ ASSERT_TRUE(backForwardList);
+
+ Ewk_Back_Forward_List_Item* currentItem = ewk_back_forward_list_current_item_get(backForwardList);
+ checkItem(currentItem, ewk_view_title_get(webView()), url, url);
+
+ Ewk_Back_Forward_List_Item* anotherCurrentItem = ewk_back_forward_list_current_item_get(backForwardList);
+ ASSERT_EQ(currentItem, anotherCurrentItem);
+}
+
+TEST_F(EWK2UnitTestBase, ewk_back_forward_list_previous_item_get)
+{
+ OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
+ httpServer->run(serverCallbackNavigation);
+
+ WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1);
+ loadUrlSync(url1);
+ ASSERT_STREQ(ewk_view_title_get(webView()), title1);
+
+ loadUrlSync(urlFromTitle(httpServer.get(), title2));
+ ASSERT_STREQ(ewk_view_title_get(webView()), title2);
+
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
+ ASSERT_TRUE(backForwardList);
+
+ Ewk_Back_Forward_List_Item* previousItem = ewk_back_forward_list_previous_item_get(backForwardList);
+ checkItem(previousItem, title1, url1, url1);
+
+ Ewk_Back_Forward_List_Item* anotherPreviousItem = ewk_back_forward_list_previous_item_get(backForwardList);
+ ASSERT_EQ(previousItem, anotherPreviousItem);
+}
+
+TEST_F(EWK2UnitTestBase, ewk_back_forward_list_next_item_get)
+{
+ OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
+ httpServer->run(serverCallbackNavigation);
+
+ loadUrlSync(urlFromTitle(httpServer.get(), title1));
+ ASSERT_STREQ(ewk_view_title_get(webView()), title1);
+
+ WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2);
+ loadUrlSync(url2);
+ ASSERT_STREQ(ewk_view_title_get(webView()), title2);
+
+ // Go back to Page1.
+ ewk_view_back(webView());
+ waitUntilTitleChangedTo(title1);
+
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
+ ASSERT_TRUE(backForwardList);
+
+ Ewk_Back_Forward_List_Item* nextItem = ewk_back_forward_list_next_item_get(backForwardList);
+ checkItem(nextItem, title2, url2, url2);
+
+ Ewk_Back_Forward_List_Item* anotherNextItem = ewk_back_forward_list_next_item_get(backForwardList);
+ ASSERT_EQ(nextItem, anotherNextItem);
+}
+
+TEST_F(EWK2UnitTestBase, ewk_back_forward_list_item_at_index_get)
+{
+ OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
+ httpServer->run(serverCallbackNavigation);
+
+ WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1);
+ loadUrlSync(url1);
+ ASSERT_STREQ(ewk_view_title_get(webView()), title1);
+
+ loadUrlSync(urlFromTitle(httpServer.get(), title2));
+ ASSERT_STREQ(ewk_view_title_get(webView()), title2);
+
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
+ ASSERT_TRUE(backForwardList);
+
+ Ewk_Back_Forward_List_Item* previousItem = ewk_back_forward_list_item_at_index_get(backForwardList, -1);
+ checkItem(previousItem, title1, url1, url1);
+
+ Ewk_Back_Forward_List_Item* anotherPreviousItem = ewk_back_forward_list_item_at_index_get(backForwardList, -1);
+ ASSERT_EQ(previousItem, anotherPreviousItem);
+
+ Ewk_Back_Forward_List_Item* nonExistingItem = ewk_back_forward_list_item_at_index_get(backForwardList, 10);
+ ASSERT_FALSE(nonExistingItem);
+}
+
+TEST_F(EWK2UnitTestBase, ewk_back_forward_list_count)
+{
+ OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
+ httpServer->run(serverCallbackNavigation);
+
+ loadUrlSync(urlFromTitle(httpServer.get(), title1));
+ ASSERT_STREQ(ewk_view_title_get(webView()), title1);
+
+ loadUrlSync(urlFromTitle(httpServer.get(), title2));
+ ASSERT_STREQ(ewk_view_title_get(webView()), title2);
+
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
+ ASSERT_TRUE(backForwardList);
+
+ EXPECT_EQ(ewk_back_forward_list_count(backForwardList), 2);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
index 034f87140..a5e8157da 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
@@ -28,6 +28,7 @@
#include "UnitTestUtils/EWK2UnitTestBase.h"
#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include <EWebKit2.h>
+#include <Ecore.h>
#include <gtest/gtest.h>
using namespace EWK2UnitTest;
@@ -67,3 +68,83 @@ TEST_F(EWK2UnitTestBase, ewk_context_uri_scheme_register)
loadUrlSync("fooscheme:MyPath");
ASSERT_STREQ(ewk_view_title_get(webView()), "Foo");
}
+
+struct VibrationCbData {
+ bool didReceiveVibrateCallback; // Whether the vibration event received.
+ bool didReceiveCancelVibrationCallback; // Whether the cancel vibration event received.
+ unsigned vibrateCalledCount; // Vibrate callbacks count.
+ uint64_t expectedVibrationTime; // Expected vibration time.
+};
+
+static void vibrateCallback(uint64_t vibrationTime, void* userData)
+{
+ VibrationCbData* data = static_cast<VibrationCbData*>(userData);
+ if (vibrationTime == data->expectedVibrationTime)
+ data->didReceiveVibrateCallback = true;
+ data->vibrateCalledCount++;
+}
+
+static void cancelVibrationCallback(void* userData)
+{
+ VibrationCbData* data = static_cast<VibrationCbData*>(userData);
+ data->didReceiveCancelVibrationCallback = true;
+}
+
+static void loadVibrationHTMLString(Evas_Object* webView, const char* vibrationPattern, bool waitForVibrationEvent, VibrationCbData* data)
+{
+ const char* content =
+ "<html><head><script type='text/javascript'>function vibrate() { navigator.vibrate(%s);"
+ " document.title = \"Loaded\"; }</script></head><body onload='vibrate()'></body></html>";
+
+ data->didReceiveVibrateCallback = false;
+ data->didReceiveCancelVibrationCallback = false;
+ data->vibrateCalledCount = 0;
+ Eina_Strbuf* buffer = eina_strbuf_new();
+ eina_strbuf_append_printf(buffer, content, vibrationPattern);
+ ewk_view_html_string_load(webView, eina_strbuf_string_get(buffer), 0, 0);
+ eina_strbuf_free(buffer);
+
+ if (!waitForVibrationEvent)
+ return;
+
+ while (!data->didReceiveVibrateCallback && !data->didReceiveCancelVibrationCallback)
+ ecore_main_loop_iterate();
+}
+
+TEST_F(EWK2UnitTestBase, ewk_context_vibration_client_callbacks_set)
+{
+ VibrationCbData data = { false, false, 0, 5000 };
+ ewk_context_vibration_client_callbacks_set(ewk_context_default_get(), vibrateCallback, cancelVibrationCallback, &data);
+
+ // Vibrate for 5 seconds.
+ loadVibrationHTMLString(webView(), "5000", true, &data);
+ ASSERT_TRUE(data.didReceiveVibrateCallback);
+
+ // Cancel any existing vibrations.
+ loadVibrationHTMLString(webView(), "0", true, &data);
+ ASSERT_TRUE(data.didReceiveCancelVibrationCallback);
+
+ // This case the pattern will cause the device to vibrate for 200 ms, be still for 100 ms, and then vibrate for 5000 ms.
+ loadVibrationHTMLString(webView(), "[200, 100, 5000]", true, &data);
+ ASSERT_EQ(data.vibrateCalledCount, 2);
+ ASSERT_TRUE(data.didReceiveVibrateCallback);
+
+ // Cancel outstanding vibration pattern.
+ loadVibrationHTMLString(webView(), "[0]", true, &data);
+ ASSERT_TRUE(data.didReceiveCancelVibrationCallback);
+
+ // Stop listening for vibration events, by calling the function with null for the callbacks.
+ ewk_context_vibration_client_callbacks_set(ewk_context_default_get(), 0, 0, &data);
+
+ // Make sure we don't receive vibration event.
+ loadVibrationHTMLString(webView(), "[5000]", false, &data);
+ waitUntilTitleChangedTo("Loaded");
+ ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded");
+ ASSERT_FALSE(data.didReceiveVibrateCallback);
+
+ // Make sure we don't receive cancel vibration event.
+ loadVibrationHTMLString(webView(), "0", false, &data);
+ waitUntilTitleChangedTo("Loaded");
+ ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded");
+ ASSERT_FALSE(data.didReceiveCancelVibrationCallback);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
index 7dbd496bd..10be26cb5 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
@@ -57,7 +57,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
eina_strbuf_append_printf(buffer, INDEX_HTML_STRING, soup_server_get_port(server));
soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar; Max-Age=60");
soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(buffer), eina_strbuf_length_get(buffer));
- eina_strbuf_string_free(buffer);
+ eina_strbuf_free(buffer);
} else if (!strcmp(path, "/image.png"))
soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60");
else
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
new file mode 100644
index 000000000..7f62e0b1e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
@@ -0,0 +1,118 @@
+/*
+ * 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 "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include "WKEinaSharedString.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKURL.h>
+#include <gtest/gtest.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+// Use macro here instead of global variables in order not to have always the same pointers.
+#define testString "I'm test string!"
+#define anotherTestString "I'm another test string!"
+#define testUrl "file:///path/somewhere"
+
+static inline void checkString(const WKEinaSharedString& string, const char* pattern)
+{
+ ASSERT_EQ(string.isNull(), pattern ? false : true);
+ ASSERT_EQ(string.length(), pattern ? strlen(pattern) : 0); // Compare length.
+ ASSERT_EQ(string, pattern); // Compare values. Check '==' operator with WKEinaSharedString and plain string.
+ ASSERT_STREQ(string, pattern); // Compare values. Check 'const char*' operator.
+}
+
+TEST_F(EWK2UnitTestBase, constructEmpty)
+{
+ WKEinaSharedString emptyString;
+ checkString(emptyString, 0);
+}
+
+TEST_F(EWK2UnitTestBase, constructFromPlainString)
+{
+ WKEinaSharedString emptyString(testString);
+ checkString(emptyString, testString);
+}
+
+TEST_F(EWK2UnitTestBase, constructFromWKString)
+{
+ WKEinaSharedString string(AdoptWK, WKStringCreateWithUTF8CString(testString));
+ checkString(string, testString);
+}
+
+TEST_F(EWK2UnitTestBase, constructFromWKURL)
+{
+ WKEinaSharedString string(AdoptWK, WKURLCreateWithUTF8CString(testUrl));
+ checkString(string, testUrl);
+}
+
+TEST_F(EWK2UnitTestBase, costructCopy)
+{
+ WKEinaSharedString string(testString);
+ WKEinaSharedString copyString(string);
+ checkString(string, testString);
+ checkString(copyString, testString);
+ ASSERT_EQ(string, copyString); // Check '==' operator with two instances of WKEinaSharedString.
+}
+
+TEST_F(EWK2UnitTestBase, comparisonOperators)
+{
+ WKEinaSharedString string(testString);
+ WKEinaSharedString sameString(testString);
+ WKEinaSharedString anotherString(anotherTestString);
+
+ ASSERT_EQ(string, sameString); // Check '==' operator with two instances of WKEinaSharedString.
+ ASSERT_NE(string, anotherString); // Check '!=' operator with two instances of WKEinaSharedString.
+
+ const char* explicitlySharedString = eina_stringshare_add(testString);
+ ASSERT_EQ(static_cast<const char*>(string), explicitlySharedString); // Compare pointers.
+ ASSERT_STREQ(string, explicitlySharedString); // Compare values.
+ eina_stringshare_del(explicitlySharedString);
+
+ ASSERT_EQ(string, string); // Self-comparison.
+}
+
+TEST_F(EWK2UnitTestBase, assignmentOperators)
+{
+ WKEinaSharedString string;
+
+ string = testString;
+ checkString(string, testString);
+
+ WKEinaSharedString anotherString(anotherTestString);
+ string = anotherString;
+ checkString(string, anotherTestString);
+ ASSERT_EQ(string, anotherString);
+
+ string = string; // Check that self-assignment does not break WKEinaSharedString internal data.
+ checkString(string, anotherTestString);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp
new file mode 100644
index 000000000..fdf7fdf23
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp
@@ -0,0 +1,116 @@
+/*
+ * 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 "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include "UnitTestUtils/EWK2UnitTestServer.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static void onIntentServiceRegistration(void* userData, Evas_Object*, void* eventInfo)
+{
+ bool* intentRegistered = static_cast<bool*>(userData);
+ ASSERT_FALSE(*intentRegistered);
+ *intentRegistered = true;
+
+ Ewk_Intent_Service* service = static_cast<Ewk_Intent_Service*>(eventInfo);
+ ASSERT_TRUE(service);
+ EXPECT_STREQ(ewk_intent_service_action_get(service), "action");
+ EXPECT_STREQ(ewk_intent_service_type_get(service), "type");
+ EXPECT_STREQ(ewk_intent_service_title_get(service), "Title");
+ EXPECT_STREQ(ewk_intent_service_href_get(service), "http://example.com/service");
+ EXPECT_STREQ(ewk_intent_service_disposition_get(service), "inline");
+}
+
+TEST_F(EWK2UnitTestBase, ewk_intent_service_registration)
+{
+ bool intentRegistered = false;
+ evas_object_smart_callback_add(webView(), "intent,service,register", onIntentServiceRegistration, &intentRegistered);
+ loadUrlSync(environment->urlForResource("intent-service.html").data());
+ evas_object_smart_callback_del(webView(), "intent,service,register", onIntentServiceRegistration);
+ ASSERT_TRUE(intentRegistered);
+}
+
+int stringSortCb(const void* d1, const void* d2)
+{
+ return strcmp(static_cast<const char*>(d1), static_cast<const char*>(d2));
+}
+
+static void onIntentReceived(void* userData, Evas_Object*, void* eventInfo)
+{
+ unsigned* intentReceivedCount = static_cast<unsigned*>(userData);
+ ASSERT_GE(*intentReceivedCount, 0);
+ ASSERT_LE(*intentReceivedCount, 1);
+ ++(*intentReceivedCount);
+
+ Ewk_Intent* intent = static_cast<Ewk_Intent*>(eventInfo);
+ ASSERT_TRUE(intent);
+
+ if (*intentReceivedCount == 1) {
+ // First intent.
+ EXPECT_STREQ(ewk_intent_action_get(intent), "action1");
+ EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type1");
+ EXPECT_STREQ(ewk_intent_service_get(intent), "http://service1.com/");
+ EXPECT_STREQ(ewk_intent_extra_get(intent, "key1"), "value1");
+ EXPECT_STREQ(ewk_intent_extra_get(intent, "key2"), "value2");
+ } else {
+ // Second intent.
+ EXPECT_STREQ(ewk_intent_action_get(intent), "action2");
+ EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type2");
+ Eina_List* suggestions = ewk_intent_suggestions_get(intent);
+ ASSERT_TRUE(suggestions);
+ ASSERT_EQ(eina_list_count(suggestions), 2);
+ // We need to sort the suggestions since Intent is using a HashSet internally.
+ suggestions = eina_list_sort(suggestions, 2, stringSortCb);
+ EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 0)), "http://service1.com/");
+ EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 1)), "http://service2.com/");
+ }
+}
+
+TEST_F(EWK2UnitTestBase, ewk_intent_request)
+{
+ unsigned intentReceivedCount = 0;
+ evas_object_smart_callback_add(webView(), "intent,request,new", onIntentReceived, &intentReceivedCount);
+ loadUrlSync(environment->urlForResource("intent-request.html").data());
+
+ // A user gesture is required for the intent to start.
+ mouseClick(5, 5);
+ while (intentReceivedCount != 1)
+ ecore_main_loop_iterate();
+ ASSERT_EQ(intentReceivedCount, 1);
+
+ // Generate a second intent request.
+ mouseClick(5, 5);
+ while (intentReceivedCount != 2)
+ ecore_main_loop_iterate();
+ ASSERT_EQ(intentReceivedCount, 2);
+ evas_object_smart_callback_del(webView(), "intent,request,new", onIntentReceived);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
index 43ec3338d..29811fc6a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
@@ -33,7 +33,8 @@ enum {
PROP_URI,
PROP_STATUS_CODE,
PROP_CONTENT_LENGTH,
- PROP_MIME_TYPE
+ PROP_MIME_TYPE,
+ PROP_SUGGESTED_FILENAME
};
using namespace WebKit;
@@ -45,6 +46,7 @@ struct _WebKitURIResponsePrivate {
WebCore::ResourceResponse resourceResponse;
CString uri;
CString mimeType;
+ CString suggestedFilename;
};
static void webkitURIResponseFinalize(GObject* object)
@@ -70,6 +72,9 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue*
case PROP_MIME_TYPE:
g_value_set_string(value, webkit_uri_response_get_mime_type(response));
break;
+ case PROP_SUGGESTED_FILENAME:
+ g_value_set_string(value, webkit_uri_response_get_suggested_filename(response));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
}
@@ -133,6 +138,19 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass
0,
WEBKIT_PARAM_READABLE));
+ /**
+ * WebKitURIResponse:suggested-filename:
+ *
+ * The suggested filename for the URI response.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_SUGGESTED_FILENAME,
+ g_param_spec_string("suggested-filename",
+ _("Suggested Filename"),
+ _("The suggested filename for the URI response"),
+ 0,
+ WEBKIT_PARAM_READABLE));
+
g_type_class_add_private(responseClass, sizeof(WebKitURIResponsePrivate));
}
@@ -230,6 +248,28 @@ gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsC
return !!response->priv->resourceResponse.soupMessageCertificate();
}
+/**
+ * webkit_uri_response_get_suggested_filename:
+ * @response: a #WebKitURIResponse
+ *
+ * Get the suggested filename for @response, as specified by
+ * the 'Content-Disposition' HTTP header, or %NULL if it's not
+ * present.
+ *
+ * Returns: (transfer none): the suggested filename or %NULL if
+ * the 'Content-Disposition' HTTP header is not present.
+ */
+const gchar* webkit_uri_response_get_suggested_filename(WebKitURIResponse* response)
+{
+ g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0);
+
+ if (response->priv->resourceResponse.suggestedFilename().isEmpty())
+ return 0;
+
+ response->priv->suggestedFilename = response->priv->resourceResponse.suggestedFilename().utf8();
+ return response->priv->suggestedFilename.data();
+}
+
WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse)
{
WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL));
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
index 19705921a..d90cf4132 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
@@ -53,24 +53,26 @@ struct _WebKitURIResponseClass {
};
WEBKIT_API GType
-webkit_uri_response_get_type (void);
+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);
+webkit_uri_response_get_https_status (WebKitURIResponse *response,
+ GTlsCertificate **certificate,
+ GTlsCertificateFlags *errors);
+WEBKIT_API const gchar *
+webkit_uri_response_get_suggested_filename (WebKitURIResponse *response);
G_END_DECLS
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index fe9df9f75..620c9a876 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -32,6 +32,7 @@
#include "WebKitURISchemeRequestPrivate.h"
#include "WebKitWebContextPrivate.h"
#include <WebCore/FileSystem.h>
+#include <WebCore/Language.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/gobject/GOwnPtr.h>
@@ -518,6 +519,31 @@ void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context,
#endif
}
+/**
+ * webkit_web_context_set_preferred_languages:
+ * @context: a #WebKitWebContext
+ * @languages: (element-type utf8): a #GList of language identifiers
+ *
+ * Set the list of preferred languages, sorted from most desirable
+ * to least desirable. The list will be used to build the "Accept-Language"
+ * header that will be included in the network requests started by
+ * the #WebKitWebContext.
+ */
+void webkit_web_context_set_preferred_languages(WebKitWebContext* context, GList* languageList)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
+
+ if (!languageList)
+ return;
+
+ Vector<String> languages;
+ for (GList* iter = languageList; iter; iter = g_list_next(iter))
+ languages.append(String::fromUTF8(static_cast<char*>(iter->data)).lower().replace("_", "-"));
+
+ WebCore::overrideUserPreferredLanguages(languages);
+ WebCore::languageDidChange();
+}
+
WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload)
{
GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
index 0d32ba5bb..5af7f2414 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
@@ -146,6 +146,10 @@ WEBKIT_API void
webkit_web_context_set_spell_checking_languages (WebKitWebContext *context,
const gchar *languages);
+WEBKIT_API void
+webkit_web_context_set_preferred_languages (WebKitWebContext *context,
+ GList *languages);
+
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
index 80e5fff23..ee86d448a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
@@ -79,7 +79,7 @@ enum {
MOUSE_TARGET_CHANGED,
- PRINT_REQUESTED,
+ PRINT,
RESOURCE_LOAD_STARTED,
@@ -106,13 +106,6 @@ enum {
PROP_ZOOM_LEVEL
};
-typedef enum {
- NotReplacingContent,
- WillReplaceContent,
- ReplacingContent,
- DidReplaceContent
-} ReplaceContentStatus;
-
typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap;
typedef HashMap<String, GRefPtr<WebKitWebResource> > ResourcesMap;
@@ -122,7 +115,6 @@ struct _WebKitWebViewPrivate {
CString customTextEncoding;
double estimatedLoadProgress;
CString activeURI;
- ReplaceContentStatus replaceContentStatus;
bool waitingForMainResource;
gulong mainResourceResponseHandlerID;
@@ -159,7 +151,7 @@ static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, c
return FALSE;
GOwnPtr<char> htmlString(g_strdup_printf("<html><body>%s</body></html>", error->message));
- webkit_web_view_replace_content(webView, htmlString.get(), failingURI, 0);
+ webkit_web_view_load_alternate_html(webView, htmlString.get(), failingURI, 0);
return TRUE;
}
@@ -882,7 +874,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
WEBKIT_TYPE_HIT_TEST_RESULT,
G_TYPE_UINT);
/**
- * WebKitWebView::print-requested:
+ * WebKitWebView::print:
* @web_view: the #WebKitWebView on which the signal is emitted
* @print_operation: the #WebKitPrintOperation that will handle the print request
*
@@ -899,11 +891,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*/
- signals[PRINT_REQUESTED] =
- g_signal_new("print-requested",
+ signals[PRINT] =
+ g_signal_new("print",
G_TYPE_FROM_CLASS(webViewClass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebViewClass, print_requested),
+ G_STRUCT_OFFSET(WebKitWebViewClass, print),
g_signal_accumulator_true_handled, 0,
webkit_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN, 1,
@@ -1107,25 +1099,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
WEBKIT_TYPE_FORM_SUBMISSION_REQUEST);
}
-static bool updateReplaceContentStatus(WebKitWebView* webView, WebKitLoadEvent loadEvent)
-{
- if (webView->priv->replaceContentStatus == ReplacingContent) {
- if (loadEvent == WEBKIT_LOAD_FINISHED)
- webView->priv->replaceContentStatus = DidReplaceContent;
- return true;
- }
-
- if (loadEvent == WEBKIT_LOAD_STARTED) {
- if (webView->priv->replaceContentStatus == WillReplaceContent) {
- webView->priv->replaceContentStatus = ReplacingContent;
- return true;
- }
- webView->priv->replaceContentStatus = NotReplacingContent;
- }
-
- return false;
-}
-
static void setCertificateToMainResource(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
@@ -1169,21 +1142,16 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
webView->priv->waitingForMainResource = false;
} else if (loadEvent == WEBKIT_LOAD_COMMITTED) {
webView->priv->subresourcesMap.clear();
- if (webView->priv->replaceContentStatus != ReplacingContent) {
- if (!webView->priv->mainResource) {
- // When a page is loaded from the history cache, the main resource load callbacks
- // are called when the main frame load is finished. We want to make sure there's a
- // main resource available when load has been committed, so we delay the emission of
- // load-changed signal until main resource object has been created.
- webView->priv->waitingForMainResource = true;
- } else
- setCertificateToMainResource(webView);
- }
+ if (!webView->priv->mainResource) {
+ // When a page is loaded from the history cache, the main resource load callbacks
+ // are called when the main frame load is finished. We want to make sure there's a
+ // main resource available when load has been committed, so we delay the emission of
+ // load-changed signal until main resource object has been created.
+ webView->priv->waitingForMainResource = true;
+ } else
+ setCertificateToMainResource(webView);
}
- if (updateReplaceContentStatus(webView, loadEvent))
- return;
-
if (webView->priv->waitingForMainResource)
webView->priv->lastDelayedEvent = loadEvent;
else
@@ -1192,9 +1160,6 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error)
{
- if (webView->priv->replaceContentStatus == ReplacingContent)
- return;
-
gboolean returnValue;
g_signal_emit(webView, signals[LOAD_FAILED], 0, loadEvent, failingURI, error, &returnValue);
g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
@@ -1212,9 +1177,6 @@ void webkitWebViewSetTitle(WebKitWebView* webView, const CString& title)
void webkitWebViewSetEstimatedLoadProgress(WebKitWebView* webView, double estimatedLoadProgress)
{
- if (webView->priv->replaceContentStatus != NotReplacingContent)
- return;
-
if (webView->priv->estimatedLoadProgress == estimatedLoadProgress)
return;
@@ -1321,7 +1283,7 @@ void webkitWebViewPrintFrame(WebKitWebView* webView, WKFrameRef wkFrame)
{
GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView));
gboolean returnValue;
- g_signal_emit(webView, signals[PRINT_REQUESTED], 0, printOperation.get(), &returnValue);
+ g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue);
if (returnValue)
return;
@@ -1349,16 +1311,8 @@ static void waitForMainResourceResponseIfWaitingForResource(WebKitWebView* webVi
g_signal_connect(priv->mainResource.get(), "notify::response", G_CALLBACK(mainResourceResponseChangedCallback), webView);
}
-static inline bool webkitWebViewIsReplacingContentOrDidReplaceContent(WebKitWebView* webView)
-{
- return (webView->priv->replaceContentStatus == ReplacingContent || webView->priv->replaceContentStatus == DidReplaceContent);
-}
-
void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame, uint64_t resourceIdentifier, WebKitURIRequest* request, bool isMainResource)
{
- if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView))
- return;
-
WebKitWebViewPrivate* priv = webView->priv;
WebKitWebResource* resource = webkitWebResourceCreate(wkFrame, request, isMainResource);
if (WKFrameIsMainFrame(wkFrame) && (isMainResource || !priv->mainResource)) {
@@ -1371,9 +1325,6 @@ void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame
WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier)
{
- if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView))
- return 0;
-
GRefPtr<WebKitWebResource> resource = webView->priv->loadingResourcesMap.get(resourceIdentifier);
ASSERT(resource.get());
return resource.get();
@@ -1381,9 +1332,6 @@ WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView* webView, ui
void webkitWebViewRemoveLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier)
{
- if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView))
- return;
-
WebKitWebViewPrivate* priv = webView->priv;
ASSERT(priv->loadingResourcesMap.contains(resourceIdentifier));
priv->loadingResourcesMap.remove(resourceIdentifier);
@@ -1391,9 +1339,6 @@ void webkitWebViewRemoveLoadingWebResource(WebKitWebView* webView, uint64_t reso
WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView* webView, uint64_t resourceIdentifier)
{
- if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView))
- return 0;
-
WebKitWebViewPrivate* priv = webView->priv;
WebKitWebResource* resource = webkitWebViewGetLoadingWebResource(webView, resourceIdentifier);
if (resource != priv->mainResource)
@@ -1597,6 +1542,33 @@ void webkit_web_view_load_html(WebKitWebView* webView, const gchar* content, con
}
/**
+ * webkit_web_view_load_alternate_html:
+ * @web_view: a #WebKitWebView
+ * @content: the new content to display as the main page of the @web_view
+ * @content_uri: the URI for the alternate page content
+ * @base_uri: (allow-none): the base URI for relative locations or %NULL
+ *
+ * Load the given @content string for the URI @content_uri.
+ * This allows clients to display page-loading errors in the #WebKitWebView itself.
+ * When this method is called from #WebKitWebView::load-failed signal to show an
+ * error page, the the back-forward list is maintained appropriately.
+ * For everything else this method works the same way as webkit_web_view_load_html().
+ */
+void webkit_web_view_load_alternate_html(WebKitWebView* webView, const gchar* content, const gchar* contentURI, const gchar* baseURI)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+ g_return_if_fail(content);
+ g_return_if_fail(contentURI);
+
+ WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(content));
+ WKRetainPtr<WKURLRef> contentURL(AdoptWK, WKURLCreateWithUTF8CString(contentURI));
+ WKRetainPtr<WKURLRef> baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0;
+ WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
+ WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), contentURL.get());
+ webkitWebViewUpdateURI(webView);
+}
+
+/**
* webkit_web_view_load_plain_text:
* @web_view: a #WebKitWebView
* @plain_text: The plain text to load
@@ -1637,36 +1609,6 @@ void webkit_web_view_load_request(WebKitWebView* webView, WebKitURIRequest* requ
}
/**
- * webkit_web_view_replace_content:
- * @web_view: a #WebKitWebView
- * @content: the new content to display as the main page of the @web_view
- * @content_uri: the URI for the page content
- * @base_uri: (allow-none): the base URI for relative locations or %NULL
- *
- * Replace the content of @web_view with @content using @content_uri as page URI.
- * This allows clients to display page-loading errors in the #WebKitWebView itself.
- * This is typically called from #WebKitWebView::load-failed signal. The URI passed in
- * @base_uri has to be an absolute URI. The mime type of the document will be "text/html".
- * Signals #WebKitWebView::load-changed and #WebKitWebView::load-failed are not emitted
- * when replacing content of a #WebKitWebView using this method.
- */
-void webkit_web_view_replace_content(WebKitWebView* webView, const gchar* content, const gchar* contentURI, const gchar* baseURI)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(content);
- g_return_if_fail(contentURI);
-
- webView->priv->replaceContentStatus = WillReplaceContent;
-
- WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(content));
- WKRetainPtr<WKURLRef> contentURL(AdoptWK, WKURLCreateWithUTF8CString(contentURI));
- WKRetainPtr<WKURLRef> baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0;
- WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
- WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), contentURL.get());
- webkitWebViewUpdateURI(webView);
-}
-
-/**
* webkit_web_view_get_title:
* @web_view: a #WebKitWebView
*
@@ -1815,6 +1757,10 @@ gboolean webkit_web_view_can_go_forward(WebKitWebView* webView)
* the requested URI is "about:blank".
* </para></listitem>
* <listitem><para>
+ * If the load operation was started by webkit_web_view_load_alternate_html(),
+ * the requested URI is content URI provided.
+ * </para></listitem>
+ * <listitem><para>
* If the load operation was started by webkit_web_view_go_back() or
* webkit_web_view_go_forward(), the requested URI is the original URI
* of the previous/next item in the #WebKitBackForwardList of @web_view.
@@ -1838,10 +1784,6 @@ gboolean webkit_web_view_can_go_forward(WebKitWebView* webView)
* one and it will not change unless a new load operation is started
* or a navigation action within the same page is performed.
* </para></listitem>
- * <listitem><para>
- * When the page content is replaced using webkit_web_view_replace_content(),
- * the active URI is the content_uri provided.
- * </para></listitem>
* </orderedlist>
*
* You can monitor the active URI by connecting to the notify::uri
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
index 6ebd17f04..540014ac4 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
@@ -162,7 +162,7 @@ struct _WebKitWebViewClass {
void (* mouse_target_changed) (WebKitWebView *web_view,
WebKitHitTestResult *hit_test_result,
guint modifiers);
- gboolean (* print_requested) (WebKitWebView *web_view,
+ gboolean (* print) (WebKitWebView *web_view,
WebKitPrintOperation *print_operation);
void (* resource_load_started) (WebKitWebView *web_view,
WebKitWebResource *resource,
@@ -210,7 +210,11 @@ WEBKIT_API void
webkit_web_view_load_html (WebKitWebView *web_view,
const gchar *content,
const gchar *base_uri);
-
+WEBKIT_API void
+webkit_web_view_load_alternate_html (WebKitWebView *web_view,
+ const gchar *content,
+ const gchar *content_uri,
+ const gchar *base_uri);
WEBKIT_API void
webkit_web_view_load_plain_text (WebKitWebView *web_view,
const gchar *plain_text);
@@ -222,12 +226,6 @@ webkit_web_view_load_request (WebKitWebView *w
WEBKIT_API void
webkit_web_view_stop_loading (WebKitWebView *web_view);
-WEBKIT_API void
-webkit_web_view_replace_content (WebKitWebView *web_view,
- const gchar *content,
- const gchar *content_uri,
- const gchar *base_uri);
-
WEBKIT_API const gchar *
webkit_web_view_get_title (WebKitWebView *web_view);
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
index 92da1ebe5..596498c83 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
@@ -37,6 +37,7 @@ webkit_web_context_get_spell_checking_enabled
webkit_web_context_set_spell_checking_enabled
webkit_web_context_get_spell_checking_languages
webkit_web_context_set_spell_checking_languages
+webkit_web_context_set_preferred_languages
<SUBSECTION URI Scheme>
WebKitURISchemeRequestCallback
@@ -75,9 +76,9 @@ webkit_web_view_new_with_context
webkit_web_view_get_context
webkit_web_view_load_uri
webkit_web_view_load_html
+webkit_web_view_load_alternate_html
webkit_web_view_load_plain_text
webkit_web_view_load_request
-webkit_web_view_replace_content
webkit_web_view_can_go_back
webkit_web_view_go_back
webkit_web_view_can_go_forward
@@ -325,6 +326,7 @@ webkit_uri_response_get_status_code
webkit_uri_response_get_content_length
webkit_uri_response_get_mime_type
webkit_uri_response_get_https_status
+webkit_uri_response_get_suggested_filename
<SUBSECTION Standard>
WebKitURIResponseClass
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
index 876685712..eff59862b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
@@ -74,6 +74,24 @@ public:
quitMainLoop();
}
+ GtkMenu* getPopupMenu()
+ {
+ GOwnPtr<GList> toplevels(gtk_window_list_toplevels());
+ for (GList* iter = toplevels.get(); iter; iter = g_list_next(iter)) {
+ if (!GTK_IS_WINDOW(iter->data))
+ continue;
+
+ GtkWidget* child = gtk_bin_get_child(GTK_BIN(iter->data));
+ if (!GTK_IS_MENU(child))
+ continue;
+
+ if (gtk_menu_get_attach_widget(GTK_MENU(child)) == GTK_WIDGET(m_webView))
+ return GTK_MENU(child);
+ }
+ g_assert_not_reached();
+ return 0;
+ }
+
bool shouldShowInputMethodsMenu()
{
GtkSettings* settings = gtk_widget_get_settings(GTK_WIDGET(m_webView));
@@ -391,24 +409,6 @@ public:
return false;
}
- GtkMenu* getPopupMenu()
- {
- GOwnPtr<GList> toplevels(gtk_window_list_toplevels());
- for (GList* iter = toplevels.get(); iter; iter = g_list_next(iter)) {
- if (!GTK_IS_WINDOW(iter->data))
- continue;
-
- GtkWidget* child = gtk_bin_get_child(GTK_BIN(iter->data));
- if (!GTK_IS_MENU(child))
- continue;
-
- if (gtk_menu_get_attach_widget(GTK_MENU(child)) == GTK_WIDGET(m_webView))
- return GTK_MENU(child);
- }
- g_assert_not_reached();
- return 0;
- }
-
GtkMenuItem* getMenuItem(GtkMenu* menu, const gchar* itemLabel)
{
GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu)));
@@ -721,6 +721,115 @@ static void testContextMenuDismissed(ContextMenuDismissedTest* test, gconstpoint
g_assert(test->m_dismissed);
}
+class ContextMenuSmartSeparatorsTest: public ContextMenuTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(ContextMenuSmartSeparatorsTest);
+
+ bool contextMenu(WebKitContextMenu* contextMenu, GdkEvent*, WebKitHitTestResult*)
+ {
+ webkit_context_menu_remove_all(contextMenu);
+
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_GO_BACK));
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD));
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_COPY));
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT));
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+ webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator());
+
+ quitMainLoop();
+
+ return false;
+ }
+
+ GtkMenu* showContextMenuAndGetGtkMenu()
+ {
+ showContextMenuAndWaitUntilFinished();
+ return getPopupMenu();
+ }
+};
+
+static void testContextMenuSmartSeparators(ContextMenuSmartSeparatorsTest* test, gconstpointer)
+{
+ test->showInWindowAndWaitUntilMapped();
+
+ test->loadHtml("<html><body>WebKitGTK+ Context menu tests</body></html>", "file:///");
+ test->waitUntilLoadFinished();
+
+ GtkMenu* menu = test->showContextMenuAndGetGtkMenu();
+ g_assert(menu);
+
+ // Leading and trailing separators are not added to the context menu.
+ GOwnPtr<GList> menuItems(gtk_container_get_children(GTK_CONTAINER(menu)));
+ g_assert_cmpuint(g_list_length(menuItems.get()), ==, 6);
+ GtkWidget* item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+
+ // Hiding a menu item between two separators hides the following separator.
+ GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(g_list_nth_data(menuItems.get(), 3)));
+ gtk_action_set_visible(action, FALSE);
+ menuItems.set(gtk_container_get_children(GTK_CONTAINER(menu)));
+ g_assert_cmpuint(g_list_length(menuItems.get()), ==, 6);
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ gtk_action_set_visible(action, TRUE);
+
+ // Showing an action between two separators shows the hidden separator.
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+
+ // Trailing separators are hidden too.
+ action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(g_list_nth_data(menuItems.get(), 5)));
+ gtk_action_set_visible(action, FALSE);
+ menuItems.set(gtk_container_get_children(GTK_CONTAINER(menu)));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4));
+ g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item));
+ item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5));
+ g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item));
+}
+
void beforeAll()
{
ContextMenuDefaultTest::add("WebKitWebView", "default-menu", testContextMenuDefaultMenu);
@@ -729,6 +838,7 @@ void beforeAll()
ContextMenuDisabledTest::add("WebKitWebView", "disable-menu", testContextMenuDisableMenu);
ContextMenuSubmenuTest::add("WebKitWebView", "submenu", testContextMenuSubMenu);
ContextMenuDismissedTest::add("WebKitWebView", "menu-dismissed", testContextMenuDismissed);
+ ContextMenuSmartSeparatorsTest::add("WebKitWebView", "smart-separators", testContextMenuSmartSeparators);
}
void afterAll()
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
index 59eed7658..dabf072e3 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
@@ -70,6 +70,13 @@ static void testLoadHtml(LoadTrackingTest* test, gconstpointer)
assertNormalLoadHappened(test->m_loadEvents);
}
+static void testLoadAlternateHTML(LoadTrackingTest* test, gconstpointer)
+{
+ test->loadAlternateHTML("<html><body>Alternate page</body></html>", "http://error-page.foo/", 0);
+ test->waitUntilLoadFinished();
+ assertNormalLoadHappened(test->m_loadEvents);
+}
+
static void testLoadPlainText(LoadTrackingTest* test, gconstpointer)
{
test->loadPlainText("Hello WebKit-GTK+");
@@ -262,6 +269,7 @@ void beforeAll()
LoadTrackingTest::add("WebKitWebView", "loading-status", testLoadingStatus);
LoadTrackingTest::add("WebKitWebView", "loading-error", testLoadingError);
LoadTrackingTest::add("WebKitWebView", "load-html", testLoadHtml);
+ LoadTrackingTest::add("WebKitWebView", "load-alternate-html", testLoadAlternateHTML);
LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText);
LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest);
LoadStopTrackingTest::add("WebKitWebView", "stop-loading", testLoadCancelled);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp
index 150c31bd3..123831f76 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp
@@ -49,7 +49,7 @@ static void testPrintOperationPrintSettings(WebViewTest* test, gconstpointer)
g_assert(webkit_print_operation_get_page_setup(printOperation.get()) == pageSetup.get());
}
-static gboolean webViewPrintRequestedCallback(WebKitWebView* webView, WebKitPrintOperation* printOperation, WebViewTest* test)
+static gboolean webViewPrintCallback(WebKitWebView* webView, WebKitPrintOperation* printOperation, WebViewTest* test)
{
g_assert(webView == test->m_webView);
@@ -64,9 +64,9 @@ static gboolean webViewPrintRequestedCallback(WebKitWebView* webView, WebKitPrin
return TRUE;
}
-static void testWebViewPrintRequested(WebViewTest* test, gconstpointer)
+static void testWebViewPrint(WebViewTest* test, gconstpointer)
{
- g_signal_connect(test->m_webView, "print-requested", G_CALLBACK(webViewPrintRequestedCallback), test);
+ g_signal_connect(test->m_webView, "print", G_CALLBACK(webViewPrintCallback), test);
test->loadHtml("<html><body onLoad=\"print();\">WebKitGTK+ printing test</body></html>", 0);
g_main_loop_run(test->m_mainLoop);
}
@@ -196,7 +196,7 @@ void beforeAll()
g_assert(kTempDirectory);
WebViewTest::add("WebKitPrintOperation", "printing-settings", testPrintOperationPrintSettings);
- WebViewTest::add("WebKitWebView", "print-requested", testWebViewPrintRequested);
+ WebViewTest::add("WebKitWebView", "print", testWebViewPrint);
#ifdef HAVE_GTK_UNIX_PRINTING
PrintTest::add("WebKitPrintOperation", "print", testPrintOperationPrint);
PrintTest::add("WebKitPrintOperation", "print-errors", testPrintOperationErrors);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
index dc7a518dd..7e2e5de61 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
@@ -397,6 +397,17 @@ static void testWebResourceMimeType(SingleResourceLoadTest* test, gconstpointer)
g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/css");
}
+static void testWebResourceSuggestedFilename(SingleResourceLoadTest* test, gconstpointer)
+{
+ test->loadURI(kServer->getURIForPath("/javascript.html").data());
+ WebKitURIResponse* response = test->waitUntilResourceLoadFinishedAndReturnURIResponse();
+ g_assert_cmpstr(webkit_uri_response_get_suggested_filename(response), ==, "JavaScript.js");
+
+ test->loadURI(kServer->getURIForPath("/image.html").data());
+ response = test->waitUntilResourceLoadFinishedAndReturnURIResponse();
+ g_assert(!webkit_uri_response_get_suggested_filename(response));
+}
+
class ResourceURITrackingTest: public SingleResourceLoadTest {
public:
MAKE_GLIB_TEST_FIXTURE(ResourceURITrackingTest);
@@ -494,32 +505,6 @@ static void testWebResourceGetData(ResourcesTest* test, gconstpointer)
test->checkResourceData(WEBKIT_WEB_RESOURCE(item->data));
}
-static void replacedContentResourceLoadStartedCallback()
-{
- g_assert_not_reached();
-}
-
-static void testWebViewResourcesReplacedContent(ResourcesTest* test, gconstpointer)
-{
- test->loadURI(kServer->getURIForPath("/").data());
- // FIXME: this should be 4 instead of 3, but we don't get the css image resource
- // due to bug https://bugs.webkit.org/show_bug.cgi?id=78510.
- test->waitUntilResourcesLoaded(3);
-
- static const char* replacedHtml =
- "<html><head>"
- " <title>Content Replaced</title>"
- " <link rel='stylesheet' href='data:text/css,body { margin: 0px; padding: 0px; }' type='text/css'>"
- " <script language='javascript' src='data:application/javascript,function foo () { var a = 1; }'></script>"
- "</head><body onload='document.title=\"Loaded\"'>WebKitGTK+ resources on replaced content test</body></html>";
- g_signal_connect(test->m_webView, "resource-load-started", G_CALLBACK(replacedContentResourceLoadStartedCallback), test);
- test->replaceContent(replacedHtml, "http://error-page.foo", 0);
- test->waitUntilTitleChangedTo("Loaded");
-
- g_assert(!webkit_web_view_get_main_resource(test->m_webView));
- g_assert(!webkit_web_view_get_subresources(test->m_webView));
-}
-
static void testWebViewResourcesHistoryCache(SingleResourceLoadTest* test, gconstpointer)
{
test->loadURI(kServer->getURIForPath("/").data());
@@ -588,6 +573,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
} else if (g_str_equal(path, "/javascript.js")) {
soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kJavascript, strlen(kJavascript));
soup_message_headers_append(message->response_headers, "Content-Type", "text/javascript");
+ soup_message_headers_append(message->response_headers, "Content-Disposition", "filename=JavaScript.js");
} else if (g_str_equal(path, "/blank.ico")) {
GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL));
char* contents;
@@ -620,9 +606,9 @@ void beforeAll()
SingleResourceLoadTest::add("WebKitWebResource", "loading", testWebResourceLoading);
SingleResourceLoadTest::add("WebKitWebResource", "response", testWebResourceResponse);
SingleResourceLoadTest::add("WebKitWebResource", "mime-type", testWebResourceMimeType);
+ SingleResourceLoadTest::add("WebKitWebResource", "suggested-filename", testWebResourceSuggestedFilename);
ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI);
ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData);
- ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent);
SingleResourceLoadTest::add("WebKitWebView", "history-cache", testWebViewResourcesHistoryCache);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
index a185db8a7..a2af7bd8d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
@@ -165,14 +165,14 @@ static void testFindControllerNext(FindControllerTest* test, gconstpointer)
test->waitUntilFindFinished();
g_assert(test->m_textFound);
- g_assert(test->m_matchCount == 2);
+ g_assert(test->m_matchCount == 1);
g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS));
webkit_find_controller_search_next(test->m_findController.get());
test->waitUntilFindFinished();
g_assert(!test->m_textFound);
- g_assert(test->m_matchCount == 2);
+ g_assert(test->m_matchCount == 1);
g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS));
}
@@ -191,14 +191,14 @@ static void testFindControllerPrevious(FindControllerTest* test, gconstpointer)
test->waitUntilFindFinished();
g_assert(test->m_textFound);
- g_assert(test->m_matchCount == 2);
+ g_assert(test->m_matchCount == 1);
g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS));
webkit_find_controller_search_previous(test->m_findController.get());
test->waitUntilFindFinished();
g_assert(test->m_textFound);
- g_assert(test->m_matchCount == 2);
+ g_assert(test->m_matchCount == 1);
g_assert(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
index 1b172dfee..cde0bc34a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "LoadTrackingTest.h"
+#include "WebKitTestServer.h"
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
#include <wtf/HashMap.h>
@@ -27,6 +28,8 @@
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/StringHash.h>
+static WebKitTestServer* kServer;
+
static void testWebContextDefault(Test* test, gconstpointer)
{
// Check there's a single instance of the default web context.
@@ -165,35 +168,6 @@ public:
webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this);
}
- static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData)
- {
- size_t dataSize;
- GOwnPtr<GError> error;
- unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr());
- g_assert(data);
-
- URISchemeTest* test = static_cast<URISchemeTest*>(userData);
- test->m_resourceData.set(reinterpret_cast<char*>(data));
- test->m_resourceDataSize = dataSize;
- g_main_loop_quit(test->m_mainLoop);
- }
-
- const char* mainResourceData(size_t& mainResourceDataSize)
- {
- m_resourceDataSize = 0;
- m_resourceData.clear();
- WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView);
- g_assert(resource);
-
- webkit_web_resource_get_data(resource, 0, resourceGetDataCallback, this);
- g_main_loop_run(m_mainLoop);
-
- mainResourceDataSize = m_resourceDataSize;
- return m_resourceData.get();
- }
-
- GOwnPtr<char> m_resourceData;
- size_t m_resourceDataSize;
GRefPtr<WebKitURISchemeRequest> m_uriSchemeRequest;
HashMap<String, URISchemeHandler> m_handlersMap;
};
@@ -266,14 +240,57 @@ static void testWebContextSpellChecker(Test* test, gconstpointer)
g_assert(webkit_web_context_get_spell_checking_enabled(webContext));
}
+static void testWebContextLanguages(WebViewTest* test, gconstpointer)
+{
+ static const char* expectedDefaultLanguage = "en";
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ size_t mainResourceDataSize = 0;
+ const char* mainResourceData = test->mainResourceData(mainResourceDataSize);
+ g_assert_cmpuint(mainResourceDataSize, ==, strlen(expectedDefaultLanguage));
+ g_assert(!strncmp(mainResourceData, expectedDefaultLanguage, mainResourceDataSize));
+
+ GList* languages = g_list_prepend(0, const_cast<gpointer>(static_cast<const void*>("dE")));
+ languages = g_list_prepend(languages, const_cast<gpointer>(static_cast<const void*>("ES_es")));
+ languages = g_list_prepend(languages, const_cast<gpointer>(static_cast<const void*>("en")));
+ webkit_web_context_set_preferred_languages(webkit_web_context_get_default(), languages);
+ g_list_free(languages);
+
+ static const char* expectedLanguages = "en, es-es;q=0.90, de;q=0.80";
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ mainResourceDataSize = 0;
+ mainResourceData = test->mainResourceData(mainResourceDataSize);
+ g_assert_cmpuint(mainResourceDataSize, ==, strlen(expectedLanguages));
+ g_assert(!strncmp(mainResourceData, expectedLanguages, mainResourceDataSize));
+}
+
+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);
+ const char* acceptLanguage = soup_message_headers_get_one(message->request_headers, "Accept-Language");
+ soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage));
+ soup_message_body_complete(message->response_body);
+}
+
void beforeAll()
{
+ kServer = new WebKitTestServer();
+ kServer->run(serverCallback);
+
Test::add("WebKitWebContext", "default-context", testWebContextDefault);
PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins);
URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme);
Test::add("WebKitWebContext", "spell-checker", testWebContextSpellChecker);
+ WebViewTest::add("WebKitWebContext", "languages", testWebContextLanguages);
}
void afterAll()
{
+ delete kServer;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
index 22796bf73..cc67c5d63 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
@@ -74,24 +74,6 @@ static void testWebViewSettings(WebViewTest* test, gconstpointer)
g_assert(webkit_settings_get_enable_javascript(settings));
}
-static void replaceContentLoadCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test)
-{
- // There might be an event from a previous load,
- // but never a WEBKIT_LOAD_STARTED after webkit_web_view_replace_content().
- g_assert_cmpint(loadEvent, !=, WEBKIT_LOAD_STARTED);
-}
-
-static void testWebViewReplaceContent(WebViewTest* test, gconstpointer)
-{
- test->loadHtml("<html><head><title>Replace Content Test</title></head><body>Content to replace</body></html>", 0);
- test->waitUntilTitleChangedTo("Replace Content Test");
-
- g_signal_connect(test->m_webView, "load-changed", G_CALLBACK(replaceContentLoadCallback), test);
- test->replaceContent("<html><body onload='document.title=\"Content Replaced\"'>New Content</body></html>",
- "http://foo.com/bar", 0);
- test->waitUntilTitleChangedTo("Content Replaced");
-}
-
static const char* kAlertDialogMessage = "WebKitGTK+ alert dialog message";
static const char* kConfirmDialogMessage = "WebKitGTK+ confirm dialog message";
static const char* kPromptDialogMessage = "WebKitGTK+ prompt dialog message";
@@ -1048,7 +1030,6 @@ void beforeAll()
WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext);
WebViewTest::add("WebKitWebView", "custom-charset", testWebViewCustomCharset);
WebViewTest::add("WebKitWebView", "settings", testWebViewSettings);
- WebViewTest::add("WebKitWebView", "replace-content", testWebViewReplaceContent);
UIClientTest::add("WebKitWebView", "create-ready-close", testWebViewCreateReadyClose);
ModalDialogsTest::add("WebKitWebView", "allow-modal-dialogs", testWebViewAllowModalDialogs);
ModalDialogsTest::add("WebKitWebView", "disallow-modal-dialogs", testWebViewDisallowModalDialogs);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
index 321b6a37a..a8d20f88c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
@@ -29,6 +29,7 @@ WebViewTest::WebViewTest()
, m_mainLoop(g_main_loop_new(0, TRUE))
, m_parentWindow(0)
, m_javascriptResult(0)
+ , m_resourceDataSize(0)
{
assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_webView));
}
@@ -70,10 +71,10 @@ void WebViewTest::loadRequest(WebKitURIRequest* request)
webkit_web_view_load_request(m_webView, request);
}
-void WebViewTest::replaceContent(const char* html, const char* contentURI, const char* baseURI)
+void WebViewTest::loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI)
{
m_activeURI = contentURI;
- webkit_web_view_replace_content(m_webView, html, contentURI, baseURI);
+ webkit_web_view_load_alternate_html(m_webView, html, contentURI, baseURI);
}
void WebViewTest::goBack()
@@ -197,6 +198,33 @@ void WebViewTest::resizeView(int width, int height)
gtk_widget_size_allocate(GTK_WIDGET(m_webView), &allocation);
}
+static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData)
+{
+ size_t dataSize;
+ GOwnPtr<GError> error;
+ unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr());
+ g_assert(data);
+
+ WebViewTest* test = static_cast<WebViewTest*>(userData);
+ test->m_resourceData.set(reinterpret_cast<char*>(data));
+ test->m_resourceDataSize = dataSize;
+ g_main_loop_quit(test->m_mainLoop);
+}
+
+const char* WebViewTest::mainResourceData(size_t& mainResourceDataSize)
+{
+ m_resourceDataSize = 0;
+ m_resourceData.clear();
+ WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView);
+ g_assert(resource);
+
+ webkit_web_resource_get_data(resource, 0, resourceGetDataCallback, this);
+ g_main_loop_run(m_mainLoop);
+
+ mainResourceDataSize = m_resourceDataSize;
+ return m_resourceData.get();
+}
+
void WebViewTest::mouseMoveTo(int x, int y, unsigned int mouseModifiers)
{
g_assert(m_parentWindow);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
index 8e469f142..25209caa3 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
@@ -35,7 +35,7 @@ public:
virtual void loadHtml(const char* html, const char* baseURI);
virtual void loadPlainText(const char* plainText);
virtual void loadRequest(WebKitURIRequest*);
- void replaceContent(const char* html, const char* contentURI, const char* baseURI);
+ void loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI);
void goBack();
void goForward();
void goToBackForwardListItem(WebKitBackForwardListItem*);
@@ -48,6 +48,7 @@ public:
void waitUntilTitleChanged();
void showInWindowAndWaitUntilMapped(GtkWindowType = GTK_WINDOW_POPUP);
void resizeView(int width, int height);
+ const char* mainResourceData(size_t& mainResourceDataSize);
void mouseMoveTo(int x, int y, unsigned int mouseModifiers = 0);
void clickMouseButton(int x, int y, unsigned int button = 1, unsigned int mouseModifiers = 0);
@@ -69,6 +70,8 @@ public:
CString m_expectedTitle;
WebKitJavascriptResult* m_javascriptResult;
GError** m_javascriptError;
+ GOwnPtr<char> m_resourceData;
+ size_t m_resourceDataSize;
private:
void doMouseButtonEvent(GdkEventType, int, int, unsigned int, unsigned int);
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index a11ef65d0..eb6b819c5 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1895,8 +1895,17 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
NSWindow *currentWindow = [self window];
if (window == currentWindow)
return;
-
- _data->_pageClient->viewWillMoveToAnotherWindow();
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
+ // Avoid calling the code added in 121482 that ensures that the undo stack is cleaned up
+ // before the WKView is moved from one window to another when the WKView is being moved
+ // out of a popover window. This avoids a bug in OS X 10.7 that was fixed in 10.8.
+ // While this technically reopens a potentially crashing code path that 121482 closed,
+ // it only reopens it for WKViews that are used for text editing and that are removed
+ // from an NSPopover at some time earlier than tear-down of the NSPopover.
+ if (![currentWindow isKindOfClass:NSClassFromString(@"_NSPopoverWindow")])
+#endif
+ _data->_pageClient->viewWillMoveToAnotherWindow();
[self removeWindowObservers];
[self addWindowObserversForWindow:window];
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
index 7911f167c..db51b85dd 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
@@ -55,7 +55,6 @@ QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* view
, viewportItem(viewportItem)
, webPageProxy(0)
, paintingIsInitialized(false)
- , m_paintNode(0)
, contentsScale(1)
{
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
index ba0e42eda..ad1c6ad3f 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
@@ -47,7 +47,6 @@ public:
QQuickWebView* const viewportItem;
WebKit::WebPageProxy* webPageProxy;
bool paintingIsInitialized;
- QSGNode* m_paintNode;
QSizeF contentsSize;
qreal contentsScale;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 6ca413f66..921586d1b 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -33,8 +33,10 @@
#include "QtWebPageLoadClient.h"
#include "QtWebPagePolicyClient.h"
#include "WebBackForwardList.h"
+#if ENABLE(INSPECTOR_SERVER)
#include "WebInspectorProxy.h"
#include "WebInspectorServer.h"
+#endif
#if ENABLE(FULLSCREEN_API)
#include "WebFullScreenManagerProxy.h"
#endif
@@ -1331,7 +1333,11 @@ void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts)
QUrl QQuickWebViewExperimental::remoteInspectorUrl() const
{
+#if ENABLE(INSPECTOR_SERVER)
return QUrl(WebInspectorServer::shared().inspectorUrlForPageID(d_ptr->webPageProxy->inspector()->remoteInspectionPageID()));
+#else
+ return QUrl();
+#endif
}
QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index)
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
index c0d3e1187..3754f169a 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
@@ -47,13 +47,13 @@ class QWEBKIT_EXPORT QWebKitTest : public QObject {
Q_PROPERTY(QVariant minimumScale READ minimumScale NOTIFY viewportChanged)
Q_PROPERTY(QVariant layoutSize READ layoutSize NOTIFY viewportChanged)
-signals:
+Q_SIGNALS:
void contentsSizeChanged();
void contentsScaleChanged();
void contentsScaleCommitted();
void viewportChanged();
-public slots:
+public Q_SLOTS:
bool touchTap(QObject* item, qreal x, qreal y, int delay = -1);
bool touchDoubleTap(QObject* item, qreal x, qreal y, int delay = -1);
bool wheelEvent(QObject* item, qreal x, qreal y, int delta, Qt::Orientation orient = Qt::Vertical);
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html b/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html
index f3ca937d2..dc9140f9d 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html
@@ -5,5 +5,7 @@
<body>
<h1>Basic page</h1>
<input id="inputField" />
+<input id="emailInputField" type="email" />
+<div id="editableDiv" contenteditable></div>
</body>
</html>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp
index 3d2a95a6c..2ad673a4b 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp
@@ -38,7 +38,7 @@ class tst_InspectorServer : public QObject {
public:
tst_InspectorServer();
-private slots:
+private Q_SLOTS:
void init();
void cleanup();
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
index 12e0ab903..d0ea1beb8 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
@@ -31,7 +31,7 @@
class tst_publicapi : public QObject {
Q_OBJECT
-private slots:
+private Q_SLOTS:
void publicAPI();
};
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro
index 11733ce48..3fd3d4583 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro
@@ -6,7 +6,6 @@ OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig()
QT += webkit-private
CONFIG += warn_on testcase
-QT -= testlib
QT += qmltest
DEFINES += DISABLE_FLICKABLE_VIEWPORT=1
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro
index fd940d43d..b340235e4 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro
@@ -6,7 +6,6 @@ OBJECTS_DIR = obj_WebView/$$activeBuildConfig()
QT += webkit-private
CONFIG += warn_on testcase
-QT -= testlib
QT += qmltest
# Test the QML files under WebView in the source repository.
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 d347e158a..5b98ae7b7 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
@@ -31,7 +31,7 @@ class tst_QQuickWebView : public QObject {
public:
tst_QQuickWebView();
-private slots:
+private Q_SLOTS:
void init();
void cleanup();
@@ -58,6 +58,7 @@ private slots:
void transparentWebViews();
void inputMethod();
+ void inputMethodHints();
void basicRenderingSanity();
private:
@@ -410,6 +411,33 @@ void tst_QQuickWebView::inputMethod()
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
}
+void tst_QQuickWebView::inputMethodHints()
+{
+ QQuickWebView* view = webView();
+
+ view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/inputmethod.html")));
+ QVERIFY(waitForLoadSucceeded(view));
+
+ // Setting focus on an input element results in an element in its shadow tree becoming the focus node.
+ // Input hints should not be set from this shadow tree node but from the input element itself.
+ runJavaScript("document.getElementById('emailInputField').focus();");
+ QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
+ QInputMethodQueryEvent query(Qt::ImHints);
+ QGuiApplication::sendEvent(view, &query);
+ Qt::InputMethodHints hints(query.value(Qt::ImHints).toUInt() & Qt::ImhExclusiveInputMask);
+ QCOMPARE(hints, Qt::ImhEmailCharactersOnly);
+
+ // The focus of an editable DIV is given directly to it, so no shadow root element
+ // is necessary. This tests the WebPage::editorState() method ability to get the
+ // right element without breaking.
+ runJavaScript("document.getElementById('editableDiv').focus();");
+ QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
+ query = QInputMethodQueryEvent(Qt::ImHints);
+ QGuiApplication::sendEvent(view, &query);
+ hints = Qt::InputMethodHints(query.value(Qt::ImHints).toUInt());
+ QCOMPARE(hints, Qt::ImhNone);
+}
+
void tst_QQuickWebView::scrollRequest()
{
webView()->setSize(QSizeF(300, 400));
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 b322bacd4..93d669cee 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
@@ -123,7 +123,7 @@ public:
static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded();
}
-signals:
+Q_SIGNALS:
void loaded();
private:
@@ -154,7 +154,7 @@ public:
, m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString())
{ }
-private slots:
+private Q_SLOTS:
void paint() { run(&tst_qrawwebview::doPaint, m_resourceDir + "/qwkview_paint.png"); }
void noBackground1() { run(&tst_qrawwebview::doNoBackground1, m_resourceDir + "/qwkview_noBackground1.png"); }
void noBackground2() { run(&tst_qrawwebview::doNoBackground2, m_resourceDir + "/qwkview_noBackground1.png"); }
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp
index cdd1f9961..6c91de717 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp
@@ -65,10 +65,10 @@ public:
{
connect(webView, SIGNAL(loadingChanged(QWebLoadRequest*)), SLOT(onLoadingChanged(QWebLoadRequest*)));
}
-signals:
+Q_SIGNALS:
void loadSucceeded();
void loadFailed();
-private slots:
+private Q_SLOTS:
void onLoadingChanged(QWebLoadRequest* loadRequest)
{
if (loadRequest->status() == QQuickWebView::LoadSucceededStatus)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/Source/WebKit2/UIProcess/API/qt/tests/util.h
index 907ddb05f..ebb162cc4 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/util.h
+++ b/Source/WebKit2/UIProcess/API/qt/tests/util.h
@@ -40,9 +40,9 @@ class LoadStartedCatcher : public QObject {
Q_OBJECT
public:
LoadStartedCatcher(QQuickWebView* webView);
-public slots:
+public Q_SLOTS:
void onLoadingChanged(QWebLoadRequest* loadRequest);
-signals:
+Q_SIGNALS:
void finished();
private:
QQuickWebView* m_webView;
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
index ef972f3e3..6b0de7f25 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
@@ -174,9 +174,9 @@ void LayerTreeCoordinatorProxy::didChangeScrollPosition(const IntPoint& position
dispatchUpdate(bind(&LayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position));
}
-void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, uint32_t graphicsSurfaceToken)
+void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer)
{
- dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, graphicsSurfaceToken));
+ dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, graphicsSurfaceToken, frontBuffer));
}
void LayerTreeCoordinatorProxy::purgeBackingStores()
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
index f603cd0fc..ed71dfe94 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
@@ -73,7 +73,7 @@ public:
void updateViewport();
void renderNextFrame();
void didChangeScrollPosition(const WebCore::IntPoint& position);
- void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken);
+ void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer);
void purgeBackingStores();
LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); }
void setLayerAnimatedOpacity(uint32_t, float);
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
index d2438f1f1..23869233c 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
@@ -33,7 +33,7 @@ messages -> LayerTreeCoordinatorProxy {
DestroyDirectlyCompositedImage(int64_t key)
DidRenderFrame()
DidChangeScrollPosition(WebCore::IntPoint position)
- SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint32_t graphicsSurfaceToken)
+ SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer)
SetLayerAnimatedOpacity(uint32_t id, float opacity)
SetLayerAnimatedTransform(uint32_t id, WebCore::TransformationMatrix transform)
}
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
index ed0be3c29..481b9f74b 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
@@ -191,7 +191,7 @@ void LayerTreeRenderer::didChangeScrollPosition(const IntPoint& position)
m_pendingRenderedContentsScrollPosition = position;
}
-void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken)
+void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer)
{
if (canvasSize.isEmpty() || !m_textureMapper)
return;
@@ -208,7 +208,7 @@ void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvas
} else
canvasBackingStore = it->second;
- canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize);
+ canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize, frontBuffer);
layer->setContentsToMedia(canvasBackingStore.get());
#endif
}
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
index 6403b5d2d..5706a4ccd 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
@@ -68,7 +68,7 @@ public:
void setContentsSize(const WebCore::FloatSize&);
void setVisibleContentsRect(const WebCore::FloatRect&);
void didChangeScrollPosition(const WebCore::IntPoint& position);
- void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken);
+ void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer);
void detach();
void appendUpdate(const Function<void()>&);
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index 26a521f39..2ba13e03c 100644
--- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -98,7 +98,8 @@ void DownloadProxy::didReceiveAuthenticationChallenge(const AuthenticationChalle
if (!m_webContext)
return;
- RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->process());
+ // FIXME (Multi-WebProcess): Get rid of deprecatedSharedProcess.
+ RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess());
m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext, this, authenticationChallengeProxy.get());
}
diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h
index d565977d9..4b49767c3 100644
--- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h
+++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h
@@ -41,7 +41,7 @@ public:
bool listen(const String& bindAddress, unsigned short port);
void close();
-private slots:
+private Q_SLOTS:
void handleNewConnection();
private:
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index c80aad42b..e024f175e 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -62,10 +62,6 @@
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
-#if PLATFORM(MAC)
-#include "BuiltInPDFView.h"
-#endif
-
#if ENABLE(BATTERY_STATUS)
#include "WebBatteryManagerProxy.h"
#endif
@@ -86,8 +82,6 @@
#include <wtf/RefCountedLeakCounter.h>
#endif
-#define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
-
using namespace WebCore;
namespace WebKit {
@@ -153,7 +147,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways)
#endif
, m_processTerminationEnabled(true)
- , m_pluginWorkQueue("com.apple.CoreIPC.PluginQueue")
{
#if !LOG_DISABLED
WebKit::initializeLogChannelsIfNecessary();
@@ -174,11 +167,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
WebContext::~WebContext()
{
- m_pluginWorkQueue.invalidate();
-
- if (m_process && m_process->isValid())
- m_process->connection()->removeQueueClient(this);
-
ASSERT(contexts().find(this) != notFound);
contexts().remove(contexts().find(this));
@@ -266,7 +254,15 @@ void WebContext::initializeDownloadClient(const WKContextDownloadClient* client)
{
m_downloadClient.initialize(client);
}
-
+
+WebProcessProxy* WebContext::deprecatedSharedProcess()
+{
+ ASSERT(m_processModel == ProcessModelSharedSecondaryProcess);
+ if (m_processes.isEmpty())
+ return 0;
+ return m_processes[0].get();
+}
+
void WebContext::languageChanged(void* context)
{
static_cast<WebContext*>(context)->languageChanged();
@@ -282,12 +278,20 @@ void WebContext::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
sendToAllProcesses(Messages::WebProcess::FullKeyboardAccessModeChanged(fullKeyboardAccessEnabled));
}
-void WebContext::ensureWebProcess()
+void WebContext::textCheckerStateChanged()
{
- if (m_process)
- return;
+ sendToAllProcesses(Messages::WebProcess::SetTextCheckerState(TextChecker::state()));
+}
+
+void WebContext::ensureSharedWebProcess()
+{
+ if (m_processes.isEmpty())
+ m_processes.append(createNewWebProcess());
+}
- m_process = WebProcessProxy::create(this);
+PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess()
+{
+ RefPtr<WebProcessProxy> process = WebProcessProxy::create(this);
WebProcessCreationParameters parameters;
@@ -332,31 +336,37 @@ void WebContext::ensureWebProcess()
RefPtr<APIObject> injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this);
if (!injectedBundleInitializationUserData)
injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
- m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0);
+ process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0);
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
- m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
+ process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
}
+ // FIXME (Multi-WebProcess): What does this mean in the brave new world?
m_pendingMessagesToPostToInjectedBundle.clear();
+
+ return process.release();
}
void WebContext::warmInitialProcess()
{
- ensureWebProcess();
+ ASSERT(m_processes.isEmpty());
+ m_processes.append(createNewWebProcess());
}
void WebContext::enableProcessTermination()
{
m_processTerminationEnabled = true;
- if (shouldTerminate(m_process.get()))
- m_process->terminate();
+ Vector<RefPtr<WebProcessProxy> > processes = m_processes;
+ for (size_t i = 0; i < processes.size(); ++i) {
+ if (shouldTerminate(processes[i].get()))
+ processes[i]->terminate();
+ }
}
bool WebContext::shouldTerminate(WebProcessProxy* process)
{
- // FIXME: Once we support multiple processes per context, this assertion won't hold.
- ASSERT(process == m_process);
+ ASSERT(m_processes.contains(process));
if (!m_processTerminationEnabled)
return false;
@@ -386,13 +396,10 @@ bool WebContext::shouldTerminate(WebProcessProxy* process)
void WebContext::processDidFinishLaunching(WebProcessProxy* process)
{
- // FIXME: Once we support multiple processes per context, this assertion won't hold.
- ASSERT_UNUSED(process, process == m_process);
+ ASSERT(m_processes.contains(process));
m_visitedLinkProvider.processDidFinishLaunching();
- m_process->connection()->addQueueClient(this);
-
// Sometimes the memorySampler gets initialized after process initialization has happened but before the process has finished launching
// so check if it needs to be started here
if (m_memorySamplerEnabled) {
@@ -401,7 +408,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process)
String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now));
sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle);
- m_process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0);
+ process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0);
}
m_connectionClient.didCreateConnection(this, process->webConnection());
@@ -409,8 +416,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process)
void WebContext::disconnectProcess(WebProcessProxy* process)
{
- // FIXME: Once we support multiple processes per context, this assertion won't hold.
- ASSERT_UNUSED(process, process == m_process);
+ ASSERT(m_processes.contains(process));
m_visitedLinkProvider.processDidClose();
@@ -452,53 +458,74 @@ void WebContext::disconnectProcess(WebProcessProxy* process)
#endif
// This can cause the web context to be destroyed.
- m_process = 0;
+ m_processes.remove(m_processes.find(process));
}
PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient* pageClient, WebPageGroup* pageGroup)
{
- ensureWebProcess();
+ RefPtr<WebProcessProxy> process;
+ if (m_processModel == ProcessModelSharedSecondaryProcess) {
+ ensureSharedWebProcess();
+ process = m_processes[0];
+ } else {
+ // FIXME (Multi-WebProcess): Add logic for sharing a process.
+ process = createNewWebProcess();
+ m_processes.append(process);
+ }
if (!pageGroup)
pageGroup = m_defaultPageGroup.get();
- return m_process->createWebPage(pageClient, this, pageGroup);
+ return process->createWebPage(pageClient, this, pageGroup);
}
WebProcessProxy* WebContext::relaunchProcessIfNecessary()
{
- ensureWebProcess();
-
- ASSERT(m_process);
- return m_process.get();
+ if (m_processModel == ProcessModelSharedSecondaryProcess) {
+ ensureSharedWebProcess();
+ return m_processes[0].get();
+ } else {
+ // FIXME (Multi-WebProcess): What should this do in this model?
+ return 0;
+ }
}
DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest& request)
{
- ensureWebProcess();
+ if (m_processModel == ProcessModelSharedSecondaryProcess) {
+ ensureSharedWebProcess();
- DownloadProxy* download = createDownloadProxy();
- uint64_t initiatingPageID = initiatingPage ? initiatingPage->pageID() : 0;
+ DownloadProxy* download = createDownloadProxy();
+ uint64_t initiatingPageID = initiatingPage ? initiatingPage->pageID() : 0;
#if PLATFORM(QT)
- ASSERT(initiatingPage); // Our design does not suppport downloads without a WebPage.
- initiatingPage->handleDownloadRequest(download);
+ ASSERT(initiatingPage); // Our design does not suppport downloads without a WebPage.
+ initiatingPage->handleDownloadRequest(download);
#endif
- process()->send(Messages::WebProcess::DownloadRequest(download->downloadID(), initiatingPageID, request), 0);
- return download;
+ m_processes[0]->send(Messages::WebProcess::DownloadRequest(download->downloadID(), initiatingPageID, request), 0);
+ return download;
+
+ } else {
+ // FIXME: (Multi-WebProcess): Implement.
+ return 0;
+ }
}
void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
{
- if (!m_process || !m_process->canSendMessage()) {
- m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody));
- return;
- }
+ if (m_processModel == ProcessModelSharedSecondaryProcess) {
+ if (m_processes.isEmpty() || !m_processes[0]->canSendMessage()) {
+ m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody));
+ return;
+ }
- // FIXME: We should consider returning false from this function if the messageBody cannot
- // be encoded.
- m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
+ // FIXME: We should consider returning false from this function if the messageBody cannot
+ // be encoded.
+ m_processes[0]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
+ } else {
+ // FIXME (Multi-WebProcess): Implement.
+ }
}
// InjectedBundle client
@@ -588,74 +615,6 @@ void WebContext::addVisitedLinkHash(LinkHash linkHash)
m_visitedLinkProvider.addVisitedLink(linkHash);
}
-void WebContext::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos)
-{
- ASSERT(isMainThread());
-
- OwnPtr<Vector<PluginInfo> > plugins(pluginInfos);
-
-#if PLATFORM(MAC)
- // Add built-in PDF last, so that it's not used when a real plug-in is installed.
- // NOTE: This has to be done on the main thread as it calls localizedString().
- if (!omitPDFSupport())
- plugins->append(BuiltInPDFView::pluginInfo());
-#endif
-
- process()->send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0);
-}
-
-void WebContext::handleGetPlugins(uint64_t requestID, bool refresh)
-{
- if (refresh)
- m_pluginInfoStore.refresh();
-
- OwnPtr<Vector<PluginInfo> > pluginInfos = adoptPtr(new Vector<PluginInfo>);
-
- Vector<PluginModuleInfo> plugins = m_pluginInfoStore.plugins();
- for (size_t i = 0; i < plugins.size(); ++i)
- pluginInfos->append(plugins[i].info);
-
- // NOTE: We have to pass the PluginInfo vector to the secondary thread via a pointer as otherwise
- // we'd end up with a deref() race on all the WTF::Strings it contains.
- RunLoop::main()->dispatch(bind(&WebContext::sendDidGetPlugins, this, requestID, pluginInfos.release()));
-}
-
-void WebContext::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh)
-{
- m_pluginWorkQueue.dispatch(bind(&WebContext::handleGetPlugins, this, requestID, refresh));
-}
-
-void WebContext::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked)
-{
- MESSAGE_CHECK_URL(urlString);
-
- String newMimeType = mimeType.lower();
-
- blocked = false;
- PluginModuleInfo plugin = pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
- if (!plugin.path)
- return;
-
- if (pluginInfoStore().shouldBlockPlugin(plugin)) {
- blocked = true;
- return;
- }
-
- pluginPath = plugin.path;
-}
-
-#if !ENABLE(PLUGIN_PROCESS)
-void WebContext::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID)
-{
- m_pluginSiteDataManager->didGetSitesWithData(sites, callbackID);
-}
-
-void WebContext::didClearPluginSiteData(uint64_t callbackID)
-{
- m_pluginSiteDataManager->didClearSiteData(callbackID);
-}
-#endif
-
DownloadProxy* WebContext::createDownloadProxy()
{
RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this);
@@ -802,7 +761,7 @@ void WebContext::didReceiveSyncMessage(WebProcessProxy* process, CoreIPC::Messag
downloadProxy->didReceiveSyncDownloadProxyMessage(process->connection(), messageID, arguments, reply);
return;
}
-
+
if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
m_iconDatabase->didReceiveSyncMessage(process->connection(), messageID, arguments, reply);
return;
@@ -921,14 +880,20 @@ bool WebContext::httpPipeliningEnabled() const
void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> callback)
{
- if (!m_process) {
+ if (m_processModel == ProcessModelSharedSecondaryProcess) {
+ if (m_processes.isEmpty()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_dictionaryCallbacks.set(callbackID, callback.get());
+ m_processes[0]->send(Messages::WebProcess::GetWebCoreStatistics(callbackID), 0);
+
+ } else {
+ // FIXME (Multi-WebProcess): Implement.
callback->invalidate();
- return;
}
-
- uint64_t callbackID = callback->callbackID();
- m_dictionaryCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebProcess::GetWebCoreStatistics(callbackID), 0);
}
static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<String, uint64_t>& map)
@@ -941,6 +906,12 @@ static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<S
return result;
}
+#if !PLATFORM(MAC)
+void WebContext::dummy(bool&)
+{
+}
+#endif
+
void WebContext::didGetWebCoreStatistics(const StatisticsData& statisticsData, uint64_t callbackID)
{
RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
@@ -972,12 +943,4 @@ void WebContext::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
sendToAllProcesses(Messages::WebProcess::SetJavaScriptGarbageCollectorTimerEnabled(flag));
}
-void WebContext::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)
-{
- if (messageID.is<CoreIPC::MessageClassWebContext>()) {
- didReceiveWebContextMessageOnConnectionWorkQueue(connection, messageID, arguments, didHandleMessage);
- return;
- }
-}
-
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index aef8af977..a011461f4 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -75,7 +75,7 @@ struct WebProcessCreationParameters;
typedef GenericCallback<WKDictionaryRef> DictionaryCallback;
-class WebContext : public APIObject, private CoreIPC::Connection::QueueClient {
+class WebContext : public APIObject {
public:
static const Type APIType = TypeContext;
@@ -90,10 +90,12 @@ public:
void initializeDownloadClient(const WKContextDownloadClient*);
ProcessModel processModel() const { return m_processModel; }
- WebProcessProxy* process() const { return m_process.get(); }
- template<typename U> bool sendToAllProcesses(const U& message);
- template<typename U> bool sendToAllProcessesRelaunchingThemIfNecessary(const U& message);
+ // FIXME (Multi-WebProcess): Remove. No code should assume that there is a shared process.
+ WebProcessProxy* deprecatedSharedProcess();
+
+ template<typename U> void sendToAllProcesses(const U& message);
+ template<typename U> void sendToAllProcessesRelaunchingThemIfNecessary(const U& message);
void processDidFinishLaunching(WebProcessProxy*);
@@ -198,7 +200,8 @@ public:
String iconDatabasePath() const;
void setLocalStorageDirectory(const String& dir) { m_overrideLocalStorageDirectory = dir; }
- void ensureWebProcess();
+ void ensureSharedWebProcess();
+ PassRefPtr<WebProcessProxy> createNewWebProcess();
void warmInitialProcess();
bool shouldTerminate(WebProcessProxy*);
@@ -220,6 +223,8 @@ public:
void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
+ void textCheckerStateChanged();
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
@@ -228,14 +233,6 @@ private:
void platformInitializeWebProcess(WebProcessCreationParameters&);
void platformInvalidateContext();
- // Plugins
- void getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh);
- void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked);
-#if !ENABLE(PLUGIN_PROCESS)
- void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID);
- void didClearPluginSiteData(uint64_t callbackID);
-#endif
-
#if PLATFORM(MAC)
void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes);
void getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames);
@@ -253,14 +250,17 @@ private:
void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size);
#endif
+#if !PLATFORM(MAC)
+ // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
+ // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
+ void dummy(bool&);
+#endif
+
void didGetWebCoreStatistics(const StatisticsData&, uint64_t callbackID);
// Implemented in generated WebContextMessageReceiver.cpp
void didReceiveWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void didReceiveSyncWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
- void didReceiveWebContextMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage);
-
- virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage) OVERRIDE;
static void languageChanged(void* context);
void languageChanged();
@@ -273,13 +273,9 @@ private:
String localStorageDirectory() const;
String platformDefaultLocalStorageDirectory() const;
- void handleGetPlugins(uint64_t requestID, bool refresh);
- void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >);
-
ProcessModel m_processModel;
- // FIXME: In the future, this should be one or more WebProcessProxies.
- RefPtr<WebProcessProxy> m_process;
+ Vector<RefPtr<WebProcessProxy> > m_processes;
RefPtr<WebPageGroup> m_defaultPageGroup;
@@ -352,23 +348,22 @@ private:
bool m_processTerminationEnabled;
HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks;
-
- WorkQueue m_pluginWorkQueue;
};
-template<typename U> inline bool WebContext::sendToAllProcesses(const U& message)
+template<typename U> inline void WebContext::sendToAllProcesses(const U& message)
{
- if (!m_process || !m_process->canSendMessage())
- return false;
-
- return m_process->send(message, 0);
+ size_t processCount = m_processes.size();
+ for (size_t i = 0; i < processCount; ++i) {
+ WebProcessProxy* process = m_processes[i].get();
+ if (process->canSendMessage())
+ process->send(message, 0);
+ }
}
-template<typename U> bool WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message)
+template<typename U> void WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message)
{
relaunchProcessIfNecessary();
-
- return m_process->send(message, 0);
+ sendToAllProcesses(message);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContext.messages.in b/Source/WebKit2/UIProcess/WebContext.messages.in
index 64f598cef..2664a5f4f 100644
--- a/Source/WebKit2/UIProcess/WebContext.messages.in
+++ b/Source/WebKit2/UIProcess/WebContext.messages.in
@@ -24,15 +24,6 @@ messages -> WebContext {
# Visited link provider messages.
AddVisitedLinkHash(uint64_t linkHash)
-
- # Plugin messages.
- GetPlugins(uint64_t requestID, bool refresh) DispatchOnConnectionQueue
- GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked)
-
-#if !ENABLE(PLUGIN_PROCESS)
- void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID)
- void DidClearPluginSiteData(uint64_t callbackID)
-#endif
DidGetWebCoreStatistics(WebKit::StatisticsData statisticsData, uint64_t callbackID)
@@ -54,4 +45,10 @@ messages -> WebContext {
SetPasteboardStringForType(WTF::String pasteboardName, WTF::String pasteboardType, WTF::String string)
SetPasteboardBufferForType(WTF::String pasteboardName, WTF::String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size)
#endif
+
+#if !PLATFORM(MAC)
+ // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
+ // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
+ Dummy() -> (bool dummyReturn)
+#endif
}
diff --git a/Source/WebKit2/UIProcess/WebIntentData.cpp b/Source/WebKit2/UIProcess/WebIntentData.cpp
index 96128dbe2..632aa3b75 100644
--- a/Source/WebKit2/UIProcess/WebIntentData.cpp
+++ b/Source/WebKit2/UIProcess/WebIntentData.cpp
@@ -30,16 +30,29 @@
#include "ImmutableArray.h"
#include "ImmutableDictionary.h"
+#include "WebProcessProxy.h"
+#include "WebSerializedScriptValue.h"
#include "WebString.h"
#include "WebURL.h"
namespace WebKit {
-WebIntentData::WebIntentData(const IntentData& store)
+WebIntentData::WebIntentData(const IntentData& store, WebProcessProxy* process)
: m_store(store)
+ , m_process(process)
{
}
+WebIntentData::~WebIntentData()
+{
+ // Remove MessagePortChannels from WebProcess.
+ if (m_process) {
+ size_t numMessagePorts = m_store.messagePorts.size();
+ for (size_t i = 0; i < numMessagePorts; ++i)
+ m_process->removeMessagePortChannel(m_store.messagePorts[i]);
+ }
+}
+
PassRefPtr<WebSerializedScriptValue> WebIntentData::data() const
{
Vector<uint8_t> dataCopy = m_store.data;
@@ -66,6 +79,7 @@ PassRefPtr<ImmutableDictionary> WebIntentData::extras() const
HashMap<String, String>::const_iterator end = m_store.extras.end();
for (HashMap<String, String>::const_iterator it = m_store.extras.begin(); it != end; ++it)
wkExtras.set(it->first, WebString::create(it->second));
+
return ImmutableDictionary::adopt(wkExtras);
}
diff --git a/Source/WebKit2/UIProcess/WebIntentData.h b/Source/WebKit2/UIProcess/WebIntentData.h
index decf4ae4f..9d59f90ce 100644
--- a/Source/WebKit2/UIProcess/WebIntentData.h
+++ b/Source/WebKit2/UIProcess/WebIntentData.h
@@ -30,21 +30,26 @@
#include "APIObject.h"
#include "IntentData.h"
-#include "WebSerializedScriptValue.h"
+#include <WebCore/KURL.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
+class ImmutableArray;
+class ImmutableDictionary;
+class WebProcessProxy;
+class WebSerializedScriptValue;
+
class WebIntentData : public APIObject {
public:
static const Type APIType = TypeIntentData;
- static PassRefPtr<WebIntentData> create(const IntentData& store)
+ static PassRefPtr<WebIntentData> create(const IntentData& store, WebProcessProxy* process)
{
- return adoptRef(new WebIntentData(store));
+ return adoptRef(new WebIntentData(store, process));
}
- virtual ~WebIntentData() { }
+ virtual ~WebIntentData();
const String& action() const { return m_store.action; }
const String& payloadType() const { return m_store.type; }
@@ -57,11 +62,12 @@ public:
const IntentData& store() const { return m_store; }
private:
- WebIntentData(const IntentData&);
+ WebIntentData(const IntentData&, WebProcessProxy*);
virtual Type type() const { return APIType; }
IntentData m_store;
+ WebProcessProxy* m_process;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 9c4df8eea..8d5cc32df 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -281,7 +281,7 @@ void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
if (!loadClient)
return;
- process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
+ m_process->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
}
void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
@@ -306,7 +306,7 @@ void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
m_uiClient.initialize(client);
- process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
+ m_process->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
setCanRunModal(m_uiClient.canRunModal());
}
@@ -329,7 +329,7 @@ void WebPageProxy::reattachToWebProcess()
m_isValid = true;
m_process = m_process->context()->relaunchProcessIfNecessary();
- process()->addExistingWebPage(this, m_pageID);
+ m_process->addExistingWebPage(this, m_pageID);
initializeWebPage();
@@ -347,8 +347,8 @@ void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
if (!item)
return;
- process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::initializeWebPage()
@@ -357,7 +357,7 @@ void WebPageProxy::initializeWebPage()
BackForwardListItemVector items = m_backForwardList->entries();
for (size_t i = 0; i < items.size(); ++i)
- process()->registerNewWebBackForwardListItem(items[i].get());
+ m_process->registerNewWebBackForwardListItem(items[i].get());
m_drawingArea = m_pageClient->createDrawingAreaProxy();
ASSERT(m_drawingArea);
@@ -367,10 +367,10 @@ void WebPageProxy::initializeWebPage()
inspector()->enableRemoteInspection();
#endif
- process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
+ m_process->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
#if ENABLE(PAGE_VISIBILITY_API)
- process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
+ m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
#endif
}
@@ -384,7 +384,7 @@ void WebPageProxy::close()
m_backForwardList->pageClosed();
m_pageClient->pageClosed();
- process()->disconnectFramesFromPage(this);
+ m_process->disconnectFramesFromPage(this);
m_mainFrame = 0;
#if ENABLE(INSPECTOR)
@@ -455,8 +455,8 @@ void WebPageProxy::close()
m_drawingArea = nullptr;
- process()->send(Messages::WebPage::Close(), m_pageID);
- process()->removeWebPage(m_pageID);
+ m_process->send(Messages::WebPage::Close(), m_pageID);
+ m_process->removeWebPage(m_pageID);
}
bool WebPageProxy::tryClose()
@@ -464,8 +464,8 @@ bool WebPageProxy::tryClose()
if (!isValid())
return true;
- process()->send(Messages::WebPage::TryClose(), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::TryClose(), m_pageID);
+ m_process->responsivenessTimer()->start();
return false;
}
@@ -494,9 +494,9 @@ void WebPageProxy::loadURL(const String& url)
SandboxExtension::Handle sandboxExtensionHandle;
bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
if (createdExtension)
- process()->willAcquireUniversalFileReadSandboxExtension();
- process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->willAcquireUniversalFileReadSandboxExtension();
+ m_process->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
@@ -509,9 +509,9 @@ void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
SandboxExtension::Handle sandboxExtensionHandle;
bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
if (createdExtension)
- process()->willAcquireUniversalFileReadSandboxExtension();
- process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->willAcquireUniversalFileReadSandboxExtension();
+ m_process->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
@@ -519,9 +519,9 @@ void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseUR
if (!isValid())
reattachToWebProcess();
- process()->assumeReadAccessToBaseURL(baseURL);
- process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->assumeReadAccessToBaseURL(baseURL);
+ m_process->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
@@ -532,9 +532,9 @@ void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const Strin
if (m_mainFrame)
m_mainFrame->setUnreachableURL(unreachableURL);
- process()->assumeReadAccessToBaseURL(baseURL);
- process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->assumeReadAccessToBaseURL(baseURL);
+ m_process->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::loadPlainTextString(const String& string)
@@ -542,8 +542,8 @@ void WebPageProxy::loadPlainTextString(const String& string)
if (!isValid())
reattachToWebProcess();
- process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
@@ -551,8 +551,8 @@ void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
if (!isValid())
reattachToWebProcess();
- process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::stopLoading()
@@ -560,8 +560,8 @@ void WebPageProxy::stopLoading()
if (!isValid())
return;
- process()->send(Messages::WebPage::StopLoading(), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::StopLoading(), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::reload(bool reloadFromOrigin)
@@ -575,7 +575,7 @@ void WebPageProxy::reload(bool reloadFromOrigin)
// We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
if (createdExtension)
- process()->willAcquireUniversalFileReadSandboxExtension();
+ m_process->willAcquireUniversalFileReadSandboxExtension();
}
if (!isValid()) {
@@ -583,8 +583,8 @@ void WebPageProxy::reload(bool reloadFromOrigin)
return;
}
- process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::goForward()
@@ -603,8 +603,8 @@ void WebPageProxy::goForward()
return;
}
- process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
+ m_process->responsivenessTimer()->start();
}
bool WebPageProxy::canGoForward() const
@@ -628,8 +628,8 @@ void WebPageProxy::goBack()
return;
}
- process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
+ m_process->responsivenessTimer()->start();
}
bool WebPageProxy::canGoBack() const
@@ -646,8 +646,8 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
setPendingAPIRequestURL(item->url());
- process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
- process()->responsivenessTimer()->start();
+ m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
+ m_process->responsivenessTimer()->start();
}
void WebPageProxy::tryRestoreScrollPosition()
@@ -655,7 +655,7 @@ void WebPageProxy::tryRestoreScrollPosition()
if (!isValid())
return;
- process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
+ m_process->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
}
void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
@@ -665,7 +665,7 @@ void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vecto
void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
{
- WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
+ WebBackForwardListItem* item = m_process->webBackForwardItem(itemID);
shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
}
@@ -676,7 +676,7 @@ void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::Argumen
if (!arguments->decode(messageDecoder))
return;
- if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
+ if (WebBackForwardListItem* item = m_process->webBackForwardItem(itemID))
m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
}
@@ -748,7 +748,7 @@ void WebPageProxy::setDrawsBackground(bool drawsBackground)
m_drawsBackground = drawsBackground;
if (isValid())
- process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
+ m_process->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
}
void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
@@ -759,21 +759,21 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground
m_drawsTransparentBackground = drawsTransparentBackground;
if (isValid())
- process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
+ m_process->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
}
void WebPageProxy::viewWillStartLiveResize()
{
if (!isValid())
return;
- process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
+ m_process->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
}
void WebPageProxy::viewWillEndLiveResize()
{
if (!isValid())
return;
- process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
+ m_process->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
}
void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
@@ -797,10 +797,10 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
return;
if (flags & ViewIsFocused)
- process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
+ m_process->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
if (flags & ViewWindowIsActive)
- process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
+ m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
if (flags & ViewIsVisible) {
bool isVisible = m_pageClient->isViewVisible();
@@ -812,7 +812,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
// If we've started the responsiveness timer as part of telling the web process to update the backing store
// state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
// stop the unresponsiveness timer here.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
}
}
}
@@ -821,7 +821,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
bool isInWindow = m_pageClient->isViewInWindow();
if (m_isInWindow != isInWindow) {
m_isInWindow = isInWindow;
- process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
+ m_process->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
}
if (isInWindow) {
@@ -841,7 +841,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
if (visibilityState != m_visibilityState) {
m_visibilityState = visibilityState;
- process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
+ m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
}
#endif
@@ -857,21 +857,21 @@ void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, cons
{
if (!isValid())
return;
- process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
+ m_process->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
}
void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
{
if (!isValid())
return;
- process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
+ m_process->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
}
void WebPageProxy::clearSelection()
{
if (!isValid())
return;
- process()->send(Messages::WebPage::ClearSelection(), m_pageID);
+ m_process->send(Messages::WebPage::ClearSelection(), m_pageID);
}
void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
@@ -883,7 +883,7 @@ void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<Validat
uint64_t callbackID = callback->callbackID();
m_validateCommandCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
+ m_process->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
}
void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
@@ -900,7 +900,7 @@ void WebPageProxy::executeEditCommand(const String& commandName)
if (commandName == ignoreSpellingCommandName)
++m_pendingLearnOrIgnoreWordMessageCount;
- process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
+ m_process->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
}
#if USE(TILED_BACKING_STORE)
@@ -909,7 +909,7 @@ void WebPageProxy::setViewportSize(const IntSize& size)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
+ m_process->send(Messages::WebPage::SetViewportSize(size), m_pageID);
}
#endif
@@ -946,12 +946,12 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag
return;
#if PLATFORM(WIN)
// FIXME: We should pass the drag data map only on DragEnter.
- process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
+ m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
#elif PLATFORM(QT) || PLATFORM(GTK)
- process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
+ m_process->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
#else
- process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
+ m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
#endif
}
@@ -978,7 +978,7 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo
{
if (!isValid())
return;
- process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
+ m_process->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
}
#endif // ENABLE(DRAG_SUPPORT)
@@ -989,7 +989,7 @@ void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
// NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
if (event.type() != WebEvent::MouseMove)
- process()->responsivenessTimer()->start();
+ m_process->responsivenessTimer()->start();
else {
if (m_processingMouseMoveEvent) {
m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
@@ -1008,10 +1008,10 @@ void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
if (m_shouldSendEventsSynchronously) {
bool handled = false;
- process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
+ m_process->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
didReceiveEvent(event.type(), handled);
} else
- process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
+ m_process->send(Messages::WebPage::MouseEvent(event), m_pageID);
}
#if MERGE_WHEEL_EVENTS
@@ -1111,16 +1111,16 @@ void WebPageProxy::processNextQueuedWheelEvent()
void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
{
- process()->responsivenessTimer()->start();
+ m_process->responsivenessTimer()->start();
if (m_shouldSendEventsSynchronously) {
bool handled = false;
- process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
+ m_process->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
didReceiveEvent(event.type(), handled);
return;
}
- process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
+ m_process->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
}
void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
@@ -1132,13 +1132,13 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
m_keyEventQueue.append(event);
- process()->responsivenessTimer()->start();
+ m_process->responsivenessTimer()->start();
if (m_shouldSendEventsSynchronously) {
bool handled = false;
- process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
+ m_process->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
didReceiveEvent(event.type(), handled);
} else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
- process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
+ m_process->send(Messages::WebPage::KeyEvent(event), m_pageID);
}
#if ENABLE(GESTURE_EVENTS)
@@ -1149,8 +1149,8 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
m_gestureEventQueue.append(event);
- process()->responsivenessTimer()->start();
- process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
+ m_process->responsivenessTimer()->start();
+ m_process->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
}
#endif
@@ -1158,7 +1158,7 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
#if PLATFORM(QT)
void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
{
- process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
+ m_process->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
}
#endif
@@ -1172,13 +1172,13 @@ void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
// we do not send any of the events to the page even if is has listeners.
if (m_needTouchEvents && !m_isPageSuspended) {
m_touchEventQueue.append(event);
- process()->responsivenessTimer()->start();
+ m_process->responsivenessTimer()->start();
if (m_shouldSendEventsSynchronously) {
bool handled = false;
- process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
+ m_process->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
didReceiveEvent(event.type(), handled);
} else
- process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
+ m_process->send(Messages::WebPage::TouchEvent(event), m_pageID);
} else {
if (m_touchEventQueue.isEmpty()) {
bool isEventHandled = false;
@@ -1198,7 +1198,7 @@ void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granula
if (!isValid())
return;
- process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
+ m_process->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
}
void WebPageProxy::centerSelectionInVisibleArea()
@@ -1206,7 +1206,7 @@ void WebPageProxy::centerSelectionInVisibleArea()
if (!isValid())
return;
- process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
+ m_process->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
}
void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
@@ -1246,7 +1246,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
return;
}
- process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
+ m_process->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
}
String WebPageProxy::pageTitle() const
@@ -1267,7 +1267,7 @@ void WebPageProxy::setUserAgent(const String& userAgent)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
+ m_process->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
}
void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
@@ -1304,7 +1304,7 @@ void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
m_isPageSuspended = false;
- process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
+ m_process->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
}
void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
@@ -1314,7 +1314,7 @@ void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
m_isPageSuspended = true;
- process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
+ m_process->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
}
bool WebPageProxy::supportsTextEncoding() const
@@ -1330,7 +1330,7 @@ void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
+ m_process->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
}
void WebPageProxy::terminateProcess()
@@ -1340,7 +1340,7 @@ void WebPageProxy::terminateProcess()
if (!m_isValid)
return;
- process()->terminate();
+ m_process->terminate();
}
#if !USE(CF) || defined(BUILDING_QT__)
@@ -1380,7 +1380,7 @@ void WebPageProxy::setTextZoomFactor(double zoomFactor)
return;
m_textZoomFactor = zoomFactor;
- process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
+ m_process->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
}
double WebPageProxy::pageZoomFactor() const
@@ -1402,7 +1402,7 @@ void WebPageProxy::setPageZoomFactor(double zoomFactor)
return;
m_pageZoomFactor = zoomFactor;
- process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
+ m_process->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
}
void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
@@ -1420,7 +1420,7 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
m_pageZoomFactor = pageZoomFactor;
m_textZoomFactor = textZoomFactor;
- process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
+ m_process->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
}
void WebPageProxy::scalePage(double scale, const IntPoint& origin)
@@ -1428,7 +1428,7 @@ void WebPageProxy::scalePage(double scale, const IntPoint& origin)
if (!isValid())
return;
- process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
+ m_process->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
}
void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
@@ -1447,7 +1447,7 @@ void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
if (!isValid())
return;
- process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
+ m_process->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
}
float WebPageProxy::deviceScaleFactor() const
@@ -1486,7 +1486,7 @@ void WebPageProxy::setUseFixedLayout(bool fixed)
m_useFixedLayout = fixed;
if (!fixed)
m_fixedLayoutSize = IntSize();
- process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
+ m_process->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
}
void WebPageProxy::setFixedLayoutSize(const IntSize& size)
@@ -1498,7 +1498,7 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size)
return;
m_fixedLayoutSize = size;
- process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
+ m_process->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
}
void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
@@ -1510,7 +1510,7 @@ void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
+ m_process->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
}
void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
@@ -1522,7 +1522,7 @@ void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
+ m_process->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
}
void WebPageProxy::setPageLength(double pageLength)
@@ -1534,7 +1534,7 @@ void WebPageProxy::setPageLength(double pageLength)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
+ m_process->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
}
void WebPageProxy::setGapBetweenPages(double gap)
@@ -1546,7 +1546,7 @@ void WebPageProxy::setGapBetweenPages(double gap)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
+ m_process->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
}
void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
@@ -1563,7 +1563,7 @@ void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsE
return;
m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
- process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
+ m_process->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
}
void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
@@ -1571,12 +1571,12 @@ void WebPageProxy::findString(const String& string, FindOptions options, unsigne
if (m_mainFrameHasCustomRepresentation)
m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
else
- process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
+ m_process->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
}
void WebPageProxy::hideFindUI()
{
- process()->send(Messages::WebPage::HideFindUI(), m_pageID);
+ m_process->send(Messages::WebPage::HideFindUI(), m_pageID);
}
void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
@@ -1589,7 +1589,7 @@ void WebPageProxy::countStringMatches(const String& string, FindOptions options,
if (!isValid())
return;
- process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
+ m_process->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
}
void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
@@ -1602,7 +1602,7 @@ void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<Scr
uint64_t callbackID = callback->callbackID();
m_scriptValueCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
+ m_process->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
}
void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
@@ -1615,7 +1615,7 @@ void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback
uint64_t callbackID = callback->callbackID();
m_stringCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
}
void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
@@ -1629,7 +1629,7 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCall
uint64_t callbackID = callback->callbackID();
m_loadDependentStringCallbackIDs.add(callbackID);
m_stringCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
}
#if ENABLE(WEB_INTENTS)
@@ -1638,7 +1638,7 @@ void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* web
if (!isValid())
return;
- process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
+ m_process->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
}
#endif
@@ -1653,7 +1653,7 @@ void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
uint64_t callbackID = callback->callbackID();
m_loadDependentStringCallbackIDs.add(callbackID);
m_stringCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
}
#if ENABLE(MHTML)
@@ -1667,7 +1667,7 @@ void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback,
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
+ m_process->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
}
#endif
@@ -1681,7 +1681,7 @@ void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prp
uint64_t callbackID = callback->callbackID();
m_stringCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
}
void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
@@ -1694,7 +1694,7 @@ void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<D
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
}
void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
@@ -1707,7 +1707,7 @@ void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resour
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
}
void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
@@ -1720,7 +1720,7 @@ void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCal
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
+ m_process->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
}
void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
@@ -1734,7 +1734,7 @@ void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
uint64_t callbackID = callback->callbackID();
m_voidCallbacks.set(callbackID, callback.get());
m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
- process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
+ m_process->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
}
void WebPageProxy::preferencesDidChange()
@@ -1752,7 +1752,7 @@ void WebPageProxy::preferencesDidChange()
// even if nothing changed in UI process, so that overrides get removed.
// Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
- process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
@@ -1811,28 +1811,28 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
void WebPageProxy::didCreateMainFrame(uint64_t frameID)
{
MESSAGE_CHECK(!m_mainFrame);
- MESSAGE_CHECK(process()->canCreateFrame(frameID));
+ MESSAGE_CHECK(m_process->canCreateFrame(frameID));
m_mainFrame = WebFrameProxy::create(this, frameID);
// Add the frame to the process wide map.
- process()->frameCreated(frameID, m_mainFrame.get());
+ m_process->frameCreated(frameID, m_mainFrame.get());
}
void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
{
MESSAGE_CHECK(m_mainFrame);
- WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
+ WebFrameProxy* parentFrame = m_process->webFrame(parentFrameID);
MESSAGE_CHECK(parentFrame);
MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
- MESSAGE_CHECK(process()->canCreateFrame(frameID));
+ MESSAGE_CHECK(m_process->canCreateFrame(frameID));
RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
// Add the frame to the process wide map.
- process()->frameCreated(frameID, subFrame.get());
+ m_process->frameCreated(frameID, subFrame.get());
// Insert the frame into the frame hierarchy.
parentFrame->appendChild(subFrame.get());
@@ -1847,7 +1847,7 @@ void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
{
MESSAGE_CHECK(m_mainFrame);
- WebFrameProxy* subframe = process()->webFrame(frameID);
+ WebFrameProxy* subframe = m_process->webFrame(frameID);
MESSAGE_CHECK(subframe);
if (isDisconnectedFrame(subframe))
@@ -1862,12 +1862,12 @@ void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t paren
{
MESSAGE_CHECK(m_mainFrame);
- WebFrameProxy* subframe = process()->webFrame(frameID);
+ WebFrameProxy* subframe = m_process->webFrame(frameID);
MESSAGE_CHECK(subframe);
MESSAGE_CHECK(!subframe->parentFrame());
MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
- WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
+ WebFrameProxy* parentFrame = m_process->webFrame(parentFrameID);
MESSAGE_CHECK(parentFrame);
MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
@@ -1917,7 +1917,7 @@ void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentS
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo);
@@ -1934,7 +1934,7 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(url);
@@ -1951,7 +1951,7 @@ void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t f
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(url);
@@ -1967,7 +1967,7 @@ void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const Resour
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->didFailProvisionalLoad();
@@ -1995,7 +1995,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
#if PLATFORM(MAC)
@@ -2035,7 +2035,7 @@ void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::Argu
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
@@ -2048,7 +2048,7 @@ void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDeco
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->didFinishLoad();
@@ -2063,7 +2063,7 @@ void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& er
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
clearLoadDependentCallbacks();
@@ -2080,7 +2080,7 @@ void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(url);
@@ -2097,7 +2097,7 @@ void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->didChangeTitle(title);
@@ -2112,7 +2112,7 @@ void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDec
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
@@ -2125,7 +2125,7 @@ void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, Core
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
@@ -2148,7 +2148,7 @@ void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::Argume
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->didRemoveFromHierarchy();
@@ -2163,7 +2163,7 @@ void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
@@ -2176,7 +2176,7 @@ void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::Argu
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
@@ -2189,7 +2189,7 @@ void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecod
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
@@ -2203,17 +2203,17 @@ void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData&
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
+ RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData, m_process.get());
m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get());
}
#endif
void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->setIsFrameSet(value);
@@ -2232,7 +2232,7 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op
if (request.url() != pendingAPIRequestURL())
clearPendingAPIRequestURL();
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
@@ -2267,7 +2267,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
@@ -2287,7 +2287,7 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceRespo
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
MESSAGE_CHECK_URL(response.url());
@@ -2319,7 +2319,7 @@ void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
@@ -2334,10 +2334,10 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons
if (!arguments->decode(messageDecoder))
return;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
+ WebFrameProxy* sourceFrame = m_process->webFrame(sourceFrameID);
MESSAGE_CHECK(sourceFrame);
RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
@@ -2349,7 +2349,7 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons
void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
@@ -2358,7 +2358,7 @@ void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourc
void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
@@ -2367,7 +2367,7 @@ void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resource
void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(response.url());
@@ -2376,7 +2376,7 @@ void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t reso
void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
@@ -2384,7 +2384,7 @@ void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t
void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
@@ -2392,7 +2392,7 @@ void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceI
void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
@@ -2418,7 +2418,7 @@ void WebPageProxy::showPage()
void WebPageProxy::closePage(bool stopResponsivenessTimer)
{
if (stopResponsivenessTimer)
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
m_pageClient->clearAllEditCommands();
m_uiClient.close(this);
@@ -2426,33 +2426,33 @@ void WebPageProxy::closePage(bool stopResponsivenessTimer)
void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
// Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
m_uiClient.runJavaScriptAlert(this, message, frame);
}
void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
// Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
result = m_uiClient.runJavaScriptConfirm(this, message, frame);
}
void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
// Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
}
@@ -2460,7 +2460,7 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message,
void WebPageProxy::shouldInterruptJavaScript(bool& result)
{
// Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
result = m_uiClient.shouldInterruptJavaScript(this);
}
@@ -2568,11 +2568,11 @@ void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
// Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
}
@@ -2604,14 +2604,14 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& set
m_openPanelResultListener = 0;
}
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
// Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
didCancelForOpenPanel();
@@ -2622,7 +2622,7 @@ void WebPageProxy::printFrame(uint64_t frameID)
ASSERT(!m_isPerformingDOMPrintOperation);
m_isPerformingDOMPrintOperation = true;
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_uiClient.printFrame(this, frame);
@@ -2646,7 +2646,7 @@ void WebPageProxy::setMediaVolume(float volume)
if (!isValid())
return;
- process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
+ m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
}
#if PLATFORM(QT)
@@ -2660,7 +2660,7 @@ void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize
if (!isValid())
return;
- process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
+ m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
}
void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
@@ -2732,7 +2732,7 @@ void WebPageProxy::didChooseColor(const WebCore::Color& color)
if (!isValid())
return;
- process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
+ m_process->send(Messages::WebPage::DidChooseColor(color), m_pageID);
}
void WebPageProxy::didEndColorChooser()
@@ -2745,7 +2745,7 @@ void WebPageProxy::didEndColorChooser()
m_colorChooser->invalidate();
m_colorChooser = nullptr;
- process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
+ m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
}
#endif
@@ -2782,18 +2782,18 @@ WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
void WebPageProxy::backForwardAddItem(uint64_t itemID)
{
- m_backForwardList->addItem(process()->webBackForwardItem(itemID));
+ m_backForwardList->addItem(m_process->webBackForwardItem(itemID));
}
void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
{
- WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
+ WebBackForwardListItem* item = m_process->webBackForwardItem(itemID);
if (!item)
return;
bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
if (createdExtension)
- process()->willAcquireUniversalFileReadSandboxExtension();
+ m_process->willAcquireUniversalFileReadSandboxExtension();
m_backForwardList->goToItem(item);
}
@@ -2874,12 +2874,12 @@ void WebPageProxy::didFailToFindString(const String& string)
void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
{
- process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
+ m_process->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
}
void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
{
- process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
+ m_process->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
}
NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
@@ -2890,7 +2890,7 @@ NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
#if PLATFORM(GTK)
void WebPageProxy::failedToShowPopupMenu()
{
- process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
+ m_process->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
}
#endif
@@ -2905,7 +2905,7 @@ void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, co
m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
// Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
@@ -2934,7 +2934,7 @@ void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTes
internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
// No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
- process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
+ m_process->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
}
void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
@@ -2954,7 +2954,7 @@ void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const W
m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
// Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
// Give the PageContextMenuClient one last swipe at changing the menu.
Vector<WebContextMenuItemData> items;
@@ -2981,27 +2981,27 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
}
if (item.action() == ContextMenuItemTagSmartQuotes) {
TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagSmartDashes) {
TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagSmartLinks) {
TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagTextReplacement) {
TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagShowSubstitutions) {
@@ -3019,12 +3019,12 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
}
if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
- process()->updateTextCheckerState();
+ m_process->updateTextCheckerState();
return;
}
if (item.action() == ContextMenuItemTagShowSpellingPanel) {
@@ -3036,7 +3036,7 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
++m_pendingLearnOrIgnoreWordMessageCount;
- process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
+ m_process->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
}
#endif // ENABLE(CONTEXT_MENUS)
@@ -3051,11 +3051,11 @@ void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
for (size_t i = 0; i < fileURLs.size(); ++i) {
SandboxExtension::Handle sandboxExtensionHandle;
SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
- process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
+ m_process->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
}
#endif
- process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
+ m_process->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
m_openPanelResultListener->invalidate();
m_openPanelResultListener = 0;
@@ -3066,7 +3066,7 @@ void WebPageProxy::didCancelForOpenPanel()
if (!isValid())
return;
- process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
+ m_process->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
m_openPanelResultListener->invalidate();
m_openPanelResultListener = 0;
@@ -3074,7 +3074,7 @@ void WebPageProxy::didCancelForOpenPanel()
void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const
{
- process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
+ m_process->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
}
void WebPageProxy::changeSpellingToWord(const String& word) const
@@ -3082,7 +3082,7 @@ void WebPageProxy::changeSpellingToWord(const String& word) const
if (word.isEmpty())
return;
- process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
+ m_process->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
}
void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
@@ -3101,7 +3101,7 @@ void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
if (!isValid())
return;
- process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
+ m_process->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
}
bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
@@ -3196,7 +3196,10 @@ void WebPageProxy::setToolTip(const String& toolTip)
void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
{
- m_pageClient->setCursor(cursor);
+ // The Web process may have asked to change the cursor when the view was in an active window, but
+ // if it is no longer in a window or the window is not active, then the cursor should not change.
+ if (m_pageClient->isViewWindowActive())
+ m_pageClient->setCursor(cursor);
}
void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
@@ -3231,7 +3234,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
case WebEvent::TouchEnd:
case WebEvent::TouchCancel:
#endif
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
break;
}
@@ -3289,7 +3292,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
m_keyEventQueue.removeFirst();
if (!m_keyEventQueue.isEmpty())
- process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
+ m_process->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
m_pageClient->doneWithKeyEvent(event, handled);
if (handled)
@@ -3325,7 +3328,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
void WebPageProxy::stopResponsivenessTimer()
{
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
}
void WebPageProxy::voidCallback(uint64_t callbackID)
@@ -3422,7 +3425,7 @@ void WebPageProxy::focusedFrameChanged(uint64_t frameID)
return;
}
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_focusedFrame = frame;
@@ -3435,7 +3438,7 @@ void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
return;
}
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
m_frameSetLargestFrame = frame;
@@ -3648,7 +3651,7 @@ void WebPageProxy::backForwardClear()
void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
@@ -3658,17 +3661,17 @@ void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID
void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
+ RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process.get());
m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
}
void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, uint64_t& newQuota)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
@@ -3678,7 +3681,7 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI
void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
{
- WebFrameProxy* frame = process()->webFrame(frameID);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
// FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
@@ -3737,13 +3740,13 @@ void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
void WebPageProxy::runModal()
{
// Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
- process()->responsivenessTimer()->stop();
+ m_process->responsivenessTimer()->stop();
// Our Connection's run loop might have more messages waiting to be handled after this RunModal message.
// To make sure they are handled inside of the the nested modal run loop we must first signal the Connection's
// run loop so we're guaranteed that it has a chance to wake up.
// See http://webkit.org/b/89590 for more discussion.
- process()->connection()->wakeUpRunLoop();
+ m_process->connection()->wakeUpRunLoop();
m_uiClient.runModal(this);
}
@@ -3812,7 +3815,7 @@ void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& sug
void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
{
- process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
+ m_process->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
}
void WebPageProxy::setCanRunModal(bool canRunModal)
@@ -3824,7 +3827,7 @@ void WebPageProxy::setCanRunModal(bool canRunModal)
// already qualifies for running modal child web pages, otherwise
// there's no other possibility than not allowing it.
m_canRunModal = m_uiClient.canRunModal() && canRunModal;
- process()->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID);
+ m_process->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID);
}
bool WebPageProxy::canRunModal()
@@ -3838,7 +3841,7 @@ void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInf
return;
m_isInPrintingMode = true;
- process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
void WebPageProxy::endPrinting()
@@ -3847,7 +3850,7 @@ void WebPageProxy::endPrinting()
return;
m_isInPrintingMode = false;
- process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback)
@@ -3861,7 +3864,7 @@ void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo
uint64_t callbackID = callback->callbackID();
m_computedPagesCallbacks.set(callbackID, callback.get());
m_isInPrintingMode = true;
- process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#if PLATFORM(MAC) || PLATFORM(WIN)
@@ -3875,7 +3878,7 @@ void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInf
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback)
@@ -3888,7 +3891,7 @@ void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printIn
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
- process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#elif PLATFORM(GTK)
void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback)
@@ -3902,7 +3905,7 @@ void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& p
uint64_t callbackID = callback->callbackID();
m_printFinishedCallbacks.set(callbackID, callback.get());
m_isInPrintingMode = true;
- process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+ m_process->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#endif
@@ -3917,7 +3920,7 @@ void WebPageProxy::updateBackingStoreDiscardableState()
bool isDiscardable;
- if (!process()->responsivenessTimer()->isResponsive())
+ if (!m_process->responsivenessTimer()->isResponsive())
isDiscardable = false;
else
isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible();
@@ -3942,7 +3945,7 @@ void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilena
void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event)
{
- process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
+ m_process->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
}
#if PLATFORM(MAC)
@@ -3978,7 +3981,7 @@ void WebPageProxy::handleAlternativeTextUIResult(const String& result)
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (!isClosed())
- process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
+ m_process->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
#endif
}
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index d90355c4e..22a2b7f2c 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -36,13 +36,19 @@
#include "WebNavigationDataStore.h"
#include "WebNotificationManagerProxy.h"
#include "WebPageProxy.h"
+#include "WebPluginSiteDataManager.h"
#include "WebProcessMessages.h"
#include "WebProcessProxyMessages.h"
#include <WebCore/KURL.h>
#include <stdio.h>
+#include <wtf/MainThread.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
+#if PLATFORM(MAC)
+#include "BuiltInPDFView.h"
+#endif
+
using namespace WebCore;
using namespace std;
@@ -63,6 +69,12 @@ static uint64_t generatePageID()
return uniquePageID++;
}
+static WorkQueue& pluginWorkQueue()
+{
+ DEFINE_STATIC_LOCAL(WorkQueue, queue, ("com.apple.CoreIPC.PluginQueue"));
+ return queue;
+}
+
PassRefPtr<WebProcessProxy> WebProcessProxy::create(PassRefPtr<WebContext> context)
{
return adoptRef(new WebProcessProxy(context));
@@ -171,8 +183,6 @@ WebPageProxy* WebProcessProxy::webPage(uint64_t pageID) const
PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup)
{
- ASSERT(context->process() == this);
-
uint64_t pageID = generatePageID();
RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
m_pageMap.set(pageID, webPage.get());
@@ -189,6 +199,16 @@ void WebProcessProxy::removeWebPage(uint64_t pageID)
m_pageMap.remove(pageID);
}
+#if ENABLE(WEB_INTENTS)
+void WebProcessProxy::removeMessagePortChannel(uint64_t channelID)
+{
+ if (!isValid())
+ return;
+
+ send(Messages::WebProcess::RemoveMessagePortChannel(channelID), /* destinationID */ 0);
+}
+#endif
+
WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const
{
return m_backForwardListItemMap.get(itemID).get();
@@ -282,16 +302,86 @@ void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& original
result.iterator->second->setBackForwardData(backForwardData.data(), backForwardData.size());
}
+void WebProcessProxy::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos)
+{
+ ASSERT(isMainThread());
+
+ OwnPtr<Vector<PluginInfo> > plugins(pluginInfos);
+
+#if PLATFORM(MAC)
+ // Add built-in PDF last, so that it's not used when a real plug-in is installed.
+ // NOTE: This has to be done on the main thread as it calls localizedString().
+ if (!m_context->omitPDFSupport())
+ plugins->append(BuiltInPDFView::pluginInfo());
+#endif
+
+ send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0);
+}
+
+void WebProcessProxy::handleGetPlugins(uint64_t requestID, bool refresh)
+{
+ if (refresh)
+ m_context->pluginInfoStore().refresh();
+
+ OwnPtr<Vector<PluginInfo> > pluginInfos = adoptPtr(new Vector<PluginInfo>);
+
+ Vector<PluginModuleInfo> plugins = m_context->pluginInfoStore().plugins();
+ for (size_t i = 0; i < plugins.size(); ++i)
+ pluginInfos->append(plugins[i].info);
+
+ // NOTE: We have to pass the PluginInfo vector to the secondary thread via a pointer as otherwise
+ // we'd end up with a deref() race on all the WTF::Strings it contains.
+ RunLoop::main()->dispatch(bind(&WebProcessProxy::sendDidGetPlugins, this, requestID, pluginInfos.release()));
+}
+
+void WebProcessProxy::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh)
+{
+ pluginWorkQueue().dispatch(bind(&WebProcessProxy::handleGetPlugins, this, requestID, refresh));
+}
+
+void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked)
+{
+ MESSAGE_CHECK_URL(urlString);
+
+ String newMimeType = mimeType.lower();
+
+ blocked = false;
+ PluginModuleInfo plugin = m_context->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
+ if (!plugin.path)
+ return;
+
+ if (m_context->pluginInfoStore().shouldBlockPlugin(plugin)) {
+ blocked = true;
+ return;
+ }
+
+ pluginPath = plugin.path;
+}
+
#if ENABLE(PLUGIN_PROCESS)
+
void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
{
- PluginProcessManager::shared().getPluginProcessConnection(context()->pluginInfoStore(), pluginPath, reply);
+ PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply);
}
void WebProcessProxy::pluginSyncMessageSendTimedOut(const String& pluginPath)
{
PluginProcessManager::shared().pluginSyncMessageSendTimedOut(pluginPath);
}
+
+#else
+
+void WebProcessProxy::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID)
+{
+ m_context->pluginSiteDataManager()->didGetSitesWithData(sites, callbackID);
+}
+
+void WebProcessProxy::didClearPluginSiteData(uint64_t callbackID)
+{
+ m_context->pluginSiteDataManager()->didClearSiteData(callbackID);
+}
+
#endif
void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h
index 09d861a0e..2dc204f89 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.h
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.h
@@ -55,7 +55,7 @@ class WebContext;
class WebPageGroup;
struct WebNavigationDataStore;
-class WebProcessProxy : public RefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, CoreIPC::Connection::QueueClient {
+class WebProcessProxy : public ThreadSafeRefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, CoreIPC::Connection::QueueClient {
public:
typedef HashMap<uint64_t, RefPtr<WebFrameProxy> > WebFrameProxyMap;
typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap;
@@ -85,6 +85,10 @@ public:
void addExistingWebPage(WebPageProxy*, uint64_t pageID);
void removeWebPage(uint64_t pageID);
+#if ENABLE(WEB_INTENTS)
+ void removeMessagePortChannel(uint64_t channelID);
+#endif
+
WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const;
ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; }
@@ -132,10 +136,20 @@ private:
void shouldTerminate(bool& shouldTerminate);
+ // Plugins
+ void getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh);
+ void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked);
#if ENABLE(PLUGIN_PROCESS)
void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
void pluginSyncMessageSendTimedOut(const String& pluginPath);
+#else
+ void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID);
+ void didClearPluginSiteData(uint64_t callbackID);
#endif
+
+ void handleGetPlugins(uint64_t requestID, bool refresh);
+ void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >);
+
#if USE(SECURITY_FRAMEWORK)
void secItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecItemRequestData&);
void secKeychainItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecKeychainItemRequestData&);
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
index 84805df32..2c3d58b93 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
@@ -33,10 +33,17 @@ messages -> WebProcessProxy {
ShouldTerminate() -> (bool shouldTerminate)
+ # Plugin messages.
+ GetPlugins(uint64_t requestID, bool refresh) DispatchOnConnectionQueue
+ GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked)
#if ENABLE(PLUGIN_PROCESS)
GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed
PluginSyncMessageSendTimedOut(WTF::String pluginPath)
#endif
+#if !ENABLE(PLUGIN_PROCESS)
+ void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID)
+ void DidClearPluginSiteData(uint64_t callbackID)
+#endif
#if USE(SECURITY_FRAMEWORK)
SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) DispatchOnConnectionQueue
diff --git a/Source/WebKit2/UIProcess/WebTextChecker.cpp b/Source/WebKit2/UIProcess/WebTextChecker.cpp
index 276184419..f4a65526a 100644
--- a/Source/WebKit2/UIProcess/WebTextChecker.cpp
+++ b/Source/WebKit2/UIProcess/WebTextChecker.cpp
@@ -48,27 +48,23 @@ void WebTextChecker::setClient(const WKTextCheckerClient* client)
m_client.initialize(client);
}
-static void updateStateForAllWebProcesses()
+static void updateStateForAllContexts()
{
const Vector<WebContext*>& contexts = WebContext::allContexts();
- for (size_t i = 0; i < contexts.size(); ++i) {
- WebProcessProxy* webProcess = contexts[i]->process();
- if (!webProcess)
- continue;
- webProcess->updateTextCheckerState();
- }
+ for (size_t i = 0; i < contexts.size(); ++i)
+ contexts[i]->textCheckerStateChanged();
}
void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
{
TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
- updateStateForAllWebProcesses();
+ updateStateForAllContexts();
}
void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
{
TextChecker::grammarCheckingEnabledStateChanged(enabled);
- updateStateForAllWebProcesses();
+ updateStateForAllContexts();
}
void WebTextChecker::checkSpelling(const WebPageProxy* page, bool startBeforeSelection)
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
index 236ffca05..ed2b4df8f 100644
--- a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
@@ -53,22 +53,78 @@ static void contextMenuItemActivatedCallback(GtkAction* action, WebPageProxy* pa
page->contextMenuItemSelected(item);
}
+static void contextMenuItemVisibilityChanged(GtkAction* action, GParamSpec*, WebContextMenuProxyGtk* contextMenuProxy)
+{
+ GtkMenu* menu = contextMenuProxy->gtkMenu();
+ if (!menu)
+ return;
+
+ GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu)));
+ bool previousVisibleItemIsNotASeparator = false;
+ GtkWidget* lastItemVisibleSeparator = 0;
+ for (GList* iter = items.get(); iter; iter = g_list_next(iter)) {
+ GtkWidget* widget = GTK_WIDGET(iter->data);
+
+ if (GTK_IS_SEPARATOR_MENU_ITEM(widget)) {
+ if (previousVisibleItemIsNotASeparator) {
+ gtk_widget_show(widget);
+ lastItemVisibleSeparator = widget;
+ previousVisibleItemIsNotASeparator = false;
+ } else
+ gtk_widget_hide(widget);
+ } else if (gtk_widget_get_visible(widget)) {
+ lastItemVisibleSeparator = 0;
+ previousVisibleItemIsNotASeparator = true;
+ }
+ }
+
+ if (lastItemVisibleSeparator)
+ gtk_widget_hide(lastItemVisibleSeparator);
+}
+
void WebContextMenuProxyGtk::append(ContextMenuItem& menuItem)
{
GtkAction* action = menuItem.gtkAction();
-
- if (action && (menuItem.type() == ActionType || menuItem.type() == CheckableActionType)) {
- g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(menuItem.action()));
- g_signal_connect(action, "activate", G_CALLBACK(contextMenuItemActivatedCallback), m_page);
+ if (action) {
+ switch (menuItem.type()) {
+ case ActionType:
+ case CheckableActionType:
+ g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(menuItem.action()));
+ g_signal_connect(action, "activate", G_CALLBACK(contextMenuItemActivatedCallback), m_page);
+ // Fall through.
+ case SubmenuType:
+ g_signal_connect(action, "notify::visible", G_CALLBACK(contextMenuItemVisibilityChanged), this);
+ break;
+ case SeparatorType:
+ break;
+ }
}
m_menu.appendItem(menuItem);
}
+// Populate the context menu ensuring that:
+// - There aren't separators next to each other.
+// - There aren't separators at the beginning of the menu.
+// - There aren't separators at the end of the menu.
void WebContextMenuProxyGtk::populate(Vector<ContextMenuItem>& items)
{
- for (size_t i = 0; i < items.size(); i++)
- append(items.at(i));
+ bool previousIsSeparator = false;
+ bool isEmpty = true;
+ for (size_t i = 0; i < items.size(); i++) {
+ ContextMenuItem& menuItem = items.at(i);
+ if (menuItem.type() == SeparatorType) {
+ previousIsSeparator = true;
+ continue;
+ }
+
+ if (previousIsSeparator && !isEmpty)
+ append(items.at(i - 1));
+ previousIsSeparator = false;
+
+ append(menuItem);
+ isEmpty = false;
+ }
}
void WebContextMenuProxyGtk::populate(const Vector<WebContextMenuItemData>& items)
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
index 638715fb1..0dd547102 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
@@ -57,7 +57,7 @@ public:
{
}
-public slots:
+public Q_SLOTS:
// Allows clients to call dismiss() directly, while also
// being able to hook up signals to automatically also
// dismiss the dialog since it's a slot.
@@ -68,7 +68,7 @@ public slots:
emit dismissed();
}
-signals:
+Q_SIGNALS:
void dismissed();
private:
@@ -95,11 +95,11 @@ public:
QString message() const { return m_message; }
QString defaultValue() const { return m_defaultValue; }
-public slots:
+public Q_SLOTS:
void accept(const QString& result = QString()) { emit accepted(result); }
void reject() { emit rejected(); }
-signals:
+Q_SIGNALS:
void accepted(const QString& result);
void rejected();
@@ -126,11 +126,11 @@ public:
QString hostname() const { return m_hostname; }
QString prefilledUsername() const { return m_prefilledUsername; }
-public slots:
+public Q_SLOTS:
void accept(const QString& username, const QString& password) { emit accepted(username, password); }
void reject() { emit rejected(); }
-signals:
+Q_SIGNALS:
void accepted(const QString& username, const QString& password);
void rejected();
@@ -188,11 +188,11 @@ public:
QString hostname() const { return m_hostname; }
-public slots:
+public Q_SLOTS:
void accept() { emit accepted(); }
void reject() { emit rejected(); }
-signals:
+Q_SIGNALS:
void accepted();
void rejected();
@@ -218,7 +218,7 @@ public:
QStringList fileList() const { return m_fileList; }
bool allowMultipleFiles() const { return m_allowMultiple;}
-public slots:
+public Q_SLOTS:
void reject() { emit rejected();}
void accept(const QVariant& path)
{
@@ -235,7 +235,7 @@ public slots:
emit fileSelected(filesPath);
}
-signals:
+Q_SIGNALS:
void rejected();
void fileSelected(const QStringList&);
@@ -283,11 +283,11 @@ public:
quint64 expectedUsage() const { return m_expectedUsage; }
QtWebSecurityOrigin* securityOrigin() { return &m_securityOrigin; }
-public slots:
+public Q_SLOTS:
void accept(quint64 size) { emit accepted(size); }
void reject() { emit rejected(); }
-signals:
+Q_SIGNALS:
void accepted(quint64 size);
void rejected();
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
index c04043d34..b70044076 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
@@ -65,7 +65,7 @@ public:
QStringList filePaths() const { return m_filepaths; }
-public slots:
+public Q_SLOTS:
void onAccepted(const QString& result = QString());
void onAuthenticationAccepted(const QString& username, const QString& password);
void onFileSelected(const QStringList& filePaths);
diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
index 50fa17f66..f8d384cc2 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
@@ -116,6 +116,9 @@ PassRefPtr<QtWebContext> QtWebContext::defaultContext()
return PassRefPtr<QtWebContext>(s_defaultContext);
RefPtr<WebContext> context = WebContext::create(String());
+ // A good all-around default.
+ context->setCacheModel(CacheModelDocumentBrowser);
+
RefPtr<QtWebContext> defaultContext = QtWebContext::create(context.get());
s_defaultContext = defaultContext.get();
// Make sure that this doesn't get called in WebKitTestRunner (defaultContext isn't used there).
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
index 4cc9f3372..446db753d 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
@@ -104,7 +104,7 @@ protected:
QQuickWebPage* m_webPage;
QQuickWebView* m_webView;
-private slots:
+private Q_SLOTS:
void inputPanelVisibleChanged();
private: