1 const Ci = Components.interfaces;
2 const Cc = Components.classes;
5 var
ios =
Cc[
"@mozilla.org/network/io-service;1"].getService(
Ci.nsIIOService);
21 ok(windows,
"Check access to browser windows");
22 ok(windows.length,
"There should be at least one browser window open");
25 activeWin.events.addListener(
"TabOpen",
onTabOpen);
26 activeWin.events.addListener(
"TabClose",
onTabClose);
27 activeWin.events.addListener(
"TabMove",
onTabMove);
29 gPageA = activeWin.open(
url(
"chrome://mochikit/content/browser/browser/fuel/test/ContentA.html"));
30 gPageA.events.addListener(
"load", onPageAFirstLoad);
32 is(activeWin.tabs.length, 2,
"Checking length of 'Browser.tabs' after opening 1 additional tab");
36 function onPageAFirstLoad(
event) {
37 gPageA.events.removeListener(
"load", onPageAFirstLoad);
38 is(
gPageA.uri.spec,
event.data.uri.spec,
"Checking event browser tab is equal to page A");
40 gPageB = activeWin.open(
url(
"chrome://mochikit/content/browser/browser/fuel/test/ContentB.html"));
41 gPageB.events.addListener(
"load", delayAfterOpen);
44 is(activeWin.tabs.length, 3,
"Checking length of 'Browser.tabs' after opening a second additional tab");
45 is(activeWin.activeTab.index,
gPageB.index,
"Checking 'Browser.activeTab' after setting focus");
48 function delayAfterOpen() {
49 executeSoon(afterOpen);
53 function afterOpen(
event) {
54 gPageB.events.removeListener(
"load", delayAfterOpen);
56 is(
gPageA.uri.spec,
"chrome://mochikit/content/browser/browser/fuel/test/ContentA.html",
"Checking 'BrowserTab.uri' after opening");
57 is(
gPageB.uri.spec,
"chrome://mochikit/content/browser/browser/fuel/test/ContentB.html",
"Checking 'BrowserTab.uri' after opening");
60 is(
gPageA.uri.spec,
gTabOpenPageA.uri.spec,
"Checking first browser tab open is equal to page A");
61 is(
gPageB.uri.spec,
gTabOpenPageB.uri.spec,
"Checking second browser tab open is equal to page B");
66 var
test1 =
gPageA.document.getElementById(
"test1");
67 ok(test1,
"Checking existence of element in content DOM");
68 is(test1.innerHTML,
"A",
"Checking content of element in content DOM");
75 is(
gPageA.index, 2,
"Checking index after moving tab");
81 browser.addProgressListener({
82 onStateChange:
function(webProgress, request, stateFlags, status) {
83 const complete =
Ci.nsIWebProgressListener.STATE_IS_WINDOW +
84 Ci.nsIWebProgressListener.STATE_IS_NETWORK +
85 Ci.nsIWebProgressListener.STATE_STOP;
86 if ((stateFlags & complete) == complete) {
87 browser.removeProgressListener(
this);
88 onPageBLoadComplete();
92 onLocationChange:
function() {
return 0; },
93 onProgressChange:
function() {
return 0; },
94 onStatusChange:
function() {
return 0; },
95 onSecurityChange:
function() {
return 0; },
97 if (iid.equals(
Ci.nsISupportsWeakReference) ||
98 iid.equals(
Ci.nsIWebProgressListener) ||
99 iid.equals(
Ci.nsISupports))
102 throw Components.results.NS_ERROR_NO_INTERFACE;
108 gPageB.events.addListener(
"load", onPageBLoadWithFrames);
109 gPageB.load(
url(
"chrome://mochikit/content/browser/browser/fuel/test/ContentWithFrames.html"));
112 function onPageBLoadWithFrames(
event) {
116 function onPageBLoadComplete() {
117 gPageB.events.removeListener(
"load", onPageBLoadWithFrames);
119 is(
gPageLoadCount, 1,
"Checking load count after loading new content with a frame");
123 gPageA.events.addListener(
"load", onPageASecondLoad);
124 gPageA.load(
url(
"chrome://mochikit/content/browser/browser/fuel/test/ContentB.html"));
127 function onPageASecondLoad(
event) {
128 gPageA.events.removeListener(
"load", onPageASecondLoad);
129 is(
gPageA.uri.spec,
"chrome://mochikit/content/browser/browser/fuel/test/ContentB.html",
"Checking 'BrowserTab.uri' after loading new content");
139 is(activeWin.tabs.length, 1,
"Checking length of 'Browser.tabs' after closing 2 tabs");
function onTabMove(event)
sbOSDControlService prototype QueryInterface
function onTabOpen(event)
ContinuingWebProgressListener prototype onStateChange
function onTabClose(event)