diff --git a/common/content/browser.js b/common/content/browser.js index 09a194c2..63eb7446 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -149,7 +149,7 @@ const Browser = Module("browser", { mappings.add([modes.NORMAL], ["gU"], "Go to the root of the website", function () { - let uri = content.document.location; + let uri = window.content.document.location; dactyl.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now dactyl.open(uri.protocol + "//" + (uri.host || "") + "/"); }); diff --git a/common/content/buffer.js b/common/content/buffer.js index 449eacb8..e2283944 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -339,9 +339,9 @@ const Buffer = Module("buffer", { * tab. */ get localStore() { - if (!content.dactylStore) - content.dactylStore = {}; - return content.dactylStore; + if (!window.content.dactylStore) + window.content.dactylStore = {}; + return window.content.dactylStore; }, /** @@ -460,7 +460,7 @@ const Buffer = Module("buffer", { // FIXME: getSelection() doesn't always preserve line endings, see: // https://www.mozdev.org/bugs/show_bug.cgi?id=19303 getCurrentWord: function () { - let win = buffer.focusedFrame || content; + let win = buffer.focusedFrame || window.content; let selection = win.getSelection(); if (selection.rangeCount == 0) return ""; @@ -774,7 +774,7 @@ const Buffer = Module("buffer", { */ scrollTo: function (x, y) { marks.add("'", true); - content.scrollTo(x, y); + window.content.scrollTo(x, y); }, /** @@ -884,8 +884,8 @@ const Buffer = Module("buffer", { showPageInfo: function (verbose, sections) { // Ctrl-g single line output if (!verbose) { - let file = content.document.location.pathname.split("/").pop() || "[No Name]"; - let title = content.document.title || "[No Title]"; + let file = window.content.document.location.pathname.split("/").pop() || "[No Name]"; + let title = window.content.document.title || "[No Title]"; let info = template.map("gf", function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "), @@ -1153,8 +1153,8 @@ const Buffer = Module("buffer", { return elem; } - if (content.getSelection().rangeCount) - var elem = find(content.getSelection().getRangeAt(0).startContainer); + if (window.content.getSelection().rangeCount) + var elem = find(window.content.getSelection().getRangeAt(0).startContainer); if (!(elem instanceof Element)) { let doc = Buffer.findScrollableWindow().document; elem = find(doc.body || doc.getElementsByTagName("body")[0] || diff --git a/common/content/dactyl-overlay.js b/common/content/dactyl-overlay.js index 488b4775..936c1028 100644 --- a/common/content/dactyl-overlay.js +++ b/common/content/dactyl-overlay.js @@ -16,7 +16,13 @@ return sandbox; } const jsmodules = {}; - const modules = { __proto__: jsmodules, jsmodules: jsmodules, newContext: newContext, window: window }; + const modules = { + __proto__: jsmodules, + get content() window.content, + jsmodules: jsmodules, + newContext: newContext, + window: window + }; modules.modules = modules; const BASE = "chrome://dactyl/content/"; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 13f05593..bbd1851a 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -595,7 +595,7 @@ const Dactyl = Module("dactyl", { data.push(<>{node.textContent}.toXMLString()); } } - fix(content.document.documentElement); + fix(window.content.document.documentElement); addDataEntry(file + ".xhtml", data.join("")); } diff --git a/common/content/finder.js b/common/content/finder.js index dc75a1d4..8053ac98 100644 --- a/common/content/finder.js +++ b/common/content/finder.js @@ -275,7 +275,7 @@ const RangeFind = Class("RangeFind", { this.matchCase = Boolean(matchCase); this.regex = Boolean(regex); - this.ranges = this.makeFrameList(content); + this.ranges = this.makeFrameList(window.content); this.reset(); @@ -302,7 +302,7 @@ const RangeFind = Class("RangeFind", { get searchString() this.lastString, get selectedRange() { - let selection = (buffer.focusedFrame || content).getSelection(); + let selection = (buffer.focusedFrame || window.content).getSelection(); return (selection.rangeCount ? selection.getRangeAt(0) : this.ranges[0].range).cloneRange(); }, set selectedRange(range) {