<html>
<head>
<script>
var db = openDatabase("CallbacksAreCalledInCorrectContextWorkerTest", "1.0", "", 1);

function printReferrer()
{
    var req = new XMLHttpRequest();
    req.open("GET", "callbacks-are-called-in-correct-context.cgi", false);
    req.send(null);
    top.frames[0].document.getElementById("console").innerText += "Referrer: " + req.responseText;
}

function logCallback(callbackType)
{
    top.frames[0].document.getElementById("console").innerText += "FAIL: The " + callbackType + " callback was called in the wrong context.\n"
    printReferrer();
}

function runTest()
{
    // test that transaction callbacks defined in another frame are executed in the context of that frame
    db.transaction(top.frames[2].failingTransactionCallback, top.frames[2].errorTransactionCallback);
    db.transaction(function(tx) { }, null, top.frames[2].successTransactionCallback);
}
</script>
</head>
<body>
</body>
</html>
