mozilla

Compare Revisions

Supporting per-window private browsing

Change Revisions

Revision 376741:

Revision 376741 by ignisvulpis on

Revision 407631:

Revision 407631 by jonah_bishop on

Title:
Supporting per-window private browsing
Supporting per-window private browsing
Slug:
Supporting_per-window_private_browsing
Supporting_per-window_private_browsing
Content:

Revision 376741
Revision 407631
n14      Determining whether or not a given DOM window is private isn14      Determining whether or not a given DOM window is private is
> simple: import <a href="http://mxr.mozilla.org/mozilla-central/s> simple: import <a href="http://mxr.mozilla.org/mozilla-central/s
>ource/toolkit/content/PrivateBrowsingUtils.jsm" title="http://mxr>ource/toolkit/content/PrivateBrowsingUtils.jsm" title="http://mxr
>.mozilla.org/mozilla-central/source/toolkit/content/PrivateBrowsi>.mozilla.org/mozilla-central/source/toolkit/content/PrivateBrowsi
>ngUtils.jsm"><code>resource://gre/modules/PrivateBrowsingUtils.js>ngUtils.jsm"><code>resource://gre/modules/PrivateBrowsingUtils.js
>m</code></a> and use <code>PrivateBrowsingUtils.isWindowPrivate(w>m</code></a> and use <code>PrivateBrowsingUtils.isWindowPrivate(w
>in)</code>. You can then take action based on this value, as any >indow)</code>. You can then take action based on this value, as a
>data or actions originating from this window should be considered>ny data or actions originating from this window should be conside
> private.>red private.
n18          // Firefox 20n18          // Firefox 20+
n20          if (!PrivateBrowsingUtils.isWindowPrivate(win)) {n20          if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
n27            var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsn27            var inPrivateBrowsing = Components.classes["@mozilla.
>ing;1"].>org/privatebrowsing;1"].
28                                    getService(Ci.nsIPrivateBrows28                                    getService(Components.interfa
>ingService).>ces.nsIPrivateBrowsingService).
t34            Cu.reportError(e); return;t34            Components.utils.reportError(e);
35            return;

Back to History