Webkit plug-in help
Webkit plug-in help
- Subject: Webkit plug-in help
- From: Matt Mashyna <email@hidden>
- Date: Mon, 23 Jun 2008 12:45:37 -0400
I'm sorry for posting this here but posting to the webkit list is like
putting a message in a bottle. Maybe someone here will be able to
offer a clue.
I'm struggling with a plug-in. I looked at the example plug-ins like
the movie player. The movie player looks at the source url and uses it
as a source for the movie. That works fine in simple situations. I'm
dealing with a situation where there is some redirection of a POST
before my mime type is delivered to my plug-in. I can't use the movie
player example because I can't re-post the request -- or I can't get
it to work properly.
So I looked at what is available to me. When the POST happens,
Safari's window empties and I see the url that I ultimately want to
get in the address bar. I am seeing the plug-in start. I use the
container property to get a pointer to the frame and I see the data it
has loaded. I see the data I expect but it is not complete. The frame
doesn't seem to complete loading the resource. In webPlugInStart I
start a thread to wait until I think the resource load is finished,
get it and then log it to the console. In every case the data is
truncated to about 1400 bytes.
I can't seem to force it to finish loading. What can I do to get all
the data I should be getting ?
Here's my data slurping method:
- (void)waitUntilDownloadIsFinished
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
id container = [_arguments objectForKey: WebPlugInContainerKey];
WebFrame* frame = [container webFrame];
while([frame provisionalDataSource]) // if it's provisional then I
need to wait
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
WebDataSource* source = [frame dataSource];
while([source isLoading]) // if it's not done loading then I need to
wait
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
NSData* data = [source data];
NSString* xmlStuff = [[NSString alloc] initWithData:data
encoding:NSMacOSRomanStringEncoding];
NSLog(xmlStuff);
[xmlStuff release];
[pool release];
} // waitUntilDownloadIsFinished
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden