1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-02 16:04:11 +01:00

Minor compat changes.

--HG--
extra : rebase_source : d40d66e2cd689f43243a837dbd19fe5e0ec8d462
This commit is contained in:
Kris Maglione
2014-06-27 13:24:34 -07:00
parent bfd2d975f8
commit e8dce1107a
4 changed files with 46 additions and 26 deletions

View File

@@ -366,7 +366,8 @@ var Bookmarks = Module("bookmarks", {
[, url, charset] = matches; [, url, charset] = matches;
else else
try { try {
charset = services.history.getCharsetForURI(util.newURI(url)); charset = services.annotation.getPageAnnotation(util.newURI(url),
PlacesUtils.CHARSET_ANNO);
} }
catch (e) {} catch (e) {}

View File

@@ -37,8 +37,8 @@ var MOW = Module("mow", {
modules.mow = this; modules.mow = this;
let fontSize = DOM(document.documentElement).style.fontSize; let fontSize = DOM(document.documentElement).style.fontSize;
styles.system.add("font-size", "dactyl://content/buffer.xhtml", styles.system.add("font-size", "dactyl://content/buffer.xhtml",
"body { font-size: " + fontSize + "; } \ // "body { font-size: " + fontSize + "; } \
html|html > xul|scrollbar { visibility: collapse !important; }", "html|html > xul|scrollbar { visibility: collapse !important; }",
true); true);
overlay.overlayWindow(window, { overlay.overlayWindow(window, {

View File

@@ -416,26 +416,43 @@ var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments))
var RealSet = Set; var RealSet = Set;
let Set_add = RealSet.prototype.add; let Set_add = RealSet.prototype.add;
RealSet.prototype.add = function RealSet_add(val) {
let res = this.has(val);
Set_add.apply(this, arguments);
return res;
};
RealSet.prototype.difference = function RealSet_difference(set) { Object.defineProperty(RealSet.prototype, "add", {
return RealSet(i for (i of this) if (!set.has(i))); configurable: true,
}; writable: true,
value: function RealSet_add(val) {
let res = this.has(val);
Set_add.apply(this, arguments);
return res;
},
});
RealSet.prototype.intersection = function RealSet_intersection(set) { Object.defineProperty(RealSet.prototype, "difference", {
return RealSet(i for (i of this) if (set.has(i))); configurable: true,
}; writable: true,
value: function RealSet_difference(set) {
return RealSet(i for (i of this) if (!set.has(i)));
},
});
RealSet.prototype.union = function RealSet_union(set) { Object.defineProperty(RealSet.prototype, "intersection", {
let res = RealSet(this); configurable: true,
for (let item of set) writable: true,
res.add(item); value: function RealSet_intersection(set) {
return res; return RealSet(i for (i of this) if (set.has(i)));
}; },
});
Object.defineProperty(RealSet.prototype, "union", {
configurable: true,
writable: true,
value: function RealSet_union(set) {
let res = RealSet(this);
for (let item of set)
res.add(item);
return res;
},
});
/** /**
* Utility for managing sets of strings. Given an array, returns an * Utility for managing sets of strings. Given an array, returns an

View File

@@ -2428,12 +2428,14 @@ var Buffer = Module("Buffer", {
return val; return val;
// Stolen from browser.jar/content/browser/browser.js, more or less. // Stolen from browser.jar/content/browser/browser.js, more or less.
try { Task.spawn(function () {
buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset = val; try {
window.PlacesUtils.history.setCharsetForURI(buffer.uri, val); buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset = val;
buffer.docShell.reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); yield window.PlacesUtils.setCharsetForURI(buffer.uri, val);
} buffer.docShell.reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
catch (e) { dactyl.reportError(e); } }
catch (e) { dactyl.reportError(e); }
});
return null; return null;
}, },
completer: function (context) completion.charset(context) completer: function (context) completion.charset(context)