diff options
Diffstat (limited to 'Source/WebKit2')
54 files changed, 1625 insertions, 287 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 88a52a2fb..18bdebe61 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,391 @@ +2012-09-24 KwangYong Choi <ky0.choi@samsung.com> + + [EFL][WK2] Invalid featuring of INPUT_TYPE_COLOR in test_ewk2_view. + https://bugs.webkit.org/show_bug.cgi?id=97430 + + Reviewed by Kenneth Rohde Christiansen. + + The tests of ewk_view_context_get and ewk_view_feed_touch_event are not related to + INPUT_TYPE_COLOR. These tests should be moved to outside of INPUT_TYPE_COLOR block. + + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-09-23 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL][WK2] Add setting to toggle developer extensions + https://bugs.webkit.org/show_bug.cgi?id=96974 + + Reviewed by Kenneth Rohde Christiansen. + + This is required to allow the user to inspect pages. (Web inspector) + + * UIProcess/API/efl/ewk_settings.cpp: + (ewk_settings_developer_extras_enabled_set): + (ewk_settings_developer_extras_enabled_get): + * UIProcess/API/efl/ewk_settings.h: + * UIProcess/API/efl/tests/test_ewk2_settings.cpp: + (TEST_F): + +2012-09-23 Byungwoo Lee <bw80.lee@gmail.com> + + Fix build warnings : -Wunused-parameter, -Wparentheses, -Wuninitialized. + https://bugs.webkit.org/show_bug.cgi?id=97306 + + Reviewed by Benjamin Poulain. + + Fix build warning about -Wunused-parameter on Connection.cpp, + WKEinaSharedString.cpp, ewk_view_loader_client.cpp, WebPage.cpp by + using ASSERT_UNUSED() macro or removing parameter name. + Fix build warning about -Wuninitialized on WebEventFactory.cpp by + continueing the loop at the default switch case not to use the + uninitialized variable. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::waitForSyncReply): + * Shared/efl/WebEventFactory.cpp: + (WebKit::WebEventFactory::createWebTouchEvent): + * UIProcess/API/cpp/efl/WKEinaSharedString.cpp: + (WKEinaSharedString::WKEinaSharedString): + * UIProcess/API/efl/ewk_view_loader_client.cpp: + (didSameDocumentNavigationForFrame): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::SandboxExtensionTracker::beginLoad): + +2012-09-22 Sam Weinig <sam@webkit.org> + + Install WebProcess XPC services into the right places + https://bugs.webkit.org/show_bug.cgi?id=97385 + + Reviewed by Anders Carlsson. + + * Configurations/WebProcessService.xcconfig: + Update INSTALL_PATH to go into WebKit2.framework/Versions/A/XPCServices. + + * Configurations/WebProcessServiceForWebKitDevelopment.xcconfig: + Since this config file is almost identical to WebProcessService.xcconfig, + just #include it and change the one thing that is different, the INFOPLIST_FILE + + * WebKit2.xcodeproj/project.pbxproj: + Follow XPC procedure and copy the services into the right place, WebKit2.framework/Versions/A/XPCServices + in all builds except production builds where it is not necessary. Also add a symlink like everyone else + does. + +2012-09-22 Sam Weinig <sam@webkit.org> + + Allow setting a custom path to where the plug-in sandbox profiles are being kept + https://bugs.webkit.org/show_bug.cgi?id=97399 + + Reviewed by Anders Carlsson. + + Add a new default to allow controlling where to look for plug-in sandbox profiles + called "PlugInSandboxProfileDirectoryPath". + + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::initializeSandbox): + Use the passed in sandboxProfileDirectoryPath instead of hard coding /usr/share/sandbox/. + + (WebKit::PluginProcess::platformInitialize): + * Shared/Plugins/PluginProcessCreationParameters.cpp: + (WebKit::PluginProcessCreationParameters::encode): + (WebKit::PluginProcessCreationParameters::decode): + * Shared/Plugins/PluginProcessCreationParameters.h: + (PluginProcessCreationParameters): + * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: + (WebKit::PluginProcessProxy::platformInitializePluginProcess): + Grab the sandboxProfileDirectoryPath from standardUserDefaults and pass it to + the plug-in. + +2012-09-21 Sam Weinig <sam@webkit.org> + + Fix the Lion and Snow Leopard builds. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::connectToWebProcessServiceForWebKitDevelopment): + (WebKit::createWebProcessServiceForWebKitDevelopment): + (WebKit::createWebProcessService): + +2012-09-21 Sam Weinig <sam@webkit.org> + + WebProcess XPC services need have their environment set without disrupting all other XPC services + https://bugs.webkit.org/show_bug.cgi?id=95161 + + Reviewed by Anders Carlsson. + + Replace the WebKit2Service with two new XPC services, the WebProcessService, which is only used + when installed on the system, and the WebProcessServiceForWebKitDevelopment which is used at all + other times. We need both services because XPC can't in general be configured to have a custom + environment at runtime, and thus WebProcessServiceForWebKitDevelopment has the ability to re-exec + itself into a desired state. That capability is rather undesirable for installed usage, where we + don't want to allow arbitrary changes to the environment of the service, which would allow breaking + the App Sandbox. + + * Configurations/WebProcessService.xcconfig: Copied from Source/WebKit2/Configurations/WebKit2Service.xcconfig. + * Configurations/WebProcessServiceForWebKitDevelopment.xcconfig: Renamed from Source/WebKit2/Configurations/WebKit2Service.xcconfig. + Add new configuration files. + + * Platform/mac/WorkQueueMac.cpp: + (WorkQueue::registerMachPortEventHandler): + (WorkQueue::unregisterMachPortEventHandler): + Add helpful assertions. Without them, we confusingly crash a bit later in HashTable code. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::addDYLDEnvironmentAdditions): + Factor out environment additions to this helper function. + + (WebKit::connectToWebProcessServiceForWebKitDevelopment): + (WebKit::createWebProcessServiceForWebKitDevelopment): + Add functionality to setup the webkit development service via re-exec. + + (WebKit::createWebProcessService): + Add functionality to connect to the installed WebProcess service. + + (WebKit::createProcess): + Factor out posix_spawn based launching into this helper function. + + (WebKit::ProcessLauncher::launchProcess): + Call the correct process creation function based on launch data and install state. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files to the project. + + * WebProcess/mac/WebProcessServiceEntryPoints.h: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.h. + * WebProcess/mac/WebProcessServiceEntryPoints.mm: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.mm. + (WebKit::WebProcessServiceEventHandler): + (WebProcessServiceMain): + (InitializeWebProcessForWebProcessServiceForWebKitDevelopment): + Rename to WebProcessServiceEntryPoints since this is now used for both the WebProcessService and the + WebProcessServiceForWebKitDevelopment. + + * WebProcessService/Info.plist: Copied from Source/WebKit2/WebKit2Service/Info.plist. + * WebProcessService/WebProcessServiceMain.mm: Renamed from Source/WebKit2/WebKit2Service/MainMacService.mm. + Add main for the WebProcessService which just calls into the WebProcessServiceEntryPoints in WebKit2.framework. + + * WebProcessServiceForWebKitDevelopment/Info.plist: Renamed from Source/WebKit2/WebKit2Service/Info.plist. + * WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm: Added. + Add main for the WebProcessServiceForWebKitDevelopment, which can't just call directly into WebProcessServiceEntryPoints + as the framework path might not be set up correctly. This is also where we re-exec ourselves when required. + +2012-09-21 Anders Carlsson <andersca@apple.com> + + Fix WebKit2 sandbox profile. + + Instead of using #pragmas, just disable all warnings in DerivedSources.make. I suspect + that passing -traditional to the preprocessor disables support for #pragmas but I'm afraid + to change it to something else. + + * DerivedSources.make: + * WebProcess/com.apple.WebProcess.sb.in: + +2012-09-21 Benjamin Poulain <bpoulain@apple.com> + + fast/dom/Geolocation/disconnected-frame.html test asserts + https://bugs.webkit.org/show_bug.cgi?id=97376 + + Reviewed by Alexey Proskuryakov. + + In GeolocationPermissionRequestManager::cancelRequestForGeolocation, we access an iterator + after its value has been removed from the table. + There are two problems with that: + -The iterator is no longer valid after the container has been modified. + -If it was the last element, the table has been freed and the iterator points to deleted memory. + + We solve the issue by keeping a copy of the ID. We could have inverted the order of the calls + but that would make the issue less visible for future change. + + Testing covered by fast/dom/Geolocation/disconnected-frame.html. + + * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: + (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation): + +2012-09-21 Sam Weinig <sam@webkit.org> + + REGRESSION (r120361) Warnings while preprocessing com.apple.WebProcess.sb.in + https://bugs.webkit.org/show_bug.cgi?id=91079 + <rdar://problem/12332660> + + Reviewed by Anders Carlsson. + + * WebProcess/com.apple.WebProcess.sb.in: + Add pragma to ignore the invalid preprocessor warnings. + +2012-09-21 Chris Rogers <crogers@google.com> + + Add Web Audio support for deprecated/legacy APIs + https://bugs.webkit.org/show_bug.cgi?id=97050 + + Reviewed by Eric Carlson. + + * Configurations/FeatureDefines.xcconfig: + +2012-09-21 Benjamin Poulain <bpoulain@apple.com> + + [WK2] Add basic testing support for Geolocation + https://bugs.webkit.org/show_bug.cgi?id=97278 + + Reviewed by Kenneth Rohde Christiansen. + + * Shared/API/c/WKNumber.h: Fix an unfortunate copy-paste :) + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + Remove the code forcing the Geolocation permissions. It was working around the normal + Geolocation code and updating all the GeolocationController, which is a terrible idea. + +2012-09-21 Alexey Proskuryakov <ap@apple.com> + + [WK2] Make Web Inspector work in multiple web process mode + https://bugs.webkit.org/show_bug.cgi?id=97354 + + Reviewed by Timothy Hatcher. + + * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCreateInspectorPage): + Tell WKView that it's related to original page, making inspector page be in the same process. + +2012-09-21 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Implement ViewState methods in PageClientImpl in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=97202 + + Reviewed by Martin Robinson. + + Implement isViewWindowActive(), isViewFocused(), isViewVisible() + and isViewInWindow() in PageClientImpl. + + * GNUmakefile.list.am: Add new files to compilation. + * UIProcess/API/C/gtk/WKView.cpp: + (WKViewSetFocus): New private method used by WTR to focus the + WebView. + * UIProcess/API/C/gtk/WKViewPrivate.h: Added. + * UIProcess/API/gtk/PageClientImpl.cpp: + (WebKit::PageClientImpl::isViewWindowActive): Return + webkitWebViewBaseIsInWindowActive(). + (WebKit::PageClientImpl::isViewFocused): Return + webkitWebViewBaseIsFocused(). + (WebKit::PageClientImpl::isViewVisible): Return + webkitWebViewBaseIsVisible(). + (WebKit::PageClientImpl::isViewInWindow): Return + webkitWebViewBaseIsInWindow(). + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (webkitWebViewBaseNotifyResizerSize): Updated to not receive the + window as parameter since it's now saved in the instance struct. + (toplevelWindowResizeGripVisibilityChanged): Update to + webkitWebViewBaseNotifyResizerSize() API change. + (toplevelWindowFocusInEvent): Update ViewWindowIsActive flag and + notify the WebPageProxy if it changed. + (toplevelWindowFocusOutEvent): Ditto. + (webkitWebViewBaseSetToplevelOnScreenWindow): Set the toplevel + on-screen window where the view is currently added and notify + WebPageProxy if it changed. + (webkitWebViewBaseRealize): Call + webkitWebViewBaseSetToplevelOnScreenWindow() if the view has been + added to an on-screen window. + (webkitWebViewBaseFinalize): Reset the toplevel on-screen window + to make sure all signals are disconnected when the view is + destroyed. + (webkit_web_view_base_init): Remove unneeded initialization. + (resizeWebKitWebViewBaseFromAllocation): Update to + webkitWebViewBaseNotifyResizerSize() API change. + (webkitWebViewBaseMap): Update ViewIsVisible flag and notify + WebPageProxy if it changed. + (webkitWebViewBaseUnmap): Ditto. + (webkitWebViewBaseFocusInEvent): Call webkitWebViewBaseSetFocus() + passing true to focus the view. + (webkitWebViewBaseFocusOutEvent): Call webkitWebViewBaseSetFocus() + passing false to unfocus the view. + (webkitWebViewBaseParentSet): Reset the toplevel on-screen window + if the view is re-parented. + (webkit_web_view_base_class_init): Add implementations for map and + parent-set virtual functions. + (webkitWebViewBaseSetFocus): Update the ViewIsFocused and notify + WebPageProxy if it changed. + (webkitWebViewBaseIsInWindowActive): + (webkitWebViewBaseIsFocused): + (webkitWebViewBaseIsVisible): + (webkitWebViewBaseIsInWindow): + * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewMouseTarget): Use a GTK_WINDOW_TOPLEVEL instead of + POPUP for this test to make sure the view receives focus change + events. + +2012-09-21 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add WebKitWebView:is-loading property to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=97330 + + Reviewed by Xan Lopez. + + WebKitWebView:is-loading property allows to monitor when the view + is loading something without having to deal with load-changed + signal and all the details of the load status. This also allows to + know when a new load is started before it goes to STARTED status. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewGetProperty): Implement getter for is-loading + property. + (webkit_web_view_class_init): Add is-loading property. + (webkitWebViewSetIsLoading): Set whether web view is loading a + page and emit notify signal if the is-loading property has + changed. Also update the active URI when a new load operation has + started. + (webkitWebViewEmitLoadChanged): Set is-loading to FALSE when load + finishes. + (webkitWebViewLoadFailed): Set is-loading to FALSE when load fails. + (webkit_web_view_load_uri): Set is-loading to TRUE. + (webkit_web_view_load_html): Ditto. + (webkit_web_view_load_alternate_html): Ditto. + (webkit_web_view_load_plain_text): Ditto. + (webkit_web_view_load_request): Ditto. + (webkit_web_view_reload): Ditto. + (webkit_web_view_reload_bypass_cache): Ditto. + (webkit_web_view_is_loading): Return whether the view is loading a + page. + (webkit_web_view_go_back): Set is-loading to TRUE. + (webkit_web_view_go_forward): Ditto. + (webkit_web_view_go_to_back_forward_list_item): Ditto. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/LoadTrackingTest.cpp: + (loadChangedCallback): + (loadFailedCallback): + * UIProcess/API/gtk/tests/TestLoaderClient.cpp: + (testWebViewIsLoading): + (beforeAll): + +2012-09-20 Eunmi Lee <eunmi15.lee@samsung.com> + + [EFL][WK2] Add API to feed touch event. + https://bugs.webkit.org/show_bug.cgi?id=96903 + + Reviewed by Kenneth Rohde Christiansen. + + The applications will use this API to feed touch event to the view + when they want to generate touch event from their own event processor. + WTR also will use this API to generate touch event with multiple touch + points for passing test cases of touch event in the WebKit2/EFL. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_feed_touch_event): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-09-20 Patrick Gansterer <paroga@webkit.org> + + Add String::numberToStringFixedWidth() + https://bugs.webkit.org/show_bug.cgi?id=96330 + + Reviewed by Benjamin Poulain. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + 2012-09-17 Jon Lee <jonlee@apple.com> Safari 6 notifications' onclick handlers can't call window.open() diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index f142ee8cf..835e2e40d 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -97,6 +97,7 @@ ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_NOTIFICATIONS_macosx_1090 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_VENDOR_PREFIXES = ENABLE_LEGACY_VENDOR_PREFIXES; +ENABLE_LEGACY_WEB_AUDIO = ENABLE_LEGACY_WEB_AUDIO; ENABLE_LINK_PREFETCH = ; ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; @@ -141,4 +142,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(LEGACY_VENDOR_PREFIXES) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index b7b7a526a..2fff18a71 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 11; +MINOR_VERSION = 12; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/Configurations/WebKit2Service.xcconfig b/Source/WebKit2/Configurations/WebProcessService.xcconfig index f78892996..1c4ec1fca 100644 --- a/Source/WebKit2/Configurations/WebKit2Service.xcconfig +++ b/Source/WebKit2/Configurations/WebProcessService.xcconfig @@ -25,8 +25,8 @@ GCC_ENABLE_OBJC_GC = NO; PRODUCT_NAME = com.apple.WebKit2.$(TARGET_NAME:rfc1034identifier); -INFOPLIST_FILE = WebKit2Service/Info.plist; -INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework; +INFOPLIST_FILE = WebProcessService/Info.plist; +INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework/Versions/A/XPCServices; APP_ICON = $(APP_ICON_$(CONFIGURATION)); APP_ICON_Debug = WebKit.icns; diff --git a/Source/WebKit2/Configurations/WebProcessServiceForWebKitDevelopment.xcconfig b/Source/WebKit2/Configurations/WebProcessServiceForWebKitDevelopment.xcconfig new file mode 100644 index 000000000..0b01933f5 --- /dev/null +++ b/Source/WebKit2/Configurations/WebProcessServiceForWebKitDevelopment.xcconfig @@ -0,0 +1,26 @@ +// Copyright (C) 2012 Apple Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "WebProcessService.xcconfig" + +INFOPLIST_FILE = WebProcessServiceForWebKitDevelopment/Info.plist; diff --git a/Source/WebKit2/DerivedSources.make b/Source/WebKit2/DerivedSources.make index 496c73031..896c8e06e 100644 --- a/Source/WebKit2/DerivedSources.make +++ b/Source/WebKit2/DerivedSources.make @@ -119,7 +119,7 @@ FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) | HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));') ifeq ($(TARGET_GCC_VERSION),LLVM_COMPILER) - TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional + TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional -w else TEXT_PREPROCESSOR_FLAGS=-E -P -x c -std=c89 endif diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index 41d311d12..6ecb2da8b 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -511,6 +511,7 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h \ Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp \ Source/WebKit2/UIProcess/API/C/gtk/WKView.h \ + Source/WebKit2/UIProcess/API/C/gtk/WKViewPrivate.h \ Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h \ Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp \ Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h \ diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index d22b8b4c1..b19eb7507 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -448,7 +448,7 @@ PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, ASSERT(!m_pendingSyncReplies.isEmpty()); PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last(); - ASSERT(pendingSyncReply.syncRequestID == syncRequestID); + ASSERT_UNUSED(syncRequestID, pendingSyncReply.syncRequestID == syncRequestID); // We found the sync reply, or the connection was closed. if (pendingSyncReply.didReceiveReply || !m_shouldWaitForSyncReplies) diff --git a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp index ae473ee5c..9e57e150c 100644 --- a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp +++ b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp @@ -110,6 +110,8 @@ private: void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, const Function<void()>& function) { + ASSERT(machPort != MACH_PORT_NULL); + dispatch_source_type_t sourceType = 0; switch (eventType) { case MachPortDataAvailable: @@ -144,7 +146,7 @@ void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEvent void WorkQueue::unregisterMachPortEventHandler(mach_port_t machPort) { - ASSERT(machPort); + ASSERT(machPort != MACH_PORT_NULL); MutexLocker locker(m_eventSourcesMutex); diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 1a3fa0cca..8acb4c730 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -223,6 +223,7 @@ SET (EWebKit2_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu_item.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_settings.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_touch.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_scheme_request.h" diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index 7a8cb35f4..6a313f26c 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -267,8 +267,11 @@ void PluginProcess::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) } #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -static void initializeSandbox(const String& pluginPath) +static void initializeSandbox(const String& pluginPath, const String& sandboxProfileDirectoryPath) { + if (sandboxProfileDirectoryPath.isEmpty()) + return; + RetainPtr<CFStringRef> cfPluginPath = adoptCF(pluginPath.createCFString()); RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false)); if (!pluginURL) @@ -282,9 +285,12 @@ static void initializeSandbox(const String& pluginPath) if (!bundleIdentifier) return; + RetainPtr<CFStringRef> cfSandboxProfileDirectoryPath = adoptCF(sandboxProfileDirectoryPath.createCFString()); + RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, cfSandboxProfileDirectoryPath.get(), kCFURLPOSIXPathStyle, TRUE)); + RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); - RetainPtr<CFURLRef> pluginSandboxDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, CFSTR("/usr/share/sandbox/"), kCFURLPOSIXPathStyle, YES)); - RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, pluginSandboxDirectory.get())); + RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); + RetainPtr<NSString> profileString = [[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]; if (!profileString) return; @@ -306,7 +312,7 @@ void PluginProcess::platformInitialize(const PluginProcessCreationParameters& pa WKSetVisibleApplicationName((CFStringRef)applicationName); #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - initializeSandbox(m_pluginPath); + initializeSandbox(m_pluginPath, parameters.sandboxProfileDirectoryPath); #endif } diff --git a/Source/WebKit2/Shared/API/c/WKNumber.h b/Source/WebKit2/Shared/API/c/WKNumber.h index 1b07bef8b..c8c912965 100644 --- a/Source/WebKit2/Shared/API/c/WKNumber.h +++ b/Source/WebKit2/Shared/API/c/WKNumber.h @@ -45,7 +45,7 @@ WK_EXPORT double WKDoubleGetValue(WKDoubleRef doubleRef); /* WKUInt64 */ WK_EXPORT WKTypeID WKUInt64GetTypeID(); WK_EXPORT WKUInt64Ref WKUInt64Create(uint64_t value); -WK_EXPORT uint64_t WKUInt64GetValue(WKUInt64Ref doubleRef); +WK_EXPORT uint64_t WKUInt64GetValue(WKUInt64Ref integerRef); #ifdef __cplusplus } diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index 8d3950a4c..1a0a52c41 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -47,6 +47,7 @@ void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) #if PLATFORM(MAC) encoder->encode(parentProcessName); encoder->encode(acceleratedCompositingPort); + encoder->encode(sandboxProfileDirectoryPath); #endif } @@ -65,6 +66,8 @@ bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, return false; if (!decoder->decode(result.acceleratedCompositingPort)) return false; + if (!decoder->decode(result.sandboxProfileDirectoryPath)) + return false; #endif return true; diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h index 1d6d2e09c..544374ad1 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h @@ -56,6 +56,7 @@ struct PluginProcessCreationParameters { #if PLATFORM(MAC) String parentProcessName; CoreIPC::MachPort acceleratedCompositingPort; + String sandboxProfileDirectoryPath; #endif }; diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index 6e50ed199..2b0d951cb 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -234,7 +234,7 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, co break; default: ASSERT_NOT_REACHED(); - break; + continue; } touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y))); diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp index 092914460..3e69a9908 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp @@ -29,6 +29,7 @@ #include "WKView.h" #include "WKAPICast.h" +#include "WKViewPrivate.h" #include "WebKitWebViewBasePrivate.h" using namespace WebKit; @@ -44,4 +45,7 @@ WKPageRef WKViewGetPage(WKViewRef viewRef) return toAPI(webkitWebViewBaseGetPage(toImpl(viewRef))); } - +void WKViewSetFocus(WKViewRef viewRef, bool focused) +{ + webkitWebViewBaseSetFocus(toImpl(viewRef), focused); +} diff --git a/Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.h b/Source/WebKit2/UIProcess/API/C/gtk/WKViewPrivate.h index ff3feb029..2c1b2d1f0 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.h +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKViewPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,23 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebProcessXPCServiceMain_h -#define WebProcessXPCServiceMain_h +#ifndef WKViewPrivate_h +#define WKViewPrivate_h -#if HAVE(XPC) - -#include "WKBase.h" +#include <WebKit2/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT int WebProcessXPCServiceMain(int argc, char** argv); +WK_EXPORT void WKViewSetFocus(WKViewRef viewRef, bool focused); #ifdef __cplusplus -}; // extern "C" +} #endif -#endif // HAVE(XPC) - -#endif // WebProcessXPCServiceMain_h +#endif /* WKViewPrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp index d31bfd40e..21ff597d5 100644 --- a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp +++ b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp @@ -60,7 +60,7 @@ WKEinaSharedString::WKEinaSharedString(const char* str) WKEinaSharedString::WKEinaSharedString(WKAdoptTag adoptTag, WKStringRef stringRef) : m_string(fromRefType(stringRef, /*adopt*/ true)) { - ASSERT(adoptTag == AdoptWK); // Guard for future enum changes. + ASSERT_UNUSED(adoptTag, adoptTag == AdoptWK); // Guard for future enum changes. } WKEinaSharedString::WKEinaSharedString(WKStringRef stringRef) @@ -71,7 +71,7 @@ WKEinaSharedString::WKEinaSharedString(WKStringRef stringRef) WKEinaSharedString::WKEinaSharedString(WKAdoptTag adoptTag, WKURLRef urlRef) : m_string(fromRefType(urlRef, /*adopt*/ true)) { - ASSERT(adoptTag == AdoptWK); // Guard for future enum changes. + ASSERT_UNUSED(adoptTag, adoptTag == AdoptWK); // Guard for future enum changes. } WKEinaSharedString::WKEinaSharedString(WKURLRef urlRef) diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 750cb4864..13efab13a 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -40,6 +40,7 @@ #include "ewk_navigation_policy_decision.h" #include "ewk_popup_menu_item.h" #include "ewk_settings.h" +#include "ewk_touch.h" #include "ewk_url_request.h" #include "ewk_url_response.h" #include "ewk_url_scheme_request.h" diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp index 9055ce7eb..a1f51b8bc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp @@ -83,3 +83,19 @@ Eina_Bool ewk_settings_loads_images_automatically_get(const Ewk_Settings* settin return WKPreferencesGetLoadsImagesAutomatically(settings->preferences.get()); } + +Eina_Bool ewk_settings_developer_extras_enabled_set(Ewk_Settings* settings, Eina_Bool enable) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); + + WKPreferencesSetDeveloperExtrasEnabled(settings->preferences.get(), enable); + + return true; +} + +Eina_Bool ewk_settings_developer_extras_enabled_get(const Ewk_Settings* settings) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); + + return WKPreferencesGetDeveloperExtrasEnabled(settings->preferences.get()); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h index a28d40be2..1d8b213d0 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h @@ -110,6 +110,30 @@ EAPI Eina_Bool ewk_settings_loads_images_automatically_set(Ewk_Settings *setting */ EAPI Eina_Bool ewk_settings_loads_images_automatically_get(const Ewk_Settings *settings); +/** + * Enables/disables developer extensions. + * + * By default, the developer extensions are disabled. + * + * @param settings settings object to set developer extensions + * @param enable @c EINA_TRUE to enable developer extensions, @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_settings_developer_extras_enabled_set(Ewk_Settings *settings, Eina_Bool enable); + +/** + * Queries if developer extensions are enabled. + * + * By default, the developer extensions are disabled. + * + * @param settings settings object to set developer extensions + * + * @return @c EINA_TRUE if developer extensions are enabled + @c EINA_FALSE if not or on failure + */ +EAPI Eina_Bool ewk_settings_developer_extras_enabled_get(const Ewk_Settings *settings); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 0eab8b540..10a68c404 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -1762,3 +1762,19 @@ Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, in return false; #endif } + +Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers) +{ +#if ENABLE(TOUCH_EVENTS) + EINA_SAFETY_ON_NULL_RETURN_VAL(points, false); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + Evas_Point position = { smartData->view.x, smartData->view.y }; + priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get())); + + return true; +#else + return false; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index 314975196..13f138c87 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -75,6 +75,7 @@ #include "ewk_download_job.h" #include "ewk_intent.h" #include "ewk_settings.h" +#include "ewk_touch.h" #include "ewk_url_request.h" #include "ewk_url_response.h" #include "ewk_web_error.h" @@ -692,6 +693,21 @@ EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o); */ EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int b, int a); +/** + * Feeds the touch event to the view. + * + * @param o view object to feed touch event + * @param type the type of touch event + * @param points a list of points (Ewk_Touch_Point) to process + * @param modifiers an Evas_Modifier handle to the list of modifier keys + * registered in the Evas. Users can get the Evas_Modifier from the Evas + * using evas_key_modifier_get() and can set each modifier key using + * evas_key_modifier_on() and evas_key_modifier_off() + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp index ab88624a4..997ca35a8 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp @@ -133,7 +133,7 @@ static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedIt ewk_back_forward_list_changed(ewk_view_back_forward_list_get(ewkView), addedItem, removedItems); } -static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) +static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp index dd0a6e722..9889bbae7 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp @@ -81,3 +81,17 @@ TEST_F(EWK2UnitTestBase, ewk_settings_loads_images_automatically) ASSERT_TRUE(ewk_settings_loads_images_automatically_set(settings, EINA_FALSE)); ASSERT_FALSE(ewk_settings_loads_images_automatically_get(settings)); } + +TEST_F(EWK2UnitTestBase, ewk_settings_developer_extras_enabled) +{ + Ewk_Settings* settings = ewk_view_settings_get(webView()); + + ASSERT_TRUE(ewk_settings_developer_extras_enabled_set(settings, EINA_TRUE)); + ASSERT_TRUE(ewk_settings_developer_extras_enabled_get(settings)); + + ASSERT_TRUE(ewk_settings_developer_extras_enabled_set(settings, 2)); + ASSERT_TRUE(ewk_settings_developer_extras_enabled_get(settings)); + + ASSERT_TRUE(ewk_settings_developer_extras_enabled_set(settings, EINA_FALSE)); + ASSERT_FALSE(ewk_settings_developer_extras_enabled_get(settings)); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index 8c258ba66..c3d35214c 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -25,6 +25,7 @@ #include <EWebKit2.h> #include <Ecore.h> #include <Eina.h> +#include <Evas.h> #include <gtest/gtest.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -714,6 +715,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_color_picker_color_set) ecore_main_loop_iterate(); evas_object_smart_callback_del(webView(), "input,type,color,request", onColorPickerDone); } +#endif // ENABLE(INPUT_TYPE_COLOR) TEST_F(EWK2UnitTestBase, ewk_view_context_get) { @@ -721,4 +723,29 @@ TEST_F(EWK2UnitTestBase, ewk_view_context_get) ASSERT_TRUE(context); ASSERT_EQ(context, ewk_view_context_get(webView())); } -#endif // ENABLE(INPUT_TYPE_COLOR) + +TEST_F(EWK2UnitTestBase, ewk_view_feed_touch_event) +{ + Eina_List* points = 0; + Ewk_Touch_Point point1 = { 0, 0, 0, EVAS_TOUCH_POINT_DOWN }; + Ewk_Touch_Point point2 = { 1, 0, 0, EVAS_TOUCH_POINT_DOWN }; + points = eina_list_append(points, &point1); + points = eina_list_append(points, &point2); + ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_START, points, evas_key_modifier_get(evas_object_evas_get(webView())))); + + point1.state = EVAS_TOUCH_POINT_STILL; + point2.x = 100; + point2.y = 100; + point2.state = EVAS_TOUCH_POINT_MOVE; + ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_MOVE, points, evas_key_modifier_get(evas_object_evas_get(webView())))); + + point2.state = EVAS_TOUCH_POINT_UP; + ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_END, points, evas_key_modifier_get(evas_object_evas_get(webView())))); + points = eina_list_remove(points, &point2); + + point1.state = EVAS_TOUCH_POINT_CANCEL; + ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_CANCEL, points, evas_key_modifier_get(evas_object_evas_get(webView())))); + points = eina_list_remove(points, &point1); + + eina_list_free(points); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp index a1f5d962d..d42b8b703 100644 --- a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp @@ -98,26 +98,22 @@ WebCore::IntSize PageClientImpl::viewSize() bool PageClientImpl::isViewWindowActive() { - notImplemented(); - return true; + return webkitWebViewBaseIsInWindowActive(WEBKIT_WEB_VIEW_BASE(m_viewWidget)); } bool PageClientImpl::isViewFocused() { - notImplemented(); - return true; + return webkitWebViewBaseIsFocused(WEBKIT_WEB_VIEW_BASE(m_viewWidget)); } bool PageClientImpl::isViewVisible() { - notImplemented(); - return true; + return webkitWebViewBaseIsVisible(WEBKIT_WEB_VIEW_BASE(m_viewWidget)); } bool PageClientImpl::isViewInWindow() { - notImplemented(); - return true; + return webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget)); } void PageClientImpl::PageClientImpl::processDidCrash() diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 1e6aa7fac..45c3821b0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -103,7 +103,8 @@ enum { PROP_TITLE, PROP_ESTIMATED_LOAD_PROGRESS, PROP_URI, - PROP_ZOOM_LEVEL + PROP_ZOOM_LEVEL, + PROP_IS_LOADING }; typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap; @@ -115,6 +116,7 @@ struct _WebKitWebViewPrivate { CString customTextEncoding; double estimatedLoadProgress; CString activeURI; + bool isLoading; bool waitingForMainResource; gulong mainResourceResponseHandlerID; @@ -386,6 +388,9 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu case PROP_ZOOM_LEVEL: g_value_set_double(value, webkit_web_view_get_zoom_level(webView)); break; + case PROP_IS_LOADING: + g_value_set_boolean(value, webkit_web_view_is_loading(webView)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); } @@ -506,6 +511,38 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_PARAM_READABLE)); /** + * WebKitWebView:zoom-level: + * + * The zoom level of the #WebKitWebView content. + * See webkit_web_view_set_zoom_level() for more details. + */ + g_object_class_install_property(gObjectClass, + PROP_ZOOM_LEVEL, + g_param_spec_double("zoom-level", + "Zoom level", + _("The zoom level of the view content"), + 0, G_MAXDOUBLE, 1, + WEBKIT_PARAM_READWRITE)); + + /** + * WebKitWebView:is-loading: + * + * Whether the #WebKitWebView is currently loading a page. This property becomes + * %TRUE as soon as a new load operation is requested and before the + * #WebKitWebView::load-changed signal is emitted with %WEBKIT_LOAD_STARTED and + * at that point the active URI is the requested one. + * When the load operation finishes the property is set to %FALSE before + * #WebKitWebView::load-changed is emitted with %WEBKIT_LOAD_FINISHED. + */ + g_object_class_install_property(gObjectClass, + PROP_IS_LOADING, + g_param_spec_boolean("is-loading", + "Is Loading", + _("Whether the view is loading a page"), + FALSE, + WEBKIT_PARAM_READABLE)); + + /** * WebKitWebView::load-changed: * @web_view: the #WebKitWebView on which the signal is emitted * @load_event: the #WebKitLoadEvent @@ -599,20 +636,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_POINTER); /** - * WebKitWebView:zoom-level: - * - * The zoom level of the #WebKitWebView content. - * See webkit_web_view_set_zoom_level() for more details. - */ - g_object_class_install_property(gObjectClass, - PROP_ZOOM_LEVEL, - g_param_spec_double("zoom-level", - "Zoom level", - "The zoom level of the view content", - 0, G_MAXDOUBLE, 1, - WEBKIT_PARAM_READWRITE)); - - /** * WebKitWebView::create: * @web_view: the #WebKitWebView on which the signal is emitted * @@ -1106,6 +1129,21 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_TYPE_FORM_SUBMISSION_REQUEST); } +static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading) +{ + if (webView->priv->isLoading == isLoading) + return; + + webView->priv->isLoading = isLoading; + g_object_freeze_notify(G_OBJECT(webView)); + g_object_notify(G_OBJECT(webView), "is-loading"); + + // Update the URI if a new load has started. + if (webView->priv->isLoading) + webkitWebViewUpdateURI(webView); + g_object_thaw_notify(G_OBJECT(webView)); +} + static void setCertificateToMainResource(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; @@ -1118,6 +1156,7 @@ static void setCertificateToMainResource(WebKitWebView* webView) static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) { if (loadEvent == WEBKIT_LOAD_FINISHED) { + webkitWebViewSetIsLoading(webView, false); webView->priv->waitingForMainResource = false; webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView); } else @@ -1167,6 +1206,7 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error) { + webkitWebViewSetIsLoading(webView, false); 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); @@ -1521,7 +1561,7 @@ void webkit_web_view_load_uri(WebKitWebView* webView, const gchar* uri) WKRetainPtr<WKURLRef> url(AdoptWK, WKURLCreateWithUTF8CString(uri)); WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); WKPageLoadURL(toAPI(page), url.get()); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1549,6 +1589,7 @@ void webkit_web_view_load_html(WebKitWebView* webView, const gchar* content, con WKRetainPtr<WKStringRef> contentRef(AdoptWK, WKStringCreateWithUTF8CString(content)); WKRetainPtr<WKURLRef> baseURIRef = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0; WKPageLoadHTMLString(toAPI(page), contentRef.get(), baseURIRef.get()); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1575,7 +1616,7 @@ void webkit_web_view_load_alternate_html(WebKitWebView* webView, const gchar* co 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); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1595,6 +1636,7 @@ void webkit_web_view_load_plain_text(WebKitWebView* webView, const gchar* plainT WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); WKRetainPtr<WKStringRef> plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText)); WKPageLoadPlainTextString(toAPI(page), plainTextRef.get()); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1615,7 +1657,7 @@ void webkit_web_view_load_request(WebKitWebView* webView, WebKitURIRequest* requ WKRetainPtr<WKURLRequestRef> wkRequest(AdoptWK, WKURLRequestCreateWithWKURL(wkURL.get())); WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); WKPageLoadURLRequest(toAPI(page), wkRequest.get()); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1647,7 +1689,7 @@ void webkit_web_view_reload(WebKitWebView* webView) g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WKPageReload(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)))); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1662,7 +1704,7 @@ void webkit_web_view_reload_bypass_cache(WebKitWebView* webView) g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WKPageReloadFromOrigin(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)))); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1683,6 +1725,26 @@ void webkit_web_view_stop_loading(WebKitWebView* webView) } /** + * webkit_web_view_is_loading: + * @web_view: a #WebKitWebView + * + * Gets the value of the #WebKitWebView:is-loading property. + * You can monitor when a #WebKitWebView is loading a page by connecting to + * notify::is-loading signal of @web_view. This is useful when you are + * interesting in knowing when the view is loding something but not in the + * details about the status of the load operation, for example to start a spinner + * when the view is loading a page and stop it when it finishes. + * + * Returns: %TRUE if @web_view is loading a page or %FALSE otherwise. + */ +gboolean webkit_web_view_is_loading(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + + return webView->priv->isLoading; +} + +/** * webkit_web_view_go_back: * @web_view: a #WebKitWebView * @@ -1695,7 +1757,7 @@ void webkit_web_view_go_back(WebKitWebView* webView) g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WKPageGoBack(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)))); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1726,7 +1788,7 @@ void webkit_web_view_go_forward(WebKitWebView* webView) g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WKPageGoForward(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)))); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** @@ -1900,7 +1962,7 @@ void webkit_web_view_go_to_back_forward_list_item(WebKitWebView* webView, WebKit WKPageGoToBackForwardListItem(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))), webkitBackForwardListItemGetWKItem(listItem)); - webkitWebViewUpdateURI(webView); + webkitWebViewSetIsLoading(webView, true); } /** diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 540014ac4..8a397b752 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -226,6 +226,9 @@ webkit_web_view_load_request (WebKitWebView *w WEBKIT_API void webkit_web_view_stop_loading (WebKitWebView *web_view); +WEBKIT_API gboolean +webkit_web_view_is_loading (WebKitWebView *web_view); + WEBKIT_API const gchar * webkit_web_view_get_title (WebKitWebView *web_view); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index 23b02f649..5338e2bd3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -79,7 +79,6 @@ struct _WebKitWebViewBasePrivate { WebKitWebViewChildrenMap children; OwnPtr<PageClientImpl> pageClient; RefPtr<WebPageProxy> pageProxy; - bool isPageActive; bool shouldForwardNextKeyEvent; GRefPtr<GtkIMContext> imContext; GtkClickCounter clickCounter; @@ -95,6 +94,16 @@ struct _WebKitWebViewBasePrivate { GOwnPtr<GdkEvent> contextMenuEvent; WebContextMenuProxyGtk* activeContextMenuProxy; + GtkWindow* toplevelOnScreenWindow; + unsigned long toplevelResizeGripVisibilityID; + unsigned long toplevelFocusInEventID; + unsigned long toplevelFocusOutEventID; + + // View State. + bool isInWindowActive : 1; + bool isFocused : 1; + bool isVisible : 1; + #if ENABLE(FULLSCREEN_API) bool fullScreenModeActive; WebFullScreenClientGtk fullScreenClient; @@ -108,30 +117,93 @@ struct _WebKitWebViewBasePrivate { G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER) -static void webkitWebViewBaseNotifyResizerSizeForWindow(WebKitWebViewBase* webViewBase, GtkWindow* window) +static void webkitWebViewBaseNotifyResizerSize(WebKitWebViewBase* webViewBase) { + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (!priv->toplevelOnScreenWindow) + return; + gboolean resizerVisible; - g_object_get(G_OBJECT(window), "resize-grip-visible", &resizerVisible, NULL); + g_object_get(G_OBJECT(priv->toplevelOnScreenWindow), "resize-grip-visible", &resizerVisible, NULL); IntSize resizerSize; if (resizerVisible) { GdkRectangle resizerRect; - gtk_window_get_resize_grip_area(window, &resizerRect); + gtk_window_get_resize_grip_area(priv->toplevelOnScreenWindow, &resizerRect); GdkRectangle allocation; gtk_widget_get_allocation(GTK_WIDGET(webViewBase), &allocation); if (gdk_rectangle_intersect(&resizerRect, &allocation, 0)) resizerSize = IntSize(resizerRect.width, resizerRect.height); } - if (resizerSize != webViewBase->priv->resizerSize) { - webViewBase->priv->resizerSize = resizerSize; - webViewBase->priv->pageProxy->setWindowResizerSize(resizerSize); + if (resizerSize != priv->resizerSize) { + priv->resizerSize = resizerSize; + priv->pageProxy->setWindowResizerSize(resizerSize); + } +} + +static void toplevelWindowResizeGripVisibilityChanged(GObject*, GParamSpec*, WebKitWebViewBase* webViewBase) +{ + webkitWebViewBaseNotifyResizerSize(webViewBase); +} + +static gboolean toplevelWindowFocusInEvent(GtkWidget* widget, GdkEventFocus*, WebKitWebViewBase* webViewBase) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (!priv->isInWindowActive) { + priv->isInWindowActive = true; + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewWindowIsActive); + } + + return FALSE; +} + +static gboolean toplevelWindowFocusOutEvent(GtkWidget* widget, GdkEventFocus*, WebKitWebViewBase* webViewBase) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->isInWindowActive) { + priv->isInWindowActive = false; + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } + + return FALSE; } -static void toplevelWindowResizeGripVisibilityChanged(GObject* object, GParamSpec*, WebKitWebViewBase* webViewBase) +static void webkitWebViewBaseSetToplevelOnScreenWindow(WebKitWebViewBase* webViewBase, GtkWindow* window) { - webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(object)); + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->toplevelOnScreenWindow == window) + return; + + if (priv->toplevelResizeGripVisibilityID) { + g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelResizeGripVisibilityID); + priv->toplevelResizeGripVisibilityID = 0; + } + if (priv->toplevelFocusInEventID) { + g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelFocusInEventID); + priv->toplevelFocusInEventID = 0; + } + if (priv->toplevelFocusOutEventID) { + g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelFocusOutEventID); + priv->toplevelFocusOutEventID = 0; + } + + priv->toplevelOnScreenWindow = window; + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsInWindow); + if (!priv->toplevelOnScreenWindow) + return; + + webkitWebViewBaseNotifyResizerSize(webViewBase); + + priv->toplevelResizeGripVisibilityID = + g_signal_connect(priv->toplevelOnScreenWindow, "notify::resize-grip-visible", + G_CALLBACK(toplevelWindowResizeGripVisibilityChanged), webViewBase); + priv->toplevelFocusInEventID = + g_signal_connect(priv->toplevelOnScreenWindow, "focus-in-event", + G_CALLBACK(toplevelWindowFocusInEvent), webViewBase); + priv->toplevelFocusOutEventID = + g_signal_connect(priv->toplevelOnScreenWindow, "focus-out-event", + G_CALLBACK(toplevelWindowFocusOutEvent), webViewBase); } static void webkitWebViewBaseRealize(GtkWidget* widget) @@ -178,11 +250,8 @@ static void webkitWebViewBaseRealize(GtkWidget* widget) gtk_im_context_set_client_window(priv->imContext.get(), window); GtkWidget* toplevel = gtk_widget_get_toplevel(widget); - if (widgetIsOnscreenToplevelWindow(toplevel)) { - webkitWebViewBaseNotifyResizerSizeForWindow(webView, GTK_WINDOW(toplevel)); - g_signal_connect(toplevel, "notify::resize-grip-visible", - G_CALLBACK(toplevelWindowResizeGripVisibilityChanged), webView); - } + if (widgetIsOnscreenToplevelWindow(toplevel)) + webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel)); } static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget) @@ -251,9 +320,12 @@ void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* chi static void webkitWebViewBaseFinalize(GObject* gobject) { WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(gobject); - webkitWebViewBase->priv->pageProxy->close(); + WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv; + priv->pageProxy->close(); + + webkitWebViewBaseSetToplevelOnScreenWindow(webkitWebViewBase, 0); - webkitWebViewBase->priv->~WebKitWebViewBasePrivate(); + priv->~WebKitWebViewBasePrivate(); G_OBJECT_CLASS(webkit_web_view_base_parent_class)->finalize(gobject); } @@ -263,7 +335,6 @@ static void webkit_web_view_base_init(WebKitWebViewBase* webkitWebViewBase) webkitWebViewBase->priv = priv; new (priv) WebKitWebViewBasePrivate(); - priv->isPageActive = TRUE; priv->shouldForwardNextKeyEvent = FALSE; GtkWidget* viewWidget = GTK_WIDGET(webkitWebViewBase); @@ -366,9 +437,7 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase if (priv->pageProxy->drawingArea()) priv->pageProxy->drawingArea()->setSize(viewRect.size(), IntSize()); - GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(webViewBase)); - if (widgetIsOnscreenToplevelWindow(toplevel)) - webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(toplevel)); + webkitWebViewBaseNotifyResizerSize(webViewBase); } static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) @@ -392,28 +461,37 @@ static void webkitWebViewBaseMap(GtkWidget* widget) GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->map(widget); WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); - if (!webViewBase->priv->needsResizeOnMap) + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (!priv->isVisible) { + priv->isVisible = true; + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); + } + + if (!priv->needsResizeOnMap) return; GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation, true /* sizeChanged */); - webViewBase->priv->needsResizeOnMap = false; + priv->needsResizeOnMap = false; } -static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus* event) +static void webkitWebViewBaseUnmap(GtkWidget* widget) { - WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); - WebKitWebViewBasePrivate* priv = webViewBase->priv; + GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->unmap(widget); - GtkWidget* toplevel = gtk_widget_get_toplevel(widget); - if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) { - gtk_im_context_focus_in(priv->imContext.get()); - if (!priv->isPageActive) { - priv->isPageActive = TRUE; - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewWindowIsActive); - } + WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; + if (priv->isVisible) { + priv->isVisible = false; + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); } +} + +static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus* event) +{ + WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); + webkitWebViewBaseSetFocus(webViewBase, true); + gtk_im_context_focus_in(webViewBase->priv->imContext.get()); return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->focus_in_event(widget, event); } @@ -421,12 +499,8 @@ static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus* static gboolean webkitWebViewBaseFocusOutEvent(GtkWidget* widget, GdkEventFocus* event) { WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); - WebKitWebViewBasePrivate* priv = webViewBase->priv; - - priv->isPageActive = FALSE; - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewWindowIsActive); - if (priv->imContext) - gtk_im_context_focus_out(priv->imContext.get()); + webkitWebViewBaseSetFocus(webViewBase, false); + gtk_im_context_focus_out(webViewBase->priv->imContext.get()); return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->focus_out_event(widget, event); } @@ -654,6 +728,13 @@ static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* con return TRUE; } +static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* oldParent) +{ + if (!gtk_widget_get_parent(widget)) + webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0); + +} + static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass) { GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webkitWebViewBaseClass); @@ -661,6 +742,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->draw = webkitWebViewBaseDraw; widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; widgetClass->map = webkitWebViewBaseMap; + widgetClass->unmap = webkitWebViewBaseUnmap; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; @@ -677,6 +759,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->drag_drop = webkitWebViewBaseDragDrop; widgetClass->drag_data_received = webkitWebViewBaseDragDataReceived; widgetClass->get_accessible = webkitWebViewBaseGetAccessible; + widgetClass->parent_set = webkitWebViewBaseParentSet; GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass); gobjectClass->finalize = webkitWebViewBaseFinalize; @@ -878,3 +961,44 @@ void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase g_timeout_add(1000 / 60, reinterpret_cast<GSourceFunc>(queueAnotherDrawOfAcceleratedCompositingResults), webViewBasePointer); } #endif + +void webkitWebViewBaseSetFocus(WebKitWebViewBase* webViewBase, bool focused) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->isFocused == focused) + return; + + unsigned viewStateFlags = WebPageProxy::ViewIsFocused; + priv->isFocused = focused; + + // If the view has received the focus and the window is not active + // mark the current window as active now. This can happen if the + // toplevel window is a GTK_WINDOW_POPUP and the focus has been + // set programatically like WebKitTestRunner does, because POPUP + // can't be focused. + if (priv->isFocused && !priv->isInWindowActive) { + priv->isInWindowActive = true; + viewStateFlags |= WebPageProxy::ViewWindowIsActive; + } + priv->pageProxy->viewStateDidChange(viewStateFlags); +} + +bool webkitWebViewBaseIsInWindowActive(WebKitWebViewBase* webViewBase) +{ + return webViewBase->priv->isInWindowActive; +} + +bool webkitWebViewBaseIsFocused(WebKitWebViewBase* webViewBase) +{ + return webViewBase->priv->isFocused; +} + +bool webkitWebViewBaseIsVisible(WebKitWebViewBase* webViewBase) +{ + return webViewBase->priv->isVisible; +} + +bool webkitWebViewBaseIsInWindow(WebKitWebViewBase* webViewBase) +{ + return webViewBase->priv->toplevelOnScreenWindow; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index 031e5d59b..8d0f865ff 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -56,4 +56,10 @@ GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase*); void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase*); #endif +void webkitWebViewBaseSetFocus(WebKitWebViewBase*, bool focused); +bool webkitWebViewBaseIsInWindowActive(WebKitWebViewBase*); +bool webkitWebViewBaseIsFocused(WebKitWebViewBase*); +bool webkitWebViewBaseIsVisible(WebKitWebViewBase*); +bool webkitWebViewBaseIsInWindow(WebKitWebViewBase*); + #endif // WebKitWebViewBasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 73defe419..4f5b36c4d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -88,6 +88,7 @@ webkit_web_view_get_title webkit_web_view_reload webkit_web_view_reload_bypass_cache webkit_web_view_stop_loading +webkit_web_view_is_loading webkit_web_view_get_estimated_load_progress webkit_web_view_get_custom_charset webkit_web_view_set_custom_charset diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp index d370de938..b904111f4 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp @@ -26,16 +26,19 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven { switch (loadEvent) { case WEBKIT_LOAD_STARTED: + g_assert(webkit_web_view_is_loading(webView)); g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); test->provisionalLoadStarted(); break; case WEBKIT_LOAD_REDIRECTED: + g_assert(webkit_web_view_is_loading(webView)); test->m_activeURI = webkit_web_view_get_uri(webView); if (!test->m_redirectURI.isNull()) g_assert_cmpstr(test->m_redirectURI.data(), ==, test->m_activeURI.data()); test->provisionalLoadReceivedServerRedirect(); break; case WEBKIT_LOAD_COMMITTED: { + g_assert(webkit_web_view_is_loading(webView)); g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); // Check that on committed we always have a main resource with a response. @@ -47,6 +50,7 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven break; } case WEBKIT_LOAD_FINISHED: + g_assert(!webkit_web_view_is_loading(webView)); if (!test->m_loadFailed) g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); test->loadFinished(); @@ -62,11 +66,13 @@ static void loadFailedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent switch (loadEvent) { case WEBKIT_LOAD_STARTED: + g_assert(!webkit_web_view_is_loading(webView)); g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); g_assert(error); test->provisionalLoadFailed(failingURI, error); break; case WEBKIT_LOAD_COMMITTED: + g_assert(!webkit_web_view_is_loading(webView)); g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); g_assert(error); test->loadFailed(failingURI, error); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp index dabf072e3..c3a14193d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp @@ -226,6 +226,62 @@ static void testWebViewActiveURI(ViewURITrackingTest* test, gconstpointer) test->waitUntilLoadFinished(); } +class ViewIsLoadingTest: public LoadTrackingTest { +public: + MAKE_GLIB_TEST_FIXTURE(ViewIsLoadingTest); + + static void isLoadingChanged(GObject*, GParamSpec*, ViewIsLoadingTest* test) + { + if (webkit_web_view_is_loading(test->m_webView)) + test->beginLoad(); + else + test->endLoad(); + } + + ViewIsLoadingTest() + { + g_signal_connect(m_webView, "notify::is-loading", G_CALLBACK(isLoadingChanged), this); + } + + void beginLoad() + { + // New load, load-started hasn't been emitted yet. + g_assert(m_loadEvents.isEmpty()); + g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data()); + } + + void endLoad() + { + // Load finish, load-finished and load-failed haven't been emitted yet. + g_assert(!m_loadEvents.isEmpty()); + g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFinished)); + g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFailed)); + } +}; + +static void testWebViewIsLoading(ViewIsLoadingTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/normal").data()); + test->waitUntilLoadFinished(); + + test->reload(); + test->waitUntilLoadFinished(); + + test->loadURI(kServer->getURIForPath("/error").data()); + test->waitUntilLoadFinished(); + + test->loadURI(kServer->getURIForPath("/normal").data()); + test->waitUntilLoadFinished(); + test->loadURI(kServer->getURIForPath("/normal2").data()); + test->waitUntilLoadFinished(); + + test->goBack(); + test->waitUntilLoadFinished(); + + test->goForward(); + test->waitUntilLoadFinished(); +} + static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) { static const char* responseString = "<html><body>Testing!Testing!Testing!Testing!Testing!Testing!Testing!" @@ -281,6 +337,8 @@ void beforeAll() // This test checks that web view notify::uri signal is correctly emitted // and the uri is already updated when loader client signals are emitted. ViewURITrackingTest::add("WebKitWebView", "active-uri", testWebViewActiveURI); + + ViewIsLoadingTest::add("WebKitWebView", "is-loading", testWebViewIsLoading); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index cc67c5d63..02e8138de 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -464,7 +464,7 @@ static void testWebViewWindowProperties(UIClientTest* test, gconstpointer) static void testWebViewMouseTarget(UIClientTest* test, gconstpointer) { - test->showInWindowAndWaitUntilMapped(); + test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL); const char* linksHoveredHTML = "<html><body>" diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm index ec7d9e1d4..560ceb773 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm @@ -61,6 +61,24 @@ extern "C" void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_por namespace WebKit { +namespace { + +struct UUIDHolder : public RefCounted<UUIDHolder> { + static PassRefPtr<UUIDHolder> create() + { + return adoptRef(new UUIDHolder); + } + + UUIDHolder() + { + uuid_generate(uuid); + } + + uuid_t uuid; +}; + +} + static void setUpTerminationNotificationHandler(pid_t pid) { #if HAVE(DISPATCH_H) @@ -77,25 +95,167 @@ static void setUpTerminationNotificationHandler(pid_t pid) #endif } +static void addDYLDEnvironmentAdditions(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, EnvironmentVariables& environmentVariables) +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype); + environmentExtractor.getExtractedEnvironmentVariables(environmentVariables); +#endif + + NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"]; + NSString *frameworksPath = [[webKit2Bundle bundlePath] stringByDeletingLastPathComponent]; + + // To make engineering builds work, if the path is outside of /System set up + // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the + // production configuration because it involves extra file system access. + if (isWebKitDevelopmentBuild) + environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':'); + + NSString *processPath = [webKit2Bundle pathForAuxiliaryExecutable:(launchOptions.processType == ProcessLauncher::PluginProcess ? @"PluginProcess.app" : @"WebProcess.app")]; + NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath]; + + NSString *processShimPathNSString = nil; + if (launchOptions.processType == ProcessLauncher::PluginProcess) + processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"]; + else if (launchOptions.processType == ProcessLauncher::WebProcess) + processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"]; + + // Make sure that the shim library file exists and insert it. + if (processShimPathNSString) { + const char* processShimPath = [processShimPathNSString fileSystemRepresentation]; + struct stat statBuf; + if (stat(processShimPath, &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG) + environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", processShimPath, ':'); + } + +} + typedef void (ProcessLauncher::*DidFinishLaunchingProcessFunction)(PlatformProcessIdentifier, CoreIPC::Connection::Identifier); #if HAVE(XPC) -static void launchXPCService(const ProcessLauncher::LaunchOptions&, const EnvironmentVariables&, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) +static void connectToWebProcessServiceForWebKitDevelopment(const ProcessLauncher::LaunchOptions&, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID) { // Create a connection to the WebKit2 XPC service. - xpc_connection_t connection = xpc_connection_create("com.apple.WebKit2Service", 0); + xpc_connection_t connection = xpc_connection_create("com.apple.WebKit2.WebProcessServiceForWebKitDevelopment", 0); + xpc_connection_set_instance(connection, instanceUUID->uuid); - uuid_t uuid; - uuid_generate(uuid); - xpc_connection_set_instance(connection, uuid); + // XPC requires having an event handler, even if it is not used. + xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { }); + xpc_connection_resume(connection); + + // Create the listening port. + mach_port_t listeningPort; + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); + + // Insert a send right so we can send to it. + mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); + + NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; + CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); + + xpc_object_t bootStrapMessage = xpc_dictionary_create(0, 0, 0); + xpc_dictionary_set_string(bootStrapMessage, "message-name", "bootstrap"); + xpc_dictionary_set_string(bootStrapMessage, "framework-executable-path", [[[NSBundle bundleWithIdentifier:@"com.apple.WebKit2"] executablePath] fileSystemRepresentation]); + xpc_dictionary_set_mach_send(bootStrapMessage, "server-port", listeningPort); + xpc_dictionary_set_string(bootStrapMessage, "client-identifier", clientIdentifier.data()); - xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { - xpc_type_t type = xpc_get_type(event); + that->ref(); + + xpc_connection_send_message_with_reply(connection, bootStrapMessage, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(xpc_object_t reply) { + xpc_type_t type = xpc_get_type(reply); if (type == XPC_TYPE_ERROR) { - if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_CONNECTION_INTERRUPTED) - NSLog(@"WebKit2 Web Content service exited."); + // We failed to launch. Release the send right. + mach_port_deallocate(mach_task_self(), listeningPort); + + // And the receive right. + mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1); + + RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, 0, CoreIPC::Connection::Identifier())); + } else { + ASSERT(type == XPC_TYPE_DICTIONARY); + ASSERT(!strcmp(xpc_dictionary_get_string(reply, "message-name"), "process-finished-launching")); + + // The process has finished launching, grab the pid from the connection. + pid_t processIdentifier = xpc_connection_get_pid(connection); + + // We've finished launching the process, message back to the main run loop. + RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, CoreIPC::Connection::Identifier(listeningPort, connection))); } + + that->deref(); }); + xpc_release(bootStrapMessage); +} + +static void createWebProcessServiceForWebKitDevelopment(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) +{ + EnvironmentVariables environmentVariables; + addDYLDEnvironmentAdditions(launchOptions, true, environmentVariables); + + // Generate the uuid for the service instance we are about to create. + // FIXME: This UUID should be stored on the WebProcessProxy. + RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create(); + + xpc_connection_t reExecConnection = xpc_connection_create("com.apple.WebKit2.WebProcessServiceForWebKitDevelopment", 0); + xpc_connection_set_instance(reExecConnection, instanceUUID->uuid); + + // Keep the ProcessLauncher alive while we do the re-execing (balanced in event handler). + that->ref(); + + // We wait for the connection to tear itself down (indicated via an error event) + // to indicate that the service instance re-execed itself, and is now ready to be + // connected to. + xpc_connection_set_event_handler(reExecConnection, ^(xpc_object_t event) { + ASSERT(xpc_get_type(event) == XPC_TYPE_ERROR); + + connectToWebProcessServiceForWebKitDevelopment(launchOptions, that, didFinishLaunchingProcessFunction, instanceUUID.get()); + + // Release the connection. + xpc_release(reExecConnection); + + // Other end of ref called before we setup the event handler. + that->deref(); + }); + xpc_connection_resume(reExecConnection); + + xpc_object_t reExecMessage = xpc_dictionary_create(0, 0, 0); + xpc_dictionary_set_string(reExecMessage, "message-name", "re-exec"); + + cpu_type_t architecture = launchOptions.architecture == ProcessLauncher::LaunchOptions::MatchCurrentArchitecture ? _NSGetMachExecuteHeader()->cputype : launchOptions.architecture; + xpc_dictionary_set_uint64(reExecMessage, "architecture", (uint64_t)architecture); + + xpc_object_t environment = xpc_array_create(0, 0); + char** environmentPointer = environmentVariables.environmentPointer(); + Vector<CString> temps; + for (size_t i = 0; environmentPointer[i]; ++i) { + CString temp(environmentPointer[i], strlen(environmentPointer[i])); + temps.append(temp); + + xpc_array_set_string(environment, XPC_ARRAY_APPEND, temp.data()); + } + xpc_dictionary_set_value(reExecMessage, "environment", environment); + xpc_release(environment); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + xpc_dictionary_set_bool(reExecMessage, "executable-heap", launchOptions.executableHeap); +#endif + + xpc_connection_send_message(reExecConnection, reExecMessage); + xpc_release(reExecMessage); +} + +static void createWebProcessService(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) +{ + // Generate the uuid for the service instance we are about to create. + // FIXME: This UUID should be stored on the WebProcessProxy. + RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create(); + + // Create a connection to the WebKit2 XPC service. + xpc_connection_t connection = xpc_connection_create("com.apple.WebKit2.WebProcessService", 0); + xpc_connection_set_instance(connection, instanceUUID->uuid); + + // XPC requires having an event handler, even if it is not used. + xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { }); xpc_connection_resume(connection); // Create the listening port. @@ -143,8 +303,9 @@ static void launchXPCService(const ProcessLauncher::LaunchOptions&, const Enviro #endif #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -static bool tryPreexistingProcess(const ProcessLauncher::LaunchOptions& launchOptions, const EnvironmentVariables& environmentVariables, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) +static bool tryPreexistingProcess(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) { + EnvironmentVariables environmentVariables; static const char* preexistingProcessServiceName = environmentVariables.get(EnvironmentVariables::preexistingProcessServiceNameKey()); ProcessLauncher::ProcessType preexistingProcessType; @@ -189,134 +350,117 @@ static bool tryPreexistingProcess(const ProcessLauncher::LaunchOptions& launchOp } #endif -void ProcessLauncher::launchProcess() +static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) { EnvironmentVariables environmentVariables; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - if (tryPreexistingProcess(m_launchOptions, environmentVariables, this, &ProcessLauncher::didFinishLaunchingProcess)) - return; -#endif - -#if HAVE(XPC) - if (m_launchOptions.useXPC) { - launchXPCService(m_launchOptions, environmentVariables, this, &ProcessLauncher::didFinishLaunchingProcess); - return; - } -#endif + addDYLDEnvironmentAdditions(launchOptions, isWebKitDevelopmentBuild, environmentVariables); - // Create the listening port. - mach_port_t listeningPort; - mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); - - // Insert a send right so we can send to it. - mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); - - NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"]; - NSString *frameworksPath = [[webKit2Bundle bundlePath] stringByDeletingLastPathComponent]; - const char* frameworkExecutablePath = [[webKit2Bundle executablePath] fileSystemRepresentation]; + // Create the listening port. + mach_port_t listeningPort; + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); - NSString *processPath; - if (m_launchOptions.processType == ProcessLauncher::PluginProcess) - processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"PluginProcess.app"]; - else - processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"]; + // Insert a send right so we can send to it. + mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); - NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath]; + RetainPtr<CFStringRef> cfLocalization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL)); + CString localization = String(cfLocalization.get()).utf8(); - RetainPtr<CFStringRef> cfLocalization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL)); - CString localization = String(cfLocalization.get()).utf8(); + NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"]; + NSString *processPath = [webKit2Bundle pathForAuxiliaryExecutable:(launchOptions.processType == ProcessLauncher::PluginProcess ? @"PluginProcess.app" : @"WebProcess.app")]; + NSString *frameworkExecutablePath = [webKit2Bundle executablePath]; + NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath]; - NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; - CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); + NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; + CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); - // Make a unique, per pid, per process launcher web process service name. - CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8(); + // Make a unique, per pid, per process launcher web process service name. + CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), that).utf8(); - const char* args[] = { [processAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), "-client-identifier", clientIdentifier.data(), 0 }; + const char* args[] = { [processAppExecutablePath fileSystemRepresentation], [frameworkExecutablePath fileSystemRepresentation], "-type", ProcessLauncher::processTypeAsString(launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), "-client-identifier", clientIdentifier.data(), 0 }; - // Register ourselves. - kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0); - ASSERT_UNUSED(kr, kr == KERN_SUCCESS); + // Register ourselves. + kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0); + ASSERT_UNUSED(kr, kr == KERN_SUCCESS); - posix_spawnattr_t attr; - posix_spawnattr_init(&attr); + posix_spawnattr_t attr; + posix_spawnattr_init(&attr); - short flags = 0; + short flags = 0; - // We want our process to receive all signals. - sigset_t signalMaskSet; - sigemptyset(&signalMaskSet); + // We want our process to receive all signals. + sigset_t signalMaskSet; + sigemptyset(&signalMaskSet); - posix_spawnattr_setsigmask(&attr, &signalMaskSet); - flags |= POSIX_SPAWN_SETSIGMASK; + posix_spawnattr_setsigmask(&attr, &signalMaskSet); + flags |= POSIX_SPAWN_SETSIGMASK; - // Determine the architecture to use. - cpu_type_t architecture = m_launchOptions.architecture; - if (architecture == LaunchOptions::MatchCurrentArchitecture) - architecture = _NSGetMachExecuteHeader()->cputype; + // Determine the architecture to use. + cpu_type_t architecture = launchOptions.architecture; + if (architecture == ProcessLauncher::LaunchOptions::MatchCurrentArchitecture) + architecture = _NSGetMachExecuteHeader()->cputype; - cpu_type_t cpuTypes[] = { architecture }; - size_t outCount = 0; - posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount); + cpu_type_t cpuTypes[] = { architecture }; + size_t outCount = 0; + posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount); - // Start suspended so we can set up the termination notification handler. - flags |= POSIX_SPAWN_START_SUSPENDED; + // Start suspended so we can set up the termination notification handler. + flags |= POSIX_SPAWN_START_SUSPENDED; #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - static const int allowExecutableHeapFlag = 0x2000; - if (m_launchOptions.executableHeap) - flags |= allowExecutableHeapFlag; + static const int allowExecutableHeapFlag = 0x2000; + if (launchOptions.executableHeap) + flags |= allowExecutableHeapFlag; #endif - posix_spawnattr_setflags(&attr, flags); + posix_spawnattr_setflags(&attr, flags); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype); - environmentExtractor.getExtractedEnvironmentVariables(environmentVariables); -#endif + pid_t processIdentifier = 0; + int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args), environmentVariables.environmentPointer()); - // To make engineering builds work, if the path is outside of /System set up - // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the - // production configuration because it involves extra file system access. - if (![frameworksPath hasPrefix:@"/System/"]) - environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':'); - - NSString *processShimPathNSString = nil; - if (m_launchOptions.processType == ProcessLauncher::PluginProcess) - processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"]; - else if (m_launchOptions.processType == ProcessLauncher::WebProcess) - processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"]; - - // Make sure that the shim library file exists and insert it. - if (processShimPathNSString) { - const char* processShimPath = [processShimPathNSString fileSystemRepresentation]; - struct stat statBuf; - if (stat(processShimPath, &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG) - environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", processShimPath, ':'); - } + posix_spawnattr_destroy(&attr); - pid_t processIdentifier = 0; - int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args), environmentVariables.environmentPointer()); + if (!result) { + // Set up the termination notification handler and then ask the child process to continue. + setUpTerminationNotificationHandler(processIdentifier); + kill(processIdentifier, SIGCONT); + } else { + // We failed to launch. Release the send right. + mach_port_deallocate(mach_task_self(), listeningPort); - posix_spawnattr_destroy(&attr); + // And the receive right. + mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1); + + listeningPort = MACH_PORT_NULL; + processIdentifier = 0; + } - if (!result) { - // Set up the termination notification handler and then ask the child process to continue. - setUpTerminationNotificationHandler(processIdentifier); - kill(processIdentifier, SIGCONT); - } else { - // We failed to launch. Release the send right. - mach_port_deallocate(mach_task_self(), listeningPort); + // We've finished launching the process, message back to the main run loop. + RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, CoreIPC::Connection::Identifier(listeningPort))); +} - // And the receive right. - mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1); - - listeningPort = MACH_PORT_NULL; - processIdentifier = 0; - } +void ProcessLauncher::launchProcess() +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + if (tryPreexistingProcess(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess)) + return; +#endif - // We've finished launching the process, message back to the main run loop. - RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, processIdentifier, CoreIPC::Connection::Identifier(listeningPort))); + bool isWebKitDevelopmentBuild = ![[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit2"] bundlePath] stringByDeletingLastPathComponent] hasPrefix:@"/System/"]; + +#if HAVE(XPC) + if (m_launchOptions.useXPC) { + if (m_launchOptions.processType == ProcessLauncher::WebProcess) { + if (isWebKitDevelopmentBuild) + createWebProcessServiceForWebKitDevelopment(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess); + else + createWebProcessService(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess); + } else + ASSERT_NOT_REACHED(); + return; + } +#endif + + createProcess(m_launchOptions, isWebKitDevelopmentBuild, this, &ProcessLauncher::didFinishLaunchingProcess); } void ProcessLauncher::terminateProcess() diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index d4b4ba3c8..5137968e6 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -53,6 +53,8 @@ @end +NSString * const WebKit2PlugInSandboxProfileDirectoryPathKey = @"WebKit2PlugInSandboxProfileDirectoryPath"; + using namespace WebCore; namespace WebKit { @@ -132,6 +134,12 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa if (renderServerPort != MACH_PORT_NULL) parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND); #endif + + // FIXME: We should rip this out once we have a good place to install plug-in + // sandbox profiles. + NSString* sandboxProfileDirectoryPath = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2PlugInSandboxProfileDirectoryPathKey]; + if (sandboxProfileDirectoryPath) + parameters.sandboxProfileDirectoryPath = String(sandboxProfileDirectoryPath); } bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber) diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index 5c6c73ce2..eb442fde5 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -185,7 +185,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() ASSERT(m_page); ASSERT(!m_inspectorView); - m_inspectorView.adoptNS([[WKWebInspectorWKView alloc] initWithFrame:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) contextRef:toAPI(page()->process()->context()) pageGroupRef:toAPI(inspectorPageGroup())]); + m_inspectorView.adoptNS([[WKWebInspectorWKView alloc] initWithFrame:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) contextRef:toAPI(page()->process()->context()) pageGroupRef:toAPI(inspectorPageGroup()) relatedToPage:toAPI(m_page)]); ASSERT(m_inspectorView); [m_inspectorView.get() setDrawsBackground:NO]; diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index b0c0a4c73..b64a8edb8 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -12,11 +12,13 @@ buildConfigurationList = 1A50DB48110A3C27000D3FE5 /* Build configuration list for PBXAggregateTarget "All" */; buildPhases = ( 1A50DB70110A3D67000D3FE5 /* CopyFiles */, - BCA8D46B15BCE33C009DC1F1 /* CopyFiles */, + BCFFCA8A160D6DEA003DF315 /* Add XPCServices symlink */, + BCFFCA8B160D6E7B003DF315 /* Copy XPC services for engineering builds */, ); dependencies = ( 1A50DB3C110A3C19000D3FE5 /* PBXTargetDependency */, BCDE0AC113272712001259FB /* PBXTargetDependency */, + BCAE9DFD160C0AB000A33217 /* PBXTargetDependency */, BCA8D46815BCE0D6009DC1F1 /* PBXTargetDependency */, ); name = All; @@ -581,7 +583,6 @@ BC33DD681238464600360F3F /* WebNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33DD671238464600360F3F /* WebNumber.h */; }; BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */; }; BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */; }; - BC3DE47215A91764008D26FC /* MainMacService.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3DE47115A91764008D26FC /* MainMacService.mm */; }; BC4075F3124FF0270068F20A /* WKArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075D7124FF0270068F20A /* WKArray.cpp */; }; BC4075F4124FF0270068F20A /* WKArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075D8124FF0270068F20A /* WKArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC4075F5124FF0270068F20A /* WKCertificateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075D9124FF0270068F20A /* WKCertificateInfo.cpp */; }; @@ -709,6 +710,9 @@ BC963D6B113DD19200574BE2 /* WebPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC963D6A113DD19200574BE2 /* WebPage.cpp */; }; BC963D6E113DD1A500574BE2 /* WebPageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC963D6D113DD1A500574BE2 /* WebPageMac.mm */; }; BC9B38A110F538BE00443A15 /* WebFrameProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B389F10F538BE00443A15 /* WebFrameProxy.h */; }; + BC9FA520160D3B430054DF9A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; }; + BC9FA522160D4A0C0054DF9A /* com.apple.WebKit.PluginProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E35150AB5D500C73169 /* com.apple.WebKit.PluginProcess.sb */; }; + BC9FA523160D4A0F0054DF9A /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; }; BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA0EF7D12331E78007D3CFB /* WebUndoStep.h */; }; BCA0EF8012331E78007D3CFB /* WebUndoStep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA0EF7E12331E78007D3CFB /* WebUndoStep.cpp */; }; BCA0EF9F12332642007D3CFB /* WebEditCommandProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */; }; @@ -725,9 +729,13 @@ BCA8C6A911E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */; }; BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */; }; BCA8C6B011E3C08700812FB7 /* InjectedBundlePageUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */; }; - BCA8D46C15BCE34B009DC1F1 /* com.apple.WebKit2.WebKit2Service.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebKit2Service.xpc */; }; BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */; }; BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */; }; + BCAE9DFB160C0AA100A33217 /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; }; + BCAE9E05160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCAE9E04160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm */; }; + BCAE9E07160C139A00A33217 /* WebProcessServiceMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCAE9E06160C139A00A33217 /* WebProcessServiceMain.mm */; }; + BCAE9E08160C1C0700A33217 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; }; + BCAE9E09160C233B00A33217 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; }; BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8049D122F0D6B00103529 /* MutableArray.cpp */; }; BCB0AD34122F285800B1341E /* MutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8049E122F0D6B00103529 /* MutableArray.h */; }; BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0AEE7122F53E300B1341E /* MutableDictionary.h */; }; @@ -797,9 +805,8 @@ BCDB86C11200FB97007254BE /* WebURL.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDB86C01200FB97007254BE /* WebURL.h */; }; BCDC308715FD6A8B006B6695 /* WebProcessInitialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCDC308515FD6A8B006B6695 /* WebProcessInitialization.mm */; }; BCDC308815FD6A8B006B6695 /* WebProcessInitialization.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDC308615FD6A8B006B6695 /* WebProcessInitialization.h */; }; - BCDC308B15FD6CD1006B6695 /* WebProcessXPCServiceMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCDC308915FD6CD1006B6695 /* WebProcessXPCServiceMain.mm */; }; - BCDC308C15FD6CD1006B6695 /* WebProcessXPCServiceMain.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDC308A15FD6CD1006B6695 /* WebProcessXPCServiceMain.h */; }; - BCDC308E15FDB9A7006B6695 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; }; + BCDC308B15FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCDC308915FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm */; }; + BCDC308C15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDC308A15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h */; }; BCDDB317124EBD130048D13C /* WKBase.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB316124EBD130048D13C /* WKBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */; }; BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB32C124EC2E10048D13C /* WKAPICast.h */; }; @@ -978,6 +985,13 @@ remoteGlobalIDString = BC3DE46515A91763008D26FC; remoteInfo = WebKit2Service; }; + BCAE9DFC160C0AB000A33217 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BCAE9DE8160C097400A33217; + remoteInfo = WebProcessServiceForWebKitDevelopment; + }; BCDE093513272496001259FB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -1035,16 +1049,6 @@ name = "Copy Message Generation Scripts"; runOnlyForDeploymentPostprocessing = 0; }; - BCA8D46B15BCE33C009DC1F1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = WebKit2.framework/XPCServices; - dstSubfolderSpec = 1; - files = ( - BCA8D46C15BCE34B009DC1F1 /* com.apple.WebKit2.WebKit2Service.xpc in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; BCDE093C13272496001259FB /* Copy Plug-in Process Shim */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -1663,10 +1667,8 @@ BC33DD671238464600360F3F /* WebNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNumber.h; sourceTree = "<group>"; }; BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleRangeHandle.h; sourceTree = "<group>"; }; BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleRangeHandle.cpp; sourceTree = "<group>"; }; - BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebKit2Service.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = com.apple.WebKit2.WebKit2Service.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; + BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebProcessService.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = com.apple.WebKit2.WebProcessService.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; BC3DE46815A91763008D26FC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - BC3DE46C15A91763008D26FC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebKit2Service/Info.plist; sourceTree = "<group>"; }; - BC3DE47115A91764008D26FC /* MainMacService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MainMacService.mm; path = WebKit2Service/MainMacService.mm; sourceTree = "<group>"; }; BC4075D7124FF0270068F20A /* WKArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKArray.cpp; sourceTree = "<group>"; }; BC4075D8124FF0270068F20A /* WKArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKArray.h; sourceTree = "<group>"; }; BC4075D9124FF0270068F20A /* WKCertificateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKCertificateInfo.cpp; sourceTree = "<group>"; }; @@ -1809,9 +1811,16 @@ BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageLoaderClient.h; sourceTree = "<group>"; }; BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageUIClient.cpp; sourceTree = "<group>"; }; BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageUIClient.h; sourceTree = "<group>"; }; - BCA8D46A15BCE160009DC1F1 /* WebKit2Service.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKit2Service.xcconfig; sourceTree = "<group>"; }; + BCA8D46A15BCE160009DC1F1 /* WebProcessService.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebProcessService.xcconfig; sourceTree = "<group>"; }; BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxyClient.h; sourceTree = "<group>"; }; BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyClient.cpp; sourceTree = "<group>"; }; + BCAE9DE9160C097400A33217 /* com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; + BCAE9DEF160C097500A33217 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + BCAE9DFF160C0B4100A33217 /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = "<group>"; }; + BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebProcessServiceForWebKitDevelopment.xcconfig; sourceTree = "<group>"; }; + BCAE9E01160C12DA00A33217 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebProcessService/Info.plist; sourceTree = "<group>"; }; + BCAE9E04160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessServiceForWebKitDevelopmentMain.mm; sourceTree = "<group>"; }; + BCAE9E06160C139A00A33217 /* WebProcessServiceMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebProcessServiceMain.mm; path = WebProcessService/WebProcessServiceMain.mm; sourceTree = "<group>"; }; BCB0AEE7122F53E300B1341E /* MutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableDictionary.h; sourceTree = "<group>"; }; BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutableDictionary.cpp; sourceTree = "<group>"; }; BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextUserMessageCoders.h; sourceTree = "<group>"; }; @@ -1883,8 +1892,8 @@ BCDB86C01200FB97007254BE /* WebURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURL.h; sourceTree = "<group>"; }; BCDC308515FD6A8B006B6695 /* WebProcessInitialization.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessInitialization.mm; sourceTree = "<group>"; }; BCDC308615FD6A8B006B6695 /* WebProcessInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessInitialization.h; sourceTree = "<group>"; }; - BCDC308915FD6CD1006B6695 /* WebProcessXPCServiceMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessXPCServiceMain.mm; sourceTree = "<group>"; }; - BCDC308A15FD6CD1006B6695 /* WebProcessXPCServiceMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessXPCServiceMain.h; sourceTree = "<group>"; }; + BCDC308915FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessServiceEntryPoints.mm; sourceTree = "<group>"; }; + BCDC308A15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessServiceEntryPoints.h; sourceTree = "<group>"; }; BCDDB316124EBD130048D13C /* WKBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBase.h; sourceTree = "<group>"; }; BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSharedAPICast.h; sourceTree = "<group>"; }; BCDDB32C124EC2E10048D13C /* WKAPICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAPICast.h; sourceTree = "<group>"; }; @@ -2080,11 +2089,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BCAE9DE6160C097400A33217 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BCAE9E09160C233B00A33217 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; BCDC308D15FDB99A006B6695 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - BCDC308E15FDB9A7006B6695 /* WebKit2.framework in Frameworks */, + BCAE9E08160C1C0700A33217 /* WebKit2.framework in Frameworks */, + BC9FA520160D3B430054DF9A /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2099,7 +2117,8 @@ 8DC2EF5B0486A6940098B216 /* WebKit2.framework */, 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */, 510031F61379CACB00C8DFE4 /* WebProcessShim.dylib */, - BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebKit2Service.xpc */, + BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebProcessService.xpc */, + BCAE9DE9160C097400A33217 /* com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc */, ); name = Products; sourceTree = "<group>"; @@ -2145,7 +2164,8 @@ BC122FA51327085D00F7EAC1 /* PluginProcess */, BC8A500E11765AD400757573 /* WebKit2 */, BC8A500F11765AE300757573 /* WebProcess */, - BC3DE47815A917C6008D26FC /* WebKit2Service */, + BCAE9DED160C097400A33217 /* WebProcessServiceForWebKitDevelopment */, + BC3DE47815A917C6008D26FC /* WebProcessService */, 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb.in */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */, ); @@ -2240,6 +2260,7 @@ children = ( 1A4F976A100E7B6600637A18 /* Base.xcconfig */, 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */, + BCAE9DFF160C0B4100A33217 /* CompilerVersion.xcconfig */, 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */, 1A4F976C100E7B6600637A18 /* FeatureDefines.xcconfig */, BC122FA3132707F300F7EAC1 /* PluginProcess.xcconfig */, @@ -2247,7 +2268,8 @@ 1A4F976E100E7B6600637A18 /* Version.xcconfig */, BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */, 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */, - BCA8D46A15BCE160009DC1F1 /* WebKit2Service.xcconfig */, + BCA8D46A15BCE160009DC1F1 /* WebProcessService.xcconfig */, + BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */, ); path = Configurations; sourceTree = "<group>"; @@ -2287,8 +2309,8 @@ 1A6FA01D11E1526300DB1371 /* WebProcessMainMac.mm */, 511F8A77138B460900A95F44 /* WebProcessShim.h */, 511F8A78138B460900A95F44 /* WebProcessShim.mm */, - BCDC308A15FD6CD1006B6695 /* WebProcessXPCServiceMain.h */, - BCDC308915FD6CD1006B6695 /* WebProcessXPCServiceMain.mm */, + BCDC308A15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h */, + BCDC308915FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm */, ); path = mac; sourceTree = "<group>"; @@ -2654,7 +2676,6 @@ isa = PBXGroup; children = ( 1A6FA31011E3921E00DB1371 /* MainMacProcess.cpp */, - BC3DE47115A91764008D26FC /* MainMacService.mm */, ); name = "Other Sources"; sourceTree = "<group>"; @@ -3413,12 +3434,13 @@ tabWidth = 8; usesTabs = 0; }; - BC3DE47815A917C6008D26FC /* WebKit2Service */ = { + BC3DE47815A917C6008D26FC /* WebProcessService */ = { isa = PBXGroup; children = ( - BC3DE46C15A91763008D26FC /* Info.plist */, + BCAE9E01160C12DA00A33217 /* Info.plist */, + BCAE9E06160C139A00A33217 /* WebProcessServiceMain.mm */, ); - name = WebKit2Service; + name = WebProcessService; sourceTree = "<group>"; }; BC4075D5124FEFFA0068F20A /* cf */ = { @@ -3496,6 +3518,15 @@ path = mac; sourceTree = "<group>"; }; + BCAE9DED160C097400A33217 /* WebProcessServiceForWebKitDevelopment */ = { + isa = PBXGroup; + children = ( + BCAE9DEF160C097500A33217 /* Info.plist */, + BCAE9E04160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm */, + ); + path = WebProcessServiceForWebKitDevelopment; + sourceTree = "<group>"; + }; BCBAAC58144E38B90053F82F /* WKView Details */ = { isa = PBXGroup; children = ( @@ -4267,7 +4298,7 @@ 3F87B9C0158940D80090FF62 /* WebColorChooserProxy.h in Headers */, BC59548915C7868500FD1E3E /* WebKit2.h in Headers */, BCDC308815FD6A8B006B6695 /* WebProcessInitialization.h in Headers */, - BCDC308C15FD6CD1006B6695 /* WebProcessXPCServiceMain.h in Headers */, + BCDC308C15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4355,9 +4386,9 @@ productReference = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; productType = "com.apple.product-type.framework"; }; - BC3DE46515A91763008D26FC /* WebKit2Service */ = { + BC3DE46515A91763008D26FC /* WebProcessService */ = { isa = PBXNativeTarget; - buildConfigurationList = BC3DE47615A91764008D26FC /* Build configuration list for PBXNativeTarget "WebKit2Service" */; + buildConfigurationList = BC3DE47615A91764008D26FC /* Build configuration list for PBXNativeTarget "WebProcessService" */; buildPhases = ( BC3DE46215A91763008D26FC /* Sources */, BCDC308D15FDB99A006B6695 /* Frameworks */, @@ -4367,9 +4398,26 @@ ); dependencies = ( ); - name = WebKit2Service; + name = WebProcessService; productName = WebKit2Service; - productReference = BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebKit2Service.xpc */; + productReference = BC3DE46615A91763008D26FC /* com.apple.WebKit2.WebProcessService.xpc */; + productType = "com.apple.product-type.bundle"; + }; + BCAE9DE8160C097400A33217 /* WebProcessServiceForWebKitDevelopment */ = { + isa = PBXNativeTarget; + buildConfigurationList = BCAE9DF6160C097500A33217 /* Build configuration list for PBXNativeTarget "WebProcessServiceForWebKitDevelopment" */; + buildPhases = ( + BCAE9DE5160C097400A33217 /* Sources */, + BCAE9DE6160C097400A33217 /* Frameworks */, + BCAE9DE7160C097400A33217 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = WebProcessServiceForWebKitDevelopment; + productName = WebProcessServiceForWebKitDevelopment; + productReference = BCAE9DE9160C097400A33217 /* com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc */; productType = "com.apple.product-type.bundle"; }; BCDE093313272496001259FB /* PluginProcess */ = { @@ -4423,7 +4471,8 @@ C0CE72851247E66800BC0EC4 /* Derived Sources */, 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */, 510031EA1379CACB00C8DFE4 /* WebProcessShim */, - BC3DE46515A91763008D26FC /* WebKit2Service */, + BC3DE46515A91763008D26FC /* WebProcessService */, + BCAE9DE8160C097400A33217 /* WebProcessServiceForWebKitDevelopment */, ); }; /* End PBXProject section */ @@ -4443,6 +4492,8 @@ buildActionMask = 2147483647; files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + BC9FA522160D4A0C0054DF9A /* com.apple.WebKit.PluginProcess.sb in Resources */, + BC9FA523160D4A0F0054DF9A /* com.apple.WebProcess.sb in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4454,6 +4505,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BCAE9DE7160C097400A33217 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BCAE9DFB160C0AA100A33217 /* com.apple.WebProcess.sb in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; BCDE093813272496001259FB /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4567,6 +4626,39 @@ shellPath = /bin/sh; shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n"; }; + BCFFCA8A160D6DEA003DF315 /* Add XPCServices symlink */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Add XPCServices symlink"; + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(WRAPPER_NAME)/WebKit2.framework/XPCServices", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "ln -sf ${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/WebKit2.framework/Versions/Current/XPCServices \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/WebKit2.framework/XPCServices\"\n"; + }; + BCFFCA8B160D6E7B003DF315 /* Copy XPC services for engineering builds */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/com.apple.WebKit2.WebProcessService.xpc", + "$(BUILT_PRODUCTS_DIR)/com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc", + ); + name = "Copy XPC services for engineering builds"; + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/${WRAPPER_NAME}/WebKit2.framework/Versions/A/XPCServices/com.apple.WebKit2.WebProcessService.xpc", + "$(BUILT_PRODUCTS_DIR)/${WRAPPER_NAME}/WebKit2.framework/Versions/A/XPCServices/com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [[ \"${CONFIGURATION}\" == \"Production\" ]]; then\n exit\nfi\n\nXPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/WebKit2.framework/Versions/A/XPCServices\"\nmkdir -p \"${XPC_SERVICES_PATH}\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit2.WebProcessService.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit2.WebProcessService.xpc\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc\"\n"; + }; C0CE72841247E66800BC0EC4 /* Generate Derived Sources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -5062,7 +5154,7 @@ 3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */, CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */, BCDC308715FD6A8B006B6695 /* WebProcessInitialization.mm in Sources */, - BCDC308B15FD6CD1006B6695 /* WebProcessXPCServiceMain.mm in Sources */, + BCDC308B15FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5070,7 +5162,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BC3DE47215A91764008D26FC /* MainMacService.mm in Sources */, + BCAE9E07160C139A00A33217 /* WebProcessServiceMain.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BCAE9DE5160C097400A33217 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BCAE9E05160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5107,9 +5207,14 @@ }; BCA8D46815BCE0D6009DC1F1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = BC3DE46515A91763008D26FC /* WebKit2Service */; + target = BC3DE46515A91763008D26FC /* WebProcessService */; targetProxy = BCA8D46715BCE0D6009DC1F1 /* PBXContainerItemProxy */; }; + BCAE9DFD160C0AB000A33217 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BCAE9DE8160C097400A33217 /* WebProcessServiceForWebKitDevelopment */; + targetProxy = BCAE9DFC160C0AB000A33217 /* PBXContainerItemProxy */; + }; BCDE093413272496001259FB /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */; @@ -5301,21 +5406,42 @@ }; BC3DE47315A91764008D26FC /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebKit2Service.xcconfig */; + baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebProcessService.xcconfig */; buildSettings = { }; name = Debug; }; BC3DE47415A91764008D26FC /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebKit2Service.xcconfig */; + baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebProcessService.xcconfig */; buildSettings = { }; name = Release; }; BC3DE47515A91764008D26FC /* Production */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebKit2Service.xcconfig */; + baseConfigurationReference = BCA8D46A15BCE160009DC1F1 /* WebProcessService.xcconfig */; + buildSettings = { + }; + name = Production; + }; + BCAE9DF7160C097500A33217 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + BCAE9DF8160C097500A33217 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */; + buildSettings = { + }; + name = Release; + }; + BCAE9DF9160C097500A33217 /* Production */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */; buildSettings = { }; name = Production; @@ -5433,7 +5559,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Production; }; - BC3DE47615A91764008D26FC /* Build configuration list for PBXNativeTarget "WebKit2Service" */ = { + BC3DE47615A91764008D26FC /* Build configuration list for PBXNativeTarget "WebProcessService" */ = { isa = XCConfigurationList; buildConfigurations = ( BC3DE47315A91764008D26FC /* Debug */, @@ -5443,6 +5569,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Production; }; + BCAE9DF6160C097500A33217 /* Build configuration list for PBXNativeTarget "WebProcessServiceForWebKitDevelopment" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BCAE9DF7160C097500A33217 /* Debug */, + BCAE9DF8160C097500A33217 /* Release */, + BCAE9DF9160C097500A33217 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; BCDE093E13272496001259FB /* Build configuration list for PBXNativeTarget "PluginProcess" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp index d6bdb8e15..7013fcdc6 100644 --- a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp @@ -73,8 +73,9 @@ void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocatio if (it == m_geolocationToIDMap.end()) return; + uint64_t geolocationID = it->second; m_geolocationToIDMap.remove(it); - m_idToGeolocationMap.remove(it->second); + m_idToGeolocationMap.remove(geolocationID); } void GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 276f7d3cb..2085253ba 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -162,11 +162,6 @@ void WKBundleSetPluginsEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageG toImpl(bundleRef)->setPluginsEnabled(toImpl(pageGroupRef), enabled); } -void WKBundleSetGeolocationPermission(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) -{ - toImpl(bundleRef)->setGeoLocationPermission(toImpl(pageGroupRef), enabled); -} - void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) { toImpl(bundleRef)->setJavaScriptCanAccessClipboard(toImpl(pageGroupRef), enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index 3a1512aaf..f032c6222 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -60,7 +60,6 @@ WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBund WK_EXPORT void WKBundleSetMinimumLogicalFontSize(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, int size); WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); -WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 206f47ee6..470d39b17 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -248,18 +248,6 @@ void InjectedBundle::setPluginsEnabled(WebPageGroupProxy* pageGroup, bool enable (*iter)->settings()->setPluginsEnabled(enabled); } -void InjectedBundle::setGeoLocationPermission(WebPageGroupProxy* pageGroup, bool enabled) -{ -#if ENABLE(GEOLOCATION) - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); - for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) - static_cast<GeolocationClientMock*>(GeolocationController::from(*iter)->client())->setPermission(enabled); -#else - UNUSED_PARAM(pageGroup); - UNUSED_PARAM(enabled); -#endif // ENABLE(GEOLOCATION) -} - void InjectedBundle::setJavaScriptCanAccessClipboard(WebPageGroupProxy* pageGroup, bool enabled) { const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index 404a50593..1197256d5 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -111,7 +111,6 @@ public: void setMinimumLogicalFontSize(WebPageGroupProxy*, int size); void setFrameFlatteningEnabled(WebPageGroupProxy*, bool); void setPluginsEnabled(WebPageGroupProxy*, bool); - void setGeoLocationPermission(WebPageGroupProxy*, bool); void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool); void setPrivateBrowsingEnabled(WebPageGroupProxy*, bool); void setPopupBlockingEnabled(WebPageGroupProxy*, bool); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 750983169..b6143e649 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -2795,7 +2795,7 @@ void WebPage::SandboxExtensionTracker::willPerformLoadDragDestinationAction(Pass void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxExtension::Handle& handle) { - ASSERT(frame->isMainFrame()); + ASSERT_UNUSED(frame, frame->isMainFrame()); setPendingProvisionalSandboxExtension(SandboxExtension::create(handle)); } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 1ac69ce81..738e0d881 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -203,10 +203,12 @@ void WebProcess::initializeSandbox(const String& clientIdentifier) setenv("TMPDIR", temporaryDirectory, 1); #endif + NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")]; + Vector<const char*> sandboxParameters; // These are read-only. - appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent]); + appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[webkit2Bundle bundlePath] stringByDeletingLastPathComponent]); // These are read-write getconf paths. appendReadwriteConfDirectory(sandboxParameters, "DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR); @@ -217,7 +219,7 @@ void WebProcess::initializeSandbox(const String& clientIdentifier) sandboxParameters.append(static_cast<const char*>(0)); - const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation]; + const char* profilePath = [[webkit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation]; char* errorBuf; if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParameters.data(), &errorBuf)) { diff --git a/Source/WebKit2/WebProcess/mac/WebProcessServiceEntryPoints.h b/Source/WebKit2/WebProcess/mac/WebProcessServiceEntryPoints.h new file mode 100644 index 000000000..949154a57 --- /dev/null +++ b/Source/WebKit2/WebProcess/mac/WebProcessServiceEntryPoints.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebProcessServiceEntryPoints_h +#define WebProcessServiceEntryPoints_h + +#if HAVE(XPC) + +#include "WKBase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// This entry point is used for the installed WebProcessService, which does not +// need to be re-execed, or mess around with DYLD. +WK_EXPORT int WebProcessServiceMain(int argc, char** argv); + +// This entry point is used for the WebProcessServiceForWebKitDevelopment +// which needs to be re-exec, and can't link directly to WebKit2 requiring +// some DYLD fiddling. +WK_EXPORT void InitializeWebProcessForWebProcessServiceForWebKitDevelopment(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort); + +#ifdef __cplusplus +}; // extern "C" +#endif + +#endif // HAVE(XPC) + +#endif // WebProcessServiceEntryPoints_h diff --git a/Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.mm b/Source/WebKit2/WebProcess/mac/WebProcessServiceEntryPoints.mm index b870f1d12..f282fb462 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessServiceEntryPoints.mm @@ -24,12 +24,15 @@ */ #import "config.h" -#import "WebProcessXPCServiceMain.h" +#import "WebProcessServiceEntryPoints.h" #if HAVE(XPC) #import "EnvironmentUtilities.h" #import "WebProcessInitialization.h" + +#import "EnvironmentUtilities.h" +#import "WebProcessInitialization.h" #import <stdio.h> #import <stdlib.h> #import <xpc/xpc.h> @@ -38,7 +41,7 @@ extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*); namespace WebKit { -static void WebKit2ServiceEventHandler(xpc_connection_t peer) +static void WebProcessServiceEventHandler(xpc_connection_t peer) { xpc_connection_set_target_queue(peer, dispatch_get_main_queue()); xpc_connection_set_event_handler(peer, ^(xpc_object_t event) { @@ -67,14 +70,23 @@ static void WebKit2ServiceEventHandler(xpc_connection_t peer) } // namespace WebKit -int WebProcessXPCServiceMain(int argc, char** argv) +int WebProcessServiceMain(int argc, char** argv) { // Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by // the WebProcess don't try to insert the shim and crash. WebKit::EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib"); - xpc_main(WebKit::WebKit2ServiceEventHandler); + xpc_main(WebKit::WebProcessServiceEventHandler); return 0; } +void InitializeWebProcessForWebProcessServiceForWebKitDevelopment(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort) +{ + // Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by + // the WebProcess don't try to insert the shim and crash. + WebKit::EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib"); + + WebKit::InitializeWebProcess(String(clientIdentifer), CoreIPC::Connection::Identifier(serverPort, connection)); +} + #endif // HAVE(XPC) diff --git a/Source/WebKit2/WebProcessService/Info.plist b/Source/WebKit2/WebProcessService/Info.plist new file mode 100644 index 000000000..cebb78ead --- /dev/null +++ b/Source/WebKit2/WebProcessService/Info.plist @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>com.apple.WebKit2.WebProcessService</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSFileQuarantineEnabled</key> + <true/> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>LSUIElement</key> + <true/> + <key>XPCService</key> + <dict> + <key>ServiceType</key> + <string>Application</string> + <key>RunLoopType</key> + <string>_NSApplicationMain</string> + <key>_MultipleInstance</key> + <true/> + <key>EnvironmentVariables</key> + <dict> + <key>DYLD_INSERT_LIBRARIES</key> + <string>$(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework/WebProcess.app/Contents/MacOS/WebProcessShim.dylib</string> + </dict> + </dict> +</dict> +</plist> diff --git a/Source/WebKit2/WebKit2Service/MainMacService.mm b/Source/WebKit2/WebProcessService/WebProcessServiceMain.mm index 0b46432d3..23d3ecade 100644 --- a/Source/WebKit2/WebKit2Service/MainMacService.mm +++ b/Source/WebKit2/WebProcessService/WebProcessServiceMain.mm @@ -27,11 +27,11 @@ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -#import "WebProcessXPCServiceMain.h" +#import "WebProcessServiceEntryPoints.h" int main(int argc, char** argv) { - return WebProcessXPCServiceMain(argc, argv); + return WebProcessServiceMain(argc, argv); } #else diff --git a/Source/WebKit2/WebKit2Service/Info.plist b/Source/WebKit2/WebProcessServiceForWebKitDevelopment/Info.plist index 8a680577e..8908196b6 100644 --- a/Source/WebKit2/WebKit2Service/Info.plist +++ b/Source/WebKit2/WebProcessServiceForWebKitDevelopment/Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIdentifier</key> - <string>com.apple.WebKit2Service</string> + <string>com.apple.WebKit2.WebProcessServiceForWebKitDevelopment</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> diff --git a/Source/WebKit2/WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm b/Source/WebKit2/WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm new file mode 100644 index 000000000..da426fa97 --- /dev/null +++ b/Source/WebKit2/WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <AvailabilityMacros.h> + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + +#import <crt_externs.h> +#import <dlfcn.h> +#import <mach-o/dyld.h> +#import <spawn.h> +#import <stdio.h> +#import <stdlib.h> +#import <xpc/xpc.h> + +extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*); + +static void WebProcessServiceForWebKitDevelopmentEventHandler(xpc_connection_t peer) +{ + xpc_connection_set_target_queue(peer, dispatch_get_main_queue()); + xpc_connection_set_event_handler(peer, ^(xpc_object_t event) { + xpc_type_t type = xpc_get_type(event); + if (type == XPC_TYPE_ERROR) { + if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_TERMINATION_IMMINENT) { + // FIXME: Handle this case more gracefully. + exit(EXIT_FAILURE); + } + } else { + assert(type == XPC_TYPE_DICTIONARY); + + if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "re-exec")) { + // Setup the posix_spawn attributes. + posix_spawnattr_t attr; + posix_spawnattr_init(&attr); + + short flags = 0; + + // We just want to set the process state, not actually launch a new process, + // so we are going to use the darwin extension to posix_spawn POSIX_SPAWN_SETEXEC + // to act like a more full featured exec. + flags |= POSIX_SPAWN_SETEXEC; + + // We want our process to receive all signals. + sigset_t signalMaskSet; + sigemptyset(&signalMaskSet); + posix_spawnattr_setsigmask(&attr, &signalMaskSet); + flags |= POSIX_SPAWN_SETSIGMASK; + + // Set the architecture. + cpu_type_t cpuTypes[] = { (cpu_type_t)xpc_dictionary_get_uint64(event, "architecture") }; + size_t outCount = 0; + posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + static const int allowExecutableHeapFlag = 0x2000; + if (xpc_dictionary_get_bool(event, "executable-heap")) + flags |= allowExecutableHeapFlag; +#endif + + posix_spawnattr_setflags(&attr, flags); + + uint32_t pathLength; + char path[4 * PATH_MAX]; + _NSGetExecutablePath(path, &pathLength); + + // Setup the command line. + char** argv = *_NSGetArgv(); + const char* programName = argv[0]; + const char* args[] = { programName, 0 }; + + // Setup the environment. + xpc_object_t environmentArray = xpc_dictionary_get_value(event, "environment"); + size_t numberOfEnvironmentVariables = xpc_array_get_count(environmentArray); + + char** environment = (char**)malloc(numberOfEnvironmentVariables * sizeof(char*) + 1); + for (size_t i = 0; i < numberOfEnvironmentVariables; ++i) { + const char* string = xpc_array_get_string(environmentArray, i); + size_t stringLength = strlen(string); + + char* environmentVariable = (char*)malloc(stringLength + 1); + memcpy(environmentVariable, string, stringLength); + environmentVariable[stringLength] = '\0'; + + environment[i] = environmentVariable; + } + environment[numberOfEnvironmentVariables] = 0; + + pid_t processIdentifier = 0; + posix_spawn(&processIdentifier, path, 0, &attr, const_cast<char**>(args), environment); + + posix_spawnattr_destroy(&attr); + + NSLog(@"Unable to re-exec for path: %s\n", path); + exit(EXIT_FAILURE); + } + + if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "bootstrap")) { + static void* frameworkLibrary = dlopen(xpc_dictionary_get_string(event, "framework-executable-path"), RTLD_NOW); + if (!frameworkLibrary) { + NSLog(@"Unable to load WebKit2.framework: %s\n", dlerror()); + exit(EXIT_FAILURE); + } + + typedef void (*InitializeWebProcessFunction)(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort); + InitializeWebProcessFunction InitializeWebProcessFunctionPtr = reinterpret_cast<InitializeWebProcessFunction>(dlsym(frameworkLibrary, "InitializeWebProcessForWebProcessServiceForWebKitDevelopment")); + if (!InitializeWebProcessFunctionPtr) { + NSLog(@"Unable to find entry point in WebKit2.framework: %s\n", dlerror()); + exit(EXIT_FAILURE); + } + + xpc_object_t reply = xpc_dictionary_create_reply(event); + xpc_dictionary_set_string(reply, "message-name", "process-finished-launching"); + xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply); + xpc_release(reply); + + InitializeWebProcessFunctionPtr(xpc_dictionary_get_string(event, "client-identifier"), peer, xpc_dictionary_copy_mach_send(event, "server-port")); + } + } + }); + + xpc_connection_resume(peer); +} + +int main(int argc, char** argv) +{ + xpc_main(WebProcessServiceForWebKitDevelopmentEventHandler); + return 0;; +} + +#else + +int main(int argc, char** argv) +{ + return 0; +} + +#endif diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index a9b00db39..1cdc404c0 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -199,7 +199,7 @@ EXPORTS ?number@String@WTF@@SA?AV12@_K@Z ?number@String@WTF@@SA?AV12@H@Z ?number@String@WTF@@SA?AV12@I@Z - ?number@String@WTF@@SA?AV12@NII@Z + ?number@String@WTF@@SA?AV12@NIW4TrailingZerosTruncatingPolicy@2@@Z ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ ?page@Document@WebCore@@QBEPAVPage@2@XZ diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 51f5538dc..64bf790c0 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -192,7 +192,7 @@ EXPORTS ?number@String@WTF@@SA?AV12@_K@Z ?number@String@WTF@@SA?AV12@H@Z ?number@String@WTF@@SA?AV12@I@Z - ?number@String@WTF@@SA?AV12@NII@Z + ?number@String@WTF@@SA?AV12@NIW4TrailingZerosTruncatingPolicy@2@@Z ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ ?page@Document@WebCore@@QBEPAVPage@2@XZ |
