43 let prefBranch =
Cc[
"@mozilla.org/preferences-service;1"].
45 prefBranch.setBoolPref(
"browser.privatebrowsing.keep_current_session",
true);
46 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
50 if (aTopic ==
"private-browsing")
55 let
os =
Cc[
"@mozilla.org/observer-service;1"].
57 os.addObserver(observer,
"private-browsing",
false);
58 let pbMenuItem = document.getElementById(
"privateBrowsingItem");
60 let blankTab = gBrowser.addTab();
61 gBrowser.selectedTab = blankTab;
62 let originalTitle = document.title;
66 is(pb.privateBrowsingEnabled,
false,
"The private browsing mode should not be started initially");
67 is(
gPrivateBrowsingUI.privateBrowsingEnabled,
false,
"gPrivateBrowsingUI should expose the correct private browsing status");
68 ok(pbMenuItem,
"The Private Browsing menu item exists");
69 is(pbMenuItem.getAttribute(
"label"), pbMenuItem.getAttribute(
"startlabel"),
"The Private Browsing menu item should read \"Start Private Browsing\"");
71 is(pb.privateBrowsingEnabled,
true,
"The private browsing mode should be started");
72 is(
gPrivateBrowsingUI.privateBrowsingEnabled,
true,
"gPrivateBrowsingUI should expose the correct private browsing status");
74 is(observer.data,
"enter",
"Private Browsing mode was activated using the gPrivateBrowsingUI object");
75 is(pbMenuItem.getAttribute(
"label"), pbMenuItem.getAttribute(
"stoplabel"),
"The Private Browsing menu item should read \"Stop Private Browsing\"");
77 is(pb.privateBrowsingEnabled,
false,
"The private browsing mode should not be started");
78 is(
gPrivateBrowsingUI.privateBrowsingEnabled,
false,
"gPrivateBrowsingUI should expose the correct private browsing status");
80 is(observer.data,
"exit",
"Private Browsing mode was deactivated using the gPrivateBrowsingUI object");
81 is(pbMenuItem.getAttribute(
"label"), pbMenuItem.getAttribute(
"startlabel"),
"The Private Browsing menu item should read \"Start Private Browsing\"");
84 let cmd = document.getElementById(
"Tools:PrivateBrowsing");
85 isnot(cmd,
null,
"XUL command object for the private browsing service exists");
86 var func =
new Function(
"", cmd.getAttribute(
"oncommand"));
89 is(observer.data,
"enter",
"Private Browsing mode was activated using the command object");
91 isnot(document.title, originalTitle,
"Private browsing mode has correctly changed the title");
94 is(observer.data,
"exit",
"Private Browsing mode was deactivated using the command object");
96 is(document.title, originalTitle,
"Private browsing mode has correctly restored the title");
99 gBrowser.removeTab(blankTab);
100 os.removeObserver(observer,
"private-browsing");
101 prefBranch.clearUserPref(
"browser.privatebrowsing.keep_current_session");
getService(Ci.sbIFaceplateManager)
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe