39 let osString = Components.classes[
"@mozilla.org/xre/app-info;1"].
40 getService(Components.interfaces.nsIXULRuntime).OS;
41 if (osString ==
"Linux")
56 return aBrowser.webNavigation.QueryInterface(
Ci.nsIDocumentLoader)
57 .loadGroup.QueryInterface(
Ci.nsISupportsPriority).priority;
59 function setPriority(
aBrowser, aPriority) {
62 aBrowser.webNavigation.QueryInterface(
Ci.nsIDocumentLoader)
63 .loadGroup.QueryInterface(
Ci.nsISupportsPriority).priority = aPriority;
66 function isWindowState(aWindow, aTabPriorities) {
67 let browsers = aWindow.gBrowser.browsers;
69 is(browsers.length, aTabPriorities.length,
70 "Window has expected number of tabs");
72 for (let
i = 0;
i < browsers.length;
i++) {
73 is(getPriority(browsers[
i]), aTabPriorities[i],
74 "Tab had expected priority");
83 function test_behavior() {
89 isWindowState(window_A, [-10]);
92 let tab_A2 = window_A.gBrowser.addTab(
"http://example.com");
93 let tab_A3 = window_A.gBrowser.addTab(
"about:config");
94 tab_A3.linkedBrowser.addEventListener(
"load",
function(aEvent) {
95 tab_A3.removeEventListener(
"load",
arguments.callee,
true);
98 isWindowState(window_A, [-10, 0, 0]);
101 window_A.gBrowser.selectedTab = tab_A2;
102 isWindowState(window_A, [0, -10, 0]);
104 window_A.gBrowser.removeTab(tab_A2);
106 isWindowState(window_A, [0, -10]);
109 let window_B = openDialog(location,
"_blank",
"chrome,all,dialog=no",
"http://example.com");
110 window_B.addEventListener(
"load",
function(aEvent) {
111 window_B.removeEventListener(
"load",
arguments.callee,
false);
112 window_B.gBrowser.addEventListener(
"load",
function(aEvent) {
115 if (window_B.gBrowser.currentURI.spec ==
"about:blank")
117 window_B.gBrowser.removeEventListener(
"load",
arguments.callee,
true);
119 waitForFocus(
function() {
120 isWindowState(window_A, [10, 0]);
121 isWindowState(window_B, [-10]);
123 waitForFocus(
function() {
124 isWindowState(window_A, [0, -10]);
125 isWindowState(window_B, [0]);
127 waitForFocus(
function() {
128 isWindowState(window_A, [10, 0]);
129 isWindowState(window_B, [-10]);
133 window_A.gBrowser.removeTab(tab_A3);
149 function test_extremePriorities() {
150 let tab_A1 = gBrowser.tabContainer.getItemAtIndex(0);
151 let oldPriority = getPriority(tab_A1);
155 setPriority(tab_A1,
Ci.nsISupportsPriority.PRIORITY_LOWEST);
157 let tab_A2 = gBrowser.addTab(
"http://example.com");
158 tab_A2.linkedBrowser.addEventListener(
"load",
function(aEvent) {
159 tab_A2.removeEventListener(
"load",
arguments.callee,
true);
160 gBrowser.selectedTab = tab_A2;
161 is(getPriority(tab_A1),
Ci.nsISupportsPriority.PRIORITY_LOWEST -
PRIORITY_DELTA,
162 "Can adjust priority beyond 'lowest'");
165 setPriority(tab_A1,
Ci.nsISupportsPriority.PRIORITY_HIGHEST);
166 gBrowser.selectedTab = tab_A1;
168 is(getPriority(tab_A1),
Ci.nsISupportsPriority.PRIORITY_HIGHEST +
PRIORITY_DELTA,
169 "Can adjust priority beyond 'highest'");
172 gBrowser.removeTab(tab_A2);
173 executeSoon(
function() {
174 setPriority(tab_A1, oldPriority);
182 let
tests = [test_behavior, test_extremePriorities];
186 waitForFocus(tests.shift());
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]
_updateTextAndScrollDataForTab aBrowser
_getSelectedPageStyle s i