|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
How to cancel a resource requestHi,
In my WebKit port (based on the GTK port) I would like to cancel a resource request depending on the resource length or its MIME type. I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my WebCore::FrameLoaderClient implementation could be a good place for such action as I can retrieve the length and the MIME type from the ResourceResponse argument there. However I did not find the way how to cancel the request. Any help would be appreciated. Thanks, -- Jarda http://jagpdf.org _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requesthi,
ResourceLoader has a cancel api. so i think you can do the following add addtl parameter to dispatchDidReceiveResponse to indicate if you should cancel the resp and do a loader->cancel() based on that. Thanks, Zaheer On Thu, Oct 22, 2009 at 1:48 PM, Jaroslav Gresula <jgresula.LEAVE-THIS-OUT@...> wrote: Hi, _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestOn Thu, Oct 22, 2009 at 11:18 AM, Jaroslav Gresula
<jgresula.LEAVE-THIS-OUT@...> wrote: > Hi, > > In my WebKit port (based on the GTK port) I would like to cancel a > resource request depending on the resource length or its MIME type. > > I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my > WebCore::FrameLoaderClient implementation could be a good place for such > action as I can retrieve the length and the MIME type from the > ResourceResponse argument there. However I did not find the way how to > cancel the request. > > Any help would be appreciated. in dispatchWillSendRequest you can modify the URI of the resource that's about to be requested. If you set it to, say, "about:blank", nothing will be requested. This is what the GTK+ port does, through a signal emission, to let clients implement things like adblock. Xan > > Thanks, > -- > Jarda > http://jagpdf.org > > _______________________________________________ > webkit-dev mailing list > webkit-dev@... > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestzaheer ahmad wrote:
> hi, > ResourceLoader has a cancel api. so i think you can do the following > add addtl parameter to dispatchDidReceiveResponse to indicate if you should > cancel the resp > and do a loader->cancel() based on that. I don't like the idea of modifying FrameLoaderClient since it is a standard WebKit interface. My idea was that it could be somehow done just from within my FrameLoaderClient implementation (without altering WebKit code). Thanks anyway, -- Jarda http://jagpdf.org _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestXan Lopez wrote:
> On Thu, Oct 22, 2009 at 11:18 AM, Jaroslav Gresula > <jgresula.LEAVE-THIS-OUT@...> wrote: >> Hi, >> >> In my WebKit port (based on the GTK port) I would like to cancel a >> resource request depending on the resource length or its MIME type. >> >> I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my >> WebCore::FrameLoaderClient implementation could be a good place for such >> action as I can retrieve the length and the MIME type from the >> ResourceResponse argument there. However I did not find the way how to >> cancel the request. >> >> Any help would be appreciated. > > in dispatchWillSendRequest you can modify the URI of the resource > that's about to be requested. If you set it to, say, "about:blank", > nothing will be requested. This is what the GTK+ port does, through a > signal emission, to let clients implement things like adblock. > That's a nice trick but is the resource MIME type and its length known at this point? My understanding is that this information is not available until dispatchDidReceiveResponse(). Thanks, -- Jarda http://jagpdf.org _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestOn Fri, Oct 23, 2009 at 5:05 PM, Jaroslav Gresula
<jgresula.LEAVE-THIS-OUT@...> wrote: > Xan Lopez wrote: >> On Thu, Oct 22, 2009 at 11:18 AM, Jaroslav Gresula >> <jgresula.LEAVE-THIS-OUT@...> wrote: >>> Hi, >>> >>> In my WebKit port (based on the GTK port) I would like to cancel a >>> resource request depending on the resource length or its MIME type. >>> >>> I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my >>> WebCore::FrameLoaderClient implementation could be a good place for such >>> action as I can retrieve the length and the MIME type from the >>> ResourceResponse argument there. However I did not find the way how to >>> cancel the request. >>> >>> Any help would be appreciated. >> >> in dispatchWillSendRequest you can modify the URI of the resource >> that's about to be requested. If you set it to, say, "about:blank", >> nothing will be requested. This is what the GTK+ port does, through a >> signal emission, to let clients implement things like adblock. >> > > That's a nice trick but is the resource MIME type and its length known > at this point? My understanding is that this information is not > available until dispatchDidReceiveResponse(). Well, no, but since you were asking how to cancel the request I assumed you wanted to do it before it was done, not after... If you want to do things based on the MIME type of the resource see dispatchDecidePolicyForMIMEType, which also carries the ResourceRequest. Xan > > Thanks, > -- > Jarda > http://jagpdf.org > > > _______________________________________________ > webkit-dev mailing list > webkit-dev@... > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestXan Lopez wrote:
> On Fri, Oct 23, 2009 at 5:05 PM, Jaroslav Gresula > <jgresula.LEAVE-THIS-OUT@...> wrote: >> Xan Lopez wrote: >>> On Thu, Oct 22, 2009 at 11:18 AM, Jaroslav Gresula >>> <jgresula.LEAVE-THIS-OUT@...> wrote: >>>> Hi, >>>> >>>> In my WebKit port (based on the GTK port) I would like to cancel a >>>> resource request depending on the resource length or its MIME type. >>>> >>>> I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my >>>> WebCore::FrameLoaderClient implementation could be a good place for such >>>> action as I can retrieve the length and the MIME type from the >>>> ResourceResponse argument there. However I did not find the way how to >>>> cancel the request. >>>> >>>> Any help would be appreciated. >>> >>> in dispatchWillSendRequest you can modify the URI of the resource >>> that's about to be requested. If you set it to, say, "about:blank", >>> nothing will be requested. This is what the GTK+ port does, through a >>> signal emission, to let clients implement things like adblock. >>> >> >> That's a nice trick but is the resource MIME type and its length known >> at this point? My understanding is that this information is not >> available until dispatchDidReceiveResponse(). > > Well, no, but since you were asking how to cancel the request I > assumed you wanted to do it before it was done, not after... If you > want to do things based on the MIME type of the resource see > dispatchDecidePolicyForMIMEType, which also carries the > ResourceRequest. Ok, let me rephrase my question: what I need is to cancel an ongoing (sub)resource request once its length and MIME type are known. This way I could avoid retrieving of resources whose length exceeds certain limit or whose MIME type can't be handled by my port. I've already looked at dispatchDecidePolicyForMIMEType() and it seemed to me that it is invoked only for the main resource but not for sub-resources (i.e. images) - I will look into it closer. Thanks, -- Jarda http://jagpdf.org _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: How to cancel a resource requestOn Fri, Oct 23, 2009 at 5:37 PM, Jaroslav Gresula
<jgresula.LEAVE-THIS-OUT@...> wrote: > Xan Lopez wrote: >> On Fri, Oct 23, 2009 at 5:05 PM, Jaroslav Gresula >> <jgresula.LEAVE-THIS-OUT@...> wrote: >>> Xan Lopez wrote: >>>> On Thu, Oct 22, 2009 at 11:18 AM, Jaroslav Gresula >>>> <jgresula.LEAVE-THIS-OUT@...> wrote: >>>>> Hi, >>>>> >>>>> In my WebKit port (based on the GTK port) I would like to cancel a >>>>> resource request depending on the resource length or its MIME type. >>>>> >>>>> I thought, dispatchDidReceiveResponse(DocumentLoader*, ...) in my >>>>> WebCore::FrameLoaderClient implementation could be a good place for such >>>>> action as I can retrieve the length and the MIME type from the >>>>> ResourceResponse argument there. However I did not find the way how to >>>>> cancel the request. >>>>> >>>>> Any help would be appreciated. >>>> >>>> in dispatchWillSendRequest you can modify the URI of the resource >>>> that's about to be requested. If you set it to, say, "about:blank", >>>> nothing will be requested. This is what the GTK+ port does, through a >>>> signal emission, to let clients implement things like adblock. >>>> >>> >>> That's a nice trick but is the resource MIME type and its length known >>> at this point? My understanding is that this information is not >>> available until dispatchDidReceiveResponse(). >> >> Well, no, but since you were asking how to cancel the request I >> assumed you wanted to do it before it was done, not after... If you >> want to do things based on the MIME type of the resource see >> dispatchDecidePolicyForMIMEType, which also carries the >> ResourceRequest. > > Ok, let me rephrase my question: what I need is to cancel an ongoing > (sub)resource request once its length and MIME type are known. This way > I could avoid retrieving of resources whose length exceeds certain limit > or whose MIME type can't be handled by my port. > > I've already looked at dispatchDecidePolicyForMIMEType() and it seemed > to me that it is invoked only for the main resource but not for > sub-resources (i.e. images) - I will look into it closer. Ah, you are right, I think it's only emitted for the main resource and any frame in the page maybe. So yeah, other than suggesting the method you already mentioned and the other resource-specific functions in FrameLoaderClient nothing to add :) Xan > > Thanks, > -- > Jarda > http://jagpdf.org > > _______________________________________________ > webkit-dev mailing list > webkit-dev@... > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
| Free embeddable forum powered by Nabble | Forum Help |