43 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
45 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].
49 let stateBackup = ss.getWindowState(
window);
51 function pretendToBeAPopup(whatToPretend) {
52 let state = whatToPretend ?
53 '{"windows":[{"tabs":[{"entries":[],"attributes":{}}],"isPopup":true,"hidden":"toolbar"}]}' :
54 '{"windows":[{"tabs":[{"entries":[],"attributes":{}}],"isPopup":false}]}';
55 ss.setWindowState(
window, state,
true);
57 ok(gURLBar.readOnly,
"pretendToBeAPopup correctly made the URL bar read-only");
58 is(gURLBar.getAttribute(
"enablehistory"),
"false",
59 "pretendToBeAPopup correctly disabled autocomplete on the URL bar");
62 ok(!gURLBar.readOnly,
"pretendToBeAPopup correctly made the URL bar read-write");
63 is(gURLBar.getAttribute(
"enablehistory"),
"true",
64 "pretendToBeAPopup correctly enabled autocomplete on the URL bar");
71 pretendToBeAPopup(
true);
74 pb.privateBrowsingEnabled =
true;
78 "URL bar should not be read-only after entering the private browsing mode");
79 is(gURLBar.getAttribute(
"enablehistory"),
"true",
80 "URL bar autocomplete should be enabled after entering the private browsing mode");
83 pb.privateBrowsingEnabled =
false;
86 pretendToBeAPopup(
false);
91 pb.privateBrowsingEnabled =
true;
94 pretendToBeAPopup(
true);
97 pb.privateBrowsingEnabled =
false;
100 ok(!gURLBar.readOnly,
101 "URL bar should not be read-only after leaving the private browsing mode");
102 is(gURLBar.getAttribute(
"enablehistory"),
"true",
103 "URL bar autocomplete should be enabled after leaving the private browsing mode");
106 ss.setWindowState(
window, stateBackup,
true);
getService(Ci.sbIFaceplateManager)