Bug 1064212 - Add fromWindow() to LoadContextInfo.jsm, r=dolske

This commit is contained in:
Honza Bambas 2014-09-16 15:51:51 +02:00
parent ac3405ae34
commit ed3e3039d3

View File

@ -9,6 +9,7 @@ const Cc = Components.classes;
const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
this.LoadContextInfo = {};
@ -55,8 +56,14 @@ LoadContextInfo.custom = function(_private, _anonymous, _appId, _inBrowser) {
// Copies info from provided nsILoadContext
LoadContextInfo.fromLoadContext = function(_loadContext, _anonymous) {
return new _LoadContextInfo(_loadContext.isPrivate,
return new _LoadContextInfo(_loadContext.usePrivateBrowsing,
_anonymous,
_loadContext.appId,
_loadContext.isInBrowserElement);
}
// Copies info from provided window object
LoadContextInfo.fromWindow = function(_window, _anonymous) {
var loadContext = PrivateBrowsingUtils.privacyContextFromWindow(_window);
return this.fromLoadContext(loadContext, _anonymous);
}