|
[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}
Total comments: 5
Total comments: 6
Total comments: 8
Total comments: 9
Total comments: 11
Total comments: 9
|
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
|
Total messages: 58 (17 generated)
|