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

Issue 1192013003: [Extension ServiceWorkers] Allow service worker registration (Closed)

Created:
5 years, 6 months ago by annekao
Modified:
5 years, 4 months ago
CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, jam, extensions-reviews_chromium.org, nhiroki, chromium-apps-reviews_chromium.org, darin-cc_chromium.org, horo+watch_chromium.org, kinuko+serviceworker, kinuko+watch, not at google - send to devlin
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Extension ServiceWorkers] Allow service worker registration change SchemeisHTTPOrHTTPS checks to OriginCanAccessServiceWorker in service worker files. Service Workers require a secure origin, such as HTTPS. chrome-extension:// pages are not HTTP/HTTPS, but are secure so this change allows extensions to register a Service Worker. Added an OriginCanAccessServiceWorker function in origin_util and replaced the SecureSchemeAndOriginSet with CustomSchemeAndOriginSet to add service worker schemes. Also included a function for extensions to have response codes of 200 in extension protocols file. A response code in the 200s (successful HTTP request) is required to install the Service Worker (ServiceWorkerWriteToCacheJob::OnResponseStarted, line 630). Extensions returned a response code of -1 because it was not overridden. A GetResponseCode function was written in extensions_protocol.cc in the URLRequestExtensionJob class. Added testing for fetch events. BUG=501569 Committed: https://crrev.com/1db36fd5516b2b067c05d31a2736e6dfd90fa215 Cr-Commit-Position: refs/heads/master@{#340908}

Patch Set 1 #

Patch Set 2 : Added chrome-extensions scheme check #

Total comments: 5

Patch Set 3 : OriginCanAccessServiceWorker #

Total comments: 6

Patch Set 4 : Added test #

Total comments: 8

Patch Set 5 : Fixed reload #

Patch Set 6 : Took out extra reload #

Total comments: 9

Patch Set 7 #

Patch Set 8 : Fix function name #

Total comments: 11

Patch Set 9 : Fixed nits #

Patch Set 10 : Update handler unittest #

Total comments: 9

