[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
andersca at apple.com
andersca at apple.com
Wed Dec 22 17:49:33 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 26da7111ccd9583d91af4be59999a89b388443e5
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 30 23:44:16 2010 +0000
Add a simple shim function for Debugger().
https://bugs.webkit.org/show_bug.cgi?id=50268
Reviewed by Dan Bernstein.
* PluginProcess/PluginProcess.h:
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::initShouldCallRealDebugger):
We only want to call the real Debugger() function when USERBREAK is set.
(WebKit::shouldCallRealDebugger):
Return whether USERBREAK is set.
(WebKit::PluginProcess::initializeShim):
Initialize the shim.
* PluginProcess/mac/PluginProcessMainMac.mm:
(WebKit::PluginProcessMain):
Call PluginProcess::initializeShim.
* PluginProcess/mac/PluginProcessShim.cpp:
(WebKit::WebKitPluginProcessShimInitialize):
This now takes a struct of callbacks.
(WebKit::shimDebugger):
Call the shouldCallDebugger function. If it returns true, the real Debugger() function should be called.
* PluginProcess/mac/PluginProcessShim.h:
* WebKit2.xcodeproj/project.pbxproj:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72972 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c285e56..0ead6f8 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,37 @@
2010-11-30 Anders Carlsson <andersca at apple.com>
+ Reviewed by Dan Bernstein.
+
+ Add a simple shim function for Debugger().
+ https://bugs.webkit.org/show_bug.cgi?id=50268
+
+ * PluginProcess/PluginProcess.h:
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::initShouldCallRealDebugger):
+ We only want to call the real Debugger() function when USERBREAK is set.
+
+ (WebKit::shouldCallRealDebugger):
+ Return whether USERBREAK is set.
+
+ (WebKit::PluginProcess::initializeShim):
+ Initialize the shim.
+
+ * PluginProcess/mac/PluginProcessMainMac.mm:
+ (WebKit::PluginProcessMain):
+ Call PluginProcess::initializeShim.
+
+ * PluginProcess/mac/PluginProcessShim.cpp:
+ (WebKit::WebKitPluginProcessShimInitialize):
+ This now takes a struct of callbacks.
+
+ (WebKit::shimDebugger):
+ Call the shouldCallDebugger function. If it returns true, the real Debugger() function should be called.
+
+ * PluginProcess/mac/PluginProcessShim.h:
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2010-11-30 Anders Carlsson <andersca at apple.com>
+
Reviewed by Sam Weinig.
Pass the plug-in process shim in DYLD_INSERT_LIBRARIES when launching the plug-in process
diff --git a/WebKit2/PluginProcess/PluginProcess.h b/WebKit2/PluginProcess/PluginProcess.h
index 670e1a3..a4f948b 100644
--- a/WebKit2/PluginProcess/PluginProcess.h
+++ b/WebKit2/PluginProcess/PluginProcess.h
@@ -47,9 +47,13 @@ public:
NetscapePluginModule* netscapePluginModule() const { return m_pluginModule.get(); }
-#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
+#if PLATFORM(MAC)
+ void initializeShim();
+
+#if USE(ACCELERATED_COMPOSITING)
mach_port_t compositingRenderServerPort() const { return m_compositingRenderServerPort; }
#endif
+#endif
private:
PluginProcess();
diff --git a/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/WebKit2/PluginProcess/mac/PluginProcessMac.mm
new file mode 100644
index 0000000..d9b3b9c
--- /dev/null
+++ b/WebKit2/PluginProcess/mac/PluginProcessMac.mm
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include "PluginProcess.h"
+
+#include "PluginProcessShim.h"
+#include <dlfcn.h>
+
+namespace WebKit {
+
+static bool isUserbreakSet = false;
+
+static void initShouldCallRealDebugger()
+{
+ char* var = getenv("USERBREAK");
+
+ if (var)
+ isUserbreakSet = atoi(var);
+}
+
+static bool shouldCallRealDebugger()
+{
+ static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT;
+ pthread_once(&shouldCallRealDebuggerOnce, initShouldCallRealDebugger);
+
+ return isUserbreakSet;
+}
+
+void PluginProcess::initializeShim()
+{
+ const PluginProcessShimCallbacks callbacks = {
+ shouldCallRealDebugger,
+ };
+
+ PluginProcessShimInitializeFunc initFunc = reinterpret_cast<PluginProcessShimInitializeFunc>(dlsym(RTLD_DEFAULT, "WebKitPluginProcessShimInitialize"));
+ initFunc(callbacks);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm b/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
index eaa3526..48b2f69 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
+++ b/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
@@ -47,6 +47,10 @@ namespace WebKit {
int PluginProcessMain(const CommandLine& commandLine)
{
+ // Unset DYLD_INSERT_LIBRARIES. We don't want our plug-in process shim to be loaded
+ // by any child processes that the plug-in may launch.
+ unsetenv("DYLD_INSERT_LIBRARIES");
+
String serviceName = commandLine["servicename"];
if (serviceName.isEmpty())
return EXIT_FAILURE;
@@ -71,6 +75,9 @@ int PluginProcessMain(const CommandLine& commandLine)
WTF::initializeMainThread();
RunLoop::initializeMainRunLoop();
+ // Initialize the shim.
+ PluginProcess::shared().initializeShim();
+
// Initialize the plug-in process connection.
PluginProcess::shared().initializeConnection(serverPort);
diff --git a/WebKit2/PluginProcess/mac/PluginProcessShim.cpp b/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
index 34b5b5f..4ac8fe5 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
+++ b/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
@@ -25,11 +25,32 @@
#include "PluginProcessShim.h"
-extern "C"
-void PluginProcessShimInitialize();
+#include <Carbon/Carbon.h>
+#include <mach-o/dyld-interposing.h>
+#include <stdio.h>
+
+namespace WebKit {
+
+extern "C" void WebKitPluginProcessShimInitialize(const PluginProcessShimCallbacks& callbacks);
+
+PluginProcessShimCallbacks pluginProcessShimCallbacks;
__attribute__((visibility("default")))
-void PluginProcessShimInitialize()
+void WebKitPluginProcessShimInitialize(const PluginProcessShimCallbacks& callbacks)
{
+ pluginProcessShimCallbacks = callbacks;
}
+#ifndef __LP64__
+static void shimDebugger(void)
+{
+ if (!pluginProcessShimCallbacks.shouldCallRealDebugger())
+ return;
+
+ Debugger();
+}
+
+DYLD_INTERPOSE(shimDebugger, Debugger);
+#endif
+
+} // namespace WebKit
diff --git a/WebKit2/PluginProcess/mac/PluginProcessShim.h b/WebKit2/PluginProcess/mac/PluginProcessShim.h
index b06c787..3736c55 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessShim.h
+++ b/WebKit2/PluginProcess/mac/PluginProcessShim.h
@@ -26,6 +26,14 @@
#ifndef PluginProcessShim_h
#define PluginProcessShim_h
+namespace WebKit {
+struct PluginProcessShimCallbacks {
+ bool (*shouldCallRealDebugger)();
+};
+
+typedef void (*PluginProcessShimInitializeFunc)(const PluginProcessShimCallbacks&);
+
+}
#endif // PluginProcessShim_h
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index b087c82..f0dd69e 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -151,6 +151,8 @@
1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */; };
1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; };
1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; };
+ 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */; };
+ 1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; };
1AA56F2911E92BC80061B882 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA56F2811E92BC80061B882 /* PluginController.h */; };
1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA5889011EE70400061B882 /* NetscapePluginStream.h */; };
1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; };
@@ -566,7 +568,7 @@
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */;
+ remoteGlobalIDString = 1AC25FAF12A48EA700BD2671;
remoteInfo = PluginProcessShim;
};
37F7407812721F740093869B /* PBXContainerItemProxy */ = {
@@ -735,6 +737,7 @@
1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
1AA1CD06100FA1BA0078DEBC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessMac.mm; sourceTree = "<group>"; };
1AA56F2811E92BC80061B882 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; };
1AA5889011EE70400061B882 /* NetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginStream.h; sourceTree = "<group>"; };
1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginStream.cpp; sourceTree = "<group>"; };
@@ -1159,6 +1162,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1286,6 +1290,7 @@
children = (
1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */,
1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */,
+ 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */,
1AC25F8A12A48E0300BD2671 /* PluginProcessShim.cpp */,
1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */,
);
@@ -2862,6 +2867,7 @@
EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */,
5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */,
1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */,
+ 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list