diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /LayoutTests | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'LayoutTests')
44 files changed, 830 insertions, 100 deletions
diff --git a/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt b/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt index 67db8dc..9f83f8f 100644 --- a/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt +++ b/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt @@ -9,6 +9,8 @@ PASS lastEvent.type is "touchstart" PASS lastEvent.touches.length is 2 PASS lastEvent.changedTouches.length is 2 PASS lastEvent.targetTouches.length is 2 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.touches[0].pageX is 10 PASS lastEvent.touches[0].pageY is 10 PASS lastEvent.touches[0].clientX is 10 @@ -44,6 +46,8 @@ PASS lastEvent.type is "touchmove" PASS lastEvent.touches.length is 2 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 2 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.touches[0].pageX is 15 PASS lastEvent.touches[0].pageY is 15 PASS lastEvent.touches[0].clientX is 15 @@ -64,6 +68,8 @@ PASS lastEvent.type is "touchend" PASS lastEvent.touches.length is 1 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.touches[0].pageX is 20 PASS lastEvent.touches[0].pageY is 30 PASS lastEvent.touches[0].clientX is 20 @@ -84,6 +90,8 @@ PASS lastEvent.type is "touchend" PASS lastEvent.touches.length is 0 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 0 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.changedTouches[0].pageX is 20 PASS lastEvent.changedTouches[0].pageY is 30 PASS lastEvent.changedTouches[0].clientX is 20 diff --git a/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt b/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt index 634faa1..ec168cb 100644 --- a/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt +++ b/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt @@ -7,6 +7,8 @@ PASS lastEvent.type is "touchstart" PASS lastEvent.touches.length is 1 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.shiftKey is false PASS lastEvent.touches[0].target.id is "touchtarget" PASS lastEvent.touches[0].pageX is 10 @@ -28,6 +30,8 @@ PASS lastEvent.type is "touchmove" PASS lastEvent.touches.length is 1 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.touches[0].pageX is 20 PASS lastEvent.touches[0].pageY is 15 PASS lastEvent.touches[0].clientX is 20 @@ -41,6 +45,8 @@ PASS lastEvent.type is "touchend" PASS lastEvent.touches.length is 0 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 0 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.changedTouches[0].pageX is 20 PASS lastEvent.changedTouches[0].pageY is 15 PASS lastEvent.changedTouches[0].clientX is 20 @@ -52,12 +58,16 @@ PASS lastEvent.type is "touchstart" PASS lastEvent.touches.length is 1 PASS lastEvent.changedTouches.length is 1 PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 PASS lastEvent.targetTouches[0].target.tagName is "DIV" PASS lastEvent.type is "touchmove" PASS lastEvent.touches.length is 1 PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 0 -PASS lastEvent.touches[0].target.tagName is "HTML" +PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.pageX is 0 +PASS lastEvent.pageY is 0 +PASS lastEvent.touches[0].target.tagName is "DIV" PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js b/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js index abfaf90..579c073 100644 --- a/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js +++ b/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js @@ -37,6 +37,8 @@ function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchC shouldBe("lastEvent.touches.length", totalTouchCount.toString()); shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); + shouldBe("lastEvent.pageX", "0"); + shouldBe("lastEvent.pageY", "0"); } function verifyTouchPoint(list, point, x, y, id) diff --git a/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js b/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js index ca99d83..9975c87 100644 --- a/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js +++ b/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js @@ -37,6 +37,8 @@ function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchC shouldBe("lastEvent.touches.length", totalTouchCount.toString()); shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); + shouldBe("lastEvent.pageX", "0"); + shouldBe("lastEvent.pageY", "0"); } function verifyTouchPoint(list, point, x, y, id) @@ -77,8 +79,8 @@ function verifyTouch(which) { shouldBeEqualToString("lastEvent.targetTouches[0].target.tagName", "DIV"); break; case 4: - verifyTouchEvent("touchmove", 1, 1, 0); - shouldBeEqualToString("lastEvent.touches[0].target.tagName", "HTML"); + verifyTouchEvent("touchmove", 1, 1, 1); + shouldBeEqualToString("lastEvent.touches[0].target.tagName", "DIV"); break; default: testFailed("Wrong number of touch events! (" + which + ")"); diff --git a/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js b/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js index c83daa4..01eac2f 100644 --- a/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js +++ b/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js @@ -13,7 +13,6 @@ function touchcancelHandler() { shouldBe("cancelEvent.pageY", touchY.toString()); if (window.layoutTestController) { layoutTestController.notifyDone(); - isSuccessfullyParsed(); } } diff --git a/LayoutTests/fast/events/touch/script-tests/touch-target.js b/LayoutTests/fast/events/touch/script-tests/touch-target.js new file mode 100644 index 0000000..0623811 --- /dev/null +++ b/LayoutTests/fast/events/touch/script-tests/touch-target.js @@ -0,0 +1,97 @@ +var div1 = document.createElement("div"); +div1.id = "targetA"; +div1.style.width = "100px"; +div1.style.height = "100px"; +div1.style.backgroundColor = "blue"; + +var div2 = document.createElement("div"); +div2.id = "targetB"; +div2.style.width = "100px"; +div2.style.height = "100px"; +div2.style.backgroundColor = "green"; + +var touchStartCount = 0; +var touchMoveCount = 0; + +document.getElementById('targetsDiv').appendChild(div1); +document.getElementById('targetsDiv').appendChild(document.createElement('br')); +document.getElementById('targetsDiv').appendChild(div2); + +function touchStartHandler() +{ + shouldBeEqualToString('event.type', 'touchstart'); + switch (touchStartCount) { + case 0: + shouldBeEqualToString('event.touches[0].target.id', div1.id); + shouldBeEqualToString('event.touches[1].target.id', div2.id); + break; + case 1: + shouldBeEqualToString('event.touches[0].target.id', div2.id); + shouldBeEqualToString('event.touches[1].target.id', div1.id); + break; + } + + touchStartCount++; +} + +function touchMoveHandler() +{ + shouldBeEqualToString('event.type', 'touchmove'); + switch (touchMoveCount) { + case 0: + case 1: + shouldBeEqualToString('event.touches[0].target.id', div1.id); + shouldBeEqualToString('event.touches[1].target.id', div2.id); + break; + case 2: + shouldBeEqualToString('event.touches[0].target.id', div2.id); + shouldBeEqualToString('event.touches[1].target.id', div1.id); + break; + } + + if (++touchMoveCount == 3) + { + successfullyParsed = true; + layoutTestController.notifyDone(); + isSuccessfullyParsed(); + } +} + +div1.addEventListener("touchstart", touchStartHandler, false); +div1.addEventListener("touchmove", touchMoveHandler, false); + +div2.addEventListener("touchstart", touchStartHandler, false); +div2.addEventListener("touchmove", touchMoveHandler, false); + +description("Tests that the target of touches match the element where the event originated, not where the touch is currently occurring."); + +if (window.layoutTestController) { + layoutTestController.waitUntilDone(); +} + +if (window.eventSender) { + eventSender.clearTouchPoints(); + eventSender.addTouchPoint(50, 150); + eventSender.addTouchPoint(50, 250); + eventSender.touchStart(); + + eventSender.updateTouchPoint(0, 50, 250); + eventSender.updateTouchPoint(1, 50, 150); + eventSender.touchMove(); + + eventSender.updateTouchPoint(0, 1000, 1000); + eventSender.updateTouchPoint(1, 1000, 1000); + eventSender.touchMove(); + + eventSender.releaseTouchPoint(0); + eventSender.touchEnd(); + + eventSender.addTouchPoint(50,150); + eventSender.touchStart(); + + eventSender.updateTouchPoint(0, 500, 500); + eventSender.updateTouchPoint(1, 500, 500); + eventSender.touchMove(); +} else + debug('This test requires DRT.'); + diff --git a/LayoutTests/fast/events/touch/touch-target-expected.txt b/LayoutTests/fast/events/touch/touch-target-expected.txt new file mode 100644 index 0000000..60a4c37 --- /dev/null +++ b/LayoutTests/fast/events/touch/touch-target-expected.txt @@ -0,0 +1,25 @@ +Tests that the target of touches match the element where the event originated, not where the touch is currently occurring. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + + +PASS event.type is "touchstart" +PASS event.touches[0].target.id is "targetA" +PASS event.touches[1].target.id is "targetB" +PASS event.type is "touchmove" +PASS event.touches[0].target.id is "targetA" +PASS event.touches[1].target.id is "targetB" +PASS event.type is "touchmove" +PASS event.touches[0].target.id is "targetA" +PASS event.touches[1].target.id is "targetB" +PASS event.type is "touchstart" +PASS event.touches[0].target.id is "targetB" +PASS event.touches[1].target.id is "targetA" +PASS event.type is "touchmove" +PASS event.touches[0].target.id is "targetB" +PASS event.touches[1].target.id is "targetA" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/events/touch/touch-target.html b/LayoutTests/fast/events/touch/touch-target.html new file mode 100644 index 0000000..dfd8dab --- /dev/null +++ b/LayoutTests/fast/events/touch/touch-target.html @@ -0,0 +1,14 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +<script src="../../js/resources/js-test-post-function.js"></script> +</head> +<body> +<p id="description"></p> +<div id="targetsDiv"></div> +<div id="console"></div> +<script src="script-tests/touch-target.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js b/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js index 880aed4..eb01411 100644 --- a/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js +++ b/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js @@ -39,6 +39,9 @@ descriptorShouldBe("Math.sin", "'length'", {writable: false, enumerable: false, descriptorShouldBe("Math.sin", "'name'", {writable: false, enumerable: false, configurable: false, value:"'sin'"}); var global = this; descriptorShouldBe("global", "'global'", {writable: true, enumerable: true, configurable: false, value:"global"}); +descriptorShouldBe("global", "'undefined'", {writable: false, enumerable: false, configurable: false, value:"undefined"}); +descriptorShouldBe("global", "'NaN'", {writable: false, enumerable: false, configurable: false, value:"NaN"}); +descriptorShouldBe("global", "'Infinity'", {writable: false, enumerable: false, configurable: false, value:"Infinity"}); descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, configurable: false, value:"global"}); descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: true, configurable: false, value:"XMLHttpRequest"}); descriptorShouldBe("global", "'length'", {writable: true, enumerable: true, configurable: false, value:"global.length"}); diff --git a/LayoutTests/fast/js/resources/js-test-post-async.js b/LayoutTests/fast/js/resources/js-test-post-async.js new file mode 100644 index 0000000..76777aa --- /dev/null +++ b/LayoutTests/fast/js/resources/js-test-post-async.js @@ -0,0 +1,5 @@ +shouldBeTrue("successfullyParsed"); +debug('<br /><span class="pass">TEST COMPLETE</span>'); + +if (window.layoutTestController) + layoutTestController.notifyDone(); diff --git a/LayoutTests/fast/js/resources/js-test-post.js b/LayoutTests/fast/js/resources/js-test-post.js index 6d8a68f..88882c5 100644 --- a/LayoutTests/fast/js/resources/js-test-post.js +++ b/LayoutTests/fast/js/resources/js-test-post.js @@ -1,2 +1,13 @@ -shouldBeTrue("successfullyParsed"); -debug('<br /><span class="pass">TEST COMPLETE</span>'); +function finishJSTest() +{ + shouldBeTrue("successfullyParsed"); + debug('<br /><span class="pass">TEST COMPLETE</span>'); + if (window.jsTestIsAsync && window.layoutTestController) + layoutTestController.notifyDone(); +} + +if (window.jsTestIsAsync) { + if (window.layoutTestController) + layoutTestController.waitUntilDone(); +} else + finishJSTest(); diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js index b91812f..ecf5fd0 100644 --- a/LayoutTests/fast/js/resources/js-test-pre.js +++ b/LayoutTests/fast/js/resources/js-test-pre.js @@ -37,11 +37,15 @@ function testFailed(msg) function areArraysEqual(_a, _b) { - if (_a.length !== _b.length) - return false; - for (var i = 0; i < _a.length; i++) - if (_a[i] !== _b[i]) + try { + if (_a.length !== _b.length) return false; + for (var i = 0; i < _a.length; i++) + if (_a[i] !== _b[i]) + return false; + } catch (ex) { + return false; + } return true; } @@ -118,7 +122,7 @@ function shouldBeNull(_a) { shouldBe(_a, "null"); } function shouldBeEqualToString(a, b) { - var unevaledString = '"' + b.replace(/"/g, "\"") + '"'; + var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"") + '"'; shouldBe(a, unevaledString); } diff --git a/LayoutTests/http/conf/apache2-debian-httpd.conf b/LayoutTests/http/conf/apache2-debian-httpd.conf index 03aa9c8..b8918db 100644 --- a/LayoutTests/http/conf/apache2-debian-httpd.conf +++ b/LayoutTests/http/conf/apache2-debian-httpd.conf @@ -163,6 +163,16 @@ MaxRequestsPerChild 100000 #Listen 3000 Listen 127.0.0.1:8080 Listen 127.0.0.1:8443 +# We listen to both IPv4 and IPv6 loop-back addresses, but ignore +# requests to 8000 from random users on network. +# See https://bugs.webkit.org/show_bug.cgi?id=37104 +# FIXME: This breaks the GTK-Debug and Chromium-Linux bots. +# Starting up apache fails on this line with a syntax error. +# Need a way to detect if the machine supports ipv6 and then +# only do this binding in that case. +#Listen [::1]:8000 +#Listen [::1]:8080 +#Listen [::1]:8443 # # Dynamic Shared Object (DSO) Support diff --git a/LayoutTests/http/conf/apache2-httpd.conf b/LayoutTests/http/conf/apache2-httpd.conf index 980e4e2..e915fa7 100644 --- a/LayoutTests/http/conf/apache2-httpd.conf +++ b/LayoutTests/http/conf/apache2-httpd.conf @@ -163,6 +163,12 @@ MaxRequestsPerChild 100000 #Listen 3000 Listen 127.0.0.1:8080 Listen 127.0.0.1:8443 +# We listen to both IPv4 and IPv6 loop-back addresses, but ignore +# requests to 8000 from random users on network. +# See https://bugs.webkit.org/show_bug.cgi?id=37104 +Listen [::1]:8000 +Listen [::1]:8080 +Listen [::1]:8443 # # Dynamic Shared Object (DSO) Support diff --git a/LayoutTests/http/conf/cygwin-httpd.conf b/LayoutTests/http/conf/cygwin-httpd.conf index a79ed39..1651912 100644 --- a/LayoutTests/http/conf/cygwin-httpd.conf +++ b/LayoutTests/http/conf/cygwin-httpd.conf @@ -179,6 +179,10 @@ MaxRequestsPerChild 100000 # #Listen 3000 Listen 127.0.0.1:8080 +# Apache 1.3 only supports IPv4, so we do not listen on ::1 (IPv6 loopback). +# This may cause flaky tests on systems which support IPv6 if localhost resolves +# to ::1 in addition to 127.0.0.1. +# See https://bugs.webkit.org/show_bug.cgi?id=37104 # # Dynamic Shared Object (DSO) Support diff --git a/LayoutTests/http/conf/fedora-httpd.conf b/LayoutTests/http/conf/fedora-httpd.conf index cd71d88..62100c8 100644 --- a/LayoutTests/http/conf/fedora-httpd.conf +++ b/LayoutTests/http/conf/fedora-httpd.conf @@ -138,6 +138,12 @@ MaxRequestsPerChild 100000 #Listen 12.34.56.78:80 Listen 127.0.0.1:8080 Listen 127.0.0.1:8443 +# We listen to both IPv4 and IPv6 loop-back addresses, but ignore +# requests to 8000 from random users on network. +# See https://bugs.webkit.org/show_bug.cgi?id=37104 +Listen [::1]:8000 +Listen [::1]:8080 +Listen [::1]:8443 # # Dynamic Shared Object (DSO) Support diff --git a/LayoutTests/http/conf/httpd.conf b/LayoutTests/http/conf/httpd.conf index ec04c73..6e6157c 100644 --- a/LayoutTests/http/conf/httpd.conf +++ b/LayoutTests/http/conf/httpd.conf @@ -181,6 +181,10 @@ MaxRequestsPerChild 100000 #Listen 3000 Listen 127.0.0.1:8080 Listen 127.0.0.1:8443 +# Apache 1.3 only supports IPv4, so we do not listen on ::1 (IPv6 loopback). +# This may cause flaky tests on systems which support IPv6 if localhost resolves +# to ::1 in addition to 127.0.0.1. +# See https://bugs.webkit.org/show_bug.cgi?id=37104 # # Dynamic Shared Object (DSO) Support diff --git a/LayoutTests/http/conf/mime.types b/LayoutTests/http/conf/mime.types index cfb9d53..0489350 100644 --- a/LayoutTests/http/conf/mime.types +++ b/LayoutTests/http/conf/mime.types @@ -324,6 +324,7 @@ application/vnd.vividence.scriptfile application/vnd.vsf application/vnd.wap.sic application/vnd.wap.slc +application/vnd.wap.xhtml+xml xhtmlmp application/vnd.wap.wbxml wbxml application/vnd.wap.wmlc wmlc application/vnd.wap.wmlscriptc wmlsc diff --git a/LayoutTests/http/tests/appcache/top-frame-2-expected.txt b/LayoutTests/http/tests/appcache/top-frame-2-expected.txt index 6e99bb6..41a3fe0 100644 --- a/LayoutTests/http/tests/appcache/top-frame-2-expected.txt +++ b/LayoutTests/http/tests/appcache/top-frame-2-expected.txt @@ -2,6 +2,5 @@ Test that a subframe without manifest gets picked by a relevant application cach Should say SUCCESS: -checking SUCCESS diff --git a/LayoutTests/http/tests/appcache/top-frame-2.html b/LayoutTests/http/tests/appcache/top-frame-2.html index c239d08..71bd468 100644 --- a/LayoutTests/http/tests/appcache/top-frame-2.html +++ b/LayoutTests/http/tests/appcache/top-frame-2.html @@ -16,13 +16,34 @@ function log(message) document.getElementById("result").innerHTML += message + "<br>"; } +function debug(message) +{ + // If running manually in the browser, print the sequence of events. + if (!window.layoutTestController) + log(message); +} + +var receivedExpectedMessage = false; +var receivedCheckingEvent = false; +var receivedNoupdateEvent = false; + +function checkDone() +{ + if (receivedExpectedMessage && receivedCheckingEvent && receivedNoupdateEvent) { + log("SUCCESS"); + if (window.layoutTestController) + layoutTestController.notifyDone(); + } +} + function test() { applicationCache.onnoupdate = null; applicationCache.oncached = null; // When a new main resource is associated with the cache, an update should be started. - applicationCache.onchecking = function() { log("checking") } + applicationCache.onchecking = function() { debug("checking"); receivedCheckingEvent = true; checkDone(); } + applicationCache.onnoupdate = function() { debug("noupdate"); receivedNoupdateEvent = true; checkDone(); } var ifr = document.createElement("iframe"); ifr.setAttribute("src", "resources/subframe-2.html"); @@ -35,7 +56,7 @@ applicationCache.oncached = function() { test() } applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") } applicationCache.onerror = function() { log("FAIL: received unexpected error event") } -window.addEventListener("message", function() { log("SUCCESS"); if (window.layoutTestController) layoutTestController.notifyDone() }, false); +window.addEventListener("message", function() { debug("message"); receivedExpectedMessage = true; checkDone(); }, false); </script> </body> diff --git a/LayoutTests/http/tests/appcache/top-frame-3-expected.txt b/LayoutTests/http/tests/appcache/top-frame-3-expected.txt index a10dbee..a1245cb 100644 --- a/LayoutTests/http/tests/appcache/top-frame-3-expected.txt +++ b/LayoutTests/http/tests/appcache/top-frame-3-expected.txt @@ -4,7 +4,5 @@ In this case, the subframe resource is NOT listed in manifest explicitly. Should say SUCCESS: -checking -checking SUCCESS diff --git a/LayoutTests/http/tests/appcache/top-frame-3.html b/LayoutTests/http/tests/appcache/top-frame-3.html index 9fc9dde..a2d2cc6 100644 --- a/LayoutTests/http/tests/appcache/top-frame-3.html +++ b/LayoutTests/http/tests/appcache/top-frame-3.html @@ -16,13 +16,34 @@ function log(message) document.getElementById("result").innerHTML += message + "<br>"; } +function debug(message) +{ + // If running manually in the browser, print the sequence of events. + if (!window.layoutTestController) + log(message); +} + +var receivedExpectedMessage = false; +var receivedCheckingEventsCounter = 0; +var receivedNoupdateEventsCounter = 0; + +function checkDone() +{ + if (receivedExpectedMessage && receivedCheckingEventsCounter == 2 && receivedNoupdateEventsCounter == 2) { + log("SUCCESS"); + if (window.layoutTestController) + layoutTestController.notifyDone(); + } +} + function test() { applicationCache.onnoupdate = null; applicationCache.oncached = null; // When a new main resource is associated with the cache, an update should be started. - applicationCache.onchecking = function() { log("checking") } + applicationCache.onchecking = function() { debug("checking"); receivedCheckingEventsCounter++; checkDone() } + applicationCache.onnoupdate = function() { debug("noupdate"); receivedNoupdateEventsCounter++; checkDone(); } var ifr = document.createElement("iframe"); ifr.setAttribute("src", "resources/subframe-3.html"); @@ -42,9 +63,9 @@ function test2() function test3() { - log("SUCCESS"); - if (window.layoutTestController) - layoutTestController.notifyDone(); + debug("message"); + receivedExpectedMessage = true; + checkDone(); } applicationCache.onnoupdate = function() { test() } diff --git a/LayoutTests/http/tests/appcache/top-frame-4-expected.txt b/LayoutTests/http/tests/appcache/top-frame-4-expected.txt index 43bfd43..e748160 100644 --- a/LayoutTests/http/tests/appcache/top-frame-4-expected.txt +++ b/LayoutTests/http/tests/appcache/top-frame-4-expected.txt @@ -4,7 +4,5 @@ In this case, the subframe resource is listed in manifest explicitly. Should say SUCCESS: -checking -checking SUCCESS diff --git a/LayoutTests/http/tests/appcache/top-frame-4.html b/LayoutTests/http/tests/appcache/top-frame-4.html index 39743b9..c36e0a3 100644 --- a/LayoutTests/http/tests/appcache/top-frame-4.html +++ b/LayoutTests/http/tests/appcache/top-frame-4.html @@ -16,13 +16,34 @@ function log(message) document.getElementById("result").innerHTML += message + "<br>"; } +function debug(message) +{ + // If running manually in the browser, print the sequence of events. + if (!window.layoutTestController) + log(message); +} + +var receivedExpectedMessage = false; +var receivedCheckingEventsCounter = 0; +var receivedNoupdateEventsCounter = 0; + +function checkDone() +{ + if (receivedExpectedMessage && receivedCheckingEventsCounter == 2 && receivedNoupdateEventsCounter == 2) { + log("SUCCESS"); + if (window.layoutTestController) + layoutTestController.notifyDone(); + } +} + function test() { applicationCache.onnoupdate = null; applicationCache.oncached = null; // When a new main resource is associated with the cache, an update should be started. - applicationCache.onchecking = function() { log("checking") } + applicationCache.onchecking = function() { debug("checking"); receivedCheckingEventsCounter++; checkDone() } + applicationCache.onnoupdate = function() { debug("noupdate"); receivedNoupdateEventsCounter++; checkDone(); } var ifr = document.createElement("iframe"); ifr.setAttribute("src", "resources/subframe-4.html"); @@ -42,9 +63,9 @@ function test2() function test3() { - log("SUCCESS"); - if (window.layoutTestController) - layoutTestController.notifyDone(); + debug("message"); + receivedExpectedMessage = true; + checkDone(); } applicationCache.onnoupdate = function() { test() } diff --git a/LayoutTests/storage/database-lock-after-reload.html b/LayoutTests/storage/database-lock-after-reload.html index 8bdaddc..5b5989f 100644 --- a/LayoutTests/storage/database-lock-after-reload.html +++ b/LayoutTests/storage/database-lock-after-reload.html @@ -1,8 +1,6 @@ <html> <head> <script> -var database; - function log(message) { document.getElementById("console").innerHTML += message + "<br>"; @@ -15,7 +13,7 @@ function finishTest() layoutTestController.notifyDone(); } -function errorFunction(tx, error) +function errorFunction(error) { log("Test failed - " + error.message); finishTest(); @@ -23,16 +21,16 @@ function errorFunction(tx, error) function addData(db) { - db.transaction(function(tx) { + db.transaction(function(tx) { log("Inserting some data"); - // Insert a large amount of data that will take a little while to run. Schedule a timout to run that will load a new page - // whilst the transaction is still in progress, interrupting the transaction. This should not leave the database locked and on - // the next page we should be able to insert some more data. - tx.executeSql("INSERT INTO DataTest (testData) VALUES (ZEROBLOB(524200))", [], function(tx, result) { }, errorFunction); - location.href = "./resources/database-lock-after-reload-2.html"; - }, errorFunction, function() { - finishTest(); - }); + // Load a new page while the transaction is still in progress, interrupting the transaction. + // This should not leave the database locked and on the next page we should be able to insert + // some more data. + tx.executeSql("INSERT INTO DataTest (testData) VALUES (ZEROBLOB(524200))", [], + function(tx, result) { location.href = "./resources/database-lock-after-reload-2.html"; }, + function(tx, error) { errorFunction(error); }); + tx.executeSql("INSERT INTO DataTest (testData) VALUES (ZEROBLOB(524200))"); + }, errorFunction, function() { finishTest(); }); } function runTest() @@ -42,20 +40,20 @@ function runTest() layoutTestController.dumpAsText(); layoutTestController.waitUntilDone(); } - + + var database; try { database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880); } catch (e) { log("Error - could not open database"); finishTest(); } - + database.transaction(function(tx) { log("Adding a table"); - tx.executeSql("CREATE TABLE DataTest (testData)", [], function(tx, result) { }, errorFunction); - }, errorFunction, function() { - addData(database); - }); + tx.executeSql("CREATE TABLE DataTest (testData)", [], function(tx, result) { }, + function(tx, error) { errorFunction(error); }); + }, errorFunction, function() { addData(database); }); } </script> diff --git a/LayoutTests/storage/executesql-accepts-only-one-statement-expected.txt b/LayoutTests/storage/executesql-accepts-only-one-statement-expected.txt new file mode 100644 index 0000000..b95ceee --- /dev/null +++ b/LayoutTests/storage/executesql-accepts-only-one-statement-expected.txt @@ -0,0 +1,3 @@ +This test tests that executeSql() fails when called with a string that has more than one valid statement in it. +Test passed. + diff --git a/LayoutTests/storage/executesql-accepts-only-one-statement.html b/LayoutTests/storage/executesql-accepts-only-one-statement.html new file mode 100644 index 0000000..a3860c8 --- /dev/null +++ b/LayoutTests/storage/executesql-accepts-only-one-statement.html @@ -0,0 +1,78 @@ +<html> +<head> +<script> + +var TOTAL_STATEMENTS = 8; +var statements = 0; +var db = null; + +function log(message) +{ + document.body.innerText += message + "\n"; +} + +function terminateTest() +{ + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +function executeStatement(expectedToPass, statement) +{ + db.transaction(function(tx) { + tx.executeSql(statement, [], + function(tx, data) { + if (!expectedToPass) { + log("Statement " + statement + " was expected to fail, but passed."); + terminateTest(); + } + if (++statements == TOTAL_STATEMENTS) { + log("Test passed."); + terminateTest(); + } + }, function(tx, error) { + if (expectedToPass) { + log("Statement " + statement + " was expected to pass, but failed."); + terminateTest(); + } + if (++statements == TOTAL_STATEMENTS) { + log("Test passed."); + terminateTest(); + } + }); + }); +} + +function runTest() +{ + if (window.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + } + + db = openDatabase("ExecuteSQLAcceptsOnlyOneStatementTest", "1.0", "", 1); + db.transaction(function(tx) { + tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)"); + }, function(error) { + log("Test failed: " + error.message); + terminateTest(); + }, function() { + executeStatement(true, "INSERT INTO Test VALUES (1)"); + executeStatement(true, "INSERT INTO Test VALUES (2);"); + executeStatement(true, " INSERT INTO Test VALUES (3) "); + executeStatement(true, " INSERT INTO Test VALUES (4); "); + executeStatement(true, "INSERT INTO Test VALUES (5) ;"); + executeStatement(false, "INSERT INTO Test VALUES (6); garbage"); + executeStatement(false, "INSERT INTO Test VALUES (7); INSERT INTO Test VALUES (8)"); + executeStatement(false, " INSERT INTO Test VALUES (9); INSERT INTO Test VALUES (10); "); + }); +} + +</script> +</head> +<body onload="runTest();"> +This test tests that executeSql() fails when called with a string that has more than one valid statement in it.<br> +</body> +</body> +</html> diff --git a/LayoutTests/storage/open-database-creation-callback-expected.txt b/LayoutTests/storage/open-database-creation-callback-expected.txt new file mode 100644 index 0000000..d86ab72 --- /dev/null +++ b/LayoutTests/storage/open-database-creation-callback-expected.txt @@ -0,0 +1,2 @@ +This test tests openDatabase()'s creation callback. + diff --git a/LayoutTests/storage/open-database-creation-callback-isolated-world-expected.txt b/LayoutTests/storage/open-database-creation-callback-isolated-world-expected.txt new file mode 100644 index 0000000..fa96a67 --- /dev/null +++ b/LayoutTests/storage/open-database-creation-callback-isolated-world-expected.txt @@ -0,0 +1,4 @@ +ALERT: undefined +ALERT: PASS: document.body.bar visible in a callback created in this world. +This test tests that the openDatabase() creation callback is called in the right world. + diff --git a/LayoutTests/storage/open-database-creation-callback-isolated-world.html b/LayoutTests/storage/open-database-creation-callback-isolated-world.html new file mode 100644 index 0000000..98a4664 --- /dev/null +++ b/LayoutTests/storage/open-database-creation-callback-isolated-world.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html> +<body> +This test tests that the openDatabase() creation callback is called in the right world. +<div id="console"></div> +<script> +var creationCallbacksExecuted = 0; +function done() +{ + if ((++creationCallbacksExecuted == 2) && (window.layoutTestController)) + layoutTestController.notifyDone(); +} + +function creationCallback1(db) +{ + alert("FAIL: Visible in isolated world."); + done(); +} + +function creationCallback2(db) +{ + 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.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + layoutTestController.evaluateScriptInIsolatedWorld( + 0, + "function creationCallback1(db)\n" + + "{\n" + + " alert(document.body.foo);\n" + + " window.location='javascript:done()';\n" + + "}\n" + + "var db1 = openDatabase('OpenDatabaseCreationCallbackIsolatedWorld', '1.0', '', 1, creationCallback1);"); + + var db2 = openDatabase('OpenDatabaseCreationCallbackIsolatedWorld2', '1.0', '', 1, creationCallback2); +} +</script> +</body> +</html> diff --git a/LayoutTests/storage/open-database-creation-callback.html b/LayoutTests/storage/open-database-creation-callback.html new file mode 100644 index 0000000..ac24942 --- /dev/null +++ b/LayoutTests/storage/open-database-creation-callback.html @@ -0,0 +1,90 @@ +<html> +<head> +<script> +function log(message) +{ + document.getElementById("console").innerHTML += message + "<br>"; +} + +function finishTest() +{ + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +function runTest() +{ + if (window.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.setDatabaseQuota(32768); + layoutTestController.dumpDatabaseCallbacks(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + } + + var transactionsRun = 0; + + // Open a new database with a creation callback, and make sure the creation callback is queued + var creationCallbackCalled1 = false; + var db1 = openDatabase("OpenDatabaseCreationCallback1", "1.0", "", 1, + function(db) { + creationCallbackCalled1 = true; + if (db.version != "") { + log("Creation callback was called with a database with version " + + db.version + "; empty string expected."); + finishTest(); + } + }); + + // Putting this code inside a transaction on 'db1' makes sure that it is executed after + // the creation callback is. + db1.transaction(function(tx) { + if (!creationCallbackCalled1) { + log("Creation callback for db1 was not called."); + finishTest(); + } + if (++transactionsRun == 2) + finishTest(); + }); + + // Try to open another handle to the same database. + // Since the version of this database is "" (empty string), openDatabase() should return + // a null handle and throw a INVALID_STATE_ERR exception. + var db1Fail = null; + try { + db1Fail = openDatabase("OpenDatabaseCreationCallback1", "1.0", "", 1); + log("This statement should not have been executed; an INVALID_STATE_ERR exception should've been thrown."); + finishTest(); + } catch(err) { + if (db1Fail) { + log("db1Fail should have been null."); + finishTest(); + } + } + + // Open a handle to another database, first without a creation callback, then with one. + // Make sure the creation callback is not called. + var creationCallbackCalled2 = false; + var db2 = openDatabase("OpenDatabaseCreationCallback2", "1.0", "", 1); + db2 = openDatabase("OpenDatabaseCreationCallback2", "1.0", "", 1, + function(db) { creationCallbackCalled2 = true; }); + db2.transaction(function(tx) { + if (creationCallbackCalled2) { + log("Creation callback for db2 should not have been called."); + finishTest(); + } + if (++transactionsRun == 2) + finishTest(); + }); +} + +</script> +</head> + +<body onload="runTest()"> +This test tests openDatabase()'s creation callback. +<pre id="console"> +</pre> +</body> + +</html> diff --git a/LayoutTests/storage/open-database-over-quota-expected.txt b/LayoutTests/storage/open-database-over-quota-expected.txt new file mode 100644 index 0000000..d0c15e4 --- /dev/null +++ b/LayoutTests/storage/open-database-over-quota-expected.txt @@ -0,0 +1,2 @@ +This tests that calling openDatabase with a size over 5MB doesn't assert on debug builds. +PASS diff --git a/LayoutTests/storage/open-database-over-quota.html b/LayoutTests/storage/open-database-over-quota.html new file mode 100644 index 0000000..2a9264d --- /dev/null +++ b/LayoutTests/storage/open-database-over-quota.html @@ -0,0 +1,24 @@ +<html> +<head> +<script> +function runTest() { + if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.clearAllDatabases(); + } + + try { + var db = openDatabase('OverQuotaOpen', '', 'Test for bug 36473: missing lock in call to doneCreatingDatabase', 10000000); + } catch (err) { + document.getElementById('result').innerHTML = 'PASS' + } +} +</script> +</head> +<body onload="runTest()"> +<div>This tests that calling openDatabase with a size over 5MB doesn't assert on debug builds. +<div id="result"> +FAIL: We shouldn't have been able to open the database. +</div> +</body> +</html> diff --git a/LayoutTests/storage/resources/database-lock-after-reload-2.html b/LayoutTests/storage/resources/database-lock-after-reload-2.html index d73a0df..6e0f09c 100644 --- a/LayoutTests/storage/resources/database-lock-after-reload-2.html +++ b/LayoutTests/storage/resources/database-lock-after-reload-2.html @@ -1,8 +1,6 @@ <html> <head> <script> -var database; - function log(message) { document.getElementById("console").innerHTML += message + "<br>"; @@ -15,7 +13,7 @@ function finishTest() layoutTestController.notifyDone(); } -function errorFunction(tx, error) +function errorFunction(error) { log("Test failed - " + error.message); finishTest(); @@ -23,13 +21,11 @@ function errorFunction(tx, error) function addData(db) { - db.transaction(function(tx) { + db.transaction(function(tx) { log("Inserting some data"); - - tx.executeSql("INSERT INTO DataTest (testData) VALUES (?)", ["A"], function(tx, result) { }, errorFunction); - }, function(){}, function() { - finishTest(); - }); + tx.executeSql("INSERT INTO DataTest (testData) VALUES (?)", ["A"], + function(tx, result) { }, function(tx, error) { errorFunction(error); }); + }, function() { }, function() { finishTest(); }); } function runTest() @@ -38,9 +34,9 @@ function runTest() layoutTestController.dumpAsText(); layoutTestController.waitUntilDone(); } - + try { - database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880); + var database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880); addData(database); } catch(e) { log("Error - could not open database"); diff --git a/LayoutTests/storage/statement-error-callback-expected.txt b/LayoutTests/storage/statement-error-callback-expected.txt index 791dfb6..6b65683 100644 --- a/LayoutTests/storage/statement-error-callback-expected.txt +++ b/LayoutTests/storage/statement-error-callback-expected.txt @@ -6,6 +6,9 @@ PASS - the transaction error callback was invoked. PASS - the transaction error callback was invoked. PASS - the transaction error callback was invoked. PASS - the transaction error callback was invoked. -PASS - the transaction error callback was invoked. +PASS - the transaction success callback was invoked. +PASS - the transaction success callback was invoked. +PASS - the transaction success callback was invoked. +PASS - the transaction success callback was invoked. Test Complete diff --git a/LayoutTests/storage/statement-error-callback-isolated-world-expected.txt b/LayoutTests/storage/statement-error-callback-isolated-world-expected.txt new file mode 100644 index 0000000..b376896 --- /dev/null +++ b/LayoutTests/storage/statement-error-callback-isolated-world-expected.txt @@ -0,0 +1,4 @@ +ALERT: undefined +ALERT: PASS: document.body.bar visible in a callback created in this world. +This test tests that the statement error callback is called in the right world. + diff --git a/LayoutTests/storage/statement-error-callback-isolated-world.html b/LayoutTests/storage/statement-error-callback-isolated-world.html new file mode 100644 index 0000000..196e42b --- /dev/null +++ b/LayoutTests/storage/statement-error-callback-isolated-world.html @@ -0,0 +1,52 @@ +<!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.layoutTestController)) + layoutTestController.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.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + layoutTestController.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> diff --git a/LayoutTests/storage/statement-error-callback.html b/LayoutTests/storage/statement-error-callback.html index 060a881..6db836d 100644 --- a/LayoutTests/storage/statement-error-callback.html +++ b/LayoutTests/storage/statement-error-callback.html @@ -15,37 +15,42 @@ function finishTest() } var txCallbackCount = 0; -var NUMBER_OF_TRANSACTIONS = 7; +var NUMBER_OF_TRANSACTIONS = 10; var database; -function transactionErrorFunction(error) -{ - log("PASS - the transaction error callback was invoked."); - if (++txCallbackCount == NUMBER_OF_TRANSACTIONS) - finishTest(); -} - -function transactionSuccessFunction(message) -{ - log("FAIL - the transaction success callback should not be invoked."); - if (++txCallbackCount == NUMBER_OF_TRANSACTIONS) - finishTest(); -} - -function runTransactionExpectedToFail(statementErrorCallback) +function runTransaction(expectedToFail, statementErrorCallback) { database.transaction(function(tx) { - tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)"); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); + tx.executeSql("CREATE TABLE IF NOT EXISTS TestTable (RandomData TEXT)"); + tx.executeSql("INSERT INTO TestTable VALUES (?)", ['test']); tx.executeSql("THIS STATEMENT WILL FAIL", [], function(tx, data) { log("FAIL - this statement should have failed"); finishTest(); }, statementErrorCallback); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], - function(error) { log("FAIL - This statement should not have been executed"); }, - function() { log("FAIL - This statement should not have been executed"); }); - }, transactionErrorFunction, transactionSuccessFunction); + tx.executeSql("INSERT INTO TestTable VALUES (?)", ['test1'], + function(error) { + if (expectedToFail) + log("FAIL - This statement should not have been executed"); + }, function() { + if (expectedToFail) + log("FAIL - This statement should not have been executed"); + }); + }, function(error) { + if (expectedToFail) + log("PASS - the transaction error callback was invoked."); + else + log("FAIL - the transaction error callback should not have been invoked."); + if (++txCallbackCount == NUMBER_OF_TRANSACTIONS) + finishTest(); + }, function() { + if (expectedToFail) + log("FAIL - the transaction success callback should not have been invoked."); + else + log("PASS - the transaction success callback was invoked."); + if (++txCallbackCount == NUMBER_OF_TRANSACTIONS) + finishTest(); + }); } function runTest() @@ -56,28 +61,18 @@ function runTest() layoutTestController.waitUntilDone(); } - database = openDatabase("bug-28872", "1.0", "statement error callback test", 1024); - database.transaction(function(tx) { - tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)"); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); - tx.executeSql("THIS STATEMENT WILL FAIL", [], - function(tx, data) { - log("FAIL - this statement should have failed"); - finishTest(); - }, function(tx, error) { return false; }); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], - function(tx, data) { }, - function(tx, error) { log("FAIL - This statement should not have caused an error"); }); - }, function(error) { log("FAIL - The transaction error callback should not have been invoked"); }, - function() { }); + database = openDatabase("StatementErrorCallbackTest", "1.0", "statement error callback test", 1024); - runTransactionExpectedToFail(function(error) { return true; }); - runTransactionExpectedToFail(function(error) { throw "Exception in statement error callback"; return false; }); - runTransactionExpectedToFail(function(error) {}); - runTransactionExpectedToFail(function(error) { return null; }); - runTransactionExpectedToFail(function(error) { return "some string"; }); - runTransactionExpectedToFail(function(error) { return 1234; }); - runTransactionExpectedToFail(function(error) { return {a: 2, b: "abc"}; }); + runTransaction(true, function(error) { return true; }); + runTransaction(true, function(error) { throw "Exception in statement error callback"; return false; }); + runTransaction(true, function(error) { return "some string"; }); + runTransaction(true, function(error) { return 1234; }); + runTransaction(true, function(error) { return {a: 2, b: "abc"}; }); + runTransaction(true, function(error) { return "false"; }); + runTransaction(false, function(error) {}); + runTransaction(false, function(error) { return false; }); + runTransaction(false, function(error) { return 0; }); + runTransaction(false, function(error) { return null; }); } </script> diff --git a/LayoutTests/storage/statement-success-callback-isolated-world-expected.txt b/LayoutTests/storage/statement-success-callback-isolated-world-expected.txt new file mode 100644 index 0000000..2ef027d --- /dev/null +++ b/LayoutTests/storage/statement-success-callback-isolated-world-expected.txt @@ -0,0 +1,4 @@ +ALERT: undefined +ALERT: PASS: document.body.bar visible in a callback created in this world. +This test tests that the statement success callback is called in the right world. + diff --git a/LayoutTests/storage/statement-success-callback-isolated-world.html b/LayoutTests/storage/statement-success-callback-isolated-world.html new file mode 100644 index 0000000..4fac754 --- /dev/null +++ b/LayoutTests/storage/statement-success-callback-isolated-world.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html> +<body> +This test tests that the statement success callback is called in the right world. +<div id="console"></div> +<script> +var statementSuccessCallbacksInvoked = 0; +function done() +{ + if ((++statementSuccessCallbacksInvoked == 2) && (window.layoutTestController)) + layoutTestController.notifyDone(); +} + +function statementSuccessCallback1(tx, data) +{ + alert("FAIL: Visible in isolated world."); + done(); +} + +function statementSuccessCallback2(tx, data) +{ + 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.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + layoutTestController.evaluateScriptInIsolatedWorld( + 0, + "function statementSuccessCallback1(tx, data)\n" + + "{\n" + + " alert(document.body.foo);\n" + + " window.location='javascript:done()';\n" + + "}\n" + + "var db1 = openDatabase('StatementSuccessCallbackIsolatedWorld1', '1.0', '', 1);\n" + + "db1.transaction(function(tx) {\n" + + " tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback1);\n" + + "});"); + + var db2 = openDatabase('StatementSuccessCallbackIsolatedWorld2', '1.0', '', 1); + db2.transaction(function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback2); + }); +} +</script> +</body> +</html> diff --git a/LayoutTests/storage/transaction-callback-isolated-world-expected.txt b/LayoutTests/storage/transaction-callback-isolated-world-expected.txt new file mode 100644 index 0000000..27f474f --- /dev/null +++ b/LayoutTests/storage/transaction-callback-isolated-world-expected.txt @@ -0,0 +1,4 @@ +ALERT: undefined +ALERT: PASS: document.body.bar visible in a callback created in this world. +This test tests that the transaction callback is called in the right world. + diff --git a/LayoutTests/storage/transaction-callback-isolated-world.html b/LayoutTests/storage/transaction-callback-isolated-world.html new file mode 100644 index 0000000..6825d70 --- /dev/null +++ b/LayoutTests/storage/transaction-callback-isolated-world.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html> +<body> +This test tests that the transaction callback is called in the right world. +<div id="console"></div> +<script> +var transactionCallbacksInvoked = 0; +function done() +{ + if ((++transactionCallbacksInvoked == 2) && (window.layoutTestController)) + layoutTestController.notifyDone(); +} + +function transactionCallback1(tx) +{ + alert("FAIL: Visible in isolated world."); + done(); +} + +function transactionCallback2(tx) +{ + 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.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + layoutTestController.evaluateScriptInIsolatedWorld( + 0, + "function transactionCallback1(tx)\n" + + "{\n" + + " alert(document.body.foo);\n" + + " window.location='javascript:done()';\n" + + "}\n" + + "var db1 = openDatabase('TransactionCallbackIsolatedWorld1', '1.0', '', 1);\n" + + "db1.transaction(transactionCallback1);"); + + var db2 = openDatabase('TransactionCallbackIsolatedWorld2', '1.0', '', 1); + db2.transaction(transactionCallback2); +} +</script> +</body> +</html> diff --git a/LayoutTests/storage/transaction-error-callback-isolated-world-expected.txt b/LayoutTests/storage/transaction-error-callback-isolated-world-expected.txt new file mode 100644 index 0000000..da15396 --- /dev/null +++ b/LayoutTests/storage/transaction-error-callback-isolated-world-expected.txt @@ -0,0 +1,4 @@ +ALERT: undefined +ALERT: PASS: document.body.bar visible in a callback created in this world. +This test tests that the transaction error callback is called in the right world. + diff --git a/LayoutTests/storage/transaction-error-callback-isolated-world.html b/LayoutTests/storage/transaction-error-callback-isolated-world.html new file mode 100644 index 0000000..521894d --- /dev/null +++ b/LayoutTests/storage/transaction-error-callback-isolated-world.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html> +<body> +This test tests that the transaction error callback is called in the right world. +<div id="console"></div> +<script> +var transactionErrorCallbacksInvoked = 0; +function done() +{ + if ((++transactionErrorCallbacksInvoked == 2) && (window.layoutTestController)) + layoutTestController.notifyDone(); +} + +function transactionErrorCallback1(tx) +{ + alert("FAIL: Visible in isolated world."); + done(); +} + +function transactionErrorCallback2(tx) +{ + 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.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + layoutTestController.evaluateScriptInIsolatedWorld( + 0, + "function transactionErrorCallback1(tx)\n" + + "{\n" + + " alert(document.body.foo);\n" + + " window.location='javascript:done()';\n" + + "}\n" + + "var db1 = openDatabase('TransactionErrorCallbackIsolatedWorld1', '1.0', '', 1);\n" + + "db1.transaction(function(tx) {\n" + + " tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, function(tx, error) { return true; });\n" + + "}, transactionErrorCallback1);"); + + var db2 = openDatabase('TransactionErrorCallbackIsolatedWorld2', '1.0', '', 1); + db2.transaction(function(tx) { + tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, function(tx, error) { return true; }); + }, transactionErrorCallback2); +} +</script> +</body> +</html> |