Patch Set 11 : Added comments to test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -73 lines) Patch
M chrome/browser/extensions/service_worker_apitest.cc View 1 2 3 4 5 6 3 chunks +26 lines, -9 lines 0 comments Download
M chrome/common/chrome_content_client.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/chrome_content_client.cc View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/common/secure_origin_whitelist_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/fetch/manifest.json View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/fetch/page.html View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/fetch/page.js View 1 2 3 4 5 6 1 chunk +21 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/fetch/sw.js View 1 2 3 4 5 6 1 chunk +3 lines, -1 line 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/fetch/test.js View 1 2 3 4 5 1 chunk +1 line, -7 lines 0 comments Download
M chrome/test/data/extensions/api_test/service_worker/register/manifest.json View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/register/page.html View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/register/page.js View 1 2 3 4 5 2 chunks +1 line, -2 lines 0 comments Download
M chrome/test/data/extensions/api_test/service_worker/register/sw.js View 1 2 3 4 5 1 chunk +7 lines, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/service_worker/register/test.js View 1 2 3 4 5 1 chunk +1 line, -23 lines 0 comments Download
M content/browser/service_worker/service_worker_dispatcher_host.cc View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
M content/browser/service_worker/service_worker_request_handler.cc View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/service_worker/service_worker_request_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +10 lines, -10 lines 0 comments Download
M content/common/origin_util.cc View 1 2 3 4 5 6 7 8 2 chunks +35 lines, -13 lines 0 comments Download
M content/public/common/content_client.h View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M content/public/common/origin_util.h View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -1 line 0 comments Download
M extensions/browser/extension_protocols.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 58 (17 generated)
annekao
5 years, 6 months ago (2015-06-17 22:00:02 UTC) #2
annekao
Due to the previous discussion with the URL scheme checks (https://codereview.chromium.org/1191793003/), rather than just check ...
5 years, 5 months ago (2015-07-13 23:20:27 UTC) #3
Devlin
On 2015/07/13 23:20:27, annekao wrote: > Due to the previous discussion with the URL scheme ...
5 years, 5 months ago (2015-07-14 15:47:36 UTC) #4
Devlin
Oh, also - I think the test will need to be updated with this patch, ...
5 years, 5 months ago (2015-07-14 15:47:50 UTC) #5
annekao
Added a similar function as IsOriginSecure to origin_utils. Updated the test since service workers can ...
5 years, 5 months ago (2015-07-15 18:20:05 UTC) #7
Devlin
https://codereview.chromium.org/1192013003/diff/60001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/60001/chrome/browser/extensions/service_worker_apitest.cc#newcode27 chrome/browser/extensions/service_worker_apitest.cc:27: ASSERT_EQ("success", listener.message()); Awesome! Can we add at least one ...
5 years, 5 months ago (2015-07-15 19:47:48 UTC) #8
Devlin
How's this one coming along, Anne?
5 years, 5 months ago (2015-07-20 21:01:39 UTC) #9
annekao
On 2015/07/20 21:01:39, Devlin wrote: > How's this one coming along, Anne? Funny you ask, ...
5 years, 5 months ago (2015-07-20 21:04:19 UTC) #10
annekao
https://codereview.chromium.org/1192013003/diff/60001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/60001/chrome/browser/extensions/service_worker_apitest.cc#newcode27 chrome/browser/extensions/service_worker_apitest.cc:27: ASSERT_EQ("success", listener.message()); On 2015/07/15 19:47:48, Devlin wrote: > Awesome! ...
5 years, 5 months ago (2015-07-20 21:36:56 UTC) #14
Devlin
https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc#newcode53 chrome/browser/extensions/service_worker_apitest.cc:53: // Page must refresh for service worker to take ...
5 years, 5 months ago (2015-07-20 21:54:47 UTC) #15
annekao
https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc#newcode54 chrome/browser/extensions/service_worker_apitest.cc:54: ReloadExtension(GetSingleLoadedExtension()->id()); On 2015/07/20 21:54:47, Devlin wrote: > Hmm... Reloading ...
5 years, 5 months ago (2015-07-20 22:59:38 UTC) #16
Devlin
https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc#newcode54 chrome/browser/extensions/service_worker_apitest.cc:54: ReloadExtension(GetSingleLoadedExtension()->id()); On 2015/07/20 22:59:38, annekao wrote: > On 2015/07/20 ...
5 years, 5 months ago (2015-07-20 23:04:36 UTC) #17
annekao
On 2015/07/20 23:04:36, Devlin wrote: > https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc > File chrome/browser/extensions/service_worker_apitest.cc (right): > > https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc#newcode54 > ...
5 years, 5 months ago (2015-07-21 01:05:45 UTC) #18
annekao
Looks like Reload() does work, but has to be done twice (not sure why). https://codereview.chromium.org/1192013003/diff/140001/chrome/browser/extensions/service_worker_apitest.cc ...
5 years, 5 months ago (2015-07-21 18:05:18 UTC) #20
annekao
On 2015/07/21 18:05:18, annekao wrote: > Looks like Reload() does work, but has to be ...
5 years, 5 months ago (2015-07-21 21:59:56 UTC) #21
annekao
Took out runTests in fetch/page.js which didn't allow a service worker to stay registered. Also ...
5 years, 5 months ago (2015-07-21 22:34:08 UTC) #23
Devlin
https://codereview.chromium.org/1192013003/diff/220001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/220001/chrome/browser/extensions/service_worker_apitest.cc#newcode55 chrome/browser/extensions/service_worker_apitest.cc:55: ASSERT_EQ("No Fetch Event yet.", output); These ASSERT_EQ should probably ...
5 years, 5 months ago (2015-07-21 22:42:28 UTC) #24
annekao
On 2015/07/21 22:42:28, Devlin wrote: > https://codereview.chromium.org/1192013003/diff/220001/chrome/test/data/extensions/api_test/service_worker/register/manifest.json#newcode6 > chrome/test/data/extensions/api_test/service_worker/register/manifest.json:6: > "permissions": [ > The "register" ...
5 years, 5 months ago (2015-07-21 22:48:20 UTC) #25
Devlin
On 2015/07/21 22:48:20, annekao wrote: > On 2015/07/21 22:42:28, Devlin wrote: > > > https://codereview.chromium.org/1192013003/diff/220001/chrome/test/data/extensions/api_test/service_worker/register/manifest.json#newcode6 ...
5 years, 5 months ago (2015-07-21 22:52:53 UTC) #26
annekao
https://codereview.chromium.org/1192013003/diff/220001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://codereview.chromium.org/1192013003/diff/220001/chrome/browser/extensions/service_worker_apitest.cc#newcode55 chrome/browser/extensions/service_worker_apitest.cc:55: ASSERT_EQ("No Fetch Event yet.", output); On 2015/07/21 22:42:27, Devlin ...
5 years, 5 months ago (2015-07-21 22:55:45 UTC) #27
Devlin
LGTM. Now you'll need one (or two) content/ OWNERS. I'd recommend falken@ for content/browser/service_worker, since ...
5 years, 5 months ago (2015-07-21 22:59:27 UTC) #28
annekao
Hi falken@ and kinuko@, please take a look at the changes in the content/ files. ...
5 years, 5 months ago (2015-07-21 23:25:04 UTC) #31
falken
https://codereview.chromium.org/1192013003/diff/280001/content/public/common/content_client.h File content/public/common/content_client.h (right): https://codereview.chromium.org/1192013003/diff/280001/content/public/common/content_client.h#newcode146 content/public/common/content_client.h:146: // trustworthy schemes should be added. This comment makes ...
5 years, 5 months ago (2015-07-23 00:14:07 UTC) #32
Devlin
https://codereview.chromium.org/1192013003/diff/280001/content/public/common/content_client.h File content/public/common/content_client.h (right): https://codereview.chromium.org/1192013003/diff/280001/content/public/common/content_client.h#newcode146 content/public/common/content_client.h:146: // trustworthy schemes should be added. On 2015/07/23 00:14:07, ...
5 years, 5 months ago (2015-07-23 02:31:02 UTC) #33
falken
lgtm Nit in the CL description: > "A response code in the 200s (successful HTTP ...
5 years, 5 months ago (2015-07-23 07:21:26 UTC) #34
annekao
kinuko@, please take a look.
5 years, 5 months ago (2015-07-24 21:36:24 UTC) #35
kinuko
lgtm https://codereview.chromium.org/1192013003/diff/280001/content/common/origin_util.cc File content/common/origin_util.cc (right): https://codereview.chromium.org/1192013003/diff/280001/content/common/origin_util.cc#newcode17 content/common/origin_util.cc:17: class CustomSchemeAndOriginSet { nit: 'custom scheme and origin ...
5 years, 5 months ago (2015-07-26 14:09:36 UTC) #36
annekao
Fixed CL description and nits https://codereview.chromium.org/1192013003/diff/280001/content/common/origin_util.cc File content/common/origin_util.cc (right): https://codereview.chromium.org/1192013003/diff/280001/content/common/origin_util.cc#newcode17 content/common/origin_util.cc:17: class CustomSchemeAndOriginSet { On ...
5 years, 4 months ago (2015-07-27 17:02:13 UTC) #37
annekao
The ServiceWorkerRequestHandler unit test failed due to the change from SchemeIsHTTPOrHTTPS to OriginCanAccessServiceWorkers. Since the ...
5 years, 4 months ago (2015-07-27 19:24:05 UTC) #38
falken
To be honest, I'm pretty confused by the original tests, I'd like some comments. horo ...
5 years, 4 months ago (2015-07-28 01:18:17 UTC) #40
falken
https://codereview.chromium.org/1192013003/diff/320001/content/browser/service_worker/service_worker_request_handler_unittest.cc File content/browser/service_worker/service_worker_request_handler_unittest.cc (right): https://codereview.chromium.org/1192013003/diff/320001/content/browser/service_worker/service_worker_request_handler_unittest.cc#newcode136 content/browser/service_worker/service_worker_request_handler_unittest.cc:136: EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); On 2015/07/28 01:18:17, falken wrote: > I ...
5 years, 4 months ago (2015-07-28 11:43:35 UTC) #41
annekao
https://codereview.chromium.org/1192013003/diff/320001/content/browser/service_worker/service_worker_request_handler_unittest.cc File content/browser/service_worker/service_worker_request_handler_unittest.cc (right): https://codereview.chromium.org/1192013003/diff/320001/content/browser/service_worker/service_worker_request_handler_unittest.cc#newcode120 content/browser/service_worker/service_worker_request_handler_unittest.cc:120: TEST_F(ServiceWorkerRequestHandlerTest, InitializeHandler) { On 2015/07/28 01:18:17, falken wrote: > ...
5 years, 4 months ago (2015-07-28 16:37:21 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1192013003/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1192013003/340001
5 years, 4 months ago (2015-07-28 19:11:11 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/82729)
5 years, 4 months ago (2015-07-28 19:21:24 UTC) #47
annekao
thestig@, please take a look at the changes in the chrome/common files. I added an ...
5 years, 4 months ago (2015-07-28 19:57:18 UTC) #49
Lei Zhang
chrome/common lgtm
5 years, 4 months ago (2015-07-28 21:11:02 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1192013003/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1192013003/340001
5 years, 4 months ago (2015-07-28 21:32:30 UTC) #52
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/83786)
5 years, 4 months ago (2015-07-28 23:04:16 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1192013003/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1192013003/340001
5 years, 4 months ago (2015-07-29 17:01:35 UTC) #56
commit-bot: I haz the power
Committed patchset #11 (id:340001)
5 years, 4 months ago (2015-07-29 17:09:23 UTC) #57
commit-bot: I haz the power
5 years, 4 months ago (2015-07-29 17:10:00 UTC) #58
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/1db36fd5516b2b067c05d31a2736e6dfd90fa215
Cr-Commit-Position: refs/heads/master@{#340908}

Powered by Google App Engine
This is Rietveld 408576698