|
|
Chromium Code Reviews|
Created:
4 years, 2 months ago by horo Modified:
4 years, 2 months ago CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, shimazu+serviceworker_chromium.org, serviceworker-reviews, jam, chasej+watch_chromium.org, nhiroki, kinuko+serviceworker, horo+watch_chromium.org, darin-cc_chromium.org, kinuko+watch, tzik, blink-worker-reviews_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionStore Origin-Trial tokens to ServiceWorkerDataBase
Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP
header in ServiceWorkerStorage. These are loaded when the ServiceWorker is
started.
We are thinking about using Origin-Trial for Navigation Preload feature. If we
will do so, we have to check the token before starting the ServiceWorker. So we
need to store the token in the ServiceWorkerDataBase.
And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens
and stop starting ServiceWorkers for ForeignFetch when the tokens have expired.
See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent().
BUG=649558
Committed: https://crrev.com/2b805ae42103749c9d92785b10528bde83a4bd4b
Cr-Commit-Position: refs/heads/master@{#424677}
Patch Set 1 #Patch Set 2 : Add tests #
Total comments: 2
Patch Set 3 : incorporated chasej's comment #
Total comments: 13
Patch Set 4 : incorporated falken's comment #Patch Set 5 : add comment in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent #
Total comments: 3
Patch Set 6 : fix comment #
Total comments: 4
Patch Set 7 : incorporated iclelland's comment #Messages
Total messages: 73 (54 generated)
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linu...)
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Patchset #5 (id:80001) has been deleted
Patchset #4 (id:60001) has been deleted
Patchset #4 (id:100001) has been deleted
Patchset #3 (id:40001) has been deleted
Patchset #2 (id:20001) has been deleted
Description was changed from ========== Store valid Origin-Trial tokens to SWDatabase BUG= ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase BUG= ==========
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Store Origin-Trial tokens to ServiceWorkerDataBase BUG= ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase BUG=649558 ==========
Description was changed from ========== Store Origin-Trial tokens to ServiceWorkerDataBase BUG=649558 ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. This data is loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ==========
Description was changed from ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. This data is loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. These are loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ==========
horo@chromium.org changed reviewers: + falken@chromium.org
falken@ Could you please review?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
chasej@chromium.org changed reviewers: + chasej@chromium.org
Drive-by code review (from watch on origin trials). https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... content/browser/service_worker/service_worker_version.cc:712: if (TrialTokenValidator::ValidateToken(token, url::Origin(scope()), ValidateToken() does not currently check if the entire origin trials framework is enabled. See TrialTokenValidator::RequestEnablesFeature(). With this code, it's possible that previously saved tokens will be reported as still valid, even though the framework is now disabled. It might make sense for ValidateToken() to have the check for the framework being enabled. That method was originally written assuming a caller that already checked for framework enablement. Alternatively, maybe this method should be encapsulated as TrialTokenValidator::SetValidTokens(in, out). All of the above also applies to the check for secure origins, which are required for origin trials. Service workers already require secure origins, but a later caller may not have that constraint.
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #3 (id:140001) has been deleted
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Thank you. https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... content/browser/service_worker/service_worker_version.cc:712: if (TrialTokenValidator::ValidateToken(token, url::Origin(scope()), On 2016/10/05 23:39:54, chasej wrote: > ValidateToken() does not currently check if the entire origin trials framework > is enabled. See TrialTokenValidator::RequestEnablesFeature(). With this code, > it's possible that previously saved tokens will be reported as still valid, even > though the framework is now disabled. > > It might make sense for ValidateToken() to have the check for the framework > being enabled. That method was originally written assuming a caller that already > checked for framework enablement. > > Alternatively, maybe this method should be encapsulated as > TrialTokenValidator::SetValidTokens(in, out). > > All of the above also applies to the check for secure origins, which are > required for origin trials. Service workers already require secure origins, but > a later caller may not have that constraint. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/10/06 06:59:25, horo wrote: > Thank you. > > https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... > File content/browser/service_worker/service_worker_version.cc (right): > > https://codereview.chromium.org/2376403004/diff/120001/content/browser/servic... > content/browser/service_worker/service_worker_version.cc:712: if > (TrialTokenValidator::ValidateToken(token, url::Origin(scope()), > On 2016/10/05 23:39:54, chasej wrote: > > ValidateToken() does not currently check if the entire origin trials framework > > is enabled. See TrialTokenValidator::RequestEnablesFeature(). With this code, > > it's possible that previously saved tokens will be reported as still valid, > even > > though the framework is now disabled. > > > > It might make sense for ValidateToken() to have the check for the framework > > being enabled. That method was originally written assuming a caller that > already > > checked for framework enablement. > > > > Alternatively, maybe this method should be encapsulated as > > TrialTokenValidator::SetValidTokens(in, out). > > > > All of the above also applies to the check for secure origins, which are > > required for origin trials. Service workers already require secure origins, > but > > a later caller may not have that constraint. > > Done. LGTM. I like the pair of related methods GetValidTokens/GetValidTokensFromHeader. Much better than my suggestions!
This looks good. If I understand correctly, now we parse origin trial headers both on the browser side when installing the service worker, and on the renderer side when starting the service worker thread. Is the long-term plan to pass the headers in the Start message? Or it's not worth the change? Should the comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent be updated to remove the TODO and say we only have to do the check for Chrome < M55? https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_database.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_database.cc:1276: } nit: remove braces for consistence https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_storage_unittest.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_storage_unittest.cc:51: // private nit: line wrapping https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.cc:757: // in the entry. same nits as above https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_version.h (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.h:358: // 1) The worer is a new one. nit: worker https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.h:361: // was written by old version Chrome, so |origin_trial_tokens| wasn't set and old version of Chrome (< M55)
nhiroki@chromium.org changed reviewers: + nhiroki@chromium.org
DBC https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_database.proto (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_database.proto:45: optional ServiceWorkerOriginTrialInfo origin_trial_tokens = 11; Doesn't this work? repeated ServiceWorkerOriginTrialFeature origin_trial_tokens = 11; In addtion, s/ServiceWorkerOriginTrialFeature/ServiceWorkerOriginTrialInfo/ if the above works well.
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
> This looks good. If I understand correctly, now we parse origin trial headers > both on the browser side when installing the service worker, and on the renderer > side when starting the service worker thread. Is the long-term plan to pass the > headers in the Start message? Or it's not worth the change? Yes. After this patch both the browser and the renderer checks the origin-trial headers. But I don't think it is worth to change this. SharedWorker have to check the headers in the renderer, and SharedWorker and ServiceWorker are using the same code. > Should the comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent > be updated to remove the TODO and say we only have to do the check for Chrome < > M55? done. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_database.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_database.cc:1276: } On 2016/10/07 03:35:22, falken wrote: > nit: remove braces for consistence Done. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_database.proto (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_database.proto:45: optional ServiceWorkerOriginTrialInfo origin_trial_tokens = 11; On 2016/10/07 04:40:34, nhiroki wrote: > Doesn't this work? > > repeated ServiceWorkerOriginTrialFeature origin_trial_tokens = 11; > > In addtion, s/ServiceWorkerOriginTrialFeature/ServiceWorkerOriginTrialInfo/ if > the above works well. If we use "repeated", we can't distinguish empty (not set) or zero. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_storage_unittest.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_storage_unittest.cc:51: // private On 2016/10/07 03:35:22, falken wrote: > nit: line wrapping Done. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.cc:757: // in the entry. On 2016/10/07 03:35:22, falken wrote: > same nits as above Done. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_version.h (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.h:358: // 1) The worer is a new one. On 2016/10/07 03:35:22, falken wrote: > nit: worker Done. https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_version.h:361: // was written by old version Chrome, so |origin_trial_tokens| wasn't set On 2016/10/07 03:35:22, falken wrote: > and old version of Chrome (< M55) Done.
lgtm https://codereview.chromium.org/2376403004/diff/200001/third_party/WebKit/Sou... File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2376403004/diff/200001/third_party/WebKit/Sou... third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:193: // installed in old version of Chrome (<M55) we have to check it in the "is installed" -> "was installed" (two places) https://codereview.chromium.org/2376403004/diff/200001/third_party/WebKit/Sou... third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:194: // renderer process. maybe add "renderer process (here)" for clarity
https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... File content/browser/service_worker/service_worker_database.proto (right): https://codereview.chromium.org/2376403004/diff/160001/content/browser/servic... content/browser/service_worker/service_worker_database.proto:45: optional ServiceWorkerOriginTrialInfo origin_trial_tokens = 11; On 2016/10/07 05:33:32, horo wrote: > On 2016/10/07 04:40:34, nhiroki wrote: > > Doesn't this work? > > > > repeated ServiceWorkerOriginTrialFeature origin_trial_tokens = 11; > > > > In addtion, s/ServiceWorkerOriginTrialFeature/ServiceWorkerOriginTrialInfo/ if > > the above works well. > > If we use "repeated", we can't distinguish empty (not set) or zero. Thank you. I understand the situation.
nhiroki@chromium.org changed reviewers: - nhiroki@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by horo@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
horo@chromium.org changed reviewers: + iclelland@chromium.org
https://codereview.chromium.org/2376403004/diff/200001/third_party/WebKit/Sou... File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2376403004/diff/200001/third_party/WebKit/Sou... third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:193: // installed in old version of Chrome (<M55) we have to check it in the On 2016/10/07 05:38:33, falken wrote: > "is installed" -> "was installed" (two places) Done.
iclelland@ Could you please review content/common/origin_trials/trial_token_validator.*?
horo@chromium.org changed reviewers: + keishi@chromium.org
keishi@ Please review third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM
iclelland@ Ping? :)
origin_trials LGTM; sorry for the wait https://codereview.chromium.org/2376403004/diff/220001/content/browser/servic... File content/browser/service_worker/service_worker_database.cc (right): https://codereview.chromium.org/2376403004/diff/220001/content/browser/servic... content/browser/service_worker/service_worker_database.cc:1227: const auto& info = data.origin_trial_tokens(); nit: Why auto here, but ServiceWorkerOriginTrialInfo* in the other half of this patch? Would const ServiceWorkerOriginTrialInfo& be more descriptive? (I'm totally fine with const auto& in the for loops; I just had to figure out what this one actually returned) https://codereview.chromium.org/2376403004/diff/220001/content/common/origin_... File content/common/origin_trials/trial_token_validator.h (right): https://codereview.chromium.org/2376403004/diff/220001/content/common/origin_... content/common/origin_trials/trial_token_validator.h:48: CONTENT_EXPORT std::unique_ptr<FeatureToTokensMap> GetValidTokensFromHeaders( Can you write a comment for these two methods -- at least to mention that they are used to re-validate previously stored tokens?
Thank you! https://codereview.chromium.org/2376403004/diff/220001/content/browser/servic... File content/browser/service_worker/service_worker_database.cc (right): https://codereview.chromium.org/2376403004/diff/220001/content/browser/servic... content/browser/service_worker/service_worker_database.cc:1227: const auto& info = data.origin_trial_tokens(); On 2016/10/12 03:31:38, iclelland wrote: > nit: > Why auto here, but ServiceWorkerOriginTrialInfo* in the other half of this > patch? Would const ServiceWorkerOriginTrialInfo& be more descriptive? > > (I'm totally fine with const auto& in the for loops; I just had to figure out > what this one actually returned) I thought that using "auto" increases readability. But here, "const ServiceWorkerOriginTrialInfo&" seems more reader-friendly. https://codereview.chromium.org/2376403004/diff/220001/content/common/origin_... File content/common/origin_trials/trial_token_validator.h (right): https://codereview.chromium.org/2376403004/diff/220001/content/common/origin_... content/common/origin_trials/trial_token_validator.h:48: CONTENT_EXPORT std::unique_ptr<FeatureToTokensMap> GetValidTokensFromHeaders( On 2016/10/12 03:31:39, iclelland wrote: > Can you write a comment for these two methods -- at least to mention that they > are used to re-validate previously stored tokens? Done.
The CQ bit was checked by horo@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from chasej@chromium.org, falken@chromium.org, keishi@chromium.org, iclelland@chromium.org Link to the patchset: https://codereview.chromium.org/2376403004/#ps240001 (title: "incorporated iclelland's comment")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. These are loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. These are loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:240001)
Message was sent while issue was closed.
Description was changed from ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. These are loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 ========== to ========== Store Origin-Trial tokens to ServiceWorkerDataBase Currently the Origin-Trial tokens for ServiceWorkers are stored in the HTTP header in ServiceWorkerStorage. These are loaded when the ServiceWorker is started. We are thinking about using Origin-Trial for Navigation Preload feature. If we will do so, we have to check the token before starting the ServiceWorker. So we need to store the token in the ServiceWorkerDataBase. And also if we have the tokens in ServiceWorkerDataBase, we can check the tokens and stop starting ServiceWorkers for ForeignFetch when the tokens have expired. See comments in ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(). BUG=649558 Committed: https://crrev.com/2b805ae42103749c9d92785b10528bde83a4bd4b Cr-Commit-Position: refs/heads/master@{#424677} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/2b805ae42103749c9d92785b10528bde83a4bd4b Cr-Commit-Position: refs/heads/master@{#424677} |
