Commit bc1984b0 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

2008-11-04 Anders Carlsson <andersca@apple.com>

        Reviewed by Kevin Decker.

        More cleanup. Make a bunch of instance variables RetainPtrs.
        
        * Plugins/WebBaseNetscapePluginView.h:
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView visibleRect]):
        (-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
        (-[WebBaseNetscapePluginView sendActivateEvent:]):
        (-[WebBaseNetscapePluginView sendDrawRectEvent:]):
        (-[WebBaseNetscapePluginView stopTimers]):
        (-[WebBaseNetscapePluginView restartTimers]):
        (-[WebBaseNetscapePluginView setHasFocus:]):
        (-[WebBaseNetscapePluginView mouseDown:]):
        (-[WebBaseNetscapePluginView mouseUp:]):
        (-[WebBaseNetscapePluginView mouseEntered:]):
        (-[WebBaseNetscapePluginView mouseExited:]):
        (-[WebBaseNetscapePluginView handleMouseMoved:]):
        (-[WebBaseNetscapePluginView mouseDragged:]):
        (-[WebBaseNetscapePluginView scrollWheel:]):
        (-[WebBaseNetscapePluginView keyUp:]):
        (-[WebBaseNetscapePluginView keyDown:]):
        (-[WebBaseNetscapePluginView flagsChanged:]):
        (-[WebBaseNetscapePluginView cut:]):
        (-[WebBaseNetscapePluginView copy:]):
        (-[WebBaseNetscapePluginView paste:]):
        (-[WebBaseNetscapePluginView selectAll:]):
        (-[WebBaseNetscapePluginView didStart]):
        (-[WebBaseNetscapePluginView start]):
        (-[WebBaseNetscapePluginView stop]):
        (-[WebBaseNetscapePluginView dataSource]):
        (-[WebBaseNetscapePluginView pluginPackage]):
        (-[WebBaseNetscapePluginView setPluginPackage:]):
        (-[WebBaseNetscapePluginView setAttributeKeys:andValues:]):
        (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:DOMElement:]):
        (-[WebBaseNetscapePluginView fini]):
        (-[WebBaseNetscapePluginView dealloc]):
        (-[WebBaseNetscapePluginView pluginView:receivedError:]):
        (-[WebBaseNetscapePluginView requestWithURLCString:]):
        (-[WebBaseNetscapePluginView webFrame:didFinishLoadWithReason:]):
        (-[WebBaseNetscapePluginView loadPluginRequest:]):
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
        (-[WebBaseNetscapePluginView userAgent]):
        (-[WebBaseNetscapePluginView getVariable:value:]):
        (-[WebBaseNetscapePluginView setVariable:value:]):
        (-[WebBaseNetscapePluginView _createPlugin]):
        (-[WebBaseNetscapePluginView _redeliverStream]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 28f3c1bd
2008-11-04 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker.
More cleanup. Make a bunch of instance variables RetainPtrs.
* Plugins/WebBaseNetscapePluginView.h:
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView visibleRect]):
(-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
(-[WebBaseNetscapePluginView sendActivateEvent:]):
(-[WebBaseNetscapePluginView sendDrawRectEvent:]):
(-[WebBaseNetscapePluginView stopTimers]):
(-[WebBaseNetscapePluginView restartTimers]):
(-[WebBaseNetscapePluginView setHasFocus:]):
(-[WebBaseNetscapePluginView mouseDown:]):
(-[WebBaseNetscapePluginView mouseUp:]):
(-[WebBaseNetscapePluginView mouseEntered:]):
(-[WebBaseNetscapePluginView mouseExited:]):
(-[WebBaseNetscapePluginView handleMouseMoved:]):
(-[WebBaseNetscapePluginView mouseDragged:]):
(-[WebBaseNetscapePluginView scrollWheel:]):
(-[WebBaseNetscapePluginView keyUp:]):
(-[WebBaseNetscapePluginView keyDown:]):
(-[WebBaseNetscapePluginView flagsChanged:]):
(-[WebBaseNetscapePluginView cut:]):
(-[WebBaseNetscapePluginView copy:]):
(-[WebBaseNetscapePluginView paste:]):
(-[WebBaseNetscapePluginView selectAll:]):
(-[WebBaseNetscapePluginView didStart]):
(-[WebBaseNetscapePluginView start]):
(-[WebBaseNetscapePluginView stop]):
(-[WebBaseNetscapePluginView dataSource]):
(-[WebBaseNetscapePluginView pluginPackage]):
(-[WebBaseNetscapePluginView setPluginPackage:]):
(-[WebBaseNetscapePluginView setAttributeKeys:andValues:]):
(-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:DOMElement:]):
(-[WebBaseNetscapePluginView fini]):
(-[WebBaseNetscapePluginView dealloc]):
(-[WebBaseNetscapePluginView pluginView:receivedError:]):
(-[WebBaseNetscapePluginView requestWithURLCString:]):
(-[WebBaseNetscapePluginView webFrame:didFinishLoadWithReason:]):
(-[WebBaseNetscapePluginView loadPluginRequest:]):
(-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
(-[WebBaseNetscapePluginView userAgent]):
(-[WebBaseNetscapePluginView getVariable:value:]):
(-[WebBaseNetscapePluginView setVariable:value:]):
(-[WebBaseNetscapePluginView _createPlugin]):
(-[WebBaseNetscapePluginView _redeliverStream]):
2008-11-04 Brady Eidson <beidson@apple.com>
Reviewed by John Sullivan
......
......@@ -34,6 +34,8 @@
#import <WebKit/WebBasePluginPackage.h>
#import <wtf/HashMap.h>
#import <wtf/HashSet.h>
#import <wtf/OwnPtr.h>
#import <wtf/RetainPtr.h>
@class DOMElement;
@class WebDataSource;
......@@ -61,9 +63,9 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
@interface WebBaseNetscapePluginView : NSView <WebPluginManualLoader, NSTextInput>
{
WebNetscapePluginPackage *pluginPackage;
RetainPtr<WebNetscapePluginPackage> _pluginPackage;
NSURL *sourceURL;
RetainPtr<NSURL> _sourceURL;
WebFrame *_webFrame;
BOOL _loadManually;
......@@ -72,9 +74,9 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
CALayer *_layer;
#endif
unsigned _dataLengthReceived;
NSError *_error;
RetainPtr<NSError> _error;
int mode;
int _mode;
unsigned argsCount;
char **cAttributes;
......@@ -88,13 +90,12 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
NPDrawingModel drawingModel;
NPEventModel eventModel;
#ifndef NP_NO_QUICKDRAW
// This is only valid when drawingModel is NPDrawingModelQuickDraw
GWorldPtr offscreenGWorld;
#endif
WebNetscapePluginEventHandler *eventHandler;
OwnPtr<WebNetscapePluginEventHandler> _eventHandler;
BOOL isStarted;
BOOL inSetWindow;
......@@ -108,17 +109,17 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
unsigned pluginFunctionCallDepth;
DOMElement *element;
RetainPtr<DOMElement> _element;
int32 specifiedHeight;
int32 specifiedWidth;
NSString *MIMEType;
NSURL *baseURL;
RetainPtr<NSString> _MIMEType;
RetainPtr<NSURL> _baseURL;
NSTrackingRectTag trackingTag;
HashSet<RefPtr<WebNetscapePluginStream> > streams;
NSMutableDictionary *pendingFrameLoads;
RetainPtr<NSMutableDictionary> _pendingFrameLoads;
NPPluginTextInputFuncs *textInputFuncs;
......@@ -166,10 +167,6 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
- (WebNetscapePluginPackage *)pluginPackage;
- (void)setPluginPackage:(WebNetscapePluginPackage *)thePluginPackage;
- (void)setMIMEType:(NSString *)theMIMEType;
- (void)setBaseURL:(NSURL *)theBaseURL;
- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
- (void)setMode:(int)theMode;
- (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
- (void)viewDidMoveToHostWindow;
- (void)disconnectStream:(WebNetscapePluginStream*)stream;
......
......@@ -293,7 +293,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
{
// WebCore may impose an additional clip (via CSS overflow or clip properties). Fetch
// that clip now.
return NSIntersectionRect([self convertRect:[element _windowClipRect] fromView:nil], [super visibleRect]);
return NSIntersectionRect([self convertRect:[_element.get() _windowClipRect] fromView:nil], [super visibleRect]);
}
- (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate
......@@ -301,11 +301,6 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
ASSERT(drawingModel != NPDrawingModelCoreAnimation);
ASSERT([self currentWindow] != nil);
// If drawing with QuickDraw, fix the window port so that it has the same bounds as the NSWindow's
// content view. This makes it easier to convert between AppKit view and QuickDraw port coordinates.
if (isDrawingModelQuickDraw(drawingModel))
[self fixWindowPort];
// Use AppKit to convert view coordinates to NSWindow coordinates.
NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
......@@ -321,6 +316,10 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// Look at the Carbon port to convert top-left-based window coordinates into top-left-based content coordinates.
if (isDrawingModelQuickDraw(drawingModel)) {
// If drawing with QuickDraw, fix the window port so that it has the same bounds as the NSWindow's
// content view. This makes it easier to convert between AppKit view and QuickDraw port coordinates.
[self fixWindowPort];
::Rect portBounds;
CGrafPtr port = GetWindowPort(windowRef);
GetPortBounds(port, &portBounds);
......@@ -529,7 +528,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
#ifdef NP_NO_CARBON
nPort.cgPort.window = (NPNSWindow *)[self currentWindow];
#else
nPort.cgPort.window = eventHandler->platformWindow([self currentWindow]);
nPort.cgPort.window = _eventHandler->platformWindow([self currentWindow]);
#endif /* NP_NO_CARBON */
nPort.cgPort.context = context;
window.window = &nPort.cgPort;
......@@ -699,20 +698,20 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->windowFocusChanged(activate);
_eventHandler->windowFocusChanged(activate);
}
- (void)sendDrawRectEvent:(NSRect)rect
{
ASSERT(eventHandler);
ASSERT(_eventHandler);
eventHandler->drawRect(rect);
_eventHandler->drawRect(rect);
}
- (void)stopTimers
{
if (eventHandler)
eventHandler->stopTimers();
if (_eventHandler)
_eventHandler->stopTimers();
shouldFireTimers = NO;
......@@ -740,7 +739,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// If the plugin is completely obscured (scrolled out of view, for example), then we will
// send null events at a reduced rate.
eventHandler->startTimers(isCompletelyObscured);
_eventHandler->startTimers(isCompletelyObscured);
if (!timers)
return;
......@@ -771,8 +770,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// We need to null check the event handler here because
// the plug-in view can resign focus after it's been stopped
// and the event handler has been deleted.
if (eventHandler)
eventHandler->focusChanged(hasFocus);
if (_eventHandler)
_eventHandler->focusChanged(hasFocus);
}
- (BOOL)becomeFirstResponder
......@@ -804,7 +803,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseDown(theEvent);
_eventHandler->mouseDown(theEvent);
}
- (void)mouseUp:(NSEvent *)theEvent
......@@ -812,7 +811,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseUp(theEvent);
_eventHandler->mouseUp(theEvent);
}
- (void)mouseEntered:(NSEvent *)theEvent
......@@ -820,7 +819,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseEntered(theEvent);
_eventHandler->mouseEntered(theEvent);
}
- (void)mouseExited:(NSEvent *)theEvent
......@@ -828,7 +827,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseExited(theEvent);
_eventHandler->mouseExited(theEvent);
// Set cursor back to arrow cursor. Because NSCursor doesn't know about changes that the plugin made, we could get confused about what we think the
// current cursor is otherwise. Therefore we have no choice but to unconditionally reset the cursor when the mouse exits the plugin.
......@@ -842,7 +841,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseMoved(theEvent);
_eventHandler->mouseMoved(theEvent);
}
- (void)mouseDragged:(NSEvent *)theEvent
......@@ -850,7 +849,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->mouseDragged(theEvent);
_eventHandler->mouseDragged(theEvent);
}
- (void)scrollWheel:(NSEvent *)theEvent
......@@ -860,7 +859,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
return;
}
if (!eventHandler->scrollWheel(theEvent))
if (!_eventHandler->scrollWheel(theEvent))
[super scrollWheel:theEvent];
}
......@@ -869,7 +868,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyUp(theEvent);
_eventHandler->keyUp(theEvent);
}
- (void)keyDown:(NSEvent *)theEvent
......@@ -877,7 +876,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyDown(theEvent);
_eventHandler->keyDown(theEvent);
}
- (void)flagsChanged:(NSEvent *)theEvent
......@@ -885,7 +884,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->flagsChanged(theEvent);
_eventHandler->flagsChanged(theEvent);
}
- (void)cut:(id)sender
......@@ -893,7 +892,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyDown([NSApp currentEvent]);
_eventHandler->keyDown([NSApp currentEvent]);
}
- (void)copy:(id)sender
......@@ -901,7 +900,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyDown([NSApp currentEvent]);
_eventHandler->keyDown([NSApp currentEvent]);
}
- (void)paste:(id)sender
......@@ -909,7 +908,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyDown([NSApp currentEvent]);
_eventHandler->keyDown([NSApp currentEvent]);
}
- (void)selectAll:(id)sender
......@@ -917,7 +916,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (!isStarted)
return;
eventHandler->keyDown([NSApp currentEvent]);
_eventHandler->keyDown([NSApp currentEvent]);
}
#pragma mark WEB_NETSCAPE_PLUGIN
......@@ -1114,8 +1113,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// If the OBJECT/EMBED tag has no SRC, the URL is passed to us as "".
// Check for this and don't start a load in this case.
if (sourceURL != nil && ![sourceURL _web_isEmpty]) {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:sourceURL];
if (_sourceURL && ![_sourceURL.get() _web_isEmpty]) {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_sourceURL.get()];
[request _web_setHTTPReferrer:core([self webFrame])->loader()->outgoingReferrer()];
[self loadRequest:request inTarget:nil withNotifyData:nil sendNotification:NO];
}
......@@ -1173,7 +1172,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
return NO;
// Open the plug-in package so it remains loaded while our plugin uses it
[pluginPackage open];
[_pluginPackage.get() open];
// Initialize drawingModel to an invalid value so that we can detect when the plugin does not specify a drawingModel
drawingModel = (NPDrawingModel)-1;
......@@ -1185,7 +1184,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (npErr != NPERR_NO_ERROR) {
LOG_ERROR("NPP_New failed with error: %d", npErr);
[self _destroyPlugin];
[pluginPackage close];
[_pluginPackage.get() close];
return NO;
}
......@@ -1210,9 +1209,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCocoa && isDrawingModelQuickDraw(drawingModel)) {
LOG(Plugins, "Plugin can't use use Cocoa event model with QuickDraw drawing model: %@", pluginPackage);
LOG(Plugins, "Plugin can't use use Cocoa event model with QuickDraw drawing model: %@", _pluginPackage.get());
[self _destroyPlugin];
[pluginPackage close];
[_pluginPackage.get() close];
return NO;
}
......@@ -1225,7 +1224,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
_layer = (CALayer *)value;
[self setWantsLayer:YES];
[self setLayer:_layer];
LOG(Plugins, "%@ is using Core Animation drawing model with layer %@", pluginPackage, _layer);
LOG(Plugins, "%@ is using Core Animation drawing model with layer %@", _pluginPackage.get(), _layer);
}
ASSERT(_layer);
......@@ -1233,7 +1232,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
#endif
// Create the event handler
eventHandler = WebNetscapePluginEventHandler::create(self);
_eventHandler.set(WebNetscapePluginEventHandler::create(self));
// Get the text input vtable
if (eventModel == NPEventModelCocoa) {
......@@ -1296,23 +1295,21 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
for (size_t i = 0; i < streamsCopy.size(); i++)
streamsCopy[i]->stop();
// Stop the timers
[self stopTimers];
// Stop notifications and callbacks.
[self removeWindowObservers];
[[pendingFrameLoads allKeys] makeObjectsPerformSelector:@selector(_setInternalLoadDelegate:) withObject:nil];
[[_pendingFrameLoads.get() allKeys] makeObjectsPerformSelector:@selector(_setInternalLoadDelegate:) withObject:nil];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
// Setting the window type to 0 ensures that NPP_SetWindow will be called if the plug-in is restarted.
lastSetWindow.type = (NPWindowType)0;
[self _destroyPlugin];
[pluginPackage close];
[_pluginPackage.get() close];
delete eventHandler;
eventHandler = 0;
_eventHandler.clear();
textInputFuncs = 0;
}
......@@ -1329,7 +1326,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (WebDataSource *)dataSource
{
WebFrame *webFrame = kit(core(element)->document()->frame());
WebFrame *webFrame = kit(core(_element.get())->document()->frame());
return [webFrame _dataSource];
}
......@@ -1355,42 +1352,26 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (WebNetscapePluginPackage *)pluginPackage
{
return pluginPackage;
return _pluginPackage.get();
}
- (void)setPluginPackage:(WebNetscapePluginPackage *)thePluginPackage;
{
[thePluginPackage retain];
[pluginPackage release];
pluginPackage = thePluginPackage;
NPP_New = [pluginPackage NPP_New];
NPP_Destroy = [pluginPackage NPP_Destroy];
NPP_SetWindow = [pluginPackage NPP_SetWindow];
NPP_NewStream = [pluginPackage NPP_NewStream];
NPP_WriteReady = [pluginPackage NPP_WriteReady];
NPP_Write = [pluginPackage NPP_Write];
NPP_StreamAsFile = [pluginPackage NPP_StreamAsFile];
NPP_DestroyStream = [pluginPackage NPP_DestroyStream];
NPP_HandleEvent = [pluginPackage NPP_HandleEvent];
NPP_URLNotify = [pluginPackage NPP_URLNotify];
NPP_GetValue = [pluginPackage NPP_GetValue];
NPP_SetValue = [pluginPackage NPP_SetValue];
NPP_Print = [pluginPackage NPP_Print];
}
- (void)setMIMEType:(NSString *)theMIMEType
{
NSString *type = [theMIMEType copy];
[MIMEType release];
MIMEType = type;
}
_pluginPackage = thePluginPackage;
- (void)setBaseURL:(NSURL *)theBaseURL
{
[theBaseURL retain];
[baseURL release];
baseURL = theBaseURL;
NPP_New = [_pluginPackage.get() NPP_New];
NPP_Destroy = [_pluginPackage.get() NPP_Destroy];
NPP_SetWindow = [_pluginPackage.get() NPP_SetWindow];
NPP_NewStream = [_pluginPackage.get() NPP_NewStream];
NPP_WriteReady = [_pluginPackage.get() NPP_WriteReady];
NPP_Write = [_pluginPackage.get() NPP_Write];
NPP_StreamAsFile = [_pluginPackage.get() NPP_StreamAsFile];
NPP_DestroyStream = [_pluginPackage.get() NPP_DestroyStream];
NPP_HandleEvent = [_pluginPackage.get() NPP_HandleEvent];
NPP_URLNotify = [_pluginPackage.get() NPP_URLNotify];
NPP_GetValue = [_pluginPackage.get() NPP_GetValue];
NPP_SetValue = [_pluginPackage.get() NPP_SetValue];
NPP_Print = [_pluginPackage.get() NPP_Print];
}
- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
......@@ -1402,18 +1383,18 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// modifiable and live the entire life of the plugin.
// The Java plug-in requires the first argument to be the base URL
if ([MIMEType isEqualToString:@"application/x-java-applet"]) {
if ([_MIMEType.get() isEqualToString:@"application/x-java-applet"]) {
cAttributes = (char **)malloc(([keys count] + 1) * sizeof(char *));
cValues = (char **)malloc(([values count] + 1) * sizeof(char *));
cAttributes[0] = strdup("DOCBASE");
cValues[0] = strdup([baseURL _web_URLCString]);
cValues[0] = strdup([_baseURL.get() _web_URLCString]);
argsCount++;
} else {
cAttributes = (char **)malloc([keys count] * sizeof(char *));
cValues = (char **)malloc([values count] * sizeof(char *));
}
BOOL isWMP = [[[pluginPackage bundle] bundleIdentifier] isEqualToString:@"com.microsoft.WMP.defaultplugin"];
BOOL isWMP = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.WMP.defaultplugin"];
unsigned i;
unsigned count = [keys count];
......@@ -1436,11 +1417,6 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
}
}
- (void)setMode:(int)theMode
{
mode = theMode;
}
#pragma mark NSVIEW
- (id)initWithFrame:(NSRect)frame
......@@ -1455,7 +1431,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
{
[super initWithFrame:frame];
pendingFrameLoads = [[NSMutableDictionary alloc] init];
_pendingFrameLoads.adoptNS([[NSMutableDictionary alloc] init]);
// load the plug-in if it is not already loaded
if (![thePluginPackage load]) {
......@@ -1464,16 +1440,15 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
}
[self setPluginPackage:thePluginPackage];
element = [anElement retain];
sourceURL = [theURL retain];
_element = anElement;
_sourceURL.adoptNS([theURL copy]);
_baseURL.adoptNS([theBaseURL copy]);
[self setMIMEType:MIME];
[self setBaseURL:theBaseURL];
[self setAttributeKeys:keys andValues:values];
if (loadManually)
[self setMode:NP_FULL];
_mode = NP_FULL;
else
[self setMode:NP_EMBED];
_mode = NP_EMBED;
_loadManually = loadManually;
return self;
......@@ -1492,15 +1467,14 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
DisposeGWorld(offscreenGWorld);
#endif
unsigned i;
for (i = 0; i < argsCount; i++) {
for (unsigned i = 0; i < argsCount; i++) {
free(cAttributes[i]);
free(cValues[i]);
}
free(cAttributes);
free(cValues);
ASSERT(!eventHandler);
ASSERT(!_eventHandler);
if (timers) {
deleteAllValues(*timers);
......@@ -1516,16 +1490,6 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (void)dealloc
{
ASSERT(!isStarted);
[sourceURL release];
[_error release];
[pluginPackage release];
[MIMEType release];
[baseURL release];
[pendingFrameLoads release];
[element release];
ASSERT(!plugin);
[self fini];
......@@ -1822,9 +1786,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (void)pluginView:(NSView *)pluginView receivedError:(NSError *)error
{
ASSERT(_loadManually);
[error retain];
[_error release];
_error = error;
if (![self isStarted]) {
......@@ -2010,7 +1972,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
ASSERT(string); // All strings should be representable in ISO Latin 1
NSString *URLString = [(NSString *)string _web_stringByStrippingReturnCharacters];
NSURL *URL = [NSURL _web_URLWithDataAsString:URLString relativeToURL:baseURL];
NSURL *URL = [NSURL _web_URLWithDataAsString:URLString relativeToURL:_baseURL.get()];
CFRelease(string);
if (!URL)
return nil;
......@@ -2074,7 +2036,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
{
ASSERT(isStarted);
WebPluginRequest *pluginRequest = [pendingFrameLoads objectForKey:webFrame];
WebPluginRequest *pluginRequest = [_pendingFrameLoads.get() objectForKey:webFrame];
ASSERT(pluginRequest != nil);