summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/indexeddb/resources/shared.js
blob: 9b23cb8ccf02bc42abb9202f89a43f292d499ecf (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
43
44
45
46
47
48
49
50
51
function done()
{
    isSuccessfullyParsed();
    if (window.layoutTestController)
        layoutTestController.notifyDone()
}

function unexpectedSuccessCallback()
{
    testFailed("Success function called unexpectedly.");
}

function unexpectedErrorCallback()
{
    testFailed("Error function called unexpectedly: (" + event.target.errorCode + ") " + event.target.webkitErrorMessage);
}

function unexpectedAbortCallback()
{
    testFailed("Abort function called unexpectedly!");
}

function unexpectedCompleteCallback()
{
    testFailed("oncomplete function called unexpectedly!");
}

function unexpectedBlockedCallback()
{
    testFailed("onblocked called unexpectedly");
}

function evalAndExpectException(cmd, expected)
{
    debug("Expecting exception from " + cmd);
    try {
        eval(cmd);
        testFailed("No exception thrown! Should have been " + expected);
    } catch (e) {
        code = e.code;
        testPassed("Exception was thrown.");
        shouldBe("code", expected);
    }
}

function deleteAllObjectStores(db)
{
    while (db.objectStoreNames.length)
        db.deleteObjectStore(db.objectStoreNames.item(0));
    debug("Deleted all object stores.");
}