mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 19:07:58 +01:00
[PWPBM] Make Personas work in private windows.
This commit is contained in:
@@ -1877,6 +1877,27 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
userContext.DOM = Class("DOM", DOM, { init: function DOM_(sel, ctxt) DOM(sel, ctxt || buffer.focusedFrame.document) });
|
userContext.DOM = Class("DOM", DOM, { init: function DOM_(sel, ctxt) DOM(sel, ctxt || buffer.focusedFrame.document) });
|
||||||
userContext.$ = modules.userContext.DOM;
|
userContext.$ = modules.userContext.DOM;
|
||||||
|
|
||||||
|
// Hack: disable disabling of Personas in private windows.
|
||||||
|
let root = document.documentElement;
|
||||||
|
|
||||||
|
if (PrivateBrowsingUtils && PrivateBrowsingUtils.isWindowPrivate(window)
|
||||||
|
&& root._lightweightTheme
|
||||||
|
&& root._lightweightTheme._lastScreenWidth == null) {
|
||||||
|
|
||||||
|
let { isWindowPrivate } = PrivateBrowsingUtils;
|
||||||
|
try {
|
||||||
|
PrivateBrowsingUtils.isWindowPrivate = function () false;
|
||||||
|
let { LightweightThemeConsumer } = Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", {});
|
||||||
|
LightweightThemeConsumer.call(root._lightweightTheme, document);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
util.reportError(e);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PrivateBrowsingUtils.isWindowPrivate = isWindowPrivate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dactyl.timeout(function () {
|
dactyl.timeout(function () {
|
||||||
try {
|
try {
|
||||||
var args = config.prefs.get("commandline-args")
|
var args = config.prefs.get("commandline-args")
|
||||||
|
|||||||
@@ -8,9 +8,14 @@ try {
|
|||||||
|
|
||||||
var global = this;
|
var global = this;
|
||||||
defineModule("services", {
|
defineModule("services", {
|
||||||
exports: ["services"]
|
exports: ["PrivateBrowsingUtils", "services"]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
var { PrivateBrowsingUtils } = Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lazily-instantiated XPCOM class and service cache.
|
* A lazily-instantiated XPCOM class and service cache.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -167,8 +167,7 @@ var sessionGlobal = Cu.import("resource://gre/modules/Services.jsm", {})
|
|||||||
var Storage = Module("Storage", {
|
var Storage = Module("Storage", {
|
||||||
Local: function Local(dactyl, modules, window) ({
|
Local: function Local(dactyl, modules, window) ({
|
||||||
init: function init() {
|
init: function init() {
|
||||||
this.privateMode = window.document.documentElement
|
this.privateMode = PrivateBrowsingUtils.isWindowPrivate(window);
|
||||||
.getAttribute("privatebrowsingmode");
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user