1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 09:17:59 +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"],
"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 || "") + "/");
});

View File

@@ -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] ||

View File

@@ -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/";

View File

@@ -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(""));
}

View File

@@ -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) {