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=599368 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 599368</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/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=599368">Mozilla Bug 599368</a> |
michael@0 | 15 | <iframe id="display" src="about:blank"></iframe> |
michael@0 | 16 | <div id="content" style="display: none"> |
michael@0 | 17 | |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script type="application/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test for Bug 599368 **/ |
michael@0 | 23 | |
michael@0 | 24 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 25 | |
michael@0 | 26 | window.addEventListener("load", step1, false); |
michael@0 | 27 | |
michael@0 | 28 | var gImage; |
michael@0 | 29 | var gIframe; |
michael@0 | 30 | var gBlueNotSelected; |
michael@0 | 31 | var gBlueSelected; |
michael@0 | 32 | var gFuchsiaSelected; |
michael@0 | 33 | |
michael@0 | 34 | function step1() |
michael@0 | 35 | { |
michael@0 | 36 | gIframe = document.getElementById("display"); |
michael@0 | 37 | doc = gIframe.contentDocument; |
michael@0 | 38 | |
michael@0 | 39 | gImage = doc.createElement('img'); |
michael@0 | 40 | var src = String(window.location).split("/"); |
michael@0 | 41 | src.pop(); |
michael@0 | 42 | src.push("blue-32x32.png"); |
michael@0 | 43 | src = src.join("/"); |
michael@0 | 44 | gImage.src = src; |
michael@0 | 45 | gImage.addEventListener("load", step2, false); |
michael@0 | 46 | doc.body.appendChild(gImage); |
michael@0 | 47 | |
michael@0 | 48 | doc.designMode = "on"; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | function step2() { |
michael@0 | 52 | gImage.removeEventListener("load", step2, false); |
michael@0 | 53 | |
michael@0 | 54 | gBlueNotSelected = snapshotWindow(gIframe.contentWindow, false); |
michael@0 | 55 | |
michael@0 | 56 | synthesizeMouse(gImage, 5, 5, {}, gIframe.contentWindow); |
michael@0 | 57 | setTimeout(step3, 0); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | function step3() { |
michael@0 | 61 | gBlueSelected = snapshotWindow(gIframe.contentWindow, false); |
michael@0 | 62 | |
michael@0 | 63 | var src = String(window.location).split("/"); |
michael@0 | 64 | src.pop(); |
michael@0 | 65 | src.push("fuchsia-32x32.png"); |
michael@0 | 66 | src = src.join("/"); |
michael@0 | 67 | gImage.addEventListener("load", step4, false); |
michael@0 | 68 | gImage.src = src; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | function step4() { |
michael@0 | 72 | gImage.removeEventListener("load", step4, false); |
michael@0 | 73 | |
michael@0 | 74 | gFuchsiaSelected = snapshotWindow(gIframe.contentWindow, false); |
michael@0 | 75 | |
michael@0 | 76 | assert_different(gBlueNotSelected, gBlueSelected, |
michael@0 | 77 | "selecting image should add drag points"); |
michael@0 | 78 | assert_different(gBlueSelected, gFuchsiaSelected, |
michael@0 | 79 | "different images should appear different"); |
michael@0 | 80 | |
michael@0 | 81 | SimpleTest.finish(); |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | function assert_different(shot1, shot2, desc) |
michael@0 | 85 | { |
michael@0 | 86 | var [correct, s1, s2] = compareSnapshots(shot1, shot2, false); |
michael@0 | 87 | ok(correct, desc); |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | </script> |
michael@0 | 91 | </pre> |
michael@0 | 92 | </body> |
michael@0 | 93 | </html> |