Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Issue 1274973002: Don't send the redirected request once the request was fallbacked to the network. (Closed)

Created:
5 years, 4 months ago by horo
Modified:
5 years, 4 months ago
Reviewers:
falken, michaeln, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Don't send the redirected request once the request was fallbacked to the network. According to the fetch spec (https://fetch.spec.whatwg.org/), once the request goes to the network, skip-service-worker flag must be set. So if the server returns a redirect response, the next request must not be handled by service worker. BUG=517364, 512764 Committed: https://crrev.com/eeff087680dd4fc41c1a2f92fffdc96546053b74 Cr-Commit-Position: refs/heads/master@{#342386}

Patch Set 1 #

Patch Set 2 : place parentheses around the '&&' expression #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -4 lines) Patch
M content/browser/service_worker/service_worker_controllee_request_handler.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_controllee_request_handler.cc View 1 2 chunks +6 lines, -3 lines 4 comments Download
M content/child/web_url_loader_impl.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 19 (6 generated)
horo
falken@ Could you please review?
5 years, 4 months ago (2015-08-06 08:04:14 UTC) #2
falken
On 2015/08/06 08:04:14, horo wrote: > falken@ > Could you please review? looks good... can ...
5 years, 4 months ago (2015-08-07 04:38:11 UTC) #3
horo
On 2015/08/07 04:38:11, falken wrote: > On 2015/08/06 08:04:14, horo wrote: > > falken@ > ...
5 years, 4 months ago (2015-08-07 05:00:03 UTC) #4
falken
On 2015/08/07 05:00:03, horo wrote: > On 2015/08/07 04:38:11, falken wrote: > > On 2015/08/06 ...
5 years, 4 months ago (2015-08-07 05:04:05 UTC) #5
horo
jam@ Could you please review content/child/web_url_loader_impl.cc?
5 years, 4 months ago (2015-08-07 05:38:58 UTC) #7
jam
lgtm
5 years, 4 months ago (2015-08-07 15:03:46 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1274973002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1274973002/20001
5 years, 4 months ago (2015-08-07 15:07:24 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/90448)
5 years, 4 months ago (2015-08-07 17:02:04 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1274973002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1274973002/20001
5 years, 4 months ago (2015-08-07 17:42:24 UTC) #14
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 4 months ago (2015-08-07 18:23:24 UTC) #15
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/eeff087680dd4fc41c1a2f92fffdc96546053b74 Cr-Commit-Position: refs/heads/master@{#342386}
5 years, 4 months ago (2015-08-07 18:24:16 UTC) #16
michaeln
https://codereview.chromium.org/1274973002/diff/20001/content/browser/service_worker/service_worker_controllee_request_handler.cc File content/browser/service_worker/service_worker_controllee_request_handler.cc (right): https://codereview.chromium.org/1274973002/diff/20001/content/browser/service_worker/service_worker_controllee_request_handler.cc#newcode90 content/browser/service_worker/service_worker_controllee_request_handler.cc:90: // must be set and the request shoud not ...
5 years, 4 months ago (2015-08-07 19:40:23 UTC) #18
horo
5 years, 4 months ago (2015-08-08 09:00:45 UTC) #19
Message was sent while issue was closed.
Thank you for pointing it out.
I created a CL to fix the bug.
https://codereview.chromium.org/1280133002/

https://codereview.chromium.org/1274973002/diff/20001/content/browser/service...
File content/browser/service_worker/service_worker_controllee_request_handler.cc
(right):

https://codereview.chromium.org/1274973002/diff/20001/content/browser/service...
content/browser/service_worker/service_worker_controllee_request_handler.cc:90:
// must be set and the request shoud not go to the service worker.
On 2015/08/07 19:40:23, michaeln wrote:
> Whoa, this can't be right?
> 
> User clicks link to bitly url (or googlesearch result link) which redirects to
a
> serviceworker enabled site for the actual/final location.
> 
> Desired result: The registered serviceworker handles the request for the final
> location and does the right thing.
> 
> Actual result produced by this CL: The request for the final location skips
the
> registered serviceworker because... reasons.
> 
> That actual result has got to be a BUG?
> 
> 
> I havent' been following the gory details of how redirection and
serviceworkers
> fold/collide together, but the inability to redirect from the network into a
> serviceworker controlled urlspace seems like it could be a source of great
> confusion and frustration?
> 
> Maybe I'm missing something?

Yes you are right!

Navigation request's redirect mode is "manual".
https://github.com/whatwg/fetch/issues/101#issuecomment-128269549
So, we should not set |skip_service_worker_| for main resource loads.

https://codereview.chromium.org/1274973002/diff/20001/content/browser/service...
content/browser/service_worker/service_worker_controllee_request_handler.cc:111:
if (job_->ShouldFallbackToNetwork()) {
On 2015/08/07 19:40:23, michaeln wrote:
> Also, is the difference in behavior for this fallback case intentional?

No. We should also set here.

If the original request's domain (ex: bitly) doesn't have registered SW,
|skip_service_worker_| wasn't set.
So I didn't notice the bug.

Powered by Google App Engine
This is Rietveld 408576698