From 69e2a16f0d5685b4abb632e3fad459685b7487f7 Mon Sep 17 00:00:00 2001 From: "ap@apple.com" Date: Tue, 31 Jan 2012 19:58:07 +0000 Subject: [PATCH] PluginProcess should be able to use remote open and save panels https://bugs.webkit.org/show_bug.cgi?id=77461 Reviewed by Mark Rowe. * PluginProcess/mac/PluginProcess.entitlements: Added. * PluginProcess/mac/add-entitlements.sh: Added. * WebKit2.xcodeproj/project.pbxproj: Add appropriate entitlement, plus ad hoc binary signing for it to work. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106375 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 13 ++++++++ .../PluginProcess/mac/PluginProcess.entitlements | 8 +++++ .../WebKit2/PluginProcess/mac/add-entitlements.sh | 35 ++++++++++++++++++++++ Source/WebKit2/WebKit2.xcodeproj/project.pbxproj | 20 +++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements create mode 100755 Source/WebKit2/PluginProcess/mac/add-entitlements.sh diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 2dc3ea5..100e5c9 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,16 @@ +2012-01-31 Alexey Proskuryakov + + PluginProcess should be able to use remote open and save panels + https://bugs.webkit.org/show_bug.cgi?id=77461 + + + Reviewed by Mark Rowe. + + * PluginProcess/mac/PluginProcess.entitlements: Added. + * PluginProcess/mac/add-entitlements.sh: Added. + * WebKit2.xcodeproj/project.pbxproj: + Add appropriate entitlement, plus ad hoc binary signing for it to work. + 2012-01-31 Allan Sandfeld Jensen Ensure tiles are repainted when scrolling using mouse wheel. diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements b/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements new file mode 100644 index 0000000..080e1e0 --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.files.user-selected.read-write + + + diff --git a/Source/WebKit2/PluginProcess/mac/add-entitlements.sh b/Source/WebKit2/PluginProcess/mac/add-entitlements.sh new file mode 100755 index 0000000..825695a --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/add-entitlements.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# This script is needed because adding entitlements through Xcode configuration doesn't get dependencies right in some cases, . + +app_path="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" +app_binary_path="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" +entitlement_file=PluginProcess/mac/PluginProcess.entitlements + +if [[ ${CONFIGURATION} == "Production" ]]; then + exit +fi + +osx_version=$(sw_vers -productVersion | cut -d. -f 2) +if (( ${osx_version} <= 6 )); then + exit +fi + +needs_signing=0 + +# If the signature is invalid (e.g. due to updated resources), we need to re-sign it. +codesign --verify "${app_path}" 2> /dev/null +if [[ $? != 0 ]]; then + needs_signing=1 +else + # If the entitlements file is newer than the binary, we need to re-sign the app. + if [[ "${entitlement_file}" -nt "${app_binary_path}" ]]; then + needs_signing=1 + fi +fi + +if [[ $needs_signing == 0 ]]; then + exit +fi + +codesign -f -s - --entitlements "${entitlement_file}" "${app_path}" diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index 33aa813..a4f5e3a 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -1924,6 +1924,8 @@ E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = WebProcess/mac/WebKit.icns; sourceTree = ""; }; E134F01512EA5D11004EC58D /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = ""; }; E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = ""; }; + E14E99F814D879B4001D221F /* PluginProcess.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginProcess.entitlements; sourceTree = ""; }; + E14E99F914D879C9001D221F /* add-entitlements.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "add-entitlements.sh"; sourceTree = ""; }; E179FD9B134D38060015B883 /* ArgumentCodersMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCodersMac.h; sourceTree = ""; }; E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArgumentCodersMac.mm; sourceTree = ""; }; E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintInfo.cpp; sourceTree = ""; }; @@ -2112,10 +2114,12 @@ isa = PBXGroup; children = ( 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */, + E14E99F814D879B4001D221F /* PluginProcess.entitlements */, 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */, 1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */, 1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */, 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */, + E14E99F914D879C9001D221F /* add-entitlements.sh */, ); path = mac; sourceTree = ""; @@ -4219,6 +4223,7 @@ BCDE093813272496001259FB /* Resources */, BCDE093A13272496001259FB /* Sources */, BCDE093C13272496001259FB /* Copy Plug-in Process Shim */, + E14E99FA14D879DB001D221F /* Add Entitlements */, ); buildRules = ( ); @@ -4396,6 +4401,21 @@ shellPath = /bin/sh; shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; }; + E14E99FA14D879DB001D221F /* Add Entitlements */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Add Entitlements"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "PluginProcess/mac/add-entitlements.sh"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ -- 2.7.4