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 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | |
michael@0 | 6 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 7 | title="test for nsIAccessibleHyperLink interface on XUL:label elements"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js" /> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../role.js" /> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../states.js" /> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../events.js" /> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript" |
michael@0 | 22 | src="hyperlink.js" /> |
michael@0 | 23 | |
michael@0 | 24 | <script type="application/javascript"> |
michael@0 | 25 | <![CDATA[ |
michael@0 | 26 | function testThis(aID, aAcc, aRole, aAnchorCount, aAnchorName, aURI, |
michael@0 | 27 | aStartIndex, aEndIndex, aValid) |
michael@0 | 28 | { |
michael@0 | 29 | testRole(aID, aRole); |
michael@0 | 30 | is(aAcc.anchorCount, aAnchorCount, "Wrong number of anchors for ID " |
michael@0 | 31 | + aID + "!"); |
michael@0 | 32 | is(aAcc.getAnchor(0).name, aAnchorName, "Wrong name for ID " + aID + "!"); |
michael@0 | 33 | is(aAcc.getURI(0).spec, aURI, "URI wrong for ID " + aID + "!"); |
michael@0 | 34 | is(aAcc.startIndex, aStartIndex, "Wrong startIndex value for ID " + aID |
michael@0 | 35 | + "!"); |
michael@0 | 36 | is(aAcc.endIndex, aEndIndex, "Wrong endIndex value for ID " + aID + "!"); |
michael@0 | 37 | is(aAcc.valid, aValid, "Wrong valid state for ID " + aID + "!"); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | var gQueue = null; |
michael@0 | 41 | function doTest() |
michael@0 | 42 | { |
michael@0 | 43 | var linkedLabelAcc = getAccessible("linkedLabel", |
michael@0 | 44 | [nsIAccessibleHyperLink]); |
michael@0 | 45 | testThis("linkedLabel", linkedLabelAcc, ROLE_LINK, 1, |
michael@0 | 46 | "Mozilla Foundation home", "http://www.mozilla.org/", 1, 2, |
michael@0 | 47 | true); |
michael@0 | 48 | testStates(linkedLabelAcc, STATE_LINKED, 0); |
michael@0 | 49 | |
michael@0 | 50 | var labelWithValueAcc = getAccessible("linkLabelWithValue", |
michael@0 | 51 | [nsIAccessibleHyperLink]); |
michael@0 | 52 | testThis("linkLabelWithValue", labelWithValueAcc, ROLE_LINK, 1, |
michael@0 | 53 | "Mozilla Foundation", "http://www.mozilla.org/", 2, 3, true, |
michael@0 | 54 | false, true); |
michael@0 | 55 | testStates(labelWithValueAcc, STATE_LINKED, EXT_STATE_HORIZONTAL); |
michael@0 | 56 | |
michael@0 | 57 | var normalLabelAcc = getAccessible("normalLabel"); |
michael@0 | 58 | testRole(normalLabelAcc, ROLE_LABEL); |
michael@0 | 59 | is(normalLabelAcc.name, "This label should not be a link", |
michael@0 | 60 | "Wrong name for normal label!"); |
michael@0 | 61 | testStates(normalLabelAcc, 0, 0, (STATE_FOCUSABLE | STATE_LINKED)); |
michael@0 | 62 | |
michael@0 | 63 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 64 | // Test focus |
michael@0 | 65 | |
michael@0 | 66 | gQueue = new eventQueue(); |
michael@0 | 67 | |
michael@0 | 68 | gQueue.push(new focusLink("linkedLabel", true)); |
michael@0 | 69 | gQueue.push(new focusLink("linkLabelWithValue", true)); |
michael@0 | 70 | |
michael@0 | 71 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 75 | addA11yLoadEvent(doTest); |
michael@0 | 76 | ]]> |
michael@0 | 77 | </script> |
michael@0 | 78 | |
michael@0 | 79 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 80 | <a target="_blank" |
michael@0 | 81 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=421066" |
michael@0 | 82 | title="Implement Mochitests for the nsIAccessibleHyperLink interface on XUL:label elements"> |
michael@0 | 83 | Mozilla Bug 421066 |
michael@0 | 84 | </a> |
michael@0 | 85 | <p id="display"></p> |
michael@0 | 86 | <div id="content" style="display: none"> |
michael@0 | 87 | </div> |
michael@0 | 88 | <pre id="test"> |
michael@0 | 89 | </pre> |
michael@0 | 90 | </body> |
michael@0 | 91 | |
michael@0 | 92 | <label id="linkedLabel" class="text-link" href="http://www.mozilla.org/"> |
michael@0 | 93 | Mozilla Foundation home</label> |
michael@0 | 94 | <label id="linkLabelWithValue" value="Mozilla Foundation" class="text-link" |
michael@0 | 95 | href="http://www.mozilla.org/" /> |
michael@0 | 96 | <label id="normalLabel" value="This label should not be a link" /> |
michael@0 | 97 | </window> |