From e8dce1107a37d8564e5c691ce48f8d6cac19e1d4 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 27 Jun 2014 13:24:34 -0700 Subject: [PATCH] Minor compat changes. --HG-- extra : rebase_source : d40d66e2cd689f43243a837dbd19fe5e0ec8d462 --- common/content/bookmarks.js | 3 ++- common/content/mow.js | 4 +-- common/modules/base.jsm | 51 ++++++++++++++++++++++++------------- common/modules/buffer.jsm | 14 +++++----- 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index dd64e545..ba411acd 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -366,7 +366,8 @@ var Bookmarks = Module("bookmarks", { [, url, charset] = matches; else try { - charset = services.history.getCharsetForURI(util.newURI(url)); + charset = services.annotation.getPageAnnotation(util.newURI(url), + PlacesUtils.CHARSET_ANNO); } catch (e) {} diff --git a/common/content/mow.js b/common/content/mow.js index e2ad98f5..2b6d7654 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -37,8 +37,8 @@ var MOW = Module("mow", { modules.mow = this; let fontSize = DOM(document.documentElement).style.fontSize; styles.system.add("font-size", "dactyl://content/buffer.xhtml", - "body { font-size: " + fontSize + "; } \ - html|html > xul|scrollbar { visibility: collapse !important; }", + // "body { font-size: " + fontSize + "; } \ + "html|html > xul|scrollbar { visibility: collapse !important; }", true); overlay.overlayWindow(window, { diff --git a/common/modules/base.jsm b/common/modules/base.jsm index b5b74d85..39541950 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -416,26 +416,43 @@ var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments)) var RealSet = Set; 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) { - return RealSet(i for (i of this) if (!set.has(i))); -}; +Object.defineProperty(RealSet.prototype, "add", { + 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) { - return RealSet(i for (i of this) if (set.has(i))); -}; +Object.defineProperty(RealSet.prototype, "difference", { + 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) { - let res = RealSet(this); - for (let item of set) - res.add(item); - return res; -}; +Object.defineProperty(RealSet.prototype, "intersection", { + configurable: true, + writable: true, + value: function RealSet_intersection(set) { + 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 diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index ec0a1007..ac11c4e0 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -2428,12 +2428,14 @@ var Buffer = Module("Buffer", { return val; // Stolen from browser.jar/content/browser/browser.js, more or less. - try { - buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset = val; - window.PlacesUtils.history.setCharsetForURI(buffer.uri, val); - buffer.docShell.reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); - } - catch (e) { dactyl.reportError(e); } + Task.spawn(function () { + try { + buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset = val; + yield window.PlacesUtils.setCharsetForURI(buffer.uri, val); + buffer.docShell.reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); + } + catch (e) { dactyl.reportError(e); } + }); return null; }, completer: function (context) completion.charset(context)