summaryrefslogtreecommitdiffstats
path: root/LayoutTests
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-08-19 17:55:56 +0100
committerIain Merrick <husky@google.com>2010-08-23 11:05:40 +0100
commitf486d19d62f1bc33246748b14b14a9dfa617b57f (patch)
tree195485454c93125455a30e553a73981c3816144d /LayoutTests
parent6ba0b43722d16bc295606bec39f396f596e4fef1 (diff)
downloadexternal_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'LayoutTests')
-rw-r--r--LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash-expected.txt1
-rw-r--r--LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests-expected.txt11
-rw-r--r--LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests-expected.txt13
-rw-r--r--LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt10
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt12
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt16
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/disconnected-frame.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/no-page-cache-expected.txt16
-rw-r--r--LayoutTests/fast/dom/Geolocation/no-page-cache.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/cached-page-1.html11
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html8
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner1.html8
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner2.html8
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html8
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/clear-watch-invalid-id-crash.js14
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js51
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js55
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-already.js35
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js45
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js31
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/no-page-cache.js24
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js2
27 files changed, 469 insertions, 1 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash-expected.txt b/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash-expected.txt
new file mode 100644
index 0000000..f2e7f90
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash-expected.txt
@@ -0,0 +1 @@
+TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash.html b/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash.html
new file mode 100644
index 0000000..bf492ec
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/clear-watch-invalid-id-crash.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/clear-watch-invalid-id-crash.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests-expected.txt
new file mode 100644
index 0000000..137f495
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests-expected.txt
@@ -0,0 +1,11 @@
+Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is allowed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Success callback invoked
+PASS Success callback invoked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html
new file mode 100644
index 0000000..421a026
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/delayed-permission-allowed-for-multiple-requests.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests-expected.txt
new file mode 100644
index 0000000..8ede03c
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests-expected.txt
@@ -0,0 +1,13 @@
+Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is denied.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html
new file mode 100644
index 0000000..2143094
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/delayed-permission-denied-for-multiple-requests.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt b/LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt
new file mode 100644
index 0000000..12699cc
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt
@@ -0,0 +1,10 @@
+Tests that when a request is made on a Geolocation object after its frame has been disconnected, no callbacks are made and no crash occurs.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Method called on Geolocation object with disconnected Frame.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html b/LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html
new file mode 100644
index 0000000..6c7a7e9
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/disconnected-frame-already.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt b/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt
new file mode 100644
index 0000000..33c17d3
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt
@@ -0,0 +1,12 @@
+frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
+Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is 2
+PASS error.message is "Geolocation cannot be used in frameless documents"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
new file mode 100644
index 0000000..74c0521
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
@@ -0,0 +1,16 @@
+frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
+Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html
new file mode 100644
index 0000000..d9b51c1
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/disconnected-frame-permission-denied.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame.html b/LayoutTests/fast/dom/Geolocation/disconnected-frame.html
new file mode 100644
index 0000000..b91eade
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/disconnected-frame.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/no-page-cache-expected.txt b/LayoutTests/fast/dom/Geolocation/no-page-cache-expected.txt
new file mode 100644
index 0000000..66cbe1b
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/no-page-cache-expected.txt
@@ -0,0 +1,16 @@
+Tests that pages that use Geolocation are not put in the page cache.
+
+Currently, Geolocation does not work with the page cache so pages that use Geolocation are explicitly prevented from entering the cache. This test checks for accidental enabling of the page Cache for Geolocation. See https://bugs.webkit.org/show_bug.cgi?id=43956 for details.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Main page opening resources/cached-page-1.html
+resources/cached-page-1.html fired, count = 1
+resources/cached-page-1.html about to navigate to resources/cached-page-2.html
+resources/cached-page-2.html about to go back to resources/cached-page-1.html
+resources/cached-page-1.html fired, count = 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/no-page-cache.html b/LayoutTests/fast/dom/Geolocation/no-page-cache.html
new file mode 100644
index 0000000..36975b4
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/no-page-cache.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/no-page-cache.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/cached-page-1.html b/LayoutTests/fast/dom/Geolocation/resources/cached-page-1.html
new file mode 100644
index 0000000..f7ec397
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/cached-page-1.html
@@ -0,0 +1,11 @@
+<script>
+function loadNext() {
+ var geolocation = navigator.geolocation;
+ if (window.opener.reportPageOneOnload() == 1) {
+ window.opener.debug('resources/cached-page-1.html about to navigate to resources/cached-page-2.html')
+ // Location changes need to happen outside the onload handler to generate history entries.
+ setTimeout(function() {location.href = 'cached-page-2.html';}, 0);
+ }
+}
+</script>
+<body onload="loadNext()"></body>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html b/LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html
new file mode 100644
index 0000000..5478f9c
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html
@@ -0,0 +1,8 @@
+<script>
+function init() {
+ window.opener.pageTwoLoaded = true;
+ window.opener.debug('resources/cached-page-2.html about to go back to resources/cached-page-1.html');
+ history.back();
+}
+</script>
+<body onload="init()"></body>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner1.html b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner1.html
new file mode 100644
index 0000000..2cb7e80
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ </head>
+ <body onload="window.parent.onFirstIframeLoaded()">
+ <p>This frame should be replaced before the test ends</p>
+ </body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner2.html b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner2.html
new file mode 100644
index 0000000..fb48795
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-already-inner2.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ </head>
+ <body onload="window.parent.onSecondIframeLoaded()">
+ <p>This frame should be visible when the test completes</p>
+ </body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html
new file mode 100644
index 0000000..4819351
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ </head>
+ <body onload="window.parent.onIframeLoaded()", onunload="window.parent.onIframeUnloaded();">
+ <p>This frame should be replaced before the test ends</p>
+ </body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/clear-watch-invalid-id-crash.js b/LayoutTests/fast/dom/Geolocation/script-tests/clear-watch-invalid-id-crash.js
new file mode 100644
index 0000000..6176da0
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/clear-watch-invalid-id-crash.js
@@ -0,0 +1,14 @@
+description("Tests for a crash when clearWatch() is called with a zero ID.<br><br>We call clearWatch() with a request in progress then navigate the page. This accesses the watchers map during cleanup and triggers the crash. This page should not be visible when the test completes.");
+
+if (window.layoutTestController) {
+ layoutTestController.setGeolocationPermission(true);
+ layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+} else
+ debug('This test can not be run without the LayoutTestController');
+
+navigator.geolocation.watchPosition(function() {});
+navigator.geolocation.clearWatch(0);
+location = "data:text/html,TEST COMPLETE<script>layoutTestController.notifyDone();</script>";
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
new file mode 100644
index 0000000..8b02a82
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
@@ -0,0 +1,51 @@
+description("Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is allowed.");
+
+if (window.layoutTestController)
+ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+function allowPermission() {
+ permissionSet = true;
+ if (window.layoutTestController)
+ layoutTestController.setGeolocationPermission(true);
+}
+
+var watchCallbackInvoked = false;
+var oneShotCallbackInvoked = false;
+
+navigator.geolocation.watchPosition(function() {
+ if (permissionSet) {
+ testPassed('Success callback invoked');
+ watchCallbackInvoked = true;
+ maybeFinishTest();
+ return;
+ }
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(err) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+});
+
+navigator.geolocation.getCurrentPosition(function() {
+ if (permissionSet) {
+ testPassed('Success callback invoked');
+ oneShotCallbackInvoked = true;
+ maybeFinishTest();
+ return;
+ }
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(err) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+});
+
+window.setTimeout(allowPermission, 100);
+
+function maybeFinishTest() {
+ if (watchCallbackInvoked && oneShotCallbackInvoked)
+ finishJSTest();
+}
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js
new file mode 100644
index 0000000..f230091
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js
@@ -0,0 +1,55 @@
+description("Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is denied.");
+
+if (window.layoutTestController)
+ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+function denyPermission() {
+ permissionSet = true;
+ if (window.layoutTestController)
+ layoutTestController.setGeolocationPermission(false);
+}
+
+var watchCallbackInvoked = false;
+var oneShotCallbackInvoked = false;
+var error;
+
+navigator.geolocation.watchPosition(function() {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(e) {
+ if (permissionSet) {
+ error = e;
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ watchCallbackInvoked = true;
+ maybeFinishTest();
+ return;
+ }
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+});
+
+navigator.geolocation.getCurrentPosition(function() {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(e) {
+ if (permissionSet) {
+ error = e;
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ oneShotCallbackInvoked = true;
+ maybeFinishTest();
+ return;
+ }
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+});
+window.setTimeout(denyPermission, 100);
+
+function maybeFinishTest() {
+ if (watchCallbackInvoked && oneShotCallbackInvoked)
+ finishJSTest();
+}
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-already.js b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-already.js
new file mode 100644
index 0000000..b217641
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-already.js
@@ -0,0 +1,35 @@
+description("Tests that when a request is made on a Geolocation object after its frame has been disconnected, no callbacks are made and no crash occurs.");
+
+if (window.layoutTestController) {
+ layoutTestController.setGeolocationPermission(true);
+ layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+}
+
+function onFirstIframeLoaded() {
+ iframeGeolocation = iframe.contentWindow.navigator.geolocation;
+ iframe.src = 'resources/disconnected-frame-already-inner2.html';
+}
+
+var error;
+function onSecondIframeLoaded() {
+ iframeGeolocation.getCurrentPosition(function () {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+ });
+ setTimeout(finishTest, 1000);
+}
+
+function finishTest() {
+ debug('Method called on Geolocation object with disconnected Frame.');
+ finishJSTest();
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-already-inner1.html';
+document.body.appendChild(iframe);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
new file mode 100644
index 0000000..a3f9eca
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
@@ -0,0 +1,45 @@
+description("Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.");
+
+// Prime the Geolocation instance by denying permission. This makes sure that we execute the
+// same code path for both preemptive and non-preemtive permissions policies.
+if (window.layoutTestController) {
+ layoutTestController.setGeolocationPermission(false);
+ layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+} else
+ debug('This test can not be run without the LayoutTestController');
+
+var error;
+function onIframeLoaded() {
+ iframeGeolocation = iframe.contentWindow.navigator.geolocation;
+ iframeGeolocation.getCurrentPosition(function() {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ error = e;
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ iframe.src = 'data:text/html,This frame should be visible when the test completes';
+ });
+}
+
+function onIframeUnloaded() {
+ // Make another request, with permission already denied.
+ iframeGeolocation.getCurrentPosition(function () {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ error = e;
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ finishJSTest();
+ });
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js
new file mode 100644
index 0000000..50d377a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js
@@ -0,0 +1,31 @@
+description("Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.");
+
+if (window.layoutTestController) {
+ layoutTestController.setGeolocationPermission(true);
+ layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+}
+
+function onIframeLoaded() {
+ iframeGeolocation = iframe.contentWindow.navigator.geolocation;
+ iframe.src = 'data:text/html,This frame should be visible when the test completes';
+}
+
+var error;
+function onIframeUnloaded() {
+ iframeGeolocation.getCurrentPosition(function () {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ error = e;
+ shouldBe('error.code', '2');
+ shouldBe('error.message', '"Geolocation cannot be used in frameless documents"');
+ finishJSTest();
+ });
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/no-page-cache.js b/LayoutTests/fast/dom/Geolocation/script-tests/no-page-cache.js
new file mode 100644
index 0000000..76afbce
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/no-page-cache.js
@@ -0,0 +1,24 @@
+description("Tests that pages that use Geolocation are not put in the page cache.<br><br>Currently, Geolocation does not work with the page cache so pages that use Geolocation are explicitly prevented from entering the cache. This test checks for accidental enabling of the page Cache for Geolocation. See https://bugs.webkit.org/show_bug.cgi?id=43956 for details.");
+
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+} else
+ debug('This test can not be run without the LayoutTestController');
+
+var pageOneOnloadCount = 0;
+function reportPageOneOnload() {
+ ++pageOneOnloadCount;
+ debug('resources/cached-page-1.html fired, count = ' + pageOneOnloadCount);
+ if (pageOneOnloadCount == 2) {
+ finishJSTest();
+ }
+ return pageOneOnloadCount;
+}
+
+debug("Main page opening resources/cached-page-1.html");
+window.open("resources/cached-page-1.html");
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js
index 4f789f6..8109bd0 100644
--- a/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js
@@ -3,7 +3,7 @@ description("Tests that no timers will trigger for navigator.geolocation object
if (window.layoutTestController) layoutTestController.setGeolocationPermission(true);
document.body.onload = function() {
- location = "data:text/html,You should have seen one unload alert appear.<script>window.setTimeout('if (window.layoutTestController) layoutTestController.notifyDone();', 100);</" + "script>";
+ location = "data:text/html,You should have seen one unload alert appear.<script>window.setTimeout('if (window.layoutTestController) layoutTestController.notifyDone();', 100);</script>";
}
document.body.onunload = function() {