[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 11:42:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 90f955d8fc7b50c4f0819c3a1dc7514a2a904891
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Aug 4 19:09:39 2010 +0000
Move bundle-loading code from NetscapePluginModule to a new Module class
This allows more NetscapePluginModule code to be cross-platform.
Fixes <http://webkit.org/b/43497> NetscapePluginModule::try/unload
should be cross-platform
Reviewed by Anders Carlsson.
* Platform/Module.cpp: Added.
(WebKit::Module::Module): Store our path.
(WebKit::Module::~Module): Unload our native module.
* Platform/Module.h: Added.
(WebKit::Module::leakBundle): Does what it says.
(WebKit::Module::functionPointer): Returns a pointer to the named
function, with the right type.
* Platform/mac/ModuleMac.mm: Added.
(WebKit::Module::load): Code was moved here from
NetscapePluginModule::tryLoad.
(WebKit::Module::unload): Just clears our bundle.
(WebKit::Module::platformFunctionPointer): Code was moved here from
NetscapePluginModuleMac.cpp.
* Platform/qt/ModuleQt.cpp: Added.
(WebKit::Module::load):
(WebKit::Module::unload):
(WebKit::Module::platformFunctionPointer):
* Platform/win/ModuleWin.cpp: Added.
(WebKit::Module::load):
(WebKit::Module::unload):
(WebKit::Module::platformFunctionPointer):
Just stubbed out these functions.
* WebKit2.xcodeproj/project.pbxproj: Added Module.
* WebProcess/Plugins/Netscape/NetscapePluginModule.cpp:
(WebKit::NetscapePluginModule::tryLoad):
(WebKit::NetscapePluginModule::unload):
Moved here from NetscapePluginModuleMac.cpp. Now uses the
cross-platform m_module member.
* WebProcess/Plugins/Netscape/NetscapePluginModule.h: Replaced
m_bundle with m_module.
* WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: Removed.
* win/WebKit2.vcproj: Added Module.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64663 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 09e915f..bc98eb5 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,56 @@
+2010-08-04 Adam Roben <aroben at apple.com>
+
+ Move bundle-loading code from NetscapePluginModule to a new Module
+ class
+
+ This allows more NetscapePluginModule code to be cross-platform.
+
+ Fixes <http://webkit.org/b/43497> NetscapePluginModule::try/unload
+ should be cross-platform
+
+ Reviewed by Anders Carlsson.
+
+ * Platform/Module.cpp: Added.
+ (WebKit::Module::Module): Store our path.
+ (WebKit::Module::~Module): Unload our native module.
+
+ * Platform/Module.h: Added.
+ (WebKit::Module::leakBundle): Does what it says.
+ (WebKit::Module::functionPointer): Returns a pointer to the named
+ function, with the right type.
+
+ * Platform/mac/ModuleMac.mm: Added.
+ (WebKit::Module::load): Code was moved here from
+ NetscapePluginModule::tryLoad.
+ (WebKit::Module::unload): Just clears our bundle.
+ (WebKit::Module::platformFunctionPointer): Code was moved here from
+ NetscapePluginModuleMac.cpp.
+
+ * Platform/qt/ModuleQt.cpp: Added.
+ (WebKit::Module::load):
+ (WebKit::Module::unload):
+ (WebKit::Module::platformFunctionPointer):
+ * Platform/win/ModuleWin.cpp: Added.
+ (WebKit::Module::load):
+ (WebKit::Module::unload):
+ (WebKit::Module::platformFunctionPointer):
+ Just stubbed out these functions.
+
+ * WebKit2.xcodeproj/project.pbxproj: Added Module.
+
+ * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp:
+ (WebKit::NetscapePluginModule::tryLoad):
+ (WebKit::NetscapePluginModule::unload):
+ Moved here from NetscapePluginModuleMac.cpp. Now uses the
+ cross-platform m_module member.
+
+ * WebProcess/Plugins/Netscape/NetscapePluginModule.h: Replaced
+ m_bundle with m_module.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: Removed.
+
+ * win/WebKit2.vcproj: Added Module.
+
2010-08-04 Brady Eidson <beidson at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit2/Platform/Module.cpp b/WebKit2/Platform/Module.cpp
new file mode 100644
index 0000000..92fdd47
--- /dev/null
+++ b/WebKit2/Platform/Module.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+#include "Module.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+Module::Module(const String& path)
+ : m_path(path)
+{
+}
+
+Module::~Module()
+{
+ unload();
+}
+
+}
diff --git a/WebKit2/Platform/Module.h b/WebKit2/Platform/Module.h
new file mode 100644
index 0000000..33bcf43
--- /dev/null
+++ b/WebKit2/Platform/Module.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#ifndef Module_h
+#define Module_h
+
+#include <WebCore/PlatformString.h>
+#include <wtf/Noncopyable.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#endif
+
+namespace WebKit {
+
+class Module : public Noncopyable {
+public:
+ Module(const WebCore::String& path);
+ ~Module();
+
+ bool load();
+ // Note: On Mac this leaks the CFBundle to avoid crashes when a bundle is unloaded and there are
+ // live Objective-C objects whose methods come from that bundle.
+ void unload();
+
+ template<typename FunctionType> FunctionType functionPointer(const char* functionName) const;
+
+private:
+ void* platformFunctionPointer(const char* functionName) const;
+
+ WebCore::String m_path;
+#if PLATFORM(MAC)
+ RetainPtr<CFBundleRef> m_bundle;
+#endif
+};
+
+template<typename FunctionType> FunctionType Module::functionPointer(const char* functionName) const
+{
+ return reinterpret_cast<FunctionType>(platformFunctionPointer(functionName));
+}
+
+}
+
+#endif
diff --git a/WebKit2/Platform/mac/ModuleMac.mm b/WebKit2/Platform/mac/ModuleMac.mm
new file mode 100644
index 0000000..fa38745
--- /dev/null
+++ b/WebKit2/Platform/mac/ModuleMac.mm
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+#include "Module.h"
+
+namespace WebKit {
+
+bool Module::load()
+{
+ RetainPtr<CFStringRef> bundlePath(AdoptCF, m_path.createCFString());
+ RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, FALSE));
+ if (!bundleURL)
+ return false;
+
+ RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
+ if (!bundle)
+ return false;
+
+ if (!CFBundleLoadExecutable(bundle.get()))
+ return false;
+
+ m_bundle.adoptCF(bundle.releaseRef());
+ return true;
+}
+
+void Module::unload()
+{
+ // See the comment in Module.h for why we leak the bundle here.
+ m_bundle.releaseRef();
+}
+
+void* Module::platformFunctionPointer(const char* functionName) const
+{
+ if (!m_bundle)
+ return 0;
+ RetainPtr<CFStringRef> functionNameString(AdoptCF, CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, functionName, kCFStringEncodingASCII, kCFAllocatorNull));
+ return CFBundleGetFunctionPointerForName(m_bundle.get(), functionNameString.get());
+}
+
+}
diff --git a/WebKit2/Platform/qt/ModuleQt.cpp b/WebKit2/Platform/qt/ModuleQt.cpp
new file mode 100644
index 0000000..53bee1b
--- /dev/null
+++ b/WebKit2/Platform/qt/ModuleQt.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#include "Module.h"
+
+#include "NotImplemented.h"
+
+namespace WebKit {
+
+bool Module::load()
+{
+ notImplemented();
+ return false;
+}
+
+void Module::unload()
+{
+ notImplemented();
+}
+
+void* Module::platformFunctionPointer(const char* functionName) const
+{
+ notImplemented();
+ return 0;
+}
+
+}
diff --git a/WebKit2/Platform/win/ModuleWin.cpp b/WebKit2/Platform/win/ModuleWin.cpp
new file mode 100644
index 0000000..53bee1b
--- /dev/null
+++ b/WebKit2/Platform/win/ModuleWin.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#include "Module.h"
+
+#include "NotImplemented.h"
+
+namespace WebKit {
+
+bool Module::load()
+{
+ notImplemented();
+ return false;
+}
+
+void Module::unload()
+{
+ notImplemented();
+}
+
+void* Module::platformFunctionPointer(const char* functionName) const
+{
+ notImplemented();
+ return 0;
+}
+
+}
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index b747279..6856cb6 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -61,7 +61,6 @@
1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7D111E651E200DB1371 /* Plugin.h */; };
1A6FB90B11E66FBC00DB1371 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB90911E66FBC00DB1371 /* NetscapePluginModule.h */; };
1A6FB90C11E66FBC00DB1371 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB90A11E66FBC00DB1371 /* NetscapePluginModule.cpp */; };
- 1A6FBA0311E6813E00DB1371 /* NetscapePluginModuleMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBA0211E6813E00DB1371 /* NetscapePluginModuleMac.cpp */; };
1A6FBA2A11E6862700DB1371 /* NetscapeBrowserFuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBA2811E6862700DB1371 /* NetscapeBrowserFuncs.h */; };
1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */; };
1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */; };
@@ -271,6 +270,9 @@
BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; };
BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; };
BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; };
+ C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA481209E45000A49D01 /* ModuleMac.mm */; };
+ C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA451209E2BA00A49D01 /* Module.cpp */; };
+ C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */; };
D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; };
D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */; };
@@ -364,7 +366,6 @@
1A6FB7D111E651E200DB1371 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; };
1A6FB90911E66FBC00DB1371 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; };
1A6FB90A11E66FBC00DB1371 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; };
- 1A6FBA0211E6813E00DB1371 /* NetscapePluginModuleMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModuleMac.cpp; sourceTree = "<group>"; };
1A6FBA2811E6862700DB1371 /* NetscapeBrowserFuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapeBrowserFuncs.h; sourceTree = "<group>"; };
1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapeBrowserFuncs.cpp; sourceTree = "<group>"; };
1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePlugin.h; sourceTree = "<group>"; };
@@ -580,6 +581,9 @@
BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; };
BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; };
BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; };
+ C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
+ C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
+ C0E3AA481209E45000A49D01 /* ModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModuleMac.mm; sourceTree = "<group>"; };
D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupMenu.cpp; sourceTree = "<group>"; };
D3B9484311FF4B6500032B39 /* WebPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenu.h; sourceTree = "<group>"; };
D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSearchPopupMenu.cpp; sourceTree = "<group>"; };
@@ -754,7 +758,6 @@
isa = PBXGroup;
children = (
1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */,
- 1A6FBA0211E6813E00DB1371 /* NetscapePluginModuleMac.cpp */,
);
path = mac;
sourceTree = "<group>";
@@ -764,6 +767,7 @@
children = (
1A24B5F011F531E800C38269 /* MachUtilities.cpp */,
1A24B5F111F531E800C38269 /* MachUtilities.h */,
+ C0E3AA481209E45000A49D01 /* ModuleMac.mm */,
BC0092F5115837A300E0AE2A /* RunLoopMac.mm */,
BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */,
);
@@ -1153,6 +1157,8 @@
children = (
1AB5A1BA10E021D30040F6CF /* CoreIPC */,
1A7E814E1152D2240003695B /* mac */,
+ C0E3AA451209E2BA00A49D01 /* Module.cpp */,
+ C0E3AA441209E2BA00A49D01 /* Module.h */,
BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */,
BC2E6E771141970C00A63B1E /* RunLoop.cpp */,
BC2E6E781141970C00A63B1E /* RunLoop.h */,
@@ -1357,6 +1363,7 @@
0FB659231208B4DB0044816C /* DrawingAreaBase.h in Headers */,
51578B831209ECEF00A37C4A /* WebData.h in Headers */,
514AF6C91209EE7300A26C97 /* WKData.h in Headers */,
+ C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1477,7 +1484,6 @@
1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
1A6FB90C11E66FBC00DB1371 /* NetscapePluginModule.cpp in Sources */,
- 1A6FBA0311E6813E00DB1371 /* NetscapePluginModuleMac.cpp in Sources */,
1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */,
1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */,
@@ -1562,6 +1568,8 @@
D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */,
0FB659A61208B9EE0044816C /* DrawingAreaBase.cpp in Sources */,
514AF6C81209EE7300A26C97 /* WKData.cpp in Sources */,
+ C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */,
+ C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
index c5e1eaa..e609013 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
@@ -25,6 +25,10 @@
#include "NetscapePluginModule.h"
+#include "Module.h"
+#include "NetscapeBrowserFuncs.h"
+#include <wtf/PassOwnPtr.h>
+
using namespace WebCore;
namespace WebKit {
@@ -109,5 +113,39 @@ bool NetscapePluginModule::load()
return true;
}
+bool NetscapePluginModule::tryLoad()
+{
+ m_module = adoptPtr(new Module(m_pluginPath));
+ if (!m_module->load())
+ return false;
+
+ NP_InitializeFuncPtr initializeFuncPtr = m_module->functionPointer<NP_InitializeFuncPtr>("NP_Initialize");
+ if (!initializeFuncPtr)
+ return false;
+
+ NP_GetEntryPointsFuncPtr getEntryPointsFuncPtr = m_module->functionPointer<NP_GetEntryPointsFuncPtr>("NP_GetEntryPoints");
+ if (!getEntryPointsFuncPtr)
+ return false;
+
+ m_shutdownProcPtr = m_module->functionPointer<NPP_ShutdownProcPtr>("NP_Shutdown");
+ if (!m_shutdownProcPtr)
+ return false;
+
+ if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
+ return false;
+
+ m_pluginFuncs.size = sizeof(NPPluginFuncs);
+ m_pluginFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
+ if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR)
+ return false;
+
+ return true;
+}
+
+void NetscapePluginModule::unload()
+{
+ m_module = 0;
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
index 41f3729..3ac5474 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
@@ -26,14 +26,11 @@
#ifndef NetscapePluginModule_h
#define NetscapePluginModule_h
-#include <WebCore/npfunctions.h>
+#include "Module.h"
#include <WebCore/PlatformString.h>
+#include <WebCore/npfunctions.h>
#include <wtf/RefCounted.h>
-#if PLATFORM(MAC)
-#include <wtf/RetainPtr.h>
-#endif
-
namespace WebKit {
class NetscapePluginModule : public RefCounted<NetscapePluginModule> {
@@ -62,9 +59,7 @@ private:
NPP_ShutdownProcPtr m_shutdownProcPtr;
NPPluginFuncs m_pluginFuncs;
-#if PLATFORM(MAC)
- RetainPtr<CFBundleRef> m_bundle;
-#endif
+ OwnPtr<Module> m_module;
};
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp
deleted file mode 100644
index 95b191d..0000000
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.
- */
-
-#include "NetscapePluginModule.h"
-#include "NetscapeBrowserFuncs.h"
-
-namespace WebKit {
-
-void NetscapePluginModule::unload()
-{
- if (m_bundle) {
- // We explicitly leak the bundle here, to avoid crashes when a bundle is unloaded and there are live Objective-C objects
- // whose methods come from that bundle.
- m_bundle.releaseRef();
- }
-}
-
-template<typename FuncType>
-static inline FuncType pointerToFunction(CFBundleRef bundle, const char* functionName)
-{
- RetainPtr<CFStringRef> functionNameString(AdoptCF, CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, functionName, kCFStringEncodingASCII, kCFAllocatorNull));
- return reinterpret_cast<FuncType>(CFBundleGetFunctionPointerForName(bundle, functionNameString.get()));
-}
-
-bool NetscapePluginModule::tryLoad()
-{
- RetainPtr<CFStringRef> bundlePath(AdoptCF, m_pluginPath.createCFString());
- RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLPOSIXPathStyle, FALSE));
- if (!bundleURL)
- return false;
-
- m_bundle.adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
- if (!m_bundle)
- return false;
-
- if (!CFBundleLoadExecutable(m_bundle.get()))
- return false;
-
- NP_InitializeFuncPtr initializeFuncPtr = pointerToFunction<NP_InitializeFuncPtr>(m_bundle.get(), "NP_Initialize");
- if (!initializeFuncPtr)
- return false;
-
- NP_GetEntryPointsFuncPtr getEntryPointsFuncPtr = pointerToFunction<NP_GetEntryPointsFuncPtr>(m_bundle.get(), "NP_GetEntryPoints");
- if (!getEntryPointsFuncPtr)
- return false;
-
- m_shutdownProcPtr = pointerToFunction<NPP_ShutdownProcPtr>(m_bundle.get(), "NP_Shutdown");
- if (!m_shutdownProcPtr)
- return false;
-
- if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
- return false;
-
- m_pluginFuncs.size = sizeof(NPPluginFuncs);
- m_pluginFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
- if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR)
- return false;
-
- return true;
-}
-
-} // namespace WebKit
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index ff38a53..eb0eac5 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1329,6 +1329,14 @@
>
</File>
<File
+ RelativePath="..\Platform\Module.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Platform\Module.h"
+ >
+ </File>
+ <File
RelativePath="..\Platform\RunLoop.cpp"
>
</File>
@@ -1352,6 +1360,10 @@
Name="win"
>
<File
+ RelativePath="..\Platform\win\ModuleWin.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Platform\win\RunLoopWin.cpp"
>
</File>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list