Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=574596 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 574596</title> |
michael@0 | 8 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=574596">Mozilla Bug 574596</a> |
michael@0 | 15 | <style type="text/css"> |
michael@0 | 16 | #link1 a { -moz-user-select:none; } |
michael@0 | 17 | </style> |
michael@0 | 18 | <div id="link1"><a href="http://www.mozilla.org/">link1</a></div> |
michael@0 | 19 | <div id="link2"><a href="http://www.mozilla.org/">link2</a></div> |
michael@0 | 20 | <p id="display"></p> |
michael@0 | 21 | <div id="content" style="display: none"> |
michael@0 | 22 | |
michael@0 | 23 | </div> |
michael@0 | 24 | <pre id="test"> |
michael@0 | 25 | <script type="application/javascript"> |
michael@0 | 26 | |
michael@0 | 27 | /** Test for Bug 574596 **/ |
michael@0 | 28 | |
michael@0 | 29 | function ignoreFunc(actualData, expectedData) { |
michael@0 | 30 | return true; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | var dragLinkText = [[ |
michael@0 | 34 | { type:"text/x-moz-url", data:"", eqTest:ignoreFunc }, |
michael@0 | 35 | { type:"text/x-moz-url-data", data:"http://www.mozilla.org/" }, |
michael@0 | 36 | { type:"text/x-moz-url-desc", data:"link1" }, |
michael@0 | 37 | { type:"text/uri-list", data:"http://www.mozilla.org/" }, |
michael@0 | 38 | { type:"text/_moz_htmlcontext", data:"", eqTest:ignoreFunc }, |
michael@0 | 39 | { type:"text/_moz_htmlinfo", data:"", eqTest:ignoreFunc }, |
michael@0 | 40 | { type:"text/html", data:'<div id="link1"><a href="http://www.mozilla.org/">link1</a></div>' }, |
michael@0 | 41 | { type:"text/plain", data:"http://www.mozilla.org/" } |
michael@0 | 42 | ]]; |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | function dumpTransfer(dataTransfer,expect) { |
michael@0 | 46 | dtData = dataTransfer.mozItemCount + "items:\n"; |
michael@0 | 47 | for (var i = 0; i < dataTransfer.mozItemCount; i++) { |
michael@0 | 48 | var dtTypes = dataTransfer.mozTypesAt(i); |
michael@0 | 49 | for (var j = 0; j < dtTypes.length; j++) { |
michael@0 | 50 | var actualData = dataTransfer.mozGetDataAt(dtTypes[j],i) |
michael@0 | 51 | if (expect && expect[i] && expect[i][j]) { |
michael@0 | 52 | if (expect[i][j].eqTest) |
michael@0 | 53 | dtData += expect[i][j].eqTest(actualData,expect[i][j].data) ? "ok" : "fail"; |
michael@0 | 54 | else |
michael@0 | 55 | dtData += (actualData == expect[i][j].data) ? "ok" : "fail"; |
michael@0 | 56 | } |
michael@0 | 57 | dtData += "["+i+"]" + "["+j+"]: " + '"' + dtTypes[j] + '" "' + actualData + '"\n'; |
michael@0 | 58 | } |
michael@0 | 59 | } |
michael@0 | 60 | alert(dtData); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function runTest() { |
michael@0 | 64 | var result = synthesizeDragStart($('link1'), dragLinkText, window); |
michael@0 | 65 | is(result, null, "Drag -moz-user-select:none link (#link1)"); |
michael@0 | 66 | // if (result) dumpTransfer(result,dragLinkText); |
michael@0 | 67 | |
michael@0 | 68 | dragLinkText[0][2].data = "link2"; |
michael@0 | 69 | dragLinkText[0][6].data = '<div id="link2"><a href="http://www.mozilla.org/">link2</a></div>' |
michael@0 | 70 | var result = synthesizeDragStart($('link2'), dragLinkText, window); |
michael@0 | 71 | is(result, null, "Drag link (#link2)"); |
michael@0 | 72 | // if (result) dumpTransfer(result,dragLinkText); |
michael@0 | 73 | |
michael@0 | 74 | SimpleTest.finish(); |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 78 | SimpleTest.waitForFocus(runTest); |
michael@0 | 79 | |
michael@0 | 80 | |
michael@0 | 81 | </script> |
michael@0 | 82 | </pre> |
michael@0 | 83 | </body> |
michael@0 | 84 | </html> |