+2009-03-02 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by John Sullivan, Ada Chan.
+
+ Factor loading code out into its own method and get rid of a bunch of goots.
+
+ * Plugins/WebNetscapePluginPackage.mm:
+ (-[WebNetscapePluginPackage _tryLoad]):
+ (-[WebNetscapePluginPackage load]):
+
2009-03-02 Anders Carlsson <andersca@apple.com>
Build fix.
[self _unloadWithShutdown:YES];
}
-- (BOOL)load
-{
+- (BOOL)_tryLoad
+{
NP_GetEntryPointsFuncPtr NP_GetEntryPoints = NULL;
NP_InitializeFuncPtr NP_Initialize = NULL;
NPError npErr;
if (isBundle) {
#endif
if (!CFBundleLoadExecutable(cfBundle))
- goto abort;
+ return NO;
#if !LOG_DISABLED
currentTime = CFAbsoluteTimeGetCurrent();
duration = currentTime - start;
NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_GetEntryPoints"));
NP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Shutdown"));
if (!NP_Initialize || !NP_GetEntryPoints || !NP_Shutdown)
- goto abort;
+ return NO;
#ifdef SUPPORT_CFM
}
} else {
LOG(Plugins, "%f NP_Initialize timing started", initializeStart);
npErr = NP_Initialize(&browserFuncs);
if (npErr != NPERR_NO_ERROR)
- goto abort;
+ return NO;
#if !LOG_DISABLED
currentTime = CFAbsoluteTimeGetCurrent();
duration = currentTime - initializeStart;
npErr = NP_GetEntryPoints(&pluginFuncs);
if (npErr != NPERR_NO_ERROR)
- goto abort;
+ return NO;
pluginSize = pluginFuncs.size;
pluginVersion = pluginFuncs.version;
#endif
LOG(Plugins, "%f Total load time: %f seconds", currentTime, duration);
- return [super load];
+ return YES;
+}
+
+- (BOOL)load
+{
+ if ([self _tryLoad])
+ return [super load];
-abort:
[self _unloadWithShutdown:NO];
return NO;
}