angular-docs-cn/packages
Alex Rickabaugh 395109817b fix(service-worker): properly handle invalid hashes in all scenarios (#21288)
When the SW fetches URLs listed in a manifest with hashes, it checks
the content hash against the manifest to make sure it has the correct
version of the URL. In the event of a mismatch, the SW is supposed to
consider the manifest invalid, and avoid using it. There are 3 cases
to consider by which this can happen.

Case 1: during the initial SW installation, a manifest is activated
without waiting for every URL to be fully loaded. In the background,
every prefetch URL listed by the manifest is requested and cached.
One such prefetch request could fail the hash test, and cause the
manifest to be treated as invalid. In such a case, the SW should
enter a state of EXISTING_CLIENTS_ONLY, as the latest manifest is
invalid.

This case works today.

Case 2: during the initial SW installation, as in Case 1, a manifest
is activated without waiting for each URL to fully load. However,
it's possible that the application could request a URL with a bad
hash before background initialization tries to load that URL. This
happens if, for example, the application has a broken index.html.

In this case, the SW should enter a state of EXISTING_CLIENTS_ONLY,
and serve the request from the network instead.

What happens today is that the internal error escapes the SW and
is returned as a rejected Promise to respondWith(), causing a
browser-level error that the site cannot be loaded, breaking the
site.

This change allows the SW to detect the error and enter the correct
state, falling back on the network if needed.

Case 3: during checkForUpdate(), the SW will try to fully cache the
new update before making it the latest version. Failure here is
complicated - if the page fails to load due to transient network
conditions (timeouts, 500s, etc), then it makes sense to continue
serving the existing cached version, and attempt to activate the
update on the next cycle.

If the page fails due to non-transient conditions though (400 error,
hash mismatch, etc), then the SW should consider the updated
manifest invalid, and enter a state of EXISTING_CLIENTS_ONLY.

Currently, all errors are treated as transient.

This change causes the SW to treat all errors during updates as
non-transient, which can cause the SW to unnecessarily enter a
safe mode. A future change can allow the SW to remain in normal mode
if the error is provably transient.

PR Close #21288
2018-01-10 12:18:24 -08:00
..
animations fix(animations): fix increment/decrement aliases example (#18323) 2018-01-10 12:06:55 -08:00
bazel fix(bazel): Give correct module names for ES6 output (#21320) 2018-01-09 10:30:44 -08:00
benchpress fix(benchpress): work around missing events from Chrome 63 (#21396) 2018-01-08 16:14:34 -08:00
common fix(common): export currencies via `getCurrencySymbol` (#20983) 2018-01-05 14:24:26 -08:00
compiler fix(language-service): ignore null metadatas (#20557) 2018-01-02 10:29:44 -06:00
compiler-cli docs(aio): document the template compiler options (#21333) 2018-01-08 13:23:16 -05:00
core refactor(core): create consistent naming scheme across classes (#21403) 2018-01-10 11:15:48 -08:00
docs refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
examples build: add bazel test rules for remainder of packages (#21053) 2017-12-22 13:10:51 -08:00
forms docs(forms): add text about min() and max() as functions (#21110) 2017-12-22 21:36:46 -08:00
http build: upgrade circle/build into large class (more ram) (#21053) 2017-12-22 13:10:51 -08:00
language-service build: upgrade to TypeScript 2.6 (#21144) 2017-12-22 20:15:47 -08:00
platform-browser fix(core): make all render3 tests pass in IE9 (#21279) 2018-01-05 14:25:40 -08:00
platform-browser-dynamic build: move _testing_init into tools; limit web_test concurrency (#21053) 2017-12-22 13:10:51 -08:00
platform-server build: move _testing_init into tools; limit web_test concurrency (#21053) 2017-12-22 13:10:51 -08:00
platform-webworker build: move _testing_init into tools; limit web_test concurrency (#21053) 2017-12-22 13:10:51 -08:00
platform-webworker-dynamic build: add bazel test rules for remainder of packages (#21053) 2017-12-22 13:10:51 -08:00
router docs(router): fix missing export in docs for UrlMatcher (#21095) 2018-01-04 17:48:32 -05:00
service-worker fix(service-worker): properly handle invalid hashes in all scenarios (#21288) 2018-01-10 12:18:24 -08:00
upgrade build: upgrade circle/build into large class (more ram) (#21053) 2017-12-22 13:10:51 -08:00
BUILD.bazel build: upgrade bazel rules to latest (#20768) 2017-12-07 11:27:50 -08:00
README.md Revert "docs: Remove unneeded file (#18106)" 2017-07-20 16:46:47 -05:00
empty.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
es6-subset.d.ts build: switch from npm to yarn (#19328) 2017-09-22 13:20:52 -07:00
goog.d.ts fix(compiler): add typings for `COMPILED`. 2017-09-29 09:26:38 -07:00
license-banner.txt docs(common): update copyright years (#21232) 2018-01-04 17:45:36 -05:00
rollup.config.js refactor: make all rollup config ES5 compatible (#20028) 2017-10-30 23:09:17 -04:00
system.d.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
tsconfig-build.json refactor: update angular to support TypeScript 2.4 2017-09-12 10:31:30 -07:00
tsconfig-metadata.json refactor(compiler): bump metadata version to 4 (#19338) 2017-09-26 13:31:59 -07:00
tsconfig.json build: remove references to `tsc-wrapped` (#19298) 2017-09-21 13:55:52 -07:00
types.d.ts build: add bazel test rules for remainder of packages (#21053) 2017-12-22 13:10:51 -08:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

License: MIT