| <!DOCTYPE html> |
| <html> |
| <body> |
| This test tests that the statement error callback is called in the right world. |
| <div id="console"></div> |
| <script> |
| var statementErrorCallbacksInvoked = 0; |
| function done() |
| { |
| if ((++statementErrorCallbacksInvoked == 2) && (window.testRunner)) |
| testRunner.notifyDone(); |
| } |
| |
| function statementErrorCallback1(tx, error) |
| { |
| alert("FAIL: Visible in isolated world."); |
| done(); |
| } |
| |
| function statementErrorCallback2(tx, error) |
| { |
| alert(document.body.bar); |
| done(); |
| } |
| |
| document.body.foo = "FAIL: document.body.foo visible in isolated world."; |
| document.body.bar = "PASS: document.body.bar visible in a callback created in this world."; |
| |
| if (window.testRunner) { |
| testRunner.clearAllDatabases(); |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| testRunner.evaluateScriptInIsolatedWorld( |
| 0, |
| "function statementErrorCallback1(tx, error)\n" + |
| "{\n" + |
| " alert(document.body.foo);\n" + |
| " window.location='javascript:done()';\n" + |
| "}\n" + |
| "var db1 = openDatabase('StatementErrorCallbackIsolatedWorld1', '1.0', '', 1);\n" + |
| "db1.transaction(function(tx) {\n" + |
| " tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, statementErrorCallback1);\n" + |
| "});"); |
| |
| var db2 = openDatabase('StatementErrorCallbackIsolatedWorld2', '1.0', '', 1); |
| db2.transaction(function(tx) { |
| tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, statementErrorCallback2); |
| }); |
| } |
| </script> |
| </body> |
| </html> |