dom/indexedDB/test/unit/test_transaction_lifetimes_nested.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /**
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 var testGenerator = testSteps();
     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;
    15   let db = event.target.result;
    16   db.onerror = errorHandler;
    18   event.target.onsuccess = continueToNextStep;
    19   db.createObjectStore("foo");
    20   yield undefined;
    22   let transaction1 = db.transaction("foo");
    24   let transaction2;
    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;
    31   let eventHasRun;
    33   thread.dispatch(function() {
    34     eventHasRun = true;
    36     transaction2 = db.transaction("foo");
    37   }, Components.interfaces.nsIThread.DISPATCH_NORMAL);
    39   while (!eventHasRun) {
    40     thread.processNextEvent(false);
    41   }
    43   ok(transaction2, "Non-null transaction2");
    45   continueToNextStep();
    46   yield undefined;
    48   finishTest();
    49   yield undefined;
    50 }

mercurial