Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 <html>
2 <body>
3 The link below has an onmousedown, an onmouseup, and an onmousemove handler.
4 Mouseover or click for event info in debug console.
5 <a href="jshandlers.html">Link back to this page</a>
7 <p>The link below has an event that should open www.mozilla.org when
8 clicked
9 </p>
10 <!-- The link does 'return 0' - as per bug 345521 this should *not* be
11 interpreted as false
12 -->
13 <a href="http://www.mozilla.org" onclick="return 0">Click me</a>
15 <p>The link below has an event that is cancelled - nothing should happen when
16 clicked
17 </p>
18 <a href="http://www.mozilla.org" onclick="return false">Click me<a/>
20 </body>
21 <script>
22 function findElementByTagName(start, tag)
23 {
24 var type = start.nodeType;
26 if (type == Node.ELEMENT) {
28 if (tag == start.tagName) {
29 //dump ("found one\n");
30 return start;
31 }
33 if (start.hasChildNodes) {
34 var children = start.childNodes;
35 var length = children.length;
36 var count = 0;
37 while(count < length) {
38 var ret = findElementByTagName(children[count], tag)
39 if (null != ret) {
40 return ret;
41 }
42 count++;
43 }
44 }
45 }
46 return null;
47 }
49 function getFirstLink()
50 {
51 var node = document.documentElement;
52 var ret = findElementByTagName(node, "A");
53 return ret;
54 }
56 function ondown()
57 {
58 dump("got mousedown in script\n");
59 }
61 function onup()
62 {
63 dump("got mouseup in script\n");
64 }
66 function onmove(event)
67 {
68 dump("got mousemove in script at "+event.clientX+", "+event.clientY+"\n");
69 }
71 var l = getFirstLink();
72 l.onmousedown = ondown;
73 l.onmouseup = onup;
74 l.onmousemove = onmove;
75 </script>
76 </html>