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

Issue 632213002: Fetcher: Disable memory caching when Service Worker handles a request (Closed)

Created:
6 years, 2 months ago by nhiroki
Modified:
6 years, 2 months ago
CC:
blink-reviews, Nate Chapin, gavinp+loader_chromium.org, dominicc (has gone to gerrit), kouhei (in TOK), horo
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Fetcher: Disable memory caching when Service Worker handles a request MemoryCache can cache 1 resouce for 1 URL, but ServiceWorker can serve arbitrary resources for 1 URL and pollute a memory cache entry. As a stopgap solution, this change removes a cached resouce to be controlled by Service Worker before requesting. BUG=388375 TEST=manual (access a same resource from controlled/non-controlled documents on a same tab) TEST=run_webkit_tests.py http/tests/serviceworker/chromium/memory-cache.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183534

Patch Set 1 : #

Patch Set 2 : #

Total comments: 3

Patch Set 3 : rebase #

Patch Set 4 : add layout test #

Patch Set 5 : fix test crash #

Total comments: 8

Patch Set 6 : rebase #

Patch Set 7 : tweak test #

Total comments: 4

Patch Set 8 : s/getJSON/getJSONP #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -0 lines) Patch
A LayoutTests/http/tests/serviceworker/chromium/memory-cache.html View 1 2 3 4 5 6 7 1 chunk +59 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/chromium/resources/memory-cache.jsonp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/chromium/resources/memory-cache-controlled.html View 1 2 3 4 5 6 7 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/chromium/resources/memory-cache-worker.js View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download
M Source/core/fetch/ResourceFetcher.cpp View 1 2 3 4 5 2 chunks +16 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (10 generated)
nhiroki
Hi dominicc@ and michaeln@, (This is JFYI and you don't have to review this for ...
6 years, 2 months ago (2014-10-07 06:00:35 UTC) #2
nhiroki
On 2014/10/07 06:00:35, nhiroki wrote: > Let me share a workaround patch for the memory ...
6 years, 2 months ago (2014-10-08 13:50:49 UTC) #3
nhiroki
Hi Nate, could you review this? This is my first patch for this area, so ...
6 years, 2 months ago (2014-10-08 14:30:29 UTC) #7
nhiroki
+michaeln@ and gavinp@ for review from Service Worker POV.
6 years, 2 months ago (2014-10-08 14:33:52 UTC) #9
Nate Chapin
LGTM, I guess. I'm not thrilled with having ServiceWorker special cases down here, but I ...
6 years, 2 months ago (2014-10-08 17:04:05 UTC) #10
michaeln
Looks like this ensures pages using a sw will in fact get the requests handled ...
6 years, 2 months ago (2014-10-09 00:35:26 UTC) #11
nhiroki
Thank you for reviewing! On 2014/10/09 00:35:26, michaeln wrote: > Looks like this ensures pages ...
6 years, 2 months ago (2014-10-09 02:34:15 UTC) #12
dominicc (has gone to gerrit)
I support this change. https://codereview.chromium.org/632213002/diff/80001/Source/core/fetch/ResourceFetcher.cpp File Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/632213002/diff/80001/Source/core/fetch/ResourceFetcher.cpp#newcode773 Source/core/fetch/ResourceFetcher.cpp:773: if (frame() && frame()->loader().client()->isControlledByServiceWorker()) { ...
6 years, 2 months ago (2014-10-09 02:45:24 UTC) #14
nhiroki
Added layout test instead of ResourceFetcherTest because apparently the unittest can only test pre-filled resources ...
6 years, 2 months ago (2014-10-09 14:44:29 UTC) #16
jsbell
I also support this change. :) Just a couple drive-by notes on the test. Also, ...
6 years, 2 months ago (2014-10-09 16:47:51 UTC) #18
Nate Chapin
https://codereview.chromium.org/632213002/diff/140001/Source/core/fetch/ResourceFetcher.cpp File Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/632213002/diff/140001/Source/core/fetch/ResourceFetcher.cpp#newcode782 Source/core/fetch/ResourceFetcher.cpp:782: memoryCache()->remove(resource.get()); Re: "(*) I'm not sure we can fetch ...
6 years, 2 months ago (2014-10-09 17:56:22 UTC) #19
michaeln
> > Does this prevent a serviceworker from poisoning the cache with a value that ...
6 years, 2 months ago (2014-10-09 19:47:14 UTC) #20
jsbell
On 2014/10/09 16:47:51, jsbell wrote: > Also, @gavinp's at an offsite, so he's unlikely to ...
6 years, 2 months ago (2014-10-09 23:24:59 UTC) #21
horo
https://codereview.chromium.org/632213002/diff/140001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html File LayoutTests/http/tests/serviceworker/chromium/memory-cache.html (right): https://codereview.chromium.org/632213002/diff/140001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html#newcode8 LayoutTests/http/tests/serviceworker/chromium/memory-cache.html:8: var callback; Please write comments about |callback|. "This callback ...
6 years, 2 months ago (2014-10-10 02:25:13 UTC) #22
nhiroki
Thank you, guys! Updated. https://codereview.chromium.org/632213002/diff/140001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html File LayoutTests/http/tests/serviceworker/chromium/memory-cache.html (right): https://codereview.chromium.org/632213002/diff/140001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html#newcode8 LayoutTests/http/tests/serviceworker/chromium/memory-cache.html:8: var callback; On 2014/10/10 02:25:12, ...
6 years, 2 months ago (2014-10-10 06:20:37 UTC) #24
horo
lgtm with nit https://codereview.chromium.org/632213002/diff/310001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html File LayoutTests/http/tests/serviceworker/chromium/memory-cache.html (right): https://codereview.chromium.org/632213002/diff/310001/LayoutTests/http/tests/serviceworker/chromium/memory-cache.html#newcode10 LayoutTests/http/tests/serviceworker/chromium/memory-cache.html:10: function getJSON(url) { nit: getJSONP is ...
6 years, 2 months ago (2014-10-10 06:27:39 UTC) #25
nhiroki
Thanks! I'll push this into the CQ. Please let me know if there is anything ...
6 years, 2 months ago (2014-10-10 07:33:13 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/632213002/520001
6 years, 2 months ago (2014-10-10 07:34:06 UTC) #28
commit-bot: I haz the power
6 years, 2 months ago (2014-10-10 11:11:58 UTC) #29
Message was sent while issue was closed.
Committed patchset #8 (id:520001) as 183534

Powered by Google App Engine
This is Rietveld 408576698