Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=674770
5 -->
6 <head>
7 <title>Test for Bug 674770</title>
8 <script type="application/javascript" src="/MochiKit/packed.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674770">Mozilla Bug 674770</a>
15 <p id="display"></p>
16 <div id="content">
17 <a href="file_bug674770-1.html" id="link1">test</a>
18 <div contenteditable>
19 <a href="file_bug674770-1.html" id="link2">test</a>
20 </div>
21 </div>
22 <pre id="test">
23 <script type="application/javascript">
25 if (!navigator.platform.startsWith("Linux")) {
26 SimpleTest.expectAssertions(1);
27 }
29 /** Test for Bug 674770 **/
30 SimpleTest.waitForExplicitFinish();
31 SimpleTest.waitForFocus(function() {
32 SpecialPowers.setBoolPref("middlemouse.paste", true);
33 localStorage.removeItem("clicked");
34 window.linkWasClicked = false;
36 var link = document.querySelector("#link1");
37 addEventListener("storage", function(e) {
38 is(e.key, "clicked", "Correct event");
39 is(e.newValue, "true", "Correct value");
40 window.linkWasClicked = true;
41 }, false);
42 synthesizeMouseAtCenter(link, {button: 1});
44 hitEventLoop(function() {
45 ok(window.linkWasClicked, "The click operation worked successfully");
46 window.linkWasClicked = false;
48 link = document.querySelector("#link2");
49 localStorage.removeItem("clicked");
50 synthesizeMouseAtCenter(link, {button: 1});
52 hitEventLoop(function() {
53 ok(!window.linkWasClicked, "The click operation shouldn't work in the contenteditable area");
55 localStorage.removeItem("clicked");
56 SpecialPowers.clearUserPref("middlemouse.paste");
57 SimpleTest.finish();
58 }, 100);
59 }, 100);
60 });
62 function hitEventLoop(func, times) {
63 if (times > 0) {
64 setTimeout(hitEventLoop, 0, func, times - 1);
65 } else {
66 setTimeout(func, 0);
67 }
68 }
70 </script>
71 </pre>
72 </body>
73 </html>