Re: knowing when WebView is done
Re: knowing when WebView is done
- Subject: Re: knowing when WebView is done
- From: Rush Manbert <email@hidden>
- Date: Fri, 6 Jun 2008 10:39:04 -0700
Darn, I thought I had a code example in my library, but I must have
decided that I really didn't need to know when the load completed,
because I don't have anything implemented.
I did take a look at the "Loading Resources" chapter of the "Web Kit
Objective-C Programming Guide" to try and remember what I thought I
would do. I don't know if this is helpful, but here it is.
When I receive webView:didStartProvisionalLoadForFrame:, set my
outstanding resource count to zero.
Every time I receive
webView:resource:didReceiveResponse:fromDataSource:, increment my
outstanding resource count.
Every time I receive webView:resource:didFinishLoadingFromDataSource:
or webView:resource:didFailLoadingWithError:fromDataSource:,
decrement my outstanding resource count.
Theoretically, when my outstanding resource count goes to zero during
the load, the page load is complete. But it always seemed to me that
there would be race conditions in this, and there might be a time
during a page load when the count would temporarily go to zero before
a new resource starts loading. I also don't know what the sequence
would be like for a page that had separate frames. Would I see
webView:didStartProvisionalLoadForFrame: for each frame in the page?
Maybe that's why I punted on it.
Sorry that I can't be of more help.
- Rush
On Jun 5, 2008, at 7:03 PM, Timothy Ritchey wrote:
Here is a typical trace for a failing load for me ("main" is the
name I've given to the frame):
2008-06-05 21:56:40.539 Vigil[43952:10b] didCommitLoadForFrame: main
2008-06-05 21:56:40.546 Vigil[43952:10b] didReceiveTitle: main
2008-06-05 21:56:40.598 Vigil[43952:10b] didReceiveIcon: main
2008-06-05 21:56:41.622 Vigil[43952:10b] didCommitLoadForFrame: <!--
framePath /main/<!--frame0-->-->
2008-06-05 21:56:41.623 Vigil[43952:10b] didReceiveTitle: <!--
framePath /main/<!--frame0-->-->
2008-06-05 21:56:41.720 Vigil[43952:10b] didFinishLoadForFrame: <!--
framePath /main/<!--frame0-->-->
2008-06-05 21:56:41.721 Vigil[43952:10b] didFinishLoadForFrame: main
2008-06-05 21:56:41.851 Vigil[43952:10b]
WebViewProgressFinishedNotification
2008-06-05 21:56:41.855 Vigil[43952:10b] didReceiveTitle: main
even if I track frame commit/finish load as suggested in the thread,
if I try to get rid of the webview, the world falls down around me
when it can't push out that last delegate call of didReceiveTitle. I
tried even counting title/icon, etc. and that didn't even help (you
can see there are two calls to the title delegate, both for the main
frame. There just doesn't appear to be a deterministic way to figure
out when WebView is actually done, and safe to release.
On Jun 5, 2008, at 8:24 PM, Rush Manbert wrote:
On Jun 5, 2008, at 3:23 PM, Mark Bateman wrote:
Tim,
I use the webviewdidfinishload method I'm not usre if that is any
use to you...I'm quite new so I hope I'm not missing something
obvious in your message.
See this thread:
http://lists.apple.com/archives/webkitsdk-dev/2005/Dec/msg00047.html
-Rush
_______________________________________________
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