use tabbrowser.tabs in tests (no bug)

--HG--
extra : rebase_source : a234b87605b3ba66abd71caac862245ba3d99d71
This commit is contained in:
Dão Gottwald 2010-03-22 17:04:18 +01:00
parent a8871654b2
commit 0152250bfd
10 changed files with 18 additions and 18 deletions

View File

@ -32,8 +32,8 @@ function pickOne(array) {
return array[rand(0, array.length - 1)];
}
function pickOneTab() {
var tab = pickOne(gBrowser.tabContainer.childNodes);
return [tab, Array.indexOf(gBrowser.tabContainer.childNodes, tab)];
var tab = pickOne(gBrowser.tabs);
return [tab, Array.indexOf(gBrowser.tabs, tab)];
}
function nextSequence() {
while (gBrowser.browsers.length > 1)

View File

@ -1,13 +1,13 @@
function test() {
var tabs = gBrowser.tabContainer.childElementCount;
var tabCount = gBrowser.tabs.length;
content.focus();
browserDOMWindow.openURI(makeURI("about:blank"),
null,
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
is(gBrowser.tabContainer.childElementCount, tabs + 1,
is(gBrowser.tabs.length, tabCount + 1,
"'-new-tab about:blank' opens a new tab");
is(gBrowser.selectedTab, gBrowser.tabContainer.childNodes[tabs],
is(gBrowser.selectedTab, gBrowser.tabs[tabCount],
"'-new-tab about:blank' selects the new tab");
is(document.activeElement, gURLBar.inputField,
"'-new-tab about:blank' focuses the location bar");

View File

@ -1,11 +1,11 @@
var expected = ["TabOpen", "onLocationChange", "onStateChange", "onLinkIconAvailable"];
var actual = [];
var tabIndex = -1;
__defineGetter__("tab", function () gBrowser.tabContainer.childNodes[tabIndex]);
__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
function test() {
waitForExplicitFinish();
tabIndex = gBrowser.tabContainer.childElementCount;
tabIndex = gBrowser.tabs.length;
gBrowser.addTabsProgressListener(progressListener);
gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false);
gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");

View File

@ -3,7 +3,7 @@ function test() {
gBrowser.addTab();
gBrowser.addTab();
var tabs = gBrowser.tabContainer.childNodes;
var tabs = gBrowser.tabs;
var owner;
is(tabs.length, 4, "4 tabs are open");

View File

@ -75,7 +75,7 @@ function test() {
ok(!pb.privateBrowsingEnabled, "Private browsing mode should not have been activated");
is(confirmCalls, 1, "Only one confirm box should be shown");
is(gBrowser.tabContainer.childNodes.length, 3,
is(gBrowser.tabs.length, 3,
"No tabs should be closed because private browsing mode transition was canceled");
is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild).currentURI.spec, "about:blank",
"The first tab should be a blank tab");
@ -91,7 +91,7 @@ function test() {
ok(pb.privateBrowsingEnabled, "Private browsing mode should have been activated");
is(confirmCalls, 2, "Only two confirm boxes should be shown");
is(gBrowser.tabContainer.childNodes.length, 1,
is(gBrowser.tabs.length, 1,
"Incorrect number of tabs after transition into private browsing");
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
@ -113,7 +113,7 @@ function test() {
ok(pb.privateBrowsingEnabled, "Private browsing mode should not have been deactivated");
is(confirmCalls, 1, "Only one confirm box should be shown");
is(gBrowser.tabContainer.childNodes.length, 2,
is(gBrowser.tabs.length, 2,
"No tabs should be closed because private browsing mode transition was canceled");
is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild).currentURI.spec, TEST_PAGE_1,
"The first tab should be the same one we opened");
@ -127,7 +127,7 @@ function test() {
ok(!pb.privateBrowsingEnabled, "Private browsing mode should have been deactivated");
is(confirmCalls, 2, "Only two confirm boxes should be shown");
is(gBrowser.tabContainer.childNodes.length, 3,
is(gBrowser.tabs.length, 3,
"Incorrect number of tabs after transition into private browsing");
let loads = 0;

View File

@ -67,7 +67,7 @@ function pbObserver(aSubject, aTopic, aData) {
function test() {
waitForExplicitFinish();
_obs.addObserver(pbObserver, "private-browsing", false);
is(gBrowser.tabContainer.childNodes.length, 1, "There should only be one tab");
is(gBrowser.tabs.length, 1, "There should only be one tab");
let testTab = gBrowser.addTab();
gBrowser.selectedTab = testTab;
testTab.linkedBrowser.addEventListener("unload", function () {

View File

@ -135,7 +135,7 @@ function test() {
gPrefService.clearUserPref("browser.sessionstore.privacy_level");
// undoCloseTab can reuse a single blank tab, so we have to
// make sure not to close the window when closing our last tab
if (tabbrowser.tabContainer.childNodes.length == 1)
if (tabbrowser.tabs.length == 1)
tabbrowser.addTab();
tabbrowser.removeTab(tab);
finish();

View File

@ -104,7 +104,7 @@ function test() {
newWin2.gBrowser.tabContainer.addEventListener("SSTabRestored", function(aEvent) {
newWin2.gBrowser.tabContainer.removeEventListener("SSTabRestored", arguments.callee, true);
is(newWin2.gBrowser.tabContainer.childNodes.length, 2,
is(newWin2.gBrowser.tabs.length, 2,
"The window correctly restored 2 tabs");
is(newWin2.gBrowser.currentURI.spec, testURL,
"The window correctly restored the URL");

View File

@ -75,7 +75,7 @@ function test() {
gPrefService.clearUserPref("browser.sessionstore.privacy_level");
// undoCloseTab can reuse a single blank tab, so we have to
// make sure not to close the window when closing our last tab
if (gBrowser.tabContainer.childNodes.length == 1)
if (gBrowser.tabs.length == 1)
gBrowser.addTab();
gBrowser.removeTab(tab);
finish();

View File

@ -68,7 +68,7 @@ function test() {
newState.windows[0].extData[uniqueKey2] = uniqueValue2;
ss.setWindowState(newWin, JSON.stringify(newState), false);
is(newWin.gBrowser.tabContainer.childNodes.length, 2,
is(newWin.gBrowser.tabs.length, 2,
"original tab wasn't overwritten");
is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
"window value wasn't overwritten when the tabs weren't");
@ -78,7 +78,7 @@ function test() {
newState.windows[0].extData[uniqueKey2] = uniqueValue1;
ss.setWindowState(newWin, JSON.stringify(newState), true);
is(newWin.gBrowser.tabContainer.childNodes.length, 1,
is(newWin.gBrowser.tabs.length, 1,
"original tabs were overwritten");
is(ss.getWindowValue(newWin, uniqueKey1), "",
"window value was cleared");