Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: fixed bit check Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js
index 5f88c1bb5a1692a956a12ac95ee9112cbbe6a54b..db44241f9cfcb6d8e1ea071b5e331d9352d164f8 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer-actions.js
@@ -71,6 +71,25 @@ function indexeddb_observers_actions(db1_name, db2_name, error_callback) {
perform_db2_actions_part1();
}
+function increment_key_actions(db_name, num_iters, key) {
+ var open_request = indexedDB.open(db_name);
+ open_request.onsuccess = function() {
+ var db = open_request.result;
+
+ var increment_number = function(old_value, num_left) {
+ if (num_left == 0) return;
+ var txn = db.transaction(['store'], 'readwrite');
+ var os = txn.objectStore('store');
+ var new_value = old_value + 1;
+ os.put(new_value, key);
+ txn.oncomplete = function() {
+ increment_number(new_value, num_left - 1);
+ };
+ };
+ increment_number(0, num_iters);
+ };
+};
+
if (isWorker && location.hash != "") {
var hash = location.hash.split("#")[1];
var names = JSON.parse(decodeURIComponent(hash));
@@ -78,6 +97,9 @@ if (isWorker && location.hash != "") {
var errorCallback = function(event) {
console.log('Error in actions: ' + event.target.error.message);
}
-
- indexeddb_observers_actions(names.db1_name, names.db2_name, errorCallback);
+ if (names.incrementing_actions) {
+ increment_key_actions(names.db_name, names.num_iters, names.key);
+ } else {
+ indexeddb_observers_actions(names.db1_name, names.db2_name, errorCallback);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698