summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/chromeHelpers.js
blob: 16508f62a4c774def5c53ee7ce2e3704042de8b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

var { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;

var testGenerator = testSteps();

if (!window.runTest) {
  window.runTest = function()
  {
    SimpleTest.waitForExplicitFinish();

    testGenerator.next();
  }
}

function finishTest()
{
  SimpleTest.executeSoon(function() {
    testGenerator.close();
    SimpleTest.finish();
  });
}

function grabEventAndContinueHandler(event)
{
  testGenerator.send(event);
}

function continueToNextStep()
{
  SimpleTest.executeSoon(function() {
    testGenerator.next();
  });
}

function errorHandler(event)
{
  throw new Error("indexedDB error, code " + event.target.error.name);
}