Commit b39061ad authored by Yusei Tahara's avatar Yusei Tahara Committed by Romain Courteaud

[erp5_web_renderjs_ui] Fix rjs_gadget_erp5_serviceworker.js to fix Firefox Cache Storage problem.

Don't give request object itself to cache.match. Firefox's Cache Storage does not work properly when VARY contains Accept-Language. Give URL string instead, then cache.match works on both Firefox and Chrome.
parent c86c451f
...@@ -161,7 +161,6 @@ ...@@ -161,7 +161,6 @@
new URL(REQUIRED_FILES[i], location.toString()).toString() new URL(REQUIRED_FILES[i], location.toString()).toString()
); );
} }
self.addEventListener('install', function (event) { self.addEventListener('install', function (event) {
// Perform install step: loading each required file into cache // Perform install step: loading each required file into cache
event.waitUntil( event.waitUntil(
...@@ -198,7 +197,10 @@ ...@@ -198,7 +197,10 @@
return event.respondWith( return event.respondWith(
caches.open(CACHE_NAME) caches.open(CACHE_NAME)
.then(function (cache) { .then(function (cache) {
return cache.match(event.request); // Don't give request object itself. Firefox's Cache Storage
// does not work properly when VARY contains Accept-Language.
// Give URL string instead, then cache.match works on both Firefox and Chrome.
return cache.match(event.request.url);
}) })
.then(function (response) { .then(function (response) {
// Cache hit - return the response from the cached version // Cache hit - return the response from the cached version
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>976.10820.28958.15769</string> </value> <value> <string>976.12179.24771.41523</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1559652532.29</float> <float>1559719201.36</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment