Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
| diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
| index 846481f55bb877737446463029967f3760967bc1..c4de2f0ffff33749cdb8a09657e3bf2d383551e1 100644 |
| --- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
| +++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
| @@ -34,3 +34,20 @@ function expect(t, expected) { |
| } |
| }; |
| } |
| + |
| +// Pins the transaction associated with the given store open by |
| +// issuing a chain of get(0) requests. Returns a function to call to |
| +// stop the requests and let the transaction complete. Useful when you |
| +// need to ensure a transaction is alive across other asynchronous |
| +// operations (e.g. setTimeout) |
| +function pin_transaction(store) { |
|
pwnall
2016/10/14 07:57:05
The docs do state that the point of it is to keep
jsbell
2016/10/17 19:42:04
Agreed, but...
|
| + let finish = false; |
| + (function spin() { |
| + if (finish) |
| + return; |
| + store.get(0).onsuccess = spin; |
| + }()); |
| + return () => { |
| + finish = true; |
| + }; |
| +} |