summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/target-origin
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/target-origin')
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/001-manual.html110
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/002-manual.html86
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/003-manual.html95
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/004-1.html25
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/004-manual.html36
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/005-1.html25
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/005-manual.html36
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/006-manual.html52
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/007-manual.html52
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/008-manual.html53
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/009-manual.html25
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/010-manual.html25
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html63
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/012-manual.html62
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/013-manual.html24
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/101-manual.html123
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/102-manual.html36
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/103-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/103-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/104-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/104-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/105-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/105-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/106-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/106-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/107-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/107-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/108-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/108-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/109-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/109-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/110-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/110-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/111-manual.html52
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/112-manual.html56
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/113-manual.html50
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/114-manual.html56
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/115-manual.html50
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/116-manual.html31
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/117-1.html33
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/117-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/118-1.html32
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/118-manual.html27
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/201-manual.html83
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/202.html64
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustallow.html26
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustblock.html21
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-showorigin.html31
48 files changed, 2039 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/001-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/001-manual.html
new file mode 100644
index 000000000..f64e1c4e0
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/001-manual.html
@@ -0,0 +1,110 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin syntax</title>
+ <style type="text/css">
+blockquote { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript">
+setup(function () {},{explicit_done:true});
+window.onload = function () {
+ document.getElementsByTagName('blockquote')[0].ondragstart = function (e) {
+ test(function() {
+ assert_true( !!e.dataTransfer.allowTargetOrigin );
+ }, 'allowTargetOrigin should be supported' );
+ test(function() {
+ assert_throws( new TypeError(), function () { e.dataTransfer.allowTargetOrigin(); } );
+ }, 'no parameter should throw TypeError' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin(''); } );
+ }, 'empty string should be an invalid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('*');
+ }, '* should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('/');
+ }, '/ should be a valid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('/foo'); } );
+ }, '/foo should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('foo'); } );
+ }, 'foo should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('//foo'); } );
+ }, '//foo should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://'); } );
+ }, 'http:// should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://*'); } );
+ }, 'http://* should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo*'); } );
+ }, 'http://foo* should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo.*'); } );
+ }, 'http://foo.* should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://*.foo'); } );
+ }, 'http://*.foo should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo:bar'); } );
+ }, 'http://foo:bar should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo:bar@'); } );
+ }, 'http://foo:bar@ should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file:'); } );
+ }, 'file: should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file://'); } );
+ }, 'file:// should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:'); } );
+ }, 'data: should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:text/html'); } );
+ }, 'data:text/html should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file://localhost/'); } );
+ }, 'file://localhost/ should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file:///'); } );
+ }, 'file:/// should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:text/html,'); } );
+ }, 'data:text/html, should be an invalid URL' );
+ test(function() {
+ assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('javascript:'); } );
+ }, 'javascript: should be an invalid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo');
+ }, 'http://foo should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo.bar');
+ }, 'http://foo.bar should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo/bar');
+ }, 'http://foo/bar should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo:123');
+ }, 'http://foo:123 should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo:bar@baz');
+ }, 'http://foo:bar@baz should be a valid URL' );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('http://foo:bar@baz:123/qux');
+ }, 'http://foo:bar@baz:123/qux should be a valid URL' );
+ done();
+ };
+};
+ </script>
+ </head>
+ <body>
+ <blockquote draggable="true"></blockquote>
+ <div id="log">Drag the orange square above until the drag placeholder appears, then release it.</div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/002-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/002-manual.html
new file mode 100644
index 000000000..db46c6797
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/002-manual.html
@@ -0,0 +1,86 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin events</title>
+ <style type="text/css">
+blockquote { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; float: left; }
+blockquote + blockquote { background: blue; }
+blockquote + blockquote + blockquote { background: fuchsia; }
+blockquote + div { clear: left; }
+ </style>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript">
+setup(function () {},{explicit_done:true});
+window.onload = function () {
+ var orange = document.getElementsByTagName('blockquote')[0],
+ blue = document.getElementsByTagName('blockquote')[1],
+ fuchsia = document.getElementsByTagName('blockquote')[2],
+ evtdone = {};
+ orange.ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_true( !!e.dataTransfer.allowTargetOrigin );
+ }, 'allowTargetOrigin should exist in '+e.type );
+ test(function() {
+ e.dataTransfer.allowTargetOrigin('*');
+ }, 'allowTargetOrigin should work in '+e.type );
+ };
+ blue.ondragenter = blue.ondragover = function (e) {
+ e.preventDefault();
+ };
+ orange.ondrag = blue.ondragleave = function (e) {
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_true( !!e.dataTransfer.allowTargetOrigin );
+ }, 'allowTargetOrigin should exist in '+e.type );
+ test(function() {
+ assert_throws( 'SECURITY_ERR', function () { e.dataTransfer.allowTargetOrigin('*'); } );
+ }, 'allowTargetOrigin should throw a SECURITY_ERR in '+e.type );
+ };
+ fuchsia.ondragenter = fuchsia.ondragover = fuchsia.ondrop = function (e) {
+ e.preventDefault();
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_true( !!e.dataTransfer.allowTargetOrigin );
+ }, 'allowTargetOrigin should exist in '+e.type );
+ test(function() {
+ assert_throws( 'SECURITY_ERR', function () { e.dataTransfer.allowTargetOrigin('*'); } );
+ }, 'allowTargetOrigin should throw a SECURITY_ERR in '+e.type );
+ };
+ orange.ondragend = function (e) {
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_true( !!e.dataTransfer.allowTargetOrigin );
+ }, 'allowTargetOrigin should exist in '+e.type );
+ test(function() {
+ assert_throws( 'SECURITY_ERR', function () { e.dataTransfer.allowTargetOrigin('*'); } );
+ }, 'allowTargetOrigin should throw a SECURITY_ERR in '+e.type );
+ test(function() {
+ var failtxt = '- Reload and try again';
+ assert_true( evtdone.dragstart, 'dragstart event was not tested'+failtxt );
+ assert_true( evtdone.drag, 'drag event was not tested'+failtxt );
+ assert_true( evtdone.dragenter, 'dragenter event was not tested'+failtxt );
+ assert_true( evtdone.dragleave, 'dragleave event was not tested'+failtxt );
+ assert_true( evtdone.dragover, 'dragover event was not tested'+failtxt );
+ assert_true( evtdone.drop, 'drop event was not tested'+failtxt );
+ assert_true( evtdone.dragend, 'dragend event was not tested'+failtxt );
+ }, 'all event types must now have been tested' );
+ done();
+ };
+};
+ </script>
+ </head>
+ <body>
+ <blockquote draggable="true"></blockquote>
+ <blockquote></blockquote>
+ <blockquote></blockquote>
+ <div id="log">Drag the orange square over the blue square then the fuchsia square, then release it.</div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/003-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/003-manual.html
new file mode 100644
index 000000000..5e0adbdd8
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/003-manual.html
@@ -0,0 +1,95 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin valid syntax</title>
+ <style type="text/css">
+div { float: left; height: 100px; width: 100px; margin-right: 10px; background: orange; }
+iframe { height: 100px; width: 100px; border: none; }
+.note { float: right; color: silver; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+function addNote(el,str) {
+ var par = document.createElement(el);
+ par.textContent = str;
+ document.body.appendChild(par);
+}
+function testFrame(text,frameorigin,framepath) {
+ var persist = arguments;
+ addNote('p',(done++)+'. '+text);
+ var div = document.createElement('div');
+ var frame = document.createElement('iframe');
+ frame.src = frameorigin+framepath;
+ div.draggable = true;
+ div.ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ for( var i = 3; i < persist.length; i++ ) {
+ e.dataTransfer.allowTargetOrigin(persist[i]);
+ }
+ };
+ var par = document.createElement('p');
+ par.className = 'note';
+ par.appendChild(document.createTextNode('Target: '+frameorigin));
+ par.appendChild(document.createElement('br'));
+ par.appendChild(document.createTextNode('Allowing: '+([]).slice.call(persist,3).join(' and ')));
+ if( framepath.match(/\?domain\b/) ) {
+ par.appendChild(document.createElement('br'));
+ par.appendChild(document.createTextNode('document.domain set to parent domain'));
+ }
+ document.body.appendChild(par);
+ document.body.appendChild(div);
+ document.body.appendChild(frame);
+}
+var done = 1;
+window.onload = function () {
+ var allowText = 'Drag the orange box below over the blue box the right, and release it. Fail if nothing happens in the blue box.';
+ var blockText = 'Drag the orange box below over the pink box the right, and release it. Pass if nothing happens in the pink box.';
+ var allowHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustallow.html');
+ var blockHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustblock.html');
+ if( location.hostname != httpHostMain || location.host != httpHostMain ) {
+ addNote('p','This test must be loaded over http:\/\/'+httpHostMain+'\/');
+ } else {
+ /* 01 */ testFrame(allowText,'http://'+httpHostMain,allowHelper);
+ /* 02 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper);
+ /* 03 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'*');
+ /* 04 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper,'*');
+ /* 05 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'/');
+ /* 06 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'/');
+ /* 07 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostMain);
+ /* 08 */ testFrame(blockText,'http://'+httpHostMain+':'+httpPortAlias,blockHelper,'http://'+httpHostMain);
+ /* 09 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostMain);
+ /* 10 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostMain);
+ /* 11 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostMain+':80');
+ /* 12 */ testFrame(blockText,'http://'+httpHostMain+':'+httpPortAlias,blockHelper,'http://'+httpHostMain+':80');
+ /* 13 */ testFrame(allowText,'http://'+httpHostMain+':'+httpPortAlias,allowHelper,'http://'+httpHostMain+':'+httpPortAlias);
+ /* 14 */ testFrame(blockText,'http://'+httpHostMain,blockHelper,'http://'+httpHostMain+':'+httpPortAlias);
+ /* 15 */ testFrame(blockText,'https://'+httpsHostAlias,blockHelper,'http://'+httpsHostAlias);
+ /* 16 */ testFrame(allowText,'https://'+httpsHostAlias,allowHelper,'https://'+httpsHostAlias);
+ /* 17 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://foo:bar@'+httpHostMain+'/baz');
+ /* 18 */ testFrame(allowText,'http://foo:bar@'+httpHostMain,allowHelper,'http://'+httpHostMain);
+ /* 19 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'/');
+ /* 20 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'/','http://'+httpHostAlias);
+ /* 21 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'*');
+ /* 22 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'http://'+httpHostMain);
+ /* 23 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper,'http://'+httpHostAlias,'http://'+httpHostMain);
+ /* 24 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://dummy','http://'+httpHostMain);
+ /* 25 */ testFrame(blockText,'https://'+httpsHostAlias,blockHelper,'https://'+httpsHostAlias+':'+httpsPortAlias);
+ /* 26 */ testFrame(blockText,'https://'+httpsHostAlias+':'+httpsPortAlias,blockHelper,'https://'+httpsHostAlias);
+ /* 27 */ testFrame(allowText,'https://'+httpsHostAlias+':'+httpsPortAlias,allowHelper,'https://'+httpsHostAlias+':'+httpsPortAlias);
+ window.xhr = new XMLHttpRequest();
+ xhr.open('GET',allowHelper,false);
+ xhr.send(null);
+ /* 28 */ testFrame(allowText,'data:text/html,',escape(xhr.responseText),'http://'+httpHostMain);
+ /* 29 */ testFrame(allowText,'javascript:','parent.xhr.responseText','http://'+httpHostMain);
+ /* 30 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostAlias.replace(/^[^.]+\./,''));
+ /* 31 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper+'?domain','http://'+httpHostAlias);
+ /* 32 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper+'?domain','http://'+httpHostAlias.replace(/^[^.]+\./,''));
+ }
+};
+ </script>
+ </head>
+ <body>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/004-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/004-1.html
new file mode 100644
index 000000000..f8a4e8e55
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/004-1.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Data URI does not match absolute HTTP URL</title>
+ <style type="text/css">
+html, body { margin: 0; padding: 0; }
+div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ e.dataTransfer.allowTargetOrigin('http://'+httpHostMain);
+ };
+};
+ </script>
+ </head>
+ <body>
+
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/004-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/004-manual.html
new file mode 100644
index 000000000..2a3d3bbe4
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/004-manual.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Data URI does not match absolute HTTP URL</title>
+ </head>
+ <body>
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+document.write('data:text/html,'+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Data URI does not match absolute HTTP URL<\/title>\
+ <style type="text/css">\
+iframe { border: none; height: 150px; width: 150px; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ document.body.ondragenter = document.body.ondragleave = document.body.ondragover = document.body.ondrop = function (e) {\
+ e.preventDefault();\
+ document.body.innerHTML = "FAIL";\
+ };\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square below over this text, and release it. Pass if this text does not change.<\/p>\
+ <p><iframe src="'+location.href.replace(/\.html$/,'-1.html')+'"><\/iframe><\/p>\
+ <\/body>\
+<\/html>'));
+
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/005-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/005-1.html
new file mode 100644
index 000000000..15f6a8c23
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/005-1.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title>JavaScript URI does not match absolute HTTP URL</title>
+ <style type="text/css">
+html, body { margin: 0; padding: 0; }
+div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ e.dataTransfer.allowTargetOrigin('http://'+httpHostMain);
+ };
+};
+ </script>
+ </head>
+ <body>
+
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/005-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/005-manual.html
new file mode 100644
index 000000000..90a002cf0
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/005-manual.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <title>JavaScript URI does not match absolute HTTP URL</title>
+ </head>
+ <body>
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+document.write('javascript:unescape("'+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>JavaScript does not match absolute HTTP URL<\/title>\
+ <style type=\'text/css\'>\
+iframe { border: none; height: 150px; width: 150px; }\
+ <\/style>\
+ <script type=\'text/javascript\'>\
+window.onload = function () {\
+ document.body.ondragenter = document.body.ondragleave = document.body.ondragover = document.body.ondrop = function (e) {\
+ e.preventDefault();\
+ document.body.innerHTML = \'FAIL\';\
+ };\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square below over this text, and release it. Pass if this text does not change.<\/p>\
+ <p><iframe src=\''+location.href.replace(/\.html$/,'-1.html')+'\'><\/iframe><\/p>\
+ <\/body>\
+<\/html>')+'")');
+
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/006-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/006-manual.html
new file mode 100644
index 000000000..e1674390c
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/006-manual.html
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Data URI does not match /</title>
+ </head>
+ <body>
+ <!--
+/ sets an absolute URL pointing to the document's unique identifier - used as the script origin.
+The script origin will in fact be inherited from the parent page, which is actually the same data URI.
+That part works.
+However, when it comes to matching against it, it will not match, as the global identifier does not
+match because the origin does not match the scheme/host/port tuple required.
+ -->
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+document.write('data:text/html,'+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Data URI does not match /<\/title>\
+ <style type="text/css">\
+html, body { margin: 0; padding: 0; }\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { border: none; height: 150px; width: 150px; }\
+ <\/style>\
+ <\/head>\
+ <body>\
+ <script type="text/javascript">\
+if( self == top ) {\
+ document.body.ondragenter = document.body.ondragleave = document.body.ondragover = document.body.ondrop = function (e) {\
+ e.preventDefault();\
+ document.body.innerHTML = "FAIL";\
+ };\
+ document.write("<p>Drag the orange square below over this text, and release it. Pass if this text does not change.<\\\/p>");\
+ document.write("<p><iframe src=\\""+location.href+"\\"><\\\/iframe><\\\/p>");\
+} else {\
+ document.write("<div draggable=\\"true\\"><\\\/div>");\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ e.dataTransfer.allowTargetOrigin("/");\
+ };\
+}\
+ <\/script>\
+ <\/body>\
+<\/html>'));
+
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/007-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/007-manual.html
new file mode 100644
index 000000000..4f35ed17e
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/007-manual.html
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Data URI does not match its own URL</title>
+ </head>
+ <body>
+ <!--
+Sets an absolute URL pointing to the data URI.
+The script origin will in fact be inherited from the parent page, which is actually the same data URI.
+That part works.
+However, when it comes to matching against it, it will not match, as the global identifier used as the
+script origin does not match because the origin does not match the scheme/host/port tuple required.
+ -->
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+document.write('data:text/html,'+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Data URI does not match its own URL<\/title>\
+ <style type="text/css">\
+html, body { margin: 0; padding: 0; }\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { border: none; height: 150px; width: 150px; }\
+ <\/style>\
+ <\/head>\
+ <body>\
+ <script type="text/javascript">\
+if( self == top ) {\
+ document.body.ondragenter = document.body.ondragleave = document.body.ondragover = document.body.ondrop = function (e) {\
+ e.preventDefault();\
+ document.body.innerHTML = "FAIL";\
+ };\
+ document.write("<p>Drag the orange square below over this text, and release it. Pass if this text does not change.<\\\/p>");\
+ document.write("<p><iframe src=\\""+location.href+"\\"><\\\/iframe><\\\/p>");\
+} else {\
+ document.write("<div draggable=\\"true\\"><\\\/div>");\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ e.dataTransfer.allowTargetOrigin(location.href);\
+ };\
+}\
+ <\/script>\
+ <\/body>\
+<\/html>'));
+
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/008-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/008-manual.html
new file mode 100644
index 000000000..71e915c9c
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/008-manual.html
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Data URI does match *</title>
+ </head>
+ <body>
+ <!--
+* allows any URL at all, so it should work
+ -->
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+document.write('data:text/html,'+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Data URI does match *<\/title>\
+ <style type="text/css">\
+html, body { margin: 0; padding: 0; }\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { border: none; height: 150px; width: 150px; }\
+ <\/style>\
+ <\/head>\
+ <body>\
+ <script type="text/javascript">\
+var seentypes = {};\
+if( self == top ) {\
+ document.body.ondragenter = document.body.ondragover = document.body.ondrop = function (e) {\
+ e.preventDefault();\
+ if( e.type == "drop" ) {\
+ document.body.innerHTML = ( seentypes.dragenter && seentypes.dragover ) ? "PASS" : "FAIL";\
+ } else {\
+ seentypes[e.type] = true;\
+ }\
+ };\
+ document.write("<p>Drag the orange square below over this text, and release it. Fail if this text does not change.<\\\/p>");\
+ document.write("<p><iframe src=\\""+location.href+"\\"><\\\/iframe><\\\/p>");\
+} else {\
+ document.write("<div draggable=\\"true\\"><\\\/div>");\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ e.dataTransfer.allowTargetOrigin("*");\
+ };\
+}\
+ <\/script>\
+ <\/body>\
+<\/html>'));
+
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/009-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/009-manual.html
new file mode 100644
index 000000000..2fc7ef43e
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/009-manual.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title>* should not prevent dropping on external applications</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = "copy";
+ e.dataTransfer.setData("text","PASS");
+ e.dataTransfer.allowTargetOrigin("*");
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>This test is only relevant on platforms where it is possible to switch applications in mid-drag (eg. alt+tab, dragging over taskbar buttons, dragging between restored windows).</p>
+ <p>This testcase requires an external application that accepts dropping of text from other applications - eg. Wordpad (write.exe) on Windows. Ensure that the external application is open.</p>
+ <p>Drag the orange block to the other application and release it. Pass if the word &quot;PASS&quot; appears in the other application.</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div draggable="true"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/010-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/010-manual.html
new file mode 100644
index 000000000..74a20d7e0
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/010-manual.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title>A URL should prevent dropping on external applications</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = "copy";
+ e.dataTransfer.setData("text","FAIL");
+ e.dataTransfer.allowTargetOrigin("http://foo");
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>This test is only relevant on platforms where it is possible to switch applications in mid-drag (eg. alt+tab, dragging over taskbar buttons, dragging between restored windows).</p>
+ <p>This testcase requires an external application that accepts dropping of text from other applications - eg. Wordpad (write.exe) on Windows. Ensure that the external application is open.</p>
+ <p>Drag the orange block to the other application and release it. Fail if the word &quot;FAIL&quot; appears in the other application.</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div draggable="true"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html
new file mode 100644
index 000000000..e0302712e
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin should only block dragenter, dragover, dragleave and drop events</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; float: left; }
+div + div { background: blue; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ var orange = document.getElementsByTagName('div')[0], evtdone = {}, fails = [];
+ orange.ondragstart = function (e) {
+ evtdone[e.type] = true;
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ try {
+ e.dataTransfer.allowTargetOrigin('http://example.com');
+ } catch(e) {
+ fails[fails.length] = 'allowTargetOrigin threw an error: '+e;
+ }
+ };
+ orange.ondragenter = orange.ondragover = orange.ondrop = function (e) {
+ e.preventDefault();
+ evtdone[e.type] = true;
+ };
+ orange.ondrag = orange.ondragleave = function (e) {
+ evtdone[e.type] = true;
+ };
+ orange.ondragend = function (e) {
+ evtdone[e.type] = true;
+ if( !evtdone.dragstart ) {
+ fails[fails.length] = 'dragstart did not fire - how did that happen?';
+ }
+ if( !evtdone.drag ) {
+ fails[fails.length] = 'drag did not fire';
+ }
+ if( !evtdone.dragend ) {
+ fails[fails.length] = 'dragend did not fire - OK, who broke the testcase?';
+ }
+ if( evtdone.dragenter ) {
+ fails[fails.length] = 'dragenter fired';
+ }
+ if( evtdone.dragover ) {
+ fails[fails.length] = 'dragover fired';
+ }
+ if( evtdone.dragleave ) {
+ fails[fails.length] = 'dragleave fired';
+ }
+ if( evtdone.drop ) {
+ fails[fails.length] = 'drop fired';
+ }
+ document.getElementsByTagName('p')[0].innerHTML = fails.length ? ( 'FAIL:<br>' + fails.join('<br>') ) : 'PASS';
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>Drag the orange square over the blue square then back to the orange square, then release it. Fail if this text does not change.</p>
+ <div draggable="true"></div>
+ <div></div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/012-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/012-manual.html
new file mode 100644
index 000000000..164e613ed
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/012-manual.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin after leaving browser window</title>
+ <style type="text/css">
+div { float: left; height: 100px; width: 100px; margin-right: 10px; background: orange; }
+iframe { height: 100px; width: 100px; border: none; }
+.note { float: right; color: silver; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+function addNote(el,str) {
+ var par = document.createElement(el);
+ par.textContent = str;
+ document.body.appendChild(par);
+}
+function testFrame(text,frameorigin,framepath) {
+ var persist = arguments;
+ addNote('p',(done++)+'. '+text);
+ var div = document.createElement('div');
+ var frame = document.createElement('iframe');
+ frame.src = frameorigin+framepath;
+ div.draggable = true;
+ div.ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ for( var i = 3; i < persist.length; i++ ) {
+ e.dataTransfer.allowTargetOrigin(persist[i]);
+ }
+ };
+ var par = document.createElement('p');
+ par.className = 'note';
+ par.appendChild(document.createTextNode('Target: '+frameorigin));
+ par.appendChild(document.createElement('br'));
+ par.appendChild(document.createTextNode('Allowing: '+([]).slice.call(persist,3).join(' and ')));
+ if( framepath.match(/\?domain\b/) ) {
+ par.appendChild(document.createElement('br'));
+ par.appendChild(document.createTextNode('document.domain set to parent domain'));
+ }
+ document.body.appendChild(par);
+ document.body.appendChild(div);
+ document.body.appendChild(frame);
+}
+var done = 1;
+window.onload = function () {
+ var allowText = 'Drag the orange box below outside the browser window (not onto the system taskbar) then back over the blue box the right, and release it. Fail if nothing happens in the blue box.';
+ var blockText = 'Drag the orange box below outside the browser window (not onto the system taskbar) then back over the pink box the right, and release it. Pass if nothing happens in the pink box.';
+ var allowHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustallow.html');
+ var blockHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustblock.html');
+ if( location.hostname != httpHostMain || location.host != httpHostMain ) {
+ addNote('p','This test must be loaded over http:\/\/'+httpHostMain+'\/');
+ } else {
+ /* 07 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostMain);
+ /* 09 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostMain);
+ }
+};
+ </script>
+ </head>
+ <body>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/013-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/013-manual.html
new file mode 100644
index 000000000..39ee70cf5
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/013-manual.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+ <head>
+ <title>A URL should prevent dropping on UI</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = "copy";
+ e.dataTransfer.setData("text","FAIL");
+ e.dataTransfer.allowTargetOrigin("http://foo");
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>This test is only relevant on platforms where it is possible to drop data onto the browser UI (eg. the address field).</p>
+ <p>Drag the orange block to the address field and release it. Fail if the word &quot;FAIL&quot; appears in the address field. Repeat for other UI fields.</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div draggable="true"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/101-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/101-manual.html
new file mode 100644
index 000000000..24ef03957
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/101-manual.html
@@ -0,0 +1,123 @@
+<!doctype html>
+<html>
+ <head>
+ <title>.origin for all events</title>
+ <style type="text/css">
+blockquote { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; float: left; }
+blockquote + blockquote { background: blue; }
+blockquote + blockquote + blockquote { background: fuchsia; }
+blockquote + div { clear: left; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript">
+setup(function () {},{explicit_done:true});
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ done();
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var orange = document.getElementsByTagName('blockquote')[0],
+ blue = document.getElementsByTagName('blockquote')[1],
+ fuchsia = document.getElementsByTagName('blockquote')[2],
+ evtdone = {};
+ orange.ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_equals( e.dataTransfer.origin, origin );
+ }, '.origin should exist in '+e.type );
+ test(function () {
+ //WebIDL and ECMAScript 5 - a readonly property has a getter but not a setter
+ //ES5 makes [[Put]] fail but not throw
+ var failed = false, oldorigin = e.dataTransfer.origin;
+ try {
+ e.dataTransfer.origin = 'http://example.com';
+ } catch(e) {
+ failed = e;
+ }
+ assert_equals(e.dataTransfer.origin,oldorigin);
+ assert_false(failed,'an error was thrown');
+ }, '.origin must be read-only in '+e.type);
+ };
+ blue.ondragenter = blue.ondragover = function (e) {
+ e.preventDefault();
+ };
+ orange.ondrag = blue.ondragleave = function (e) {
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_equals( e.dataTransfer.origin, origin );
+ }, '.origin should exist in '+e.type );
+ test(function () {
+ var failed = false, oldorigin = e.dataTransfer.origin;
+ try {
+ e.dataTransfer.origin = 'http://example.com';
+ } catch(e) {
+ failed = e;
+ }
+ assert_equals(e.dataTransfer.origin,oldorigin);
+ assert_false(failed,'an error was thrown');
+ }, '.origin must be read-only in '+e.type);
+ };
+ fuchsia.ondragenter = fuchsia.ondragover = fuchsia.ondrop = function (e) {
+ e.preventDefault();
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_equals( e.dataTransfer.origin, origin );
+ }, '.origin should exist in '+e.type );
+ test(function () {
+ var failed = false, oldorigin = e.dataTransfer.origin;
+ try {
+ e.dataTransfer.origin = 'http://example.com';
+ } catch(e) {
+ failed = e;
+ }
+ assert_equals(e.dataTransfer.origin,oldorigin);
+ assert_false(failed,'an error was thrown');
+ }, '.origin must be read-only in '+e.type);
+ };
+ orange.ondragend = function (e) {
+ if( evtdone[e.type] ) { return; }
+ evtdone[e.type] = true;
+ test(function() {
+ assert_equals( e.dataTransfer.origin, origin );
+ }, '.origin should exist in '+e.type );
+ test(function () {
+ var failed = false, oldorigin = e.dataTransfer.origin;
+ try {
+ e.dataTransfer.origin = 'http://example.com';
+ } catch(e) {
+ failed = e;
+ }
+ assert_equals(e.dataTransfer.origin,oldorigin);
+ assert_false(failed,'an error was thrown');
+ }, '.origin must be read-only in '+e.type);
+ test(function() {
+ var failtxt = '- Reload and try again';
+ assert_true( evtdone.dragstart, 'dragstart event was not tested'+failtxt );
+ assert_true( evtdone.drag, 'drag event was not tested'+failtxt );
+ assert_true( evtdone.dragenter, 'dragenter event was not tested'+failtxt );
+ assert_true( evtdone.dragleave, 'dragleave event was not tested'+failtxt );
+ assert_true( evtdone.dragover, 'dragover event was not tested'+failtxt );
+ assert_true( evtdone.drop, 'drop event was not tested'+failtxt );
+ assert_true( evtdone.dragend, 'dragend event was not tested'+failtxt );
+ }, 'all event types must now have been tested' );
+ done();
+ };
+};
+ </script>
+ </head>
+ <body>
+ <blockquote draggable="true"></blockquote>
+ <blockquote></blockquote>
+ <blockquote></blockquote>
+ <div id="log">Drag the orange square over the blue square then the fuchsia square, then release it.</div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/102-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/102-manual.html
new file mode 100644
index 000000000..ebb3090ba
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/102-manual.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site to itself</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/103-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/103-1.html
new file mode 100644
index 000000000..9904ceaa0
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/103-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with user/pass/port to itself</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/103-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/103-manual.html
new file mode 100644
index 000000000..7bedf0958
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/103-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with user/pass/port to itself</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://foo:bar@'+httpHostMain+':80'+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/104-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/104-1.html
new file mode 100644
index 000000000..ada4a6f99
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/104-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with non-default port to itself</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain+':'+httpPortAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/104-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/104-manual.html
new file mode 100644
index 000000000..126242462
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/104-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with non-default port to itself</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+':'+httpPortAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/105-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/105-1.html
new file mode 100644
index 000000000..ccfe4f4c4
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/105-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site to site with non-default port</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+':'+httpPortAlias+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/105-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/105-manual.html
new file mode 100644
index 000000000..4695888a6
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/105-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site to site with non-default port</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/106-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/106-1.html
new file mode 100644
index 000000000..d8ff88efc
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/106-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with non-default port to site</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain+':'+httpPortAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/106-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/106-manual.html
new file mode 100644
index 000000000..18017511b
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/106-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for http site with non-default port to site</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+':'+httpPortAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/107-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/107-1.html
new file mode 100644
index 000000000..2392b19ea
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/107-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site to itself</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'https://'+httpsHostAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/107-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/107-manual.html
new file mode 100644
index 000000000..ecd9e9b7b
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/107-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site to itself</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'https://'+httpsHostAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/108-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/108-1.html
new file mode 100644
index 000000000..b3027dbe2
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/108-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site with non-default port to itself</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'https://'+httpsHostAlias+':'+httpsPortAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/108-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/108-manual.html
new file mode 100644
index 000000000..eb77db366
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/108-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site with non-default port to itself</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'https://'+httpsHostAlias+':'+httpsPortAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/109-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/109-1.html
new file mode 100644
index 000000000..6b4e1d80c
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/109-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site to site with non-default port</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'https://'+httpsHostAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+':'+httpsPortAlias+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/109-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/109-manual.html
new file mode 100644
index 000000000..7817a8550
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/109-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site to site with non-default port</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'https://'+httpsHostAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/110-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/110-1.html
new file mode 100644
index 000000000..ee584003a
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/110-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site with non-default port to site</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'https://'+httpsHostAlias+':'+httpsPortAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = 'https://'+httpsHostAlias+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/110-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/110-manual.html
new file mode 100644
index 000000000..663e162bd
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/110-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for https site with non-default port to site</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'https://'+httpsHostAlias+':'+httpsPortAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/111-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/111-manual.html
new file mode 100644
index 000000000..c81efa01d
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/111-manual.html
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for file: to http:</title>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var datastr =
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Origin for file: to http:<\/title>\
+ <style type="text/css">\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { width: 500px; height: 120px; border: none; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ var origin = "null (string)";\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ };\
+ document.getElementsByTagName("span")[0].textContent = origin;\
+ var iframe = document.createElement("iframe");\
+ iframe.src = "'+location.href.replace(/[^\/]*$/,'HELPER-showorigin.html')+'";\
+ document.body.insertBefore(iframe,document.getElementsByTagName("div")[0]);\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>\
+ <span><\/span><\/p>\
+ <div draggable="true"></div>\
+ <\/body>\
+<\/html>';
+ document.getElementsByTagName('a')[0].href = 'data:text/html,'+escape(datastr);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p><a href="">Download the linked file to your disk</a>, and open it locally. Follow further instructions in that file.</p>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/112-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/112-manual.html
new file mode 100644
index 000000000..858e51d9c
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/112-manual.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for data: with inherited http origin to http:</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var datastr =
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Origin for data: with inherited http origin to http:<\/title>\
+ <style type="text/css">\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { width: 500px; height: 120px; border: none; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ var origin = "http://'+httpHostMain+'";\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ };\
+ document.getElementsByTagName("span")[0].textContent = origin;\
+ var iframe = document.createElement("iframe");\
+ iframe.src = "'+location.href.replace(/[^\/]*$/,'HELPER-showorigin.html')+'";\
+ document.body.insertBefore(iframe,document.getElementsByTagName("div")[0]);\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>\
+ <span><\/span><\/p>\
+ <div draggable="true"></div>\
+ <\/body>\
+<\/html>';
+ var iframe = document.createElement('iframe');
+ iframe.src = 'data:text/html,'+escape(datastr);
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/113-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/113-manual.html
new file mode 100644
index 000000000..d3f889a9d
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/113-manual.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for data: with no inherited origin to http:</title>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ </head>
+ <body>
+
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+var origin = 'http://'+httpHostMain;
+if( location.href.indexOf(origin+'/') ) {
+ document.write('This must be tested on '+origin+'/');
+} else {
+ document.write("data:text/html,"+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Origin for data: with no inherited origin to http:<\/title>\
+ <style type="text/css">\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { width: 500px; height: 120px; border: none; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ var origin = "null (string)";\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ };\
+ document.getElementsByTagName("span")[0].textContent = origin;\
+ var iframe = document.createElement("iframe");\
+ iframe.src = "'+location.href.replace(/[^\/]*$/,'HELPER-showorigin.html')+'";\
+ document.body.insertBefore(iframe,document.getElementsByTagName("div")[0]);\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>\
+ <span><\/span><\/p>\
+ <div draggable="true"></div>\
+ <\/body>\
+<\/html>'));
+}
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/114-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/114-manual.html
new file mode 100644
index 000000000..b2532178a
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/114-manual.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for javascript: with inherited http origin to http:</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var datastr =
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Origin for javascript: with inherited http origin to http:<\/title>\
+ <style type="text/css">\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { width: 500px; height: 120px; border: none; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ var origin = "http://'+httpHostMain+'";\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ };\
+ document.getElementsByTagName("span")[0].textContent = origin;\
+ var iframe = document.createElement("iframe");\
+ iframe.src = "'+location.href.replace(/[^\/]*$/,'HELPER-showorigin.html')+'";\
+ document.body.insertBefore(iframe,document.getElementsByTagName("div")[0]);\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>\
+ <span><\/span><\/p>\
+ <div draggable="true"></div>\
+ <\/body>\
+<\/html>';
+ var iframe = document.createElement('iframe');
+ iframe.src = "javascript:'"+escape(datastr)+"'";
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/115-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/115-manual.html
new file mode 100644
index 000000000..751757e14
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/115-manual.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for javascript: with no inherited origin to http:</title>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ </head>
+ <body>
+
+ <p>Load the following URL in a new tab (copy &amp; paste it into the address bar):</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ <script type="text/javascript">
+var origin = 'http://'+httpHostMain;
+if( location.href.indexOf(origin+'/') ) {
+ document.write('This must be tested on '+origin+'/');
+} else {
+ document.write("javascript:'"+escape(
+'<!doctype html>\
+<html>\
+ <head>\
+ <title>Origin for javascript: with no inherited origin to http:<\/title>\
+ <style type="text/css">\
+div { height: 100px; width: 100px; background: orange; }\
+iframe { width: 500px; height: 120px; border: none; }\
+ <\/style>\
+ <script type="text/javascript">\
+window.onload = function () {\
+ var origin = "null (string)";\
+ document.getElementsByTagName("div")[0].ondragstart = function (e) {\
+ e.dataTransfer.effectAllowed = "copy";\
+ e.dataTransfer.setData("text","dummy text");\
+ };\
+ document.getElementsByTagName("span")[0].textContent = origin;\
+ var iframe = document.createElement("iframe");\
+ iframe.src = "'+location.href.replace(/[^\/]*$/,'HELPER-showorigin.html')+'";\
+ document.body.insertBefore(iframe,document.getElementsByTagName("div")[0]);\
+};\
+ <\/script>\
+ <\/head>\
+ <body>\
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>\
+ <span><\/span><\/p>\
+ <div draggable="true"></div>\
+ <\/body>\
+<\/html>')+"'");
+}
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/116-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/116-manual.html
new file mode 100644
index 000000000..fdeeeb373
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/116-manual.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for dropped files</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ document.getElementsByTagName('span')[0].textContent = 'null (string)';
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag a small file from your computer onto the blue square and release it. If a prompt appears, accept it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/117-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/117-1.html
new file mode 100644
index 000000000..c49b18ac9
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/117-1.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for site with document.domain set to a parent domain</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ document.domain = httpsHostAlias.replace(/^[^.]+\./,'');
+ var iframe = document.createElement('iframe');
+ iframe.src = origin+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/117-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/117-manual.html
new file mode 100644
index 000000000..d126fdaac
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/117-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin for site with document.domain set to a parent domain</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/118-1.html b/testing/web-platform/tests/html/editing/dnd/target-origin/118-1.html
new file mode 100644
index 000000000..d0212bd2a
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/118-1.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin after leaving browser window</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; }
+iframe { width: 500px; height: 120px; border: none; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain+':'+httpPortAlias;
+ document.getElementsByTagName('div')[0].ondragstart = function (e) {
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ };
+ document.getElementsByTagName('span')[0].textContent = origin;
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+location.pathname.replace(/[^\/]*$/,'HELPER-showorigin.html');
+ document.body.insertBefore(iframe,document.getElementsByTagName('div')[0]);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>Drag the orange square out of the browser window (not onto the system taskbar) then back onto the blue square and release it. The blue square should be replaced with the text:<br>
+ <span></span></p>
+ <div draggable="true"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/118-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/118-manual.html
new file mode 100644
index 000000000..6b931692d
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/118-manual.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Origin after leaving browser window</title>
+ <style type="text/css">
+html, body, iframe { display: block; width: 100%; height: 100%; border: none; margin: 0; padding: 0; }
+ </style>
+ <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
+ <script type="text/javascript">
+window.onload = function () {
+ var origin = 'http://'+httpHostMain;
+ if( location.href.indexOf(origin+'/') ) {
+ document.body.innerHTML = 'This must be tested on '+origin+'/';
+ return;
+ }
+ var iframe = document.createElement('iframe');
+ iframe.src = 'http://'+httpHostMain+':'+httpPortAlias+location.pathname.replace(/.html$/,'-1.html');
+ document.body.appendChild(iframe);
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/201-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/201-manual.html
new file mode 100644
index 000000000..a687147c7
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/201-manual.html
@@ -0,0 +1,83 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin with real dataTransfer should block dragenter, dragover, dragleave and drop synthetic events</title>
+ <style type="text/css">
+p + div { height: 100px; width: 100px; background: orange; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ var orange = document.getElementsByTagName('div')[0], targ = document.getElementsByTagName('div')[1], evtdone = {}, fails = [];
+ orange.ondragstart = function (e) {
+ var evt;
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ try {
+ e.dataTransfer.allowTargetOrigin('http://example.com');
+ } catch(e) {
+ fails[fails.length] = 'allowTargetOrigin threw an error: '+e;
+ }
+ try {
+ evt = new DragEvent('dragstart', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('drag', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragenter', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragover', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragleave', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('drop', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragend', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ } catch(e) {
+ fails[fails.length] = 'Synthetic event threw an error: '+e;
+ }
+ if( !evtdone.dragstart ) {
+ fails[fails.length] = 'dragstart did not fire';
+ }
+ if( !evtdone.drag ) {
+ fails[fails.length] = 'drag did not fire';
+ }
+ if( !evtdone.dragend ) {
+ fails[fails.length] = 'dragend did not fire';
+ }
+ if( evtdone.dragenter ) {
+ fails[fails.length] = 'dragenter fired';
+ }
+ if( evtdone.dragover ) {
+ fails[fails.length] = 'dragover fired';
+ }
+ if( evtdone.dragleave ) {
+ fails[fails.length] = 'dragleave fired';
+ }
+ if( evtdone.drop ) {
+ fails[fails.length] = 'drop fired';
+ }
+ document.getElementsByTagName('p')[0].innerHTML = fails.length ? ( 'FAIL:<br>' + fails.join('<br>') ) : 'PASS';
+ };
+ targ.ondragstart = function (e) {
+ evtdone[e.type] = true;
+ };
+ targ.ondragenter = targ.ondragover = targ.ondrop = function (e) {
+ e.preventDefault();
+ evtdone[e.type] = true;
+ };
+ targ.ondrag = targ.ondragleave = function (e) {
+ evtdone[e.type] = true;
+ };
+ targ.ondragend = function (e) {
+ evtdone[e.type] = true;
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>Drag the orange square to the right until the drag placeholder appears, then release it. Fail if this text does not change.</p>
+ <div draggable="true"></div>
+ <div></div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/202.html b/testing/web-platform/tests/html/editing/dnd/target-origin/202.html
new file mode 100644
index 000000000..0e6b43c06
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/202.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin with fake dataTransfer should block dragenter, dragover, dragleave and drop synthetic events</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div draggable="true"></div>
+ <div></div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+
+ <script type="text/javascript">
+test(function () {
+ var dragsource = document.getElementsByTagName('div')[0], targ = document.getElementsByTagName('div')[1], evtdone = {};
+ dragsource.ondragstart = function (e) {
+ var evt;
+ evtdone.initial = true;
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ e.dataTransfer.allowTargetOrigin('http://example.com');
+ evt = new DragEvent('dragstart', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('drag', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragenter', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragover', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragleave', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('drop', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ evt = new DragEvent('dragend', {dataTransfer:e.dataTransfer});
+ targ.dispatchEvent(evt);
+ };
+ targ.ondragstart = function (e) {
+ evtdone[e.type] = true;
+ };
+ targ.ondragenter = targ.ondragover = targ.ondrop = function (e) {
+ e.preventDefault();
+ evtdone[e.type] = true;
+ };
+ targ.ondrag = targ.ondragleave = function (e) {
+ evtdone[e.type] = true;
+ };
+ targ.ondragend = function (e) {
+ evtdone[e.type] = true;
+ };
+ var creatorevent = document.createEvent('DragEvent');
+ creatorevent.initDragEvent('dragstart', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, document.body, {});
+ dragsource.dispatchEvent(creatorevent);
+ assert_true(evtdone.dragstart, 'dragstart must fire');
+ assert_true(evtdone.drag, 'drag must fire');
+ assert_true(evtdone.dragend, 'dragend must fire');
+ assert_false(evtdone.dragenter, 'dragenter must not fire');
+ assert_false(evtdone.dragover, 'dragover must not fire');
+ assert_false(evtdone.dragleave, 'dragleave must not fire');
+ assert_false(evtdone.drop, 'drop must not fire');
+}, "allowTargetOrigin with fake dataTransfer should block events");
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustallow.html b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustallow.html
new file mode 100644
index 000000000..0a68b7448
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustallow.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Must be allowed</title>
+ <style type="text/css">
+html { background: blue; }
+html, body { margin: 0; padding: 0; height: 100%; width: 100%; }
+ </style>
+ </head>
+ <body>
+ <script type="text/javascript">
+if( location.search && location.search.indexOf('domain') != -1 ) {
+ document.domain = location.hostname.replace(/^[^.]+\./,'');
+}
+var seentypes = {};
+document.body.ondragenter = document.body.ondragover = document.body.ondrop = function (e) {
+ e.preventDefault();
+ if( e.type == 'drop' ) {
+ document.body.innerHTML = ( seentypes.dragenter && seentypes.dragover && e.dataTransfer.getData('text') == 'dummy text' ) ? 'PASS' : 'FAIL';
+ } else {
+ seentypes[e.type] = true;
+ }
+}
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustblock.html b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustblock.html
new file mode 100644
index 000000000..dd467f55f
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-mustblock.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Must be blocked</title>
+ <style type="text/css">
+html { background: fuchsia; }
+html, body { margin: 0; padding: 0; height: 100%; width: 100%; }
+ </style>
+ </head>
+ <body>
+ <script type="text/javascript">
+if( location.search && location.search.indexOf('domain') != -1 ) {
+ document.domain = location.hostname.replace(/^[^.]+\./,'');
+}
+document.body.ondragenter = document.body.ondragleave = document.body.ondragover = document.body.ondrop = function (e) {
+ e.preventDefault();
+ document.body.innerHTML = 'FAIL';
+}
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-showorigin.html b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-showorigin.html
new file mode 100644
index 000000000..ea071e811
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/HELPER-showorigin.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Readout of .origin</title>
+ <style type="text/css">
+html, body { margin: 0; padding: 0; }
+div { height: 100px; width: 100px; background: blue; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ var blue = document.getElementsByTagName('div')[0];
+ blue.ondragenter = blue.ondragover = function (e) {
+ e.preventDefault();
+ };
+ blue.ondrop = function (e) {
+ e.preventDefault();
+ if( e.dataTransfer.origin === 'null' ) {
+ document.body.innerHTML = 'null (string)';
+ } else {
+ document.body.innerHTML = e.dataTransfer.origin;
+ }
+ };
+};
+ </script>
+ </head>
+ <body>
+
+ <div></div>
+
+ </body>
+</html> \ No newline at end of file