1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-13 19:55:46 +01:00

Fix multi-window thingy and stuff.

This commit is contained in:
Kris Maglione
2012-05-23 22:55:26 -04:00
parent 7cba7018fa
commit 21adc88f11
3 changed files with 86 additions and 76 deletions

View File

@@ -634,6 +634,9 @@ var Buffer = Module("Buffer", {
| persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES; | persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
let window = this.topWindow; let window = this.topWindow;
if (!file.exists())
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
let downloadListener = new window.DownloadListener(window, let downloadListener = new window.DownloadListener(window,
services.Transfer(uri, File(file).URI, "", services.Transfer(uri, File(file).URI, "",
null, null, null, persist)); null, null, null, persist));

View File

@@ -199,13 +199,6 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
this.loaded = {}; this.loaded = {};
modules.loaded = this.loaded; modules.loaded = this.loaded;
defineModule.modules.forEach(function defModule(mod) {
let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT)
Set.add(names, "init");
keys(names).forEach(function (name) { self.deferInit(name, mod.INIT, mod); });
});
this.modules = modules; this.modules = modules;
this.scanModules(); this.scanModules();
@@ -310,28 +303,38 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
let className = mod.className || mod.constructor.className; let className = mod.className || mod.constructor.className;
init[className] = function callee() { if (!Set.has(init, className)) {
function finish() { init[className] = function callee() {
this.currentDependency = className; function finish() {
defineModule.time(className, name, INIT[name], mod, this.currentDependency = className;
modules.dactyl, modules, window); defineModule.time(className, name, INIT[name], mod,
} modules.dactyl, modules, window);
if (!callee.frobbed) { }
callee.frobbed = true; if (!callee.frobbed) {
if (modules[name] instanceof Class) callee.frobbed = true;
modules[name].withSavedValues(["currentDependency"], finish); if (modules[name] instanceof Class)
else modules[name].withSavedValues(["currentDependency"], finish);
finish.call({}); else
} finish.call({});
}; }
};
INIT[name].require = function (name) { init[name](); }; INIT[name].require = function (name) { init[name](); };
}
}, },
scanModules: function scanModules() { scanModules: function scanModules() {
let self = this; let self = this;
let { Module, modules } = this.modules; let { Module, modules } = this.modules;
defineModule.modules.forEach(function defModule(mod) {
let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT)
Set.add(names, "init");
keys(names).forEach(function (name) { self.deferInit(name, mod.INIT, mod); });
});
Module.list.forEach(function frobModule(mod) { Module.list.forEach(function frobModule(mod) {
if (!mod.frobbed) { if (!mod.frobbed) {
modules.__defineGetter__(mod.className, function () { modules.__defineGetter__(mod.className, function () {

View File

@@ -18,6 +18,7 @@ defineModule("sanitizer", {
}); });
lazyRequire("messages", ["_"]); lazyRequire("messages", ["_"]);
lazyRequire("overlay", ["overlay"]);
lazyRequire("storage", ["storage"]); lazyRequire("storage", ["storage"]);
lazyRequire("template", ["template"]); lazyRequire("template", ["template"]);
@@ -179,60 +180,63 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
} }
}); });
let (branch = Item.PREFIX + Item.SHUTDOWN_BRANCH) { util.timeout(function () { // Load order issue...
util.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
function (win) prefOverlay(branch, true, { let (branch = Item.PREFIX + Item.SHUTDOWN_BRANCH) {
append: { overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
SanitizeDialogPane: function (win) prefOverlay(branch, true, {
<groupbox orient="horizontal" xmlns={XUL}> append: {
<caption label={config.appName + /*L*/" (see :help privacy)"}/> SanitizeDialogPane:
<grid flex="1"> <groupbox orient="horizontal" xmlns={XUL}>
<columns><column flex="1"/><column flex="1"/></columns> <caption label={config.appName + /*L*/" (see :help privacy)"}/>
<rows>{ <grid flex="1">
let (items = ourItems(true)) <columns><column flex="1"/><column flex="1"/></columns>
template.map(util.range(0, Math.ceil(items.length / 2)), function (i) <rows>{
<row xmlns={XUL}>{ let (items = ourItems(true))
template.map(items.slice(i * 2, i * 2 + 2), function (item) template.map(util.range(0, Math.ceil(items.length / 2)), function (i)
<checkbox xmlns={XUL} label={item.description} preference={branch + item.name}/>) <row xmlns={XUL}>{
}</row>) template.map(items.slice(i * 2, i * 2 + 2), function (item)
}</rows> <checkbox xmlns={XUL} label={item.description} preference={branch + item.name}/>)
</grid> }</row>)
</groupbox> }</rows>
} </grid>
})); </groupbox>
} }
let (branch = Item.PREFIX + Item.BRANCH) { }));
util.overlayWindow("chrome://browser/content/sanitize.xul", }
function (win) prefOverlay(branch, false, { let (branch = Item.PREFIX + Item.BRANCH) {
append: { overlay.overlayWindow("chrome://browser/content/sanitize.xul",
itemList: <> function (win) prefOverlay(branch, false, {
<listitem xmlns={XUL} label={/*L*/"See :help privacy for the following:"} disabled="true" style="font-style: italic; font-weight: bold;"/> append: {
{ itemList: <>
template.map(ourItems(), function ([item, desc]) <listitem xmlns={XUL} label={/*L*/"See :help privacy for the following:"} disabled="true" style="font-style: italic; font-weight: bold;"/>
<listitem xmlns={XUL} type="checkbox" {
label={config.appName + " " + desc} template.map(ourItems(), function ([item, desc])
preference={branch + item} <listitem xmlns={XUL} type="checkbox"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>) label={config.appName + " " + desc}
} preference={branch + item}
</> onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>)
}, }
ready: function ready(win) { </>
let elem = win.document.getElementById("itemList"); },
elem.setAttribute("rows", elem.itemCount); ready: function ready(win) {
win.Sanitizer = Class("Sanitizer", win.Sanitizer, { let elem = win.document.getElementById("itemList");
sanitize: function sanitize() { elem.setAttribute("rows", elem.itemCount);
self.withSavedValues(["sanitizing"], function () { win.Sanitizer = Class("Sanitizer", win.Sanitizer, {
self.sanitizing = true; sanitize: function sanitize() {
sanitize.superapply(this, arguments); self.withSavedValues(["sanitizing"], function () {
sanitizer.sanitizeItems([item.name for (item in values(self.itemMap)) self.sanitizing = true;
if (item.shouldSanitize(false))], sanitize.superapply(this, arguments);
Range.fromArray(this.range || [])); sanitizer.sanitizeItems([item.name for (item in values(self.itemMap))
}, this); if (item.shouldSanitize(false))],
} Range.fromArray(this.range || []));
}); }, this);
} }
})); });
} }
}));
}
});
}, },
firstRun: 0, firstRun: 0,