diff options
author | David Barksdale <amatus@amat.us> | 2018-10-07 15:44:47 -0500 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2018-10-07 15:44:47 -0500 |
commit | 19e0c9a5c811ade500666acd74fc5132b5e2e480 (patch) | |
tree | 55aaeec12c2f63e6c330dcfd28674b32a6780999 | |
parent | d876a925f9a1ad34dff53dd4b47aaefcfa6e10e1 (diff) |
Workaround IndexedDB bug
-rw-r--r-- | gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js index 582cc68..cb0757d 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js @@ -24,20 +24,30 @@ mergeInto(LibraryManager.library, { data_pointer + size)); var transaction = self.dsdb.transaction(['datastore'], 'readwrite'); var do_put = function() { - var request = transaction.objectStore('datastore') - .put({key: key, - data: data, - type: type, - priority: priority, - anonymity: anonymity, - replication: replication, - expiry: expiry}); + // workaround for https://crbug.com/701972 + var request = transaction.objectStore('datastore').add({}) request.onerror = function(e) { - console.error('put request failed'); + console.error('add request failed'); dynCall('viiiii', cont, [cont_cls, key_pointer, size, -1, 0]); }; request.onsuccess = function(e) { - dynCall('viiiii', cont, [cont_cls, key_pointer, size, 1, 0]); + var request2 = transaction.objectStore('datastore') + .put({uid: e.target.result, + key: key, + data: data, + type: type, + priority: priority, + anonymity: anonymity, + replication: replication, + expiry: expiry}); + request2.onerror = function(e) { + console.error('put request failed'); + transaction.abort(); + dynCall('viiiii', cont, [cont_cls, key_pointer, size, -1, 0]); + }; + request2.onsuccess = function(e) { + dynCall('viiiii', cont, [cont_cls, key_pointer, size, 1, 0]); + }; }; }; if (absent) { |