mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1247435 - Fix context.incognito (this completes part of bug 1309610) r=kmag
MozReview-Commit-ID: IFW8SfNymbE --HG-- extra : rebase_source : 9e3a32a8f14456e4d821ab23eb19c041cedfa248
This commit is contained in:
parent
6001074f5a
commit
a8d42abe06
@ -283,6 +283,8 @@ class ProxyContext extends BaseContext {
|
||||
|
||||
this.uri = NetUtil.newURI(params.url);
|
||||
|
||||
this.incognito = params.incognito;
|
||||
|
||||
// This message manager is used by ParentAPIManager to send messages and to
|
||||
// close the ProxyContext if the underlying message manager closes. This
|
||||
// message manager object may change when `xulBrowser` swaps docshells, e.g.
|
||||
|
@ -252,6 +252,7 @@ defineLazyGetter(ExtensionContext.prototype, "childManager", function() {
|
||||
envType: "addon_parent",
|
||||
viewType: this.viewType,
|
||||
url: this.uri.spec,
|
||||
incognito: this.incognito,
|
||||
});
|
||||
|
||||
this.callOnClose(childManager);
|
||||
|
@ -32,6 +32,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
|
||||
"resource://gre/modules/Preferences.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||
"resource://gre/modules/PromiseUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Schemas",
|
||||
@ -188,7 +190,7 @@ class BaseContext {
|
||||
this.extension = extension;
|
||||
this.jsonSandbox = null;
|
||||
this.active = true;
|
||||
|
||||
this.incognito = null;
|
||||
this.messageManager = null;
|
||||
this.docShell = null;
|
||||
this.contentWindow = null;
|
||||
@ -204,6 +206,10 @@ class BaseContext {
|
||||
this.messageManager = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
|
||||
if (this.incognito == null) {
|
||||
this.incognito = PrivateBrowsingUtils.isContentWindowPrivate(contentWindow);
|
||||
}
|
||||
|
||||
MessageChannel.setupMessageManagers([this.messageManager]);
|
||||
|
||||
let onPageShow = event => {
|
||||
|
@ -15,7 +15,7 @@ function extensionApiFactory(context) {
|
||||
},
|
||||
|
||||
get inIncognitoContext() {
|
||||
return PrivateBrowsingUtils.isContentWindowPrivate(context.contentWindow);
|
||||
return context.incognito;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user