1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 03:38:00 +01:00

Remove bare references to 'content'.

This commit is contained in:
Kris Maglione
2010-10-04 22:09:54 -04:00
parent 2012279ad9
commit 9af8705807
5 changed files with 20 additions and 14 deletions

View File

@@ -149,7 +149,7 @@ const Browser = Module("browser", {
mappings.add([modes.NORMAL], ["gU"], mappings.add([modes.NORMAL], ["gU"],
"Go to the root of the website", "Go to the root of the website",
function () { 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.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now
dactyl.open(uri.protocol + "//" + (uri.host || "") + "/"); dactyl.open(uri.protocol + "//" + (uri.host || "") + "/");
}); });

View File

@@ -339,9 +339,9 @@ const Buffer = Module("buffer", {
* tab. * tab.
*/ */
get localStore() { get localStore() {
if (!content.dactylStore) if (!window.content.dactylStore)
content.dactylStore = {}; window.content.dactylStore = {};
return content.dactylStore; return window.content.dactylStore;
}, },
/** /**
@@ -460,7 +460,7 @@ const Buffer = Module("buffer", {
// FIXME: getSelection() doesn't always preserve line endings, see: // FIXME: getSelection() doesn't always preserve line endings, see:
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303 // https://www.mozdev.org/bugs/show_bug.cgi?id=19303
getCurrentWord: function () { getCurrentWord: function () {
let win = buffer.focusedFrame || content; let win = buffer.focusedFrame || window.content;
let selection = win.getSelection(); let selection = win.getSelection();
if (selection.rangeCount == 0) if (selection.rangeCount == 0)
return ""; return "";
@@ -774,7 +774,7 @@ const Buffer = Module("buffer", {
*/ */
scrollTo: function (x, y) { scrollTo: function (x, y) {
marks.add("'", true); marks.add("'", true);
content.scrollTo(x, y); window.content.scrollTo(x, y);
}, },
/** /**
@@ -884,8 +884,8 @@ const Buffer = Module("buffer", {
showPageInfo: function (verbose, sections) { showPageInfo: function (verbose, sections) {
// Ctrl-g single line output // Ctrl-g single line output
if (!verbose) { if (!verbose) {
let file = content.document.location.pathname.split("/").pop() || "[No Name]"; let file = window.content.document.location.pathname.split("/").pop() || "[No Name]";
let title = content.document.title || "[No Title]"; let title = window.content.document.title || "[No Title]";
let info = template.map("gf", let info = template.map("gf",
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "), function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
@@ -1153,8 +1153,8 @@ const Buffer = Module("buffer", {
return elem; return elem;
} }
if (content.getSelection().rangeCount) if (window.content.getSelection().rangeCount)
var elem = find(content.getSelection().getRangeAt(0).startContainer); var elem = find(window.content.getSelection().getRangeAt(0).startContainer);
if (!(elem instanceof Element)) { if (!(elem instanceof Element)) {
let doc = Buffer.findScrollableWindow().document; let doc = Buffer.findScrollableWindow().document;
elem = find(doc.body || doc.getElementsByTagName("body")[0] || elem = find(doc.body || doc.getElementsByTagName("body")[0] ||

View File

@@ -16,7 +16,13 @@
return sandbox; return sandbox;
} }
const jsmodules = {}; 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; modules.modules = modules;
const BASE = "chrome://dactyl/content/"; const BASE = "chrome://dactyl/content/";

View File

@@ -595,7 +595,7 @@ const Dactyl = Module("dactyl", {
data.push(<>{node.textContent}</>.toXMLString()); data.push(<>{node.textContent}</>.toXMLString());
} }
} }
fix(content.document.documentElement); fix(window.content.document.documentElement);
addDataEntry(file + ".xhtml", data.join("")); addDataEntry(file + ".xhtml", data.join(""));
} }

View File

@@ -275,7 +275,7 @@ const RangeFind = Class("RangeFind", {
this.matchCase = Boolean(matchCase); this.matchCase = Boolean(matchCase);
this.regex = Boolean(regex); this.regex = Boolean(regex);
this.ranges = this.makeFrameList(content); this.ranges = this.makeFrameList(window.content);
this.reset(); this.reset();
@@ -302,7 +302,7 @@ const RangeFind = Class("RangeFind", {
get searchString() this.lastString, get searchString() this.lastString,
get selectedRange() { 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(); return (selection.rangeCount ? selection.getRangeAt(0) : this.ranges[0].range).cloneRange();
}, },
set selectedRange(range) { set selectedRange(range) {