Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / websql / statement-success-callback-isolated-world.html
blob12fb4d7f08de759b987ea65d828401e74b1701e3
1 <!DOCTYPE html>
2 <html>
3 <body>
4 This test tests that the statement success callback is called in the right world.
5 <div id="console"></div>
6 <script>
7 var statementSuccessCallbacksInvoked = 0;
8 function done()
10 if ((++statementSuccessCallbacksInvoked == 2) && (window.testRunner))
11 testRunner.notifyDone();
14 function statementSuccessCallback1(tx, data)
16 alert("FAIL: Visible in isolated world.");
17 done();
20 function statementSuccessCallback2(tx, data)
22 alert(document.body.bar);
23 done();
26 document.body.foo = "FAIL: document.body.foo visible in isolated world.";
27 document.body.bar = "PASS: document.body.bar visible in a callback created in this world.";
29 if (window.testRunner) {
30 testRunner.clearAllDatabases();
31 testRunner.dumpAsText();
32 testRunner.waitUntilDone();
33 testRunner.evaluateScriptInIsolatedWorld(
35 "function statementSuccessCallback1(tx, data)\n" +
36 "{\n" +
37 " alert(document.body.foo);\n" +
38 " window.location='javascript:done()';\n" +
39 "}\n" +
40 "var db1 = openDatabase('StatementSuccessCallbackIsolatedWorld1', '1.0', '', 1);\n" +
41 "db1.transaction(function(tx) {\n" +
42 " tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback1);\n" +
43 "});");
45 var db2 = openDatabase('StatementSuccessCallbackIsolatedWorld2', '1.0', '', 1);
46 db2.transaction(function(tx) {
47 tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback2);
48 });
50 </script>
51 </body>
52 </html>