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

Issue 1532633003: Extension SW: Add tests that serve web_accessible_resources from a SW. (Closed)

Created:
5 years ago by lazyboy
Modified:
4 years, 11 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Extension SW: Add tests that serve web_accessible_resources from a SW. This CL also fixes an issue in DocumentThreadableLoader: DTL used to only intercept http and https protocol requests. This CL expands it to match content/ by using SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(). Without this change fetch interception from extension SW would always hit an ASSERT (in debug). ServiceWorkerTest.WebAccessibleResourcesFetch: Tests that a Fetch request is served correctly by a SW when SW is controlling an extension. ServiceWorkerTest.WebAccessibleResourcesIframeSrc: From a page outside an extension, an iframe is loaded with a .src of an extension URL that is listed in the extension's web_accessible_resources. The test verifies that if a Service Worker is controlling the extension, it will also control the iframe's requested extension resource. BUG=545535, 567382 Committed: https://crrev.com/aea32c234f38db3f70454c86cbd3b40c833482e1 Cr-Commit-Position: refs/heads/master@{#367375}

Patch Set 1 #

Patch Set 2 : add iframe test #

Total comments: 4

Patch Set 3 : Split the extension into two for two tests, add non existent WAR check. #

Patch Set 4 : fix indent #

Patch Set 5 : sync #

Total comments: 1

Patch Set 6 : Remove httpFamily protocol check for fetch #

Patch Set 7 : foo #

Total comments: 1

Patch Set 8 : shouldTreatURLSchemeAsAllowingServiceWorkers() #

Total comments: 8

Patch Set 9 : address comments from Devlin #

Patch Set 10 : remove unused var #

