43 gPrefService.setBoolPref(
"browser.privatebrowsing.keep_current_session",
true);
44 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
47 const testPageURL =
"http://localhost:8888/browser/" +
48 "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html";
52 let test_title =
"Test title";
53 let app_name = document.documentElement.getAttribute(
"title");
54 const isOSX = (
"nsILocalFileMac" in
Ci);
56 let page_without_title;
58 let pb_page_with_title;
59 let pb_page_without_title;
60 let pb_about_pb_title;
62 page_with_title = test_title;
63 page_without_title = app_name;
64 about_pb_title =
"Would you like to start Private Browsing?";
65 pb_page_with_title = test_title +
" - (Private Browsing)";
66 pb_page_without_title = app_name +
" - (Private Browsing)";
67 pb_about_pb_title = pb_page_without_title;
70 page_with_title = test_title +
" - " + app_name;
71 page_without_title = app_name;
72 about_pb_title =
"Would you like to start Private Browsing?" +
" - " + app_name;
73 pb_page_with_title = test_title +
" - " + app_name +
" (Private Browsing)";
74 pb_page_without_title = app_name +
" (Private Browsing)";
75 pb_about_pb_title =
"Private Browsing - " + app_name +
" (Private Browsing)";
78 function testTabTitle(
url, insidePB, expected_title, funcNext) {
79 pb.privateBrowsingEnabled = insidePB;
81 let
tab = gBrowser.selectedTab = gBrowser.addTab();
82 let
browser = gBrowser.selectedBrowser;
85 browser.addEventListener(
"pageshow",
function () {
86 browser.removeEventListener(
"pageshow",
arguments.callee,
false);
87 executeSoon(
function () {
88 is(document.title, expected_title,
"The window title for " +
url +
89 " is correct (" + (insidePB ?
"inside" :
"outside") +
90 " private browsing mode)");
92 let
win = gBrowser.replaceTabWithWindow(tab);
93 win.addEventListener(
"load",
function() {
94 win.removeEventListener(
"load",
arguments.callee,
false);
97 let _delayedStartup = win.delayedStartup;
98 win.delayedStartup =
function() {
100 win.delayedStartup = _delayedStartup;
102 is(win.document.title, expected_title,
"The window title for " +
url +
103 " detached tab is correct (" + (insidePB ?
"inside" :
"outside") +
104 " private browsing mode)");
113 browser.loadURI(
url);
117 pb.privateBrowsingEnabled =
false;
118 gPrefService.clearUserPref(
"browser.privatebrowsing.keep_current_session");
122 testTabTitle(
"about:blank",
false, page_without_title,
function() {
123 testTabTitle(testPageURL,
false, page_with_title,
function() {
124 testTabTitle(
"about:privatebrowsing",
false, about_pb_title,
function() {
125 testTabTitle(
"about:blank",
true, pb_page_without_title,
function() {
126 testTabTitle(testPageURL,
true, pb_page_with_title,
function() {
127 testTabTitle(
"about:privatebrowsing",
true, pb_about_pb_title,
cleanup);
getService(Ci.sbIFaceplateManager)
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
return!aWindow arguments!aWindow arguments[0]