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="Embeds relation tests"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
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 | <script type="application/javascript" |
michael@0 | 23 | src="../relations.js"></script> |
michael@0 | 24 | <script type="application/javascript" |
michael@0 | 25 | src="../browser.js"></script> |
michael@0 | 26 | |
michael@0 | 27 | <script type="application/javascript"> |
michael@0 | 28 | <![CDATA[ |
michael@0 | 29 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 30 | // Invokers |
michael@0 | 31 | |
michael@0 | 32 | function loadURI(aURI) |
michael@0 | 33 | { |
michael@0 | 34 | this.invoke = function loadURI_invoke() |
michael@0 | 35 | { |
michael@0 | 36 | tabBrowser().loadURI(aURI); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | this.eventSeq = [ |
michael@0 | 40 | new invokerChecker(EVENT_REORDER, currentBrowser) |
michael@0 | 41 | ]; |
michael@0 | 42 | |
michael@0 | 43 | this.finalCheck = function loadURI_finalCheck() |
michael@0 | 44 | { |
michael@0 | 45 | testRelation(browserDocument(), RELATION_EMBEDS, |
michael@0 | 46 | getAccessible(currentTabDocument())); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | this.getID = function loadURI_getID() |
michael@0 | 50 | { |
michael@0 | 51 | return "load uri " + aURI; |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function browserReorderChecker() |
michael@0 | 56 | { |
michael@0 | 57 | this.type = EVENT_REORDER; |
michael@0 | 58 | |
michael@0 | 59 | this.match = function browserReorderChecker_match(aEvent) |
michael@0 | 60 | { |
michael@0 | 61 | // Reorder event might be duped because of temporary document creation. |
michael@0 | 62 | if (aEvent.accessible == getAccessible(currentBrowser())) { |
michael@0 | 63 | this.cnt++; |
michael@0 | 64 | return this.cnt != 2; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | return false; |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | this.cnt = 0; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | function loadOneTab(aURI) |
michael@0 | 74 | { |
michael@0 | 75 | this.invoke = function loadOneTab_invoke() |
michael@0 | 76 | { |
michael@0 | 77 | tabBrowser().loadOneTab(aURI, null, null, null, false); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | this.eventSeq = [ |
michael@0 | 81 | new browserReorderChecker() |
michael@0 | 82 | ]; |
michael@0 | 83 | |
michael@0 | 84 | this.finalCheck = function loadURI_finalCheck() |
michael@0 | 85 | { |
michael@0 | 86 | testRelation(browserDocument(), RELATION_EMBEDS, |
michael@0 | 87 | getAccessible(currentTabDocument())); |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | this.getID = function loadOneTab_getID() |
michael@0 | 91 | { |
michael@0 | 92 | return "load uri '" + aURI + "' in new tab"; |
michael@0 | 93 | } |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 97 | // Testing |
michael@0 | 98 | |
michael@0 | 99 | gA11yEventDumpToConsole = true; // debug |
michael@0 | 100 | |
michael@0 | 101 | var gQueue = null; |
michael@0 | 102 | function doTests() |
michael@0 | 103 | { |
michael@0 | 104 | testRelation(browserDocument(), RELATION_EMBEDS, |
michael@0 | 105 | getAccessible(currentTabDocument())); |
michael@0 | 106 | |
michael@0 | 107 | enableLogging("docload"); |
michael@0 | 108 | gQueue = new eventQueue(); |
michael@0 | 109 | |
michael@0 | 110 | gQueue.push(new loadURI("about:about")); |
michael@0 | 111 | gQueue.push(new loadOneTab("about:mozilla")); |
michael@0 | 112 | |
michael@0 | 113 | gQueue.onFinish = function() |
michael@0 | 114 | { |
michael@0 | 115 | disableLogging(); |
michael@0 | 116 | closeBrowserWindow(); |
michael@0 | 117 | } |
michael@0 | 118 | gQueue.invoke(); |
michael@0 | 119 | } |
michael@0 | 120 | |
michael@0 | 121 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 122 | openBrowserWindow(doTests, "about:"); |
michael@0 | 123 | ]]> |
michael@0 | 124 | </script> |
michael@0 | 125 | |
michael@0 | 126 | <vbox flex="1" style="overflow: auto;"> |
michael@0 | 127 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 128 | <a target="_blank" |
michael@0 | 129 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=707654" |
michael@0 | 130 | title="Embeds relation on root accessible can return not content document"> |
michael@0 | 131 | Mozilla Bug 707654 |
michael@0 | 132 | </a> |
michael@0 | 133 | <p id="display"></p> |
michael@0 | 134 | <div id="content" style="display: none"> |
michael@0 | 135 | </div> |
michael@0 | 136 | <pre id="test"> |
michael@0 | 137 | </pre> |
michael@0 | 138 | </body> |
michael@0 | 139 | </vbox> |
michael@0 | 140 | </window> |