WebKit/WebResourceLoadDelegate problem
WebKit/WebResourceLoadDelegate problem
- Subject: WebKit/WebResourceLoadDelegate problem
- From: Leon McNeill <email@hidden>
- Date: Wed, 9 Jul 2003 16:13:26 +0100
Alright, I have had no problems getting the one-line-of-code browser
working, but as I explore the various delegates, I have run into a
problem using the WebResourceLoadDelegate system to track resources as
they load. I'm getting all of my delegate methods called fine, but
they're being handed the same WebDataSource for *every* resource WebKit
loads. Long-winded analysis below:
Load a simple web page with [[theWebView mainFrame]
loadRequest:theRequest], no problem -- www.google.com is nice, since it
consists of #1) a single HTML page and #2) a single image.
I have implemented identifierForInitialRequest: to return serially
numbered NSNumbers. No problem, any further delegate messages I
receive do definitely bear these identifiers properly.
For resource #1 (
http://www.google.com/), I then get sent
didReceiveResponse, didReceiveContentLength (3359), and
didFinishLoadingFromDataSource. Everything's peachy, as examining the
data source referred to by the didFinish... message indicates a MIME
type of 'text/html', with a data length of 3359. Excellent.
Here's where things go south. I start getting messages for resource #2
(
http://www.google.com/images/logo.gif). didReceiveResponse is called
for #2 with the same WebDataSource object as used by #1! Fine, I
think, maybe it's re-using the data source object. Everything's
otherwise fine, as the MIMEType of the NSURLResponse is proper
(image/gif), and I do then get didReceiveContentLength (8858), a
different size than the previous resource.
Finally, I get didFinishLoadingFromDataSource for #2. Examining the
data source referred to by the message (once again, the same data
source object used by #1) gives me 'text/html', 3359 bytes -- #1's
data. The WebView shows everything fine.
This is happening in a mini-project used solely for this test, so I
can't imagine that I'm doing anything unusual that should make this
happen. After all, all of these delegate methods return void except
identifierForInitialRequest. Trying it with a real site like Apple
gets the same results, but 43 of them instead of 2. Are WebKit
delegate messages broken, or am I?
--
Leon McNeill
Softchaos, Ltd.
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.