diff options
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/file/prompt')
9 files changed, 295 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/001.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/001.html new file mode 100644 index 000000000..dc54aac5e --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/001.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for basic server name</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'http:' && location.protocol != 'https:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded over http or https.'; + return; + } + var orange = document.getElementsByTagName('div')[0]; + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) { + e.preventDefault(); + }; + document.getElementsByTagName('span')[0].innerHTML = location.hostname; +}; +</script> + +<div></div> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, correctly identifying the server name as <span></span></p> +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/002.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/002.html new file mode 100644 index 000000000..7bad40a2f --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/002.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for server name and document.domain</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'http:' && location.protocol != 'https:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded over http or https.'; + return; + } + if( !location.hostname.match(/[^\.]\.[^\.]+\.[^\.]/) ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded from a subdomain that allows document.domain to be set to a parent domain (try using a server name that contains at least two or three dots, for example www.example.org).'; + return; + } + var realhost = location.hostname, newdomain = location.hostname.replace(/^[^.]+\./,''); + try { + document.domain = location.hostname.replace(/^[^.]+\./,''); + } catch(e) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded from a subdomain that allows document.domain to be set to a parent domain.'; + return; + } + var orange = document.getElementsByTagName('div')[0]; + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) { + e.preventDefault(); + }; + document.getElementsByTagName('span')[0].innerHTML = realhost; +}; +</script> + +<div></div> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, identifying the server name as <span></span></p> +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/003.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/003.html new file mode 100644 index 000000000..4b7a98aae --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/003.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for ftp server name</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'ftp:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded over ftp.'; + return; + } + var orange = document.getElementsByTagName('div')[0]; + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) { + e.preventDefault(); + }; + document.getElementsByTagName('span')[0].innerHTML = location.hostname; +}; +</script> + +<div></div> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, correctly identifying the server name as <span></span></p> +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/004.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/004.html new file mode 100644 index 000000000..539668819 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/004.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for file:</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'file:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'Save this page to your local filesystem, and load it from there.'; + return; + } + var orange = document.getElementsByTagName('div')[0]; + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) { + e.preventDefault(); + }; +}; +</script> + +<div></div> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, either showing the server name as localhost, or otherwise identifying this file as the target of the upload.</p> +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/005.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/005.html new file mode 100644 index 000000000..395d37d62 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/005.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for special cases</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } +</style> + +<script> +window.onload = function() { + if( location.protocol == 'file:' || location.protocol == 'http:' || location.protocol == 'https:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'Use the source of this file as the source of special-case URLs within your browser, such as scriptable chrome: or opera: or attachment: URLs (eg. opera:config and send yourself the file as an email attachments and open the attachment in the browser).'; + return; + } + var orange = document.getElementsByTagName('div')[0]; + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) { + e.preventDefault(); + }; +}; +</script> + +<div></div> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, either showing the server name as unknown, or otherwise identifying this URL as the target of the upload.</p> +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/006.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/006.html new file mode 100644 index 000000000..5f0f9b306 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/006.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for data URI with inherited origin</title> +<style> +iframe { border: none; height: 250px; width: 250px; } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'http:' && location.protocol != 'https:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded over http or https.'; + return; + } + var url = "data:text/html,"+escape( +'<!DOCTYPE html>\ +<title>drag & drop - file drop prompt for data URI with inherited origin<\/title>\ +<style>\ + body > div {\ + height: 200px;\ + width: 200px;\ + background-color: orange;\ + }\ +<\/style>\ +<script>\ +window.onload = function() {\ + var orange = document.getElementsByTagName("div")[0];\ + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) {\ + e.preventDefault();\ + };\ +};\ +<\/script>\ +<div><\/div>' + ); + var frame = document.createElement('iframe'); + frame.setAttribute('src',url); + document.body.appendChild(frame); + document.getElementsByTagName('span')[0].innerHTML = location.hostname; +}; +</script> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, correctly identifying the server name <span></span>.</p> +<noscript><p>Enable JavaScript and reload</p></noscript>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/007.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/007.html new file mode 100644 index 000000000..5a5b982d6 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/007.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for data URI without inherited origin</title> +<script> +window.onload = function() { + var url = "data:text/html,"+escape( +'<!DOCTYPE html>\ +<title>drag & drop - file drop prompt for data URI with inherited origin<\/title>\ +<style>\ + body > div {\ + height: 200px;\ + width: 200px;\ + background-color: orange;\ + }\ +<\/style>\ +<script>\ +window.onload = function() {\ + var orange = document.getElementsByTagName("div")[0];\ + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) {\ + e.preventDefault();\ + };\ +};\ +<\/script>\ +<div><\/div>\ +<p>Drag a file from your desktop onto the orange square. A prompt should appear, either showing the server name as unknown, or otherwise identifying this URL as the target of the upload.<\/p>' + ); + document.getElementsByTagName('p')[1].textContent = url; +}; +</script> + +<p>Load the following URL in a new tab (copy & paste it into the address bar):</p> +<p></p> +<noscript><p>Enable JavaScript and reload</p></noscript>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/008.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/008.html new file mode 100644 index 000000000..ff07b78de --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/008.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for javascript URL with inherited origin</title> +<style> +iframe { border: none; height: 250px; width: 250px; } +</style> + +<script> +window.onload = function() { + if( location.protocol != 'http:' && location.protocol != 'https:' ) { + document.getElementsByTagName('p')[0].innerHTML = 'This test should be loaded over http or https.'; + return; + } + var url = "javascript:'"+escape( +'<!DOCTYPE html>\ +<title>drag & drop - file drop prompt for data URI with inherited origin<\/title>\ +<style>\ + body > div {\ + height: 200px;\ + width: 200px;\ + background-color: orange;\ + }\ +<\/style>\ +<script>\ +window.onload = function() {\ + var orange = document.getElementsByTagName("div")[0];\ + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) {\ + e.preventDefault();\ + };\ +};\ +<\/script>\ +<div><\/div>' + +"'"); + var frame = document.createElement('iframe'); + frame.setAttribute('src',url); + document.body.appendChild(frame); + document.getElementsByTagName('span')[0].innerHTML = location.hostname; +}; +</script> + +<p>Drag a file from your desktop onto the orange square. A prompt should appear, correctly identifying the server name <span></span></p> +<noscript><p>Enable JavaScript and reload</p></noscript>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/editing/dnd/file/prompt/009.html b/testing/web-platform/tests/html/editing/dnd/file/prompt/009.html new file mode 100644 index 000000000..6fa18b975 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/file/prompt/009.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<title>drag & drop - file drop prompt for javascript URL without inherited origin</title> +<script> +window.onload = function() { + var url = "javascript:'"+escape( +'<!DOCTYPE html>\ +<title>drag & drop - file drop prompt for data URI with inherited origin<\/title>\ +<style>\ + body > div {\ + height: 200px;\ + width: 200px;\ + background-color: orange;\ + }\ +<\/style>\ +<script>\ +window.onload = function() {\ + var orange = document.getElementsByTagName("div")[0];\ + orange.ondragover = orange.ondragenter = orange.ondrop = function(e) {\ + e.preventDefault();\ + };\ +};\ +<\/script>\ +<div><\/div>\ +<p>Drag a file from your desktop onto the orange square. A prompt should appear, either showing the server name as unknown, or otherwise identifying this URL as the target of the upload (it may alternatively identify the security context about:blank).<\/p>' + +"'"); + document.getElementsByTagName('p')[1].textContent = url; +}; +</script> + +<p>Load the following URL in a new tab (copy & paste it into the address bar):</p> +<p></p> +<noscript><p>Enable JavaScript and reload</p></noscript>
\ No newline at end of file |