Closed Bug 769467 Opened 9 years ago Closed 9 years ago

Add a PrivateBrowsingUtils module with a helper for determining whether a content window is in private browsing mode


(Toolkit :: General, defect)

Not set





(Reporter: ehsan.akhgari, Assigned: cwiiis)




(1 file, 3 obsolete files)

from bug 722984 comment #16)
> Comment on attachment 637581 [details] [diff] [review]
> Patch v3
> I think it would be much simpler in general if there was a global private
> browsing utility function that took a content window and returned whether
> it's "private" using the docshell tree, rather than jumping through hoops in
> various places to use gPrivateBrowsingUI.
> Something like:
> PrivateBrowsingUtils.isWindowPrivate(window)
> isWindowPrivate: function (arbitraryWindow) {
>   return arbitraryWindow.QueryInterface(Ci.nsIInterfaceRequestor)
>      .getInterface(Ci.nsIWebNavigation)
>      .QueryInterface(Ci.nsIDocShellTreeItem)
>      .rootTreeItem.QueryInterface(Ci.nsILoadContext)
>      .usePrivateBrowsing;
> }

Note that the patch here should also switch the existing callers to the new API.
Blocks: PBnGen
Bug 722984's patch is another potential consumer (along with your bug 722976).
OS: Mac OS X → All
Hardware: x86 → All
Attached patch Add PrivateBrowsingUtils module (obsolete) — Splinter Review
Does as suggested in comment #0
Attachment #638403 - Flags: review?(
Blocks: 722976
This patch adds the module in browser/ and the patch in bug 722976 uses it outside of browser/. One of these patches is wrong.
Moved from browser/components to dom/base, as discussed on IRC.
Attachment #638403 - Attachment is obsolete: true
Attachment #638403 - Flags: review?(
Attachment #638706 - Flags: review?(
Moving to toolkit/content after discussion on IRC.
Attachment #638706 - Attachment is obsolete: true
Attachment #638706 - Flags: review?(
Attachment #638717 - Flags: review?(
Comment on attachment 638717 [details] [diff] [review]
Add PrivateBrowsingUtils module (in the more-right place)

List it under EXTRA_JS_MODULES instead of EXTRA_PP_JS_MODULES (no need for preprocessing). r=me with that.
Attachment #638717 - Flags: review?( → review+
Component: Private Browsing → General
Product: Firefox → Toolkit
QA Contact: private.browsing → general
Version: unspecified → Trunk
Attaching final patch for reference, carrying r+.

Pushed to inbound:

Let's deal with code using it in a follow-up bug.
Attachment #638717 - Attachment is obsolete: true
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.