奇妙な状況に遭遇しました。を呼び出しています。database.transaction(txCallback, txError, txSuccess)
トランザクション呼び出しの後に呼び出しを行うalert()
と、txSuccess
関数は呼び出されずに
txCallback
関数が呼び出されます。
これは既知のエラーですか、それとも合理的な説明付きの文書化された動作ですか?
これは、RippleEmulatorとGoogleChrome(Rippleのベース)でのみ発生するようです。Safariでは発生しませんalert
。Safariを使用しているかどうかに関係なく、期待どおりに動作しconsole.log
ます。
このHTMLは、状況をよく示しています。
<html>
<head>
<script>
function dbalert() {
var db = window.openDatabase("test","1.0","test",1024*1024);
console.log("Next line should read: In transaction callback");
window.transactionCalled = false;
db.transaction(
function (tx) {
console.log("In transaction callback");
window.transactionCalled = true;
},
function (tx, err) {
console.error("ERROR");
console.log(err);
},
function () {
if (window.transactionCalled) {
console.log("Success callback: everything worked!");
} else {
console.error("Success callback: BUT TRANSACTION WAS NEVER CALLED");
}
}
);
/*****
* Change to FALSE to get this working.
*****/
if (true) {
alert("Ok, let's see what happened");
} else {
console.log("Ok, let's see what happened");
}
}
</script>
</head>
<body onLoad="dbalert();">
<div id="out">
</div>
</body>
</html>