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

Issue 2602853002: Eliminate network fallback from ServiceWorkerContextRequestHandler. (Closed)

Created:
3 years, 11 months ago by falken
Modified:
3 years, 11 months ago
Reviewers:
asanka, horo
CC:
blink-worker-reviews_chromium.org, cbentzel+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, eroman, horo+watch_chromium.org, jam, jsbell+serviceworker_chromium.org, kinuko+watch, kinuko+serviceworker, michaeln, mmenke, nhiroki, serviceworker-reviews, shimazu+serviceworker_chromium.org, tzik
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Eliminate network fallback from ServiceWorkerContextRequestHandler. ServiceWorkerContextRequestHandler should emit a network error instead of falling back to network when it cannot handle a request. Otherwise, a service worker can be spawned that did not load via our custom ServiceWorkerWriteToCacheJob/ServiceWorkerReadFromCacheJob jobs, resulting in a running worker whose ServiceWorkerVersion has not been properly initialized. I suspect this can cause the bug 485900. This patch: - Changes network fallback for failure cases to an ERR_FAILED network error. - As an exception, an installed worker loading an unstored script still results in network fallback. This should be deprecated and removed eventually, see https://github.com/w3c/ServiceWorker/issues/1021. - Changes the behavior for a new worker loading an already stored script (i.e., calling importScripts() for the same script multiple times). Before this patch, we would fallback to network for this script. Now, we read the stored script. This is not yet codified in the spec but is expected to have almost no real-world impact and has support on https://github.com/w3c/ServiceWorker/issues/1041 BUG=485900, 678899 Review-Url: https://codereview.chromium.org/2602853002 Cr-Commit-Position: refs/heads/master@{#442590} Committed: https://chromium.googlesource.com/chromium/src/+/815dc48c9d00b0142a2421de8f10b7cb9c5b34ab

Patch Set 1 #

Patch Set 2 : rm notreached #

Patch Set 3 : add rtsets #

Patch Set 4 : more test #

Patch Set 5 : rm redundant tests #

Patch Set 6 : ok #

Total comments: 25

Patch Set 7 : rebase #

Patch Set 8 : review comments #

Patch Set 9 : typos #

Total comments: 2

Patch Set 10 : rm class #

Unified diffs Side-by-side diffs Delta from patch set Stats (+390 lines, -160 lines) Patch
M content/browser/service_worker/service_worker_browsertest.cc View 1 2 3 4 5 6 10 chunks +15 lines, -29 lines 0 comments Download
M content/browser/service_worker/service_worker_context_request_handler.h View 1 2 3 4 2 chunks +19 lines, -18 lines 0 comments Download
M content/browser/service_worker/service_worker_context_request_handler.cc View 1 2 3 4 5 6 7 2 chunks +169 lines, -89 lines 0 comments Download
M content/browser/service_worker/service_worker_context_request_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 12 chunks +67 lines, -14 lines 0 comments Download
M content/browser/service_worker/service_worker_metrics.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_provider_host.h View 1 2 3 4 5 6 2 chunks +1 line, -10 lines 0 comments Download
M content/browser/service_worker/service_worker_read_from_cache_job.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_script_cache_map.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M net/log/net_log_event_type_list.h View 1 2 3 4 5 6 7 1 chunk +7 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/importScripts.html View 1 2 3 4 5 6 7 1 chunk +52 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/duplicate-import-worker.js View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/echo.php View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/get-version.php View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/import-scripts-worker.js View 1 2 3 4 5 6 7 8 1 chunk +26 lines, -0 lines 0 comments Download

Messages

Total messages: 38 (28 generated)
falken
horo: Can you review this?
3 years, 11 months ago (2017-01-06 07:44:48 UTC) #14
falken
https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc File content/browser/service_worker/service_worker_browsertest.cc (left): https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc#oldcode2563 content/browser/service_worker/service_worker_browsertest.cc:2563: ASSERT_EQ(SERVICE_WORKER_OK, status); Forgot to mention something. I didn't understand ...
3 years, 11 months ago (2017-01-06 08:31:40 UTC) #16
horo
https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc File content/browser/service_worker/service_worker_browsertest.cc (left): https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc#oldcode2563 content/browser/service_worker/service_worker_browsertest.cc:2563: ASSERT_EQ(SERVICE_WORKER_OK, status); On 2017/01/06 08:31:40, falken wrote: > Forgot ...
3 years, 11 months ago (2017-01-10 07:09:27 UTC) #19
falken
Thanks. PTAL. https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc File content/browser/service_worker/service_worker_browsertest.cc (left): https://codereview.chromium.org/2602853002/diff/100001/content/browser/service_worker/service_worker_browsertest.cc#oldcode2563 content/browser/service_worker/service_worker_browsertest.cc:2563: ASSERT_EQ(SERVICE_WORKER_OK, status); On 2017/01/10 07:09:27, horo wrote: ...
3 years, 11 months ago (2017-01-10 08:17:46 UTC) #20
horo
lgtm with a nit. https://codereview.chromium.org/2602853002/diff/160001/content/browser/service_worker/service_worker_context_request_handler_unittest.cc File content/browser/service_worker/service_worker_context_request_handler_unittest.cc (right): https://codereview.chromium.org/2602853002/diff/160001/content/browser/service_worker/service_worker_context_request_handler_unittest.cc#newcode39 content/browser/service_worker/service_worker_context_request_handler_unittest.cc:39: class ServiceWorkerContextRequestHandlerTest; nit: remove this
3 years, 11 months ago (2017-01-10 08:37:37 UTC) #21
falken
asanka: can you review net/ horo: thanks https://codereview.chromium.org/2602853002/diff/160001/content/browser/service_worker/service_worker_context_request_handler_unittest.cc File content/browser/service_worker/service_worker_context_request_handler_unittest.cc (right): https://codereview.chromium.org/2602853002/diff/160001/content/browser/service_worker/service_worker_context_request_handler_unittest.cc#newcode39 content/browser/service_worker/service_worker_context_request_handler_unittest.cc:39: class ServiceWorkerContextRequestHandlerTest; ...
3 years, 11 months ago (2017-01-10 08:44:34 UTC) #23
asanka
/net/ lgtm
3 years, 11 months ago (2017-01-10 15:13:29 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2602853002/180001
3 years, 11 months ago (2017-01-10 15:15:30 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2602853002/180001
3 years, 11 months ago (2017-01-10 15:16:23 UTC) #35
commit-bot: I haz the power
3 years, 11 months ago (2017-01-10 15:20:08 UTC) #38
Message was sent while issue was closed.
Committed patchset #10 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/815dc48c9d00b0142a2421de8f10...

Powered by Google App Engine
This is Rietveld 408576698