|
|
Created:
9 years, 2 months ago by mkosiba (inactive) Modified:
9 years, 1 month ago CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, dpranke+watch-content_chromium.org, Steve Block Visibility:
Public. |
DescriptionReturn a specific error code for unknown URL schemes.
The ERR_ABORTED error code is very general and for this particular case
we already have a corresponding net:: error case.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=104712
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=110287
Patch Set 1 #Patch Set 2 : Added unit test. #
Total comments: 2
Patch Set 3 : rebase #
Messages
Total messages: 18 (0 generated)
Code LGTM. Do you have a bug you can reference in the commit message, perhaps an indication of how to test it for the QA folks?
1) why send it to multiple reviewers? patches should only be sent to one reviewer in general, otherwise multiple people are spending time reviewing a patch unnecessarily 2) I'm not familiar enough with this code, better to send it to someone who works on networking code. I'd suggest either willchan/eroman/wtc
On 2011/10/03 17:15:23, John Abd-El-Malek wrote: > 1) why send it to multiple reviewers? patches should only be sent to one > reviewer in general, otherwise multiple people are spending time reviewing a > patch unnecessarily > 2) I'm not familiar enough with this code, better to send it to someone who > works on networking code. I'd suggest either willchan/eroman/wtc Looks like I included you by accident, probably because of 7e88fc14. Sorry about that.
On 2011/10/03 17:13:57, Avi wrote: > Code LGTM. Do you have a bug you can reference in the commit message, perhaps an > indication of how to test it for the QA folks? I don't have a bug number for this. Do you want me to file one? I'll add a unit test but as far as testing nothing except for "check if foo://bar redirects to search" comes to mind.
I don't know when ResourceDispatcherHost::HandleExternalProtocol is called, so my review is not authoritative. But the patch looks correct to me.
I added a unit test to verify the change. Thanks! Martin
http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... File content/browser/renderer_host/resource_dispatcher_host_unittest.cc (right): http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... content/browser/renderer_host/resource_dispatcher_host_unittest.cc:1232: MakeTestRequest(0, 1, GURL("foo://bar")); mkosiba: I don't understand why the network stack does not return the net::ERR_UNKNOWN_URL_SCHEME error for this URL. Can you set breakpoints on the two return statements in URLRequestJobManager::CreateJob() in net/url_request/url_request_job_manager.cc, and see if the breakpoints are hit when you run this unit test? if (job_factory) { if (!job_factory->IsHandledProtocol(scheme)) { return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME); } } else if (!SupportsScheme(scheme)) { return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME); } Thank you.
http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... File content/browser/renderer_host/resource_dispatcher_host_unittest.cc (right): http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... content/browser/renderer_host/resource_dispatcher_host_unittest.cc:1232: MakeTestRequest(0, 1, GURL("foo://bar")); I did the experiment in gdb. I found that net::URLRequestJobManager::CreateJob() is not called at all. Looking at ResourceDispatcherHost::BeginRequest(), I think this is because we don't create a net::URLRequest object in this case.
On 2011/10/04 21:34:55, wtc wrote: > http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... > File content/browser/renderer_host/resource_dispatcher_host_unittest.cc (right): > > http://codereview.chromium.org/8117003/diff/1002/content/browser/renderer_hos... > content/browser/renderer_host/resource_dispatcher_host_unittest.cc:1232: > MakeTestRequest(0, 1, GURL("foo://bar")); > I did the experiment in gdb. I found that > net::URLRequestJobManager::CreateJob() is not called at all. > Looking at ResourceDispatcherHost::BeginRequest(), I think > this is because we don't create a net::URLRequest object in > this case. This is what I've found as well. Does this mean that the correct fix is to use net::URLRequest, or is my change OK?
willchan: please review this CL. I also have a question for you at the end of this comment. On 2011/10/05 10:13:49, Martin Kosiba wrote: > > This is what I've found as well. Does this mean that the correct fix is to use > net::URLRequest, or is my change OK? mkosiba: Your change seems OK to me. Unfortunately I don't know the ResourceDispatcherHost code very well, even though I work on the network stack. The experiments done by you and me showed that ResourceDispatcherHost and the network stack (represented by the net::URLRequest class) each have a list of URL schemes it can handle. So what we discovered seems like a duplication of effort, which is not necessarily a bug. svn blame shows that willchan seems to know the job_factory.IsHandledURL() related code in ResourceDispatcherHost well. Perhaps he can shed some light on why ResourceDispatcherHost doesn't just rely on net::URLRequestJobManager::CreateJob() to detect unknown URL schemes.
On 2011/10/05 22:59:23, wtc wrote: > willchan: please review this CL. I also have a question for you at > the end of this comment. > > On 2011/10/05 10:13:49, Martin Kosiba wrote: > > > > This is what I've found as well. Does this mean that the correct fix is to use > > net::URLRequest, or is my change OK? > > mkosiba: Your change seems OK to me. Unfortunately I don't know > the ResourceDispatcherHost code very well, even though I work on > the network stack. > > The experiments done by you and me showed that > ResourceDispatcherHost and the network stack (represented by > the net::URLRequest class) each have a list of URL schemes it > can handle. So what we discovered seems like a duplication of > effort, which is not necessarily a bug. > > svn blame shows that willchan seems to know the > job_factory.IsHandledURL() related code in ResourceDispatcherHost > well. Perhaps he can shed some light on why ResourceDispatcherHost > doesn't just rely on net::URLRequestJobManager::CreateJob() to detect > unknown URL schemes. Because of features like https://developer.mozilla.org/En/DOM/Window.navigator.registerProtocolHandler that allow for registering new schemes on a per-profile basis. net::URLRequestJobManager is not profile-context aware, it needs to delegate to a URLRequestContext specific object like URLRequestJobFactory which is intended to subsume URLRequestJobManager.
willchan: thanks for answering my question. Could you take a quick look at this CL and see if it makes sense?
lgtm
CQ is trying the patch. Follow status at https://chromium-status.appspot.com/cq/mkosiba@chromium.org/8117003/1002
Change committed as 104712
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mkosiba@chromium.org/8117003/19001
Change committed as 110287 |