[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 08:00:16 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 077d556491abb42f87f99f02988b8d2db50c3679
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 9 20:41:36 2003 +0000
WebCore:
Fixed: <rdar://problem/3333897>: should support navigator.plugins.refresh as a way to add a plugin without restarting Safari
Reviewed by rjw.
* khtml/ecma/kjs_navigator.cpp:
(PluginBase::refresh): new
(PluginsFunc::tryCall): call refresh
* kwq/KWQKConfigBase.h:
* kwq/KWQKConfigBase.mm:
(RefreshPlugins): new
* kwq/WebCoreViewFactory.h:
WebKit:
Fixed: <rdar://problem/3333897>: should support navigator.plugins.refresh as a way to add a plugin without restarting Safari
Reviewed by rjw.
* Plugins.subproj/WebBaseNetscapePluginView.m:
(-[WebBaseNetscapePluginView dealloc]): release the plug-in object
* Plugins.subproj/WebBasePluginPackage.h:
* Plugins.subproj/WebBasePluginPackage.m:
(-[WebBasePluginPackage initWithPath:]): store the last mod date
(-[WebBasePluginPackage dealloc]): release the last mod date
(-[WebBasePluginPackage lastModifiedDate]): new
(-[WebBasePluginPackage isEqual:]): new
(-[WebBasePluginPackage hash]): new
* Plugins.subproj/WebNetscapePluginPackage.m:
(-[WebNetscapePluginPackage load]): convert the NPP_Shutdown proc pointer so that we can use it later
(-[WebNetscapePluginPackage unload]): added log message
* Plugins.subproj/WebPluginDatabase.h:
* Plugins.subproj/WebPluginDatabase.m:
(-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]): tweak
(-[WebPluginDatabase plugins]): tweak
(-[WebPluginDatabase init]): call refresh
(-[WebPluginDatabase refresh]): new
(-[WebPluginDatabase loadPluginIfNeededForMIMEType:]): tweak
* WebCoreSupport.subproj/WebViewFactory.m:
(-[WebViewFactory refreshPlugins:]): new
* WebView.subproj/WebControllerSets.h:
* WebView.subproj/WebControllerSets.m:
(+[WebViewSets makeWebViewsPerformSelector:]): new
* WebView.subproj/WebFrame.m:
(-[WebFrame _reloadForPluginChanges]): new
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebView.m:
(-[WebView _reloadForPluginChanges]): new
* WebView.subproj/WebViewPrivate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1731cb0..a20751d 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,17 @@
+2003-10-09 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3333897>: should support navigator.plugins.refresh as a way to add a plugin without restarting Safari
+
+ Reviewed by rjw.
+
+ * khtml/ecma/kjs_navigator.cpp:
+ (PluginBase::refresh): new
+ (PluginsFunc::tryCall): call refresh
+ * kwq/KWQKConfigBase.h:
+ * kwq/KWQKConfigBase.mm:
+ (RefreshPlugins): new
+ * kwq/WebCoreViewFactory.h:
+
=== Safari-109 ===
2003-10-08 David Hyatt <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1731cb0..a20751d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,17 @@
+2003-10-09 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3333897>: should support navigator.plugins.refresh as a way to add a plugin without restarting Safari
+
+ Reviewed by rjw.
+
+ * khtml/ecma/kjs_navigator.cpp:
+ (PluginBase::refresh): new
+ (PluginsFunc::tryCall): call refresh
+ * kwq/KWQKConfigBase.h:
+ * kwq/KWQKConfigBase.mm:
+ (RefreshPlugins): new
+ * kwq/WebCoreViewFactory.h:
+
=== Safari-109 ===
2003-10-08 David Hyatt <hyatt at apple.com>
diff --git a/WebCore/khtml/ecma/kjs_navigator.cpp b/WebCore/khtml/ecma/kjs_navigator.cpp
index d43f760..12fff62 100644
--- a/WebCore/khtml/ecma/kjs_navigator.cpp
+++ b/WebCore/khtml/ecma/kjs_navigator.cpp
@@ -46,6 +46,8 @@ namespace KJS {
public:
PluginBase(ExecState *exec);
virtual ~PluginBase();
+
+ void refresh(bool reload);
struct MimeClassInfo;
struct PluginInfo;
@@ -321,6 +323,17 @@ PluginBase::~PluginBase()
}
}
+void PluginBase::refresh(bool reload)
+{
+ delete plugins;
+ delete mimes;
+ plugins = 0;
+ mimes = 0;
+#if APPLE_CHANGES
+ RefreshPlugins(reload);
+#endif
+}
+
/*******************************************************************/
IMPLEMENT_PROTOFUNC(PluginsFunc)
@@ -442,9 +455,10 @@ Value MimeType::get(ExecState *exec, const Identifier &propertyName) const
}
-Value PluginsFunc::tryCall(ExecState *, Object &, const List &)
+Value PluginsFunc::tryCall(ExecState *exec, Object &, const List &args)
{
- return Undefined();
+ PluginBase(exec).refresh(args[0].toBoolean(exec));
+ return Undefined();
}
diff --git a/WebCore/kwq/KWQKConfigBase.h b/WebCore/kwq/KWQKConfigBase.h
index a8155dc..11b8fa7 100644
--- a/WebCore/kwq/KWQKConfigBase.h
+++ b/WebCore/kwq/KWQKConfigBase.h
@@ -68,4 +68,6 @@ private:
};
+void RefreshPlugins(bool reload);
+
#endif
diff --git a/WebCore/kwq/KWQKConfigBase.mm b/WebCore/kwq/KWQKConfigBase.mm
index 54ade67..3eb4440 100644
--- a/WebCore/kwq/KWQKConfigBase.mm
+++ b/WebCore/kwq/KWQKConfigBase.mm
@@ -142,3 +142,9 @@ QStringList KConfig::readListEntry(const QString &pKey, char sep) const
ERROR("not yet implemented");
return QStringList();
}
+
+void RefreshPlugins(bool reload)
+{
+ [[WebCoreViewFactory sharedFactory] refreshPlugins:reload];
+}
+
diff --git a/WebCore/kwq/WebCoreViewFactory.h b/WebCore/kwq/WebCoreViewFactory.h
index 33e1cd4..e42c881 100644
--- a/WebCore/kwq/WebCoreViewFactory.h
+++ b/WebCore/kwq/WebCoreViewFactory.h
@@ -31,6 +31,7 @@
@protocol WebCoreViewFactory
- (NSArray *)pluginsInfo; // array of id <WebCorePluginInfo>
+- (void)refreshPlugins:(BOOL)reloadPages;
- (NSString *)inputElementAltText;
- (NSString *)resetButtonDefaultLabel;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2e5ea31..045227e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,6 +1,43 @@
+2003-10-09 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3333897>: should support navigator.plugins.refresh as a way to add a plugin without restarting Safari
+
+ Reviewed by rjw.
+
+ * Plugins.subproj/WebBaseNetscapePluginView.m:
+ (-[WebBaseNetscapePluginView dealloc]): release the plug-in object
+ * Plugins.subproj/WebBasePluginPackage.h:
+ * Plugins.subproj/WebBasePluginPackage.m:
+ (-[WebBasePluginPackage initWithPath:]): store the last mod date
+ (-[WebBasePluginPackage dealloc]): release the last mod date
+ (-[WebBasePluginPackage lastModifiedDate]): new
+ (-[WebBasePluginPackage isEqual:]): new
+ (-[WebBasePluginPackage hash]): new
+ * Plugins.subproj/WebNetscapePluginPackage.m:
+ (-[WebNetscapePluginPackage load]): convert the NPP_Shutdown proc pointer so that we can use it later
+ (-[WebNetscapePluginPackage unload]): added log message
+ * Plugins.subproj/WebPluginDatabase.h:
+ * Plugins.subproj/WebPluginDatabase.m:
+ (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]): tweak
+ (-[WebPluginDatabase plugins]): tweak
+ (-[WebPluginDatabase init]): call refresh
+ (-[WebPluginDatabase refresh]): new
+ (-[WebPluginDatabase loadPluginIfNeededForMIMEType:]): tweak
+ * WebCoreSupport.subproj/WebViewFactory.m:
+ (-[WebViewFactory refreshPlugins:]): new
+ * WebView.subproj/WebControllerSets.h:
+ * WebView.subproj/WebControllerSets.m:
+ (+[WebViewSets makeWebViewsPerformSelector:]): new
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame _reloadForPluginChanges]): new
+ * WebView.subproj/WebFramePrivate.h:
+ * WebView.subproj/WebView.m:
+ (-[WebView _reloadForPluginChanges]): new
+ * WebView.subproj/WebViewPrivate.h:
+
=== Safari-109 ===
-2003-10-03 Richard Williamson (Home0 <rjw at apple.com>
+2003-10-03 Richard Williamson <rjw at apple.com>
Fix part of 3438071. Creating an instance of WebPreferences using init
will do the expected thing: that is, create a new instance! We used to
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 3955449..bb99efd 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -901,8 +901,9 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
- (void)setPlugin:(WebNetscapePluginPackage *)thePlugin;
{
+ [thePlugin retain];
[plugin release];
- plugin = [thePlugin retain];
+ plugin = thePlugin;
NPP_New = [plugin NPP_New];
NPP_Destroy = [plugin NPP_Destroy];
@@ -1007,11 +1008,10 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
free(cAttributes[i]);
free(cValues[i]);
}
- [streams removeAllObjects];
+ [plugin release];
[streams release];
[MIMEType release];
[baseURL release];
- [streamNotifications removeAllObjects];
[streamNotifications release];
free(cAttributes);
free(cValues);
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.h b/WebKit/Plugins.subproj/WebBasePluginPackage.h
index 3ad5043..cb51fe3 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.h
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.h
@@ -26,6 +26,8 @@
NSString *pluginDescription;
NSBundle *bundle;
+
+ NSDate *lastModifiedDate;
NSDictionary *MIMEToDescription;
NSDictionary *MIMEToExtensions;
@@ -46,6 +48,7 @@
- (NSString *)filename;
- (NSString *)pluginDescription;
- (NSBundle *)bundle;
+- (NSDate *)lastModifiedDate;
- (NSEnumerator *)extensionEnumerator;
- (NSEnumerator *)MIMETypeEnumerator;
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.m b/WebKit/Plugins.subproj/WebBasePluginPackage.m
index 67d2547..be47a55 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.m
@@ -60,9 +60,10 @@
- initWithPath:(NSString *)pluginPath
{
[super init];
- extensionToMIME = [[NSMutableDictionary dictionary] retain];
+ extensionToMIME = [[NSMutableDictionary alloc] init];
path = [[self pathByResolvingSymlinksAndAliasesInPath:pluginPath] retain];
bundle = [[NSBundle alloc] initWithPath:path];
+ lastModifiedDate = [[[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES] objectForKey:NSFileModificationDate] retain];
return self;
}
@@ -148,6 +149,8 @@
- (void)dealloc
{
+ [self unload];
+
[name release];
[path release];
[pluginDescription release];
@@ -211,6 +214,11 @@
return bundle;
}
+- (NSDate *)lastModifiedDate
+{
+ return lastModifiedDate;
+}
+
- (void)setName:(NSString *)theName
{
[name release];
@@ -265,6 +273,18 @@
name, path, [MIMEToExtensions description], [MIMEToDescription description], pluginDescription];
}
+- (BOOL)isEqual:(id)object
+{
+ return ([object isKindOfClass:[WebBasePluginPackage class]] &&
+ [[object name] isEqualToString:name] &&
+ [[object lastModifiedDate] isEqual:lastModifiedDate]);
+}
+
+- (unsigned)hash
+{
+ return [[name stringByAppendingString:[lastModifiedDate description]] hash];
+}
+
@end
@implementation NSArray (WebPluginExtensions)
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index e7ebf56..e7cad17 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -339,7 +339,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
if (isLoaded) {
return YES;
}
-
+
if (isBundle) {
CFBundleRef cfBundle = [bundle _cfBundle];
if (!CFBundleLoadExecutable(cfBundle)) {
@@ -440,7 +440,9 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
CFAbsoluteTime mainStart = CFAbsoluteTimeGetCurrent();
#endif
LOG(Plugins, "%f main timing started", mainStart);
- npErr = pluginMainFunc(&browserFuncs, &pluginFuncs, &NPP_Shutdown);
+ NPP_ShutdownProcPtr shutdownFunction;
+ npErr = pluginMainFunc(&browserFuncs, &pluginFuncs, &shutdownFunction);
+ NPP_Shutdown = (NPP_ShutdownProcPtr)functionPointerForTVector((TransitionVector)shutdownFunction);
if (!isBundle) {
// Don't free pluginMainFunc if we got it from a bundle because it is owned by CFBundle in that case.
free(pluginMainFunc);
@@ -575,6 +577,8 @@ abort:
if (!isLoaded) {
return;
}
+
+ LOG(Plugins, "Unloading %@...", name);
NPP_Shutdown();
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.h b/WebKit/Plugins.subproj/WebPluginDatabase.h
index 48db262..c84126c 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.h
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.h
@@ -9,8 +9,8 @@
@interface WebPluginDatabase : NSObject
{
- NSArray *plugins;
- NSMutableArray *pendingPluginLoads;
+ NSMutableSet *plugins;
+ NSMutableSet *pendingPluginLoads;
}
+ (WebPluginDatabase *)installedPlugins;
@@ -21,6 +21,8 @@
- (NSArray *)plugins;
+- (void)refresh;
+
- (void)loadPluginIfNeededForMIMEType:(NSString *)MIMEType;
@end
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.m b/WebKit/Plugins.subproj/WebPluginDatabase.m
index cede613..fd2b0f1 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.m
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.m
@@ -5,7 +5,7 @@
#import <WebKit/WebAssertions.h>
#import <WebKit/WebBasePluginPackage.h>
-#import <WebKit/WebDataSource.h>
+#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFrameViewPrivate.h>
#import <WebKit/WebKitLogging.h>
@@ -95,12 +95,11 @@ static BOOL sIsCocoa = FALSE;
- (WebBasePluginPackage *)pluginForKey:(NSString *)key withEnumeratorSelector:(SEL)enumeratorSelector
{
WebBasePluginPackage *plugin, *CFMPlugin=nil, *machoPlugin=nil, *webPlugin=nil;
- NSString *lowercaseKey = [key lowercaseString];
- uint i;
+ NSEnumerator *pluginEnumerator = [plugins objectEnumerator];
+ key = [key lowercaseString];
- for (i=0; i<[plugins count]; i++) {
- plugin = [plugins objectAtIndex:i];
- if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:lowercaseKey]) {
+ while ((plugin = [pluginEnumerator nextObject]) != nil) {
+ if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]) {
if ([plugin isKindOfClass:[WebPluginPackage class]]) {
if (webPlugin == nil) {
webPlugin = plugin;
@@ -149,7 +148,7 @@ static BOOL sIsCocoa = FALSE;
- (NSArray *)plugins
{
- return plugins;
+ return [plugins allObjects];
}
static NSArray *pluginLocations(void)
@@ -173,89 +172,102 @@ static NSArray *pluginLocations(void)
if (self == nil) {
return nil;
}
+ [self refresh];
+ return self;
- NSArray *pluginDirectories = pluginLocations();
+}
+- (void)refresh
+{
+ NSEnumerator *directoryEnumerator = [pluginLocations() objectEnumerator];
+ NSMutableSet *uniqueFilenames = [[NSMutableArray alloc] init];
NSFileManager *fileManager = [NSFileManager defaultManager];
-
- NSMutableArray *pluginPaths = [NSMutableArray arrayWithCapacity:10];
- NSMutableSet *filenames = [NSMutableSet setWithCapacity:10];
-
- NSArray *files;
- NSString *file;
- uint i, j, n;
+ NSMutableSet *newPlugins = [[NSMutableSet alloc] init];
+ NSString *pluginDirectory;
- for (i = 0; i < [pluginDirectories count]; i++) {
- files = [fileManager directoryContentsAtPath:[pluginDirectories objectAtIndex:i]];
- for (n = 0; n < [files count]; n++) {
- file = [files objectAtIndex:n];
- if (![filenames containsObject:file]) { // avoid duplicates
- [filenames addObject:file];
- [pluginPaths addObject:[[pluginDirectories objectAtIndex:i] stringByAppendingPathComponent:file]];
+ // Create a new set of plug-ins.
+ while ((pluginDirectory = [directoryEnumerator nextObject]) != nil) {
+ NSEnumerator *filenameEnumerator = [[fileManager directoryContentsAtPath:pluginDirectory] objectEnumerator];
+ NSString *filename;
+ while ((filename = [filenameEnumerator nextObject]) != nil) {
+ if (![uniqueFilenames containsObject:filename]) {
+ [uniqueFilenames addObject:filename];
+ NSString *pluginPath = [pluginDirectory stringByAppendingPathComponent:filename];
+ WebBasePluginPackage *pluginPackage = [WebBasePluginPackage pluginWithPath:pluginPath];
+ if (pluginPackage) {
+ [newPlugins addObject:pluginPackage];
+ }
}
}
}
- NSMutableArray *pluginArray = [NSMutableArray arrayWithCapacity:[pluginPaths count]];
+ [uniqueFilenames release];
- for (i = 0; i < [pluginPaths count]; i++) {
- WebBasePluginPackage *pluginPackage = [WebBasePluginPackage pluginWithPath:[pluginPaths objectAtIndex:i]];
- if (pluginPackage) {
- [pluginArray addObject:pluginPackage];
- LOG(Plugins, "Found plugin: %s", [[pluginPackage name] lossyCString]);
- LOG(Plugins, "%s", [[pluginPackage description] lossyCString]);
+ // Remove all uninstalled plug-ins and add the new plug-ins.
+ if (plugins) {
+ NSMutableSet *pluginsToUnload = [plugins mutableCopy];
+ [pluginsToUnload minusSet:newPlugins];
+#if !LOG_DISABLED
+ NSMutableSet *reallyNewPlugins = [newPlugins mutableCopy];
+ [reallyNewPlugins minusSet:plugins];
+ if ([reallyNewPlugins count] > 0) {
+ LOG(Plugins, "New plugins:\n%@", reallyNewPlugins);
}
+ if ([pluginsToUnload count] > 0) {
+ LOG(Plugins, "Removed plugins:\n%@", pluginsToUnload);
+ }
+ [reallyNewPlugins release];
+#endif
+ [plugins minusSet:pluginsToUnload];
+ [plugins unionSet:newPlugins];
+ [pluginsToUnload release];
+ [newPlugins release];
+ } else {
+ LOG(Plugins, "Plugin database initialization:\n%@", newPlugins);
+ plugins = newPlugins;
}
-
- plugins = [pluginArray copy];
-
- // Register plug-in WebDocumentViews and WebDocumentRepresentations
- NSArray *viewTypes = [[WebFrameView _viewTypesAllowImageTypeOmission:NO] allKeys];
- NSArray *mimes;
- NSString *mime;
- WebBasePluginPackage *plugin;
- uint pluginCount, mimeCount;
- pluginCount = [plugins count];
- for (i = 0; i < pluginCount; i++) {
- plugin = [plugins objectAtIndex:i];
- mimes = [[plugin MIMETypeEnumerator] allObjects];
- if ([plugin isKindOfClass:[WebNetscapePluginPackage class]]){
- mimeCount = [mimes count];
- for (j = 0; j < mimeCount; j++){
- mime = [mimes objectAtIndex:j];
-
- // Don't override previously registered types.
- if(![viewTypes containsObject:mime]){
- // Cocoa plugins must register themselves.
- [WebView registerViewClass:[WebNetscapePluginDocumentView class] representationClass:[WebNetscapePluginRepresentation class] forMIMEType:mime];
+ // Unregister netscape plug-in WebDocumentViews and WebDocumentRepresentations.
+ NSMutableDictionary *MIMEToViewClass = [WebFrameView _viewTypesAllowImageTypeOmission:NO];
+ NSEnumerator *keyEnumerator = [MIMEToViewClass keyEnumerator];
+ NSString *MIMEType;
+ while ((MIMEType = [keyEnumerator nextObject]) != nil) {
+ if ([MIMEToViewClass objectForKey:MIMEType] == [WebNetscapePluginDocumentView class]) {
+ [WebView _unregisterViewClassAndRepresentationClassForMIMEType:MIMEType];
+ }
+ }
+
+ // Register netscape plug-in WebDocumentViews and WebDocumentRepresentations
+ // but do not override other document views and representations.
+ NSEnumerator *pluginEnumerator = [plugins objectEnumerator];
+ WebBasePluginPackage *plugin;
+ while ((plugin = [pluginEnumerator nextObject]) != nil) {
+ if ([plugin isKindOfClass:[WebNetscapePluginPackage class]]) {
+ NSEnumerator *MIMEEnumerator = [plugin MIMETypeEnumerator];
+ while ((MIMEType = [MIMEEnumerator nextObject]) != nil) {
+ if ([MIMEToViewClass objectForKey:MIMEType] == nil) {
+ [WebView registerViewClass:[WebNetscapePluginDocumentView class] representationClass:[WebNetscapePluginRepresentation class] forMIMEType:MIMEType];
}
}
- }
- else {
- if (!pendingPluginLoads)
- pendingPluginLoads = [[NSMutableArray alloc] init];
- [pendingPluginLoads addObject: plugin];
+ } else {
+ if (![plugin isLoaded]) {
+ if (!pendingPluginLoads) {
+ pendingPluginLoads = [[NSMutableSet alloc] init];
+ }
+ [pendingPluginLoads addObject:plugin];
+ }
}
}
-
- return self;
}
- (void)loadPluginIfNeededForMIMEType: (NSString *)MIMEType
{
- NSArray *mimes;
+ NSEnumerator *pluginEnumerator = [pendingPluginLoads objectEnumerator];
WebBasePluginPackage *plugin;
- int i, pluginCount;
-
- pluginCount = [pendingPluginLoads count];
- for (i = pluginCount-1; i >= 0; i--){
- plugin = [pendingPluginLoads objectAtIndex:i];
- mimes = [[plugin MIMETypeEnumerator] allObjects];
- if ([mimes containsObject: MIMEType]){
- [[plugin bundle] load];
- [pendingPluginLoads removeObject: plugin];
- continue;
+ while ((plugin = [pluginEnumerator nextObject]) != nil) {
+ if ([[[plugin MIMETypeEnumerator] allObjects] containsObject:MIMEType]) {
+ [plugin load];
+ [pendingPluginLoads removeObject:plugin];
}
}
}
diff --git a/WebKit/WebCoreSupport.subproj/WebViewFactory.m b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
index aed628c..1b4156e 100644
--- a/WebKit/WebCoreSupport.subproj/WebViewFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
@@ -9,6 +9,7 @@
#import <WebKit/WebViewFactory.h>
#import <WebKit/WebAssertions.h>
+#import <WebKit/WebControllerSets.h>
#import <WebKit/WebLocalizableStrings.h>
#import <WebKit/WebPluginDatabase.h>
@@ -28,6 +29,14 @@
return [[WebPluginDatabase installedPlugins] plugins];
}
+- (void)refreshPlugins:(BOOL)reloadPages
+{
+ [[WebPluginDatabase installedPlugins] refresh];
+ if (reloadPages) {
+ [WebViewSets makeWebViewsPerformSelector:@selector(_reloadForPluginChanges)];
+ }
+}
+
- (NSString *)inputElementAltText
{
return UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value");
diff --git a/WebKit/WebView.subproj/WebControllerSets.h b/WebKit/WebView.subproj/WebControllerSets.h
index a1f4fe0..6add657 100644
--- a/WebKit/WebView.subproj/WebControllerSets.h
+++ b/WebKit/WebView.subproj/WebControllerSets.h
@@ -12,6 +12,7 @@
+ (void)addWebView:(WebView *)webView toSetNamed:(NSString *)name;
+ (void)removeWebView:(WebView *)webView fromSetNamed:(NSString *)name;
+ (NSEnumerator *)webViewsInSetNamed:(NSString *)name;
++ (void)makeWebViewsPerformSelector:(SEL)selector;
@end
diff --git a/WebKit/WebView.subproj/WebControllerSets.m b/WebKit/WebView.subproj/WebControllerSets.m
index 8a42f44..a02f55f 100644
--- a/WebKit/WebView.subproj/WebControllerSets.m
+++ b/WebKit/WebView.subproj/WebControllerSets.m
@@ -63,6 +63,15 @@ NSMutableDictionary *sets = nil;
return [(NSSet *)set objectEnumerator];
}
++ (void)makeWebViewsPerformSelector:(SEL)selector
+{
+ NSEnumerator *setEnumerator = [sets objectEnumerator];
+ NSMutableSet *set;
+ while ((set = [setEnumerator nextObject]) != nil) {
+ [set makeObjectsPerformSelector:selector];
+ }
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 3c06694..b56d04c 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -18,6 +18,10 @@
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebKitStatisticsPrivate.h>
#import <WebKit/WebKitLogging.h>
+#import <WebKit/WebNetscapePluginDocumentView.h>
+#import <WebKit/WebNetscapePluginEmbeddedView.h>
+#import <WebKit/WebNullPluginView.h>
+#import <WebKit/WebPlugin.h>
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebUIDelegate.h>
@@ -2304,6 +2308,28 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
return [_private->bridge bodyBackgroundColor];
}
+- (void)_reloadForPluginChanges;
+{
+ NSView <WebDocumentView> *documentView = [[self frameView] documentView];
+ if ([documentView isKindOfClass:[WebNetscapePluginDocumentView class]]) {
+ [self reload];
+ } else if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ NSEnumerator *viewEnumerator = [[documentView subviews] objectEnumerator];
+ NSView *view;
+ while ((view = [viewEnumerator nextObject]) != nil) {
+ if ([view isKindOfClass:[WebNetscapePluginEmbeddedView class]] ||
+ [view isKindOfClass:[WebNullPluginView class]] ||
+ [view conformsToProtocol:@protocol(WebPlugin)]) {
+ [self reload];
+ break;
+ }
+ }
+ } else {
+ [[self childFrames] makeObjectsPerformSelector:@selector(_reloadForPluginChanges)];
+ }
+
+}
+
@end
@implementation WebFormState : NSObject
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 79b9da6..cd534ce 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -195,4 +195,6 @@ extern NSString *WebPageCacheDocumentViewKey;
- (NSColor *)_bodyBackgroundColor;
+- (void)_reloadForPluginChanges;
+
@end
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 6383087..7e4bd2b 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -634,6 +634,12 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
[[self _UIDelegateForwarder] webViewClose:self];
}
++ (void)_unregisterViewClassAndRepresentationClassForMIMEType:(NSString *)MIMEType;
+{
+ [[WebFrameView _viewTypesAllowImageTypeOmission:NO] removeObjectForKey:MIMEType];
+ [[WebDataSource _repTypesAllowImageTypeOmission:NO] removeObjectForKey:MIMEType];
+}
+
+ (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
{
NSString *MIMEType = [self _generatedMIMETypeForURLScheme:URLScheme];
@@ -908,6 +914,11 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
[NSApp setWindowsNeedUpdate:YES];
}
+- (void)_reloadForPluginChanges
+{
+ [[self mainFrame] _reloadForPluginChanges];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 0d23457..0a33864 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -206,6 +206,8 @@ Could be worth adding to the API.
*/
+ (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
++ (void)_unregisterViewClassAndRepresentationClassForMIMEType:(NSString *)MIMEType;
+
+ (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
+ (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
/*!
@@ -245,6 +247,8 @@ Could be worth adding to the API.
- (void)_willChangeValueForKey:(NSString *)key;
- (void)_didChangeValueForKey:(NSString *)key;
+
+- (void)_reloadForPluginChanges;
@end
@interface _WebSafeForwarder : NSObject
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list