[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:32:04 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 645581c9f1afc190b4c5dfb1f37a8018e53766d6
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Mar 27 22:57:00 2003 +0000
- Allow Netscape plug-ins that don't have resource files to load in Safari.
- Added more error handling when loading plug-ins.
Reviewed by darin.
* Plugins.subproj/WebNetscapePluginPackage.m:
(-[WebNetscapePluginPackage load]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7ee4545..9576eca 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,13 @@
+2003-03-27 Chris Blumenberg <cblu at apple.com>
+
+ - Allow Netscape plug-ins that don't have resource files to load in Safari.
+ - Added more error handling when loading plug-ins.
+
+ Reviewed by darin.
+
+ * Plugins.subproj/WebNetscapePluginPackage.m:
+ (-[WebNetscapePluginPackage load]):
+
2003-03-27 Maciej Stachowiak <mjs at apple.com>
Reviewed by Darin.
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index 4f453aa..37f1563 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -224,6 +224,8 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
- initWithPath:(NSString *)pluginPath
{
[super initWithPath:pluginPath];
+
+ resourceRef = -1;
OSType type = 0;
@@ -291,6 +293,26 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
return isLoaded;
}
+- (void)unloadWithoutShutdown
+{
+ if (!isLoaded) {
+ return;
+ }
+
+ if (resourceRef != -1) {
+ [self closeResourceFile:resourceRef];
+ }
+
+ if (isBundle) {
+ CFBundleUnloadExecutable([bundle _cfBundle]);
+ } else {
+ CloseConnection(&connID);
+ }
+
+ LOG(Plugins, "Plugin Unloaded");
+ isLoaded = NO;
+}
+
- (BOOL)load
{
NP_GetEntryPointsFuncPtr NP_GetEntryPoints = NULL;
@@ -299,7 +321,6 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
NPError npErr;
OSErr err;
-
if (isLoaded) {
return YES;
}
@@ -307,18 +328,22 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
if (isBundle) {
CFBundleRef cfBundle = [bundle _cfBundle];
if (!CFBundleLoadExecutable(cfBundle)) {
- return NO;
+ goto abort;
}
+
+ isLoaded = YES;
+
if (isCFM) {
pluginMainFunc = (MainFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("main") );
- if(!pluginMainFunc)
- return NO;
+ if(!pluginMainFunc) {
+ goto abort;
+ }
} else {
NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Initialize"));
NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_GetEntryPoints"));
NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Shutdown"));
- if (!NP_Initialize || !NP_GetEntryPoints || !NPP_Shutdown) {
- return NO;
+ if (NP_Initialize || !NP_GetEntryPoints || !NPP_Shutdown) {
+ goto abort;
}
}
BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("BP_CreatePluginMIMETypesPreferences"));
@@ -330,21 +355,24 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
err = FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &fref, NULL);
if (err != noErr) {
ERROR("FSPathMakeRef failed. Error=%d", err);
- return NO;
+ goto abort;
}
err = FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, NULL, &spec, NULL);
if (err != noErr) {
ERROR("FSGetCatalogInfo failed. Error=%d", err);
- return NO;
+ goto abort;
}
err = GetDiskFragment(&spec, 0, kCFragGoesToEOF, nil, kPrivateCFragCopy, &connID, (Ptr *)&pluginMainFunc, nil);
if (err != noErr) {
ERROR("GetDiskFragment failed. Error=%d", err);
- return NO;
+ goto abort;
}
+
+ isLoaded = YES;
+
pluginMainFunc = (MainFuncPtr)functionPointerForTVector((TransitionVector)pluginMainFunc);
if (!pluginMainFunc) {
- return NO;
+ goto abort;
}
isCFM = TRUE;
@@ -352,12 +380,10 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
// Plugins (at least QT) require that you call UseResFile on the resource file before loading it.
resourceRef = [self openResourceFile];
- if (resourceRef == -1) {
- return NO;
+ if (resourceRef != -1) {
+ UseResFile(resourceRef);
}
- UseResFile(resourceRef);
-
// swap function tables
if (isCFM) {
browserFuncs.version = 11;
@@ -383,8 +409,12 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
browserFuncs.forceredraw = (NPN_ForceRedrawProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_ForceRedraw);
browserFuncs.getJavaEnv = (NPN_GetJavaEnvProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetJavaEnv);
browserFuncs.getJavaPeer = (NPN_GetJavaPeerProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetJavaPeer);
-
+
npErr = pluginMainFunc(&browserFuncs, &pluginFuncs, &NPP_Shutdown);
+ if (npErr != NPERR_NO_ERROR) {
+ [self unload];
+ return NO;
+ }
pluginSize = pluginFuncs.size;
pluginVersion = pluginFuncs.version;
@@ -428,9 +458,17 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
browserFuncs.forceredraw = NPN_ForceRedraw;
browserFuncs.getJavaEnv = NPN_GetJavaEnv;
browserFuncs.getJavaPeer = NPN_GetJavaPeer;
-
- NP_Initialize(&browserFuncs);
- NP_GetEntryPoints(&pluginFuncs);
+
+ npErr = NP_Initialize(&browserFuncs);
+ if (npErr != NPERR_NO_ERROR) {
+ [self unload];
+ return NO;
+ }
+ npErr = NP_GetEntryPoints(&pluginFuncs);
+ if (npErr != NPERR_NO_ERROR) {
+ [self unload];
+ return NO;
+ }
pluginSize = pluginFuncs.size;
pluginVersion = pluginFuncs.version;
@@ -449,24 +487,24 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
NPP_GetValue = pluginFuncs.getvalue;
NPP_SetValue = pluginFuncs.setvalue;
}
+
LOG(Plugins, "Plugin Loaded");
- isLoaded = TRUE;
return YES;
-}
+abort:
+ [self unloadWithoutShutdown];
+ return NO;
+}
+
- (void)unload
{
- NPP_Shutdown();
-
- [self closeResourceFile:resourceRef];
-
- if (isBundle) {
- CFBundleUnloadExecutable([bundle _cfBundle]);
- } else {
- CloseConnection(&connID);
+ if (!isLoaded) {
+ return;
}
- LOG(Plugins, "Plugin Unloaded");
- isLoaded = FALSE;
+
+ NPP_Shutdown();
+
+ [self unloadWithoutShutdown];
}
- (NPP_SetWindowProcPtr)NPP_SetWindow
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list