dom/indexedDB/test/unit/test_transaction_lifetimes_nested.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:12dc33cb75c4
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
5
6 var testGenerator = testSteps();
7
8 function testSteps()
9 {
10 let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1);
11 request.onerror = errorHandler;
12 request.onupgradeneeded = grabEventAndContinueHandler;
13 let event = yield undefined;
14
15 let db = event.target.result;
16 db.onerror = errorHandler;
17
18 event.target.onsuccess = continueToNextStep;
19 db.createObjectStore("foo");
20 yield undefined;
21
22 let transaction1 = db.transaction("foo");
23
24 let transaction2;
25
26 let comp = this.window ? SpecialPowers.wrap(Components) : Components;
27 let thread = comp.classes["@mozilla.org/thread-manager;1"]
28 .getService(comp.interfaces.nsIThreadManager)
29 .currentThread;
30
31 let eventHasRun;
32
33 thread.dispatch(function() {
34 eventHasRun = true;
35
36 transaction2 = db.transaction("foo");
37 }, Components.interfaces.nsIThread.DISPATCH_NORMAL);
38
39 while (!eventHasRun) {
40 thread.processNextEvent(false);
41 }
42
43 ok(transaction2, "Non-null transaction2");
44
45 continueToNextStep();
46 yield undefined;
47
48 finishTest();
49 yield undefined;
50 }

mercurial