2012-10-07 12:39:42 -07:00
|
|
|
// Make sure that we can open private browsing windows
|
|
|
|
|
|
|
|
function test() {
|
2012-12-10 03:39:00 -08:00
|
|
|
waitForExplicitFinish();
|
2012-10-07 12:39:42 -07:00
|
|
|
var nonPrivateWin = OpenBrowserWindow();
|
|
|
|
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "OpenBrowserWindow() should open a normal window");
|
|
|
|
nonPrivateWin.close();
|
2012-12-10 03:39:00 -08:00
|
|
|
|
2012-10-07 12:39:42 -07:00
|
|
|
var privateWin = OpenBrowserWindow({private: true});
|
|
|
|
ok(PrivateBrowsingUtils.isWindowPrivate(privateWin), "OpenBrowserWindow({private: true}) should open a private window");
|
2012-12-10 03:39:00 -08:00
|
|
|
|
|
|
|
nonPrivateWin = OpenBrowserWindow({private: false});
|
|
|
|
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "OpenBrowserWindow({private: false}) should open a normal window");
|
|
|
|
nonPrivateWin.close();
|
|
|
|
|
|
|
|
whenDelayedStartupFinished(privateWin, function() {
|
|
|
|
nonPrivateWin = privateWin.OpenBrowserWindow({private: false});
|
|
|
|
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "privateWin.OpenBrowserWindow({private: false}) should open a normal window");
|
2013-03-13 12:15:05 -07:00
|
|
|
|
2012-12-10 03:39:00 -08:00
|
|
|
nonPrivateWin.close();
|
2013-03-13 12:15:05 -07:00
|
|
|
|
|
|
|
[
|
|
|
|
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accesskey: true },
|
|
|
|
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accesskey: false },
|
|
|
|
].forEach(function(menu) {
|
|
|
|
let newWindow = privateWin.document.getElementById(menu.normal);
|
|
|
|
let newPrivateWindow = privateWin.document.getElementById(menu.private);
|
|
|
|
if (newWindow && newPrivateWindow) {
|
|
|
|
ok(!newPrivateWindow.hidden, "New Private Window menu item should be hidden");
|
|
|
|
isnot(newWindow.label, newPrivateWindow.label, "New Window's label shouldn't be overwritten");
|
|
|
|
if (menu.accesskey) {
|
|
|
|
isnot(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey shouldn't be overwritten");
|
|
|
|
}
|
|
|
|
isnot(newWindow.command, newPrivateWindow.command, "New Window's command shouldn't be overwritten");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-12-10 03:39:00 -08:00
|
|
|
privateWin.close();
|
2013-03-13 12:15:05 -07:00
|
|
|
|
|
|
|
Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
|
|
|
|
privateWin = OpenBrowserWindow({private: true});
|
|
|
|
whenDelayedStartupFinished(privateWin, function() {
|
|
|
|
[
|
|
|
|
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accessKey: true },
|
|
|
|
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accessKey: false },
|
|
|
|
].forEach(function(menu) {
|
|
|
|
let newWindow = privateWin.document.getElementById(menu.normal);
|
|
|
|
let newPrivateWindow = privateWin.document.getElementById(menu.private);
|
|
|
|
if (newWindow && newPrivateWindow) {
|
|
|
|
ok(newPrivateWindow.hidden, "New Private Window menu item should be hidden");
|
|
|
|
is(newWindow.label, newPrivateWindow.label, "New Window's label should be overwritten");
|
|
|
|
if (menu.accesskey) {
|
|
|
|
is(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey should be overwritten");
|
|
|
|
}
|
|
|
|
is(newWindow.command, newPrivateWindow.command, "New Window's command should be overwritten");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
privateWin.close();
|
|
|
|
Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
|
|
|
|
finish();
|
|
|
|
});
|
2012-12-10 03:39:00 -08:00
|
|
|
});
|
2012-10-07 12:39:42 -07:00
|
|
|
}
|
|
|
|
|