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 @@
new URL(REQUIRED_FILES[i], location.toString()).toString()
);
}
self.addEventListener('install', function (event) {
// Perform install step: loading each required file into cache
event.waitUntil(
......@@ -198,7 +197,10 @@
return event.respondWith(
caches.open(CACHE_NAME)
.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) {
// Cache hit - return the response from the cached version
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.10820.28958.15769</string> </value>
<value> <string>976.12179.24771.41523</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1559652532.29</float>
<float>1559719201.36</float>
<string>UTC</string>
</tuple>
</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