summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/chromeHelpers.js
blob: 8284181858eb15e227e4751bc3fdeb5dc62fbe52 (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
/**
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

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

// testSteps is expected to be defined by the file including this file.
/* global testSteps */

var testGenerator = testSteps();

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

    testGenerator.next();
  };
}

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

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

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

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