Closed Bug 769467 Opened 14 years ago Closed 14 years ago

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

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: ehsan.akhgari, Assigned: cwiiis)

References

Details

Attachments

(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?(gavin.sharp)
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?(gavin.sharp)
Attachment #638706 - Flags: review?(gavin.sharp)
Moving to toolkit/content after discussion on IRC.
Attachment #638706 - Attachment is obsolete: true
Attachment #638706 - Flags: review?(gavin.sharp)
Attachment #638717 - Flags: review?(gavin.sharp)
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?(gavin.sharp) → 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: http://hg.mozilla.org/integration/mozilla-inbound/rev/505d87bc55d4 Let's deal with code using it in a follow-up bug.
Attachment #638717 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: