From e34c3249262300af6642d2efc2849f96b81b910a Mon Sep 17 00:00:00 2001
From: Vincent Bechu <vincent.bechu@nexedi.com>
Date: Thu, 15 Jun 2017 15:03:43 +0000
Subject: [PATCH] erp5_officejs: fix local storage for source code

---
 .../web_page_module/gadget_officejs_bootloader_js.js         | 5 +++--
 .../web_page_module/gadget_officejs_bootloader_js.xml        | 4 ++--
 .../gadget_officejs_bootloader_serviceworker_js.js           | 4 ++--
 .../gadget_officejs_bootloader_serviceworker_js.xml          | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js
index e072630716..017444fa43 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js
@@ -26,7 +26,7 @@ var repair = false;
       check_local_modification: false,
       signature_storage: {
         type: "indexeddb",
-        database: "installer_hash"
+        database: window.location.pathname + version_url + "_hash"
       },
       local_sub_storage: {
         type: "query",
@@ -34,7 +34,8 @@ var repair = false;
           type: "uuid",
           sub_storage: {
             type: "indexeddb",
-            database: "officejs_code_source"
+            database: window.location.origin + window.location.pathname +
+              version_url
           }
         }
       },
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml
index dcd53e53b4..a7e128198b 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml
@@ -236,7 +236,7 @@
             </item>
             <item>
                 <key> <string>serial</string> </key>
-                <value> <string>958.64411.34322.58368</string> </value>
+                <value> <string>960.4200.19356.54459</string> </value>
             </item>
             <item>
                 <key> <string>state</string> </key>
@@ -254,7 +254,7 @@
                     </tuple>
                     <state>
                       <tuple>
-                        <float>1493803864.07</float>
+                        <float>1497535303.22</float>
                         <string>UTC</string>
                       </tuple>
                     </state>
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
index bc6e02c2b2..a2f55eea73 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
@@ -39,13 +39,13 @@ var global = self, window = self;
       .replace(self.registration.scope, "")
       .replace(self.version_url, "");
     if (relative_url === "") {
-      relative_url = self.registration.scope;
+      relative_url = "/";
     }
     event.respondWith(
       new self.RSVP.Queue()
         .push(function () {
           if (self.storage.get === undefined) {
-            self.storage = createStorage("officejs_code_source");
+            self.storage = createStorage(self.registration.scope);
           }
           return self.storage.getAttachment("/", relative_url)
             .push(function (blob) {
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
index 4e07735544..1b61986209 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
@@ -227,7 +227,7 @@
             </item>
             <item>
                 <key> <string>serial</string> </key>
-                <value> <string>959.27737.62903.2116</string> </value>
+                <value> <string>960.4199.25759.2730</string> </value>
             </item>
             <item>
                 <key> <string>state</string> </key>
@@ -245,7 +245,7 @@
                     </tuple>
                     <state>
                       <tuple>
-                        <float>1497359632.58</float>
+                        <float>1497613210.46</float>
                         <string>UTC</string>
                       </tuple>
                     </state>
-- 
2.30.9