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.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>HTML link states testing</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../role.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../events.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | //gA11yEventDumpToConsole = true; // debug stuff |
michael@0 | 25 | |
michael@0 | 26 | var gLinkWindow = null; |
michael@0 | 27 | function closeDocChecker() |
michael@0 | 28 | { |
michael@0 | 29 | this.__proto__ = new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE); |
michael@0 | 30 | |
michael@0 | 31 | this.check = function closeDocChecker_check(aEvent) |
michael@0 | 32 | { |
michael@0 | 33 | gLinkWindow = aEvent.accessible.rootDocument.window; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | this.match = function closeDocChecker_match(aEvent) |
michael@0 | 37 | { |
michael@0 | 38 | // A temporary about:blank document gets loaded before 'example.com' |
michael@0 | 39 | // document. |
michael@0 | 40 | return aEvent.DOMNode.URL == "http://www.example.com/"; |
michael@0 | 41 | } |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | function clickLink(aID) |
michael@0 | 45 | { |
michael@0 | 46 | this.eventSeq = [ |
michael@0 | 47 | new stateChangeChecker(STATE_TRAVERSED, false, true, "link_traversed"), |
michael@0 | 48 | new closeDocChecker() |
michael@0 | 49 | ]; |
michael@0 | 50 | |
michael@0 | 51 | this.invoke = function clickLink_invoke() |
michael@0 | 52 | { |
michael@0 | 53 | synthesizeMouse(getNode("link_traversed"), 1, 1, { shiftKey: true }); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | this.getID = function clickLink_getID() |
michael@0 | 57 | { |
michael@0 | 58 | return "link + '" + aID + "' clicked."; |
michael@0 | 59 | } |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | var gQueue = null; |
michael@0 | 63 | function doTest() |
michael@0 | 64 | { |
michael@0 | 65 | // a@href and its text node |
michael@0 | 66 | testStates("link_href", STATE_LINKED); |
michael@0 | 67 | testStates(getAccessible("link_href").firstChild, STATE_LINKED); |
michael@0 | 68 | |
michael@0 | 69 | // a@onclick |
michael@0 | 70 | testStates("link_click", STATE_LINKED); |
michael@0 | 71 | |
michael@0 | 72 | // a@onmousedown |
michael@0 | 73 | testStates("link_mousedown", STATE_LINKED); |
michael@0 | 74 | |
michael@0 | 75 | // a@onmouseup |
michael@0 | 76 | testStates("link_mouseup", STATE_LINKED); |
michael@0 | 77 | |
michael@0 | 78 | // a@role="link" |
michael@0 | 79 | testStates("link_arialink", STATE_LINKED); |
michael@0 | 80 | |
michael@0 | 81 | // a@role="button" |
michael@0 | 82 | testStates("link_ariabutton", 0, 0, STATE_LINKED); |
michael@0 | 83 | |
michael@0 | 84 | // a (no @href, no click event listener) |
michael@0 | 85 | testStates("link_notlink", 0, 0, STATE_LINKED); |
michael@0 | 86 | |
michael@0 | 87 | // a: no traversed state |
michael@0 | 88 | testStates("link_traversed", 0, 0, STATE_TRAVERSED); |
michael@0 | 89 | |
michael@0 | 90 | // a: traversed state |
michael@0 | 91 | //enableLogging("docload"); // debug stuff |
michael@0 | 92 | |
michael@0 | 93 | gQueue = new eventQueue(); |
michael@0 | 94 | gQueue.push(new clickLink("link_traversed")); |
michael@0 | 95 | gQueue.onFinish = |
michael@0 | 96 | function() |
michael@0 | 97 | { |
michael@0 | 98 | gLinkWindow.close(); |
michael@0 | 99 | //disableLogging(); // debug stuff |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | gQueue.invoke(); // will call SimpleTest.finsih(); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 106 | addA11yLoadEvent(doTest); |
michael@0 | 107 | </script> |
michael@0 | 108 | |
michael@0 | 109 | </head> |
michael@0 | 110 | |
michael@0 | 111 | <body> |
michael@0 | 112 | |
michael@0 | 113 | <a target="_blank" |
michael@0 | 114 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409" |
michael@0 | 115 | title="Expose click action if mouseup and mousedown are registered"> |
michael@0 | 116 | Mozilla Bug 423409 |
michael@0 | 117 | </a> |
michael@0 | 118 | <a target="_blank" |
michael@0 | 119 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=754830" |
michael@0 | 120 | title="Calculate link states separately"> |
michael@0 | 121 | Mozilla Bug 754830 |
michael@0 | 122 | </a> |
michael@0 | 123 | <a target="_blank" |
michael@0 | 124 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=757774" |
michael@0 | 125 | title="Fire state change event when link is traversed"> |
michael@0 | 126 | Mozilla Bug 757774 |
michael@0 | 127 | </a> |
michael@0 | 128 | <p id="display"></p> |
michael@0 | 129 | <div id="content" style="display: none"></div> |
michael@0 | 130 | <pre id="test"> |
michael@0 | 131 | </pre> |
michael@0 | 132 | |
michael@0 | 133 | <a id="link_href" href="http://mozilla.org">link</a> |
michael@0 | 134 | <a id="link_click" onclick="">link</a> |
michael@0 | 135 | <a id="link_mousedown" onmousedown="">link</a> |
michael@0 | 136 | <a id="link_mouseup" onmouseup="">link</a> |
michael@0 | 137 | <a id="link_arialink" role="link">aria link</a> |
michael@0 | 138 | <a id="link_ariabutton" role="button">aria button</a> |
michael@0 | 139 | <a id="link_notlink">not link</a> |
michael@0 | 140 | |
michael@0 | 141 | <a id="link_traversed" href="http://www.example.com" target="_top">example.com</a> |
michael@0 | 142 | |
michael@0 | 143 | </body> |
michael@0 | 144 | </html> |