Unified diffs Side-by-side diffs Delta from patch set Stats (+259 lines, -11 lines) Patch
M chrome/browser/extensions/service_worker_apitest.cc View 1 2 3 4 5 6 7 8 1 chunk +63 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/data_for_extension View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/manifest.json View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.html View 1 2 6 7 1 chunk +1 line, -1 line 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js View 1 2 3 4 5 6 7 8 9 1 chunk +69 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/sw.js View 1 2 3 4 5 6 7 8 1 chunk +26 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/iframe_src/background.js View 1 2 3 4 5 6 7 8 1 chunk +15 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/iframe_src/iframe.html View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
A + chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/iframe_src/iframe.js View 1 2 6 7 1 chunk +5 lines, -6 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/iframe_src/manifest.json View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/iframe_src/sw.js View 1 2 3 4 5 6 7 8 1 chunk +32 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/webpage.html View 1 2 1 chunk +22 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 42 (17 generated)
lazyboy
5 years ago (2015-12-16 18:56:13 UTC) #3
Devlin
This is a good start, but I'd also like to see us testing the ability ...
5 years ago (2015-12-16 22:31:32 UTC) #4
lazyboy
On 2015/12/16 22:31:32, Devlin wrote: > This is a good start, but I'd also like ...
5 years ago (2015-12-16 22:42:51 UTC) #5
Devlin
On 2015/12/16 22:42:51, lazyboy wrote: > On 2015/12/16 22:31:32, Devlin wrote: > > This is ...
5 years ago (2015-12-16 22:47:30 UTC) #6
lazyboy
I've added another test to verify that scenario, PTAL. Thanks.
5 years ago (2015-12-17 01:39:03 UTC) #10
Devlin
https://chromiumcodereview.appspot.com/1532633003/diff/20001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://chromiumcodereview.appspot.com/1532633003/diff/20001/chrome/browser/extensions/service_worker_apitest.cc#newcode580 chrome/browser/extensions/service_worker_apitest.cc:580: // resource file. After verifying that, we register a ...
5 years ago (2015-12-17 17:37:34 UTC) #11
lazyboy
https://chromiumcodereview.appspot.com/1532633003/diff/20001/chrome/browser/extensions/service_worker_apitest.cc File chrome/browser/extensions/service_worker_apitest.cc (right): https://chromiumcodereview.appspot.com/1532633003/diff/20001/chrome/browser/extensions/service_worker_apitest.cc#newcode580 chrome/browser/extensions/service_worker_apitest.cc:580: // resource file. After verifying that, we register a ...
5 years ago (2015-12-17 19:27:22 UTC) #12
lazyboy
https://chromiumcodereview.appspot.com/1532633003/diff/80001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js File chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js (right): https://chromiumcodereview.appspot.com/1532633003/diff/80001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js#newcode51 chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js:51: fetch(getTestURL()).then(function(response) { @falken, this fetch() is causing an assertion ...
5 years ago (2015-12-18 02:19:35 UTC) #14
lazyboy
5 years ago (2015-12-18 02:19:39 UTC) #15
falken
This will probably need some careful debugging, DocumentThreadableLoader is not a fun class. The assert ...
5 years ago (2015-12-18 06:53:56 UTC) #17
lazyboy
On 2015/12/18 06:53:56, falken wrote: > This will probably need some careful debugging, DocumentThreadableLoader is ...
5 years ago (2015-12-19 01:13:16 UTC) #18
falken
On 2015/12/19 01:13:16, lazyboy wrote: > On 2015/12/18 06:53:56, falken wrote: > > This will ...
5 years ago (2015-12-21 05:14:56 UTC) #19
lazyboy
Great, thanks for the help. https://chromiumcodereview.appspot.com/1532633003/diff/120001/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp File third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp (right): https://chromiumcodereview.appspot.com/1532633003/diff/120001/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp#newcode196 third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp:196: // We assume that ...
5 years ago (2015-12-21 05:57:16 UTC) #22
falken
Sorry, it looks like I jumped to conclusions about HTTP being an oversight. The CL ...
5 years ago (2015-12-21 06:31:39 UTC) #24
yhirano
Sorry for the naive question, should we allow a service worker to trap requests *to* ...
5 years ago (2015-12-21 08:04:26 UTC) #25
Devlin
On 2015/12/21 08:04:26, yhirano wrote: > Sorry for the naive question, should we allow a ...
5 years ago (2015-12-22 00:25:09 UTC) #26
lazyboy
On 2015/12/21 06:31:39, falken wrote: > Sorry, it looks like I jumped to conclusions about ...
5 years ago (2015-12-22 02:12:34 UTC) #27
falken
The change to DocumentThreadableLoader lgtm (as a non-owner), be sure to update CL description first ...
5 years ago (2015-12-22 14:14:43 UTC) #28
lazyboy
+japhet for core/loader/DocumentThreadableLoader.cpp OWNER. @falken, I've updated the CL description.
5 years ago (2015-12-22 17:54:11 UTC) #31
Nate Chapin
lgtm
4 years, 11 months ago (2015-12-30 18:32:30 UTC) #32
Devlin
extensions lgtm https://codereview.chromium.org/1532633003/diff/140001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js File chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js (right): https://codereview.chromium.org/1532633003/diff/140001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js#newcode33 chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js:33: var url = chrome.runtime.getURL('/data_for_extension'); needed? https://codereview.chromium.org/1532633003/diff/140001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/sw.js File ...
4 years, 11 months ago (2016-01-04 17:16:50 UTC) #33
lazyboy
https://chromiumcodereview.appspot.com/1532633003/diff/140001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js File chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js (right): https://chromiumcodereview.appspot.com/1532633003/diff/140001/chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js#newcode33 chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/fetch/page.js:33: var url = chrome.runtime.getURL('/data_for_extension'); On 2016/01/04 17:16:50, Devlin wrote: ...
4 years, 11 months ago (2016-01-04 19:10:26 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1532633003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1532633003/180001
4 years, 11 months ago (2016-01-04 20:18:50 UTC) #38
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years, 11 months ago (2016-01-04 21:37:14 UTC) #40
commit-bot: I haz the power
4 years, 11 months ago (2016-01-04 21:39:09 UTC) #42
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/aea32c234f38db3f70454c86cbd3b40c833482e1
Cr-Commit-Position: refs/heads/master@{#367375}

Powered by Google App Engine
This is Rietveld 408576698