Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
| index 814987393be25ee3794094cde6bfa487503deea5..95969274b5d70d8d870deaeccd33ee9b75d9f97f 100644 |
| --- a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
| @@ -62,12 +62,14 @@ function createdb_for_multiple_tests(dbname, version) { |
| assert_unreached("unexpected open." + evt + " event"); |
| } |
| - if (e.target.result + "" == "[object IDBDatabase]" && !this.db) { |
| - this.db = e.target.result; |
| - |
| - this.db.onerror = fail(test, "unexpected db.error"); |
| - this.db.onabort = fail(test, "unexpected db.abort"); |
| - this.db.onversionchange = fail(test, "unexpected db.versionchange"); |
| + if (e.target.result + '' == '[object IDBDatabase]' && |
| + !this.db) { |
| + un this.db = e.target.result; |
|
jsbell
2017/01/27 00:31:29
un -> editing typo?
pwnall
2017/01/27 01:23:50
Done.
Thank you :(
This somehow crawled in after I
|
| + |
| + this.db.onerror = fail(test, 'unexpected db.error'); |
| + this.db.onabort = fail(test, 'unexpected db.abort'); |
| + this.db.onversionchange = |
| + fail(test, 'unexpected db.versionchange'); |
| } |
| }) |
| }) |
| @@ -102,22 +104,31 @@ function assert_key_equals(actual, expected, description) { |
| assert_equals(indexedDB.cmp(actual, expected), 0, description); |
| } |
| -function indexeddb_test(upgrade_func, open_func, description) { |
| - async_test(function(t) { |
| - var dbname = document.location + '-' + t.name; |
| - var del = indexedDB.deleteDatabase(dbname); |
| - del.onerror = t.unreached_func('deleteDatabase should succeed'); |
| - var open = indexedDB.open(dbname, 1); |
| - open.onerror = t.unreached_func('open should succeed'); |
| - open.onupgradeneeded = t.step_func(function() { |
| - var db = open.result; |
| - var tx = open.transaction; |
| - upgrade_func(t, db, tx); |
| - }); |
| - open.onsuccess = t.step_func(function() { |
| - var db = open.result; |
| - if (open_func) |
| - open_func(t, db); |
| - }); |
| - }, description); |
| +function indexeddb_test(upgrade_func, open_func, description, options) { |
| + async_test(function(t) { |
| + var dbname = document.location + '-' + t.name; |
| + var del = indexedDB.deleteDatabase(dbname); |
| + del.onerror = t.unreached_func('deleteDatabase should succeed'); |
| + var open = indexedDB.open(dbname, 1); |
| + if (!(options && options.will_abort)) { |
|
jsbell
2017/01/27 00:31:29
Aside: one nice way to handle an options argument
pwnall
2017/01/27 01:23:49
Done.
I didn't know this pattern. Thank you very m
|
| + open.onsuccess = t.unreached_func('open should not succeed'); |
| + } else { |
| + open.onerror = t.unreached_func('open should succeed'); |
| + } |
| + open.onupgradeneeded = t.step_func(function() { |
| + var db = open.result; |
| + var tx = open.transaction; |
| + var old_abort = tx.abort; |
| + tx.abort = function() { |
|
jsbell
2017/01/27 00:31:29
we don't want to monkey patch here any more, do we
pwnall
2017/01/27 01:23:50
Done.
Sorry for the carelessness :(
|
| + open.onerror = null; |
| + old_abort.call(tx); |
| + }; |
| + upgrade_func(t, db, tx); |
| + }); |
| + open.onsuccess = t.step_func(function() { |
| + var db = open.result; |
| + if (open_func) |
| + open_func(t, db); |
| + }); |
| + }, description); |
| } |