diff --git a/common/content/buffer.js b/common/content/buffer.js index dc158220..ad4ce71b 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -368,9 +368,9 @@ const Buffer = Module("buffer", { * tab. */ get localStore() { - if (!window.content.dactylStore) - window.content.dactylStore = {}; - return window.content.dactylStore; + if (!content.dactylStore) + content.dactylStore = {}; + return content.dactylStore; }, /** @@ -383,18 +383,18 @@ const Buffer = Module("buffer", { /** * @property {string} The current top-level document's URL. */ - get URL() window.content.location.href, + get URL() content.location.href, /** * @property {string} The current top-level document's URL, sans any * fragment identifier. */ - get URI() window.content.document.documentURI, + get URI() content.document.documentURI, /** * @property {number} The buffer's height in pixels. */ - get pageHeight() window.content.innerHeight, + get pageHeight() content.innerHeight, /** * @property {number} The current browser's zoom level, as a @@ -413,7 +413,7 @@ const Buffer = Module("buffer", { /** * @property {string} The current document's title. */ - get title() window.content.document.title, + get title() content.document.title, /** * @property {number} The buffer's horizontal scroll percentile. @@ -457,7 +457,7 @@ const Buffer = Module("buffer", { if (frame.document.body instanceof HTMLBodyElement) frames.push(frame); Array.forEach(frame.frames, rec); - })(win || window.content); + })(win || content); if (focusedFirst) return frames.filter(function (f) f === buffer.focusedFrame).concat( frames.filter(function (f) f !== buffer.focusedFrame)); @@ -469,7 +469,7 @@ const Buffer = Module("buffer", { */ get focusedFrame() { let frame = (dactyl.has("tabs") ? tabs.localStore : this.localStore).focusedFrame; - return frame && frame.get() || window.content; + return frame && frame.get() || content; }, set focusedFrame(frame) { (dactyl.has("tabs") ? tabs.localStore : this.localStore).focusedFrame = Cu.getWeakReference(frame); @@ -485,7 +485,7 @@ const Buffer = Module("buffer", { * @returns {string} */ getCurrentWord: function () { - let win = buffer.focusedFrame || window.content; + let win = buffer.focusedFrame || content; let selection = win.getSelection(); if (selection.rangeCount == 0) return ""; @@ -821,7 +821,7 @@ const Buffer = Module("buffer", { */ scrollTo: function (x, y) { marks.add("'", true); - window.content.scrollTo(x, y); + content.scrollTo(x, y); }, /** @@ -847,7 +847,7 @@ const Buffer = Module("buffer", { * count skips backwards. */ shiftFrameFocus: function (count) { - if (!(window.content.document instanceof HTMLDocument)) + if (!(content.document instanceof HTMLDocument)) return; let frames = buffer.allFrames(); @@ -872,7 +872,7 @@ const Buffer = Module("buffer", { // focus next frame and scroll into view frames[next].focus(); - if (frames[next] != window.content) + if (frames[next] != content) frames[next].frameElement.scrollIntoView(false); // add the frame indicator @@ -908,8 +908,8 @@ const Buffer = Module("buffer", { showPageInfo: function (verbose, sections) { // Ctrl-g single line output if (!verbose) { - let file = window.content.document.location.pathname.split("/").pop() || "[No Name]"; - let title = window.content.document.title || "[No Title]"; + let file = content.document.location.pathname.split("/").pop() || "[No Name]"; + let title = content.document.title || "[No Title]"; let info = template.map("gf", function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "), @@ -1106,7 +1106,7 @@ const Buffer = Module("buffer", { if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0)) return win; - win = window.content; + win = content; if (win.scrollMaxX > 0 || win.scrollMaxY > 0) return win; @@ -1307,7 +1307,7 @@ const Buffer = Module("buffer", { commands.add(["sav[eas]", "w[rite]"], "Save current document to disk", function (args) { - let doc = window.content.document; + let doc = content.document; let chosenData = null; let filename = args[0]; @@ -1351,9 +1351,9 @@ const Buffer = Module("buffer", { prefs.set("browser.download.lastDir", io.cwd); try { - var contentDisposition = window.content.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils) - .getDocumentMetadata("content-disposition"); + var contentDisposition = content.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils) + .getDocumentMetadata("content-disposition"); } catch (e) {} diff --git a/common/content/commands.js b/common/content/commands.js index b429ce57..46f9a4fb 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -664,7 +664,7 @@ const Commands = Module("commands", { */ hasDomain: function (command, host) { try { - for (let [cmd, args] in this._subCommands(command)) + for (let [cmd, args] in this.subCommands(command)) if (Array.concat(cmd.domains(args)).some(function (domain) util.isSubdomain(domain, host))) return true; } @@ -682,7 +682,7 @@ const Commands = Module("commands", { * @returns {boolean} */ hasPrivateData: function (command) { - for (let [cmd, args] in this._subCommands(command)) + for (let [cmd, args] in this.subCommands(command)) if (cmd.privateData) return !callable(cmd.privateData) || cmd.privateData(args); return false; @@ -1059,7 +1059,7 @@ const Commands = Module("commands", { while (str); }, - _subCommands: function (command) { + subCommands: function (command) { let commands = [command]; while (command = commands.shift()) try { diff --git a/common/content/dactyl-overlay.js b/common/content/dactyl-overlay.js index 2d8b09eb..a0a51da6 100644 --- a/common/content/dactyl-overlay.js +++ b/common/content/dactyl-overlay.js @@ -16,7 +16,7 @@ const jsmodules = {}; const modules = { __proto__: jsmodules, - get content() window.content, + get content() this.config.browser.contentWindow || window.content, jsmodules: jsmodules, newContext: newContext, window: window diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 4c9808f4..84731c65 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -363,7 +363,7 @@ const Dactyl = Module("dactyl", { return; let win = document.commandDispatcher.focusedWindow; - let elem = config.mainWidget || window.content; + let elem = config.mainWidget || content; // TODO: make more generic try { if (this.has("mail") && !config.isComposeWindow) { @@ -374,7 +374,7 @@ const Dactyl = Module("dactyl", { } else { let frame = buffer.focusedFrame; - if (frame && frame.top == window.content && !Editor.getEditor(frame)) + if (frame && frame.top == content && !Editor.getEditor(frame)) elem = frame; } } @@ -624,7 +624,7 @@ const Dactyl = Module("dactyl", { data.push(<>{node.textContent}.toXMLString()); } } - fix(window.content.document.documentElement); + fix(content.document.documentElement); addDataEntry(file + ".xhtml", data.join("")); } diff --git a/common/content/events.js b/common/content/events.js index b9731ee8..d9e70e8a 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -713,7 +713,7 @@ const Events = Module("events", { if (elem == null && Editor.getEditor(win)) elem = win; - if (win && win.top == window.content && dactyl.has("tabs")) + if (win && win.top == content && dactyl.has("tabs")) buffer.focusedFrame = win; try { @@ -1064,7 +1064,7 @@ const Events = Module("events", { isContentNode: function isContentNode(node) { let win = (node.ownerDocument || node).defaultView || node; for (; win; win = win.parent != win && win.parent) - if (win == window.content) + if (win == content) return true; return false; }, diff --git a/common/content/finder.js b/common/content/finder.js index 04e6affc..243115ac 100644 --- a/common/content/finder.js +++ b/common/content/finder.js @@ -268,7 +268,7 @@ const RangeFind = Class("RangeFind", { this.matchCase = Boolean(matchCase); this.regexp = Boolean(regexp); - this.ranges = this.makeFrameList(window.content); + this.ranges = this.makeFrameList(content); this.reset(); @@ -295,7 +295,7 @@ const RangeFind = Class("RangeFind", { get searchString() this.lastString, get selectedRange() { - let selection = (buffer.focusedFrame || window.content).getSelection(); + let selection = (buffer.focusedFrame || content).getSelection(); return (selection.rangeCount ? selection.getRangeAt(0) : this.ranges[0].range).cloneRange(); }, set selectedRange(range) { diff --git a/common/content/help.js b/common/content/help.js index 3b23994f..947636e4 100644 --- a/common/content/help.js +++ b/common/content/help.js @@ -9,7 +9,7 @@ function checkFragment() { var frag = document.location.hash.substr(1); var elem = document.getElementById(frag); function action() { - window.content.scrollTo(0, window.content.scrollY + elem.getBoundingClientRect().top - 10); // 10px context + content.scrollTo(0, content.scrollY + elem.getBoundingClientRect().top - 10); // 10px context } if (elem) { action(); diff --git a/common/content/hints.js b/common/content/hints.js index 653aaf45..df7d7327 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -260,7 +260,7 @@ const Hints = Module("hints", { * Pushes the hints into the pageHints object, but does not display them. * * @param {Window} win The window for which to generate hints. - * @default window.content + * @default content */ _generate: function _generate(win, offsets) { if (!win) @@ -845,7 +845,7 @@ const Hints = Module("hints", { this._canUpdate = false; this._continue = Boolean(opts.continue); - this._top = opts.window || window.content; + this._top = opts.window || content; this._top.addEventListener("resize", this._resizeTimer.closure.tell, true); this._generate(); diff --git a/common/content/io.js b/common/content/io.js index 00342081..3cfba864 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -677,7 +677,8 @@ lookup: context.title = [full ? "Path" : "Filename", "Type"]; context.keys = { - text: !full ? "leafName" : function (f) dir + f.leafName, + text: !full ? "leafName" : function (f) this.path, + path: function (f) dir + f.leafName, description: function (f) this.isdir ? "Directory" : "File", isdir: function (f) f.isDirectory(), icon: function (f) this.isdir ? "resource://gre/res/html/folder.png" @@ -731,7 +732,7 @@ lookup: dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; - context.keys.text = function (f) f.path.substr(dir.length); + context.keys.text = function (f) this.path.substr(dir.length); }); }; diff --git a/common/content/javascript.js b/common/content/javascript.js index adbc92ea..b29989bd 100644 --- a/common/content/javascript.js +++ b/common/content/javascript.js @@ -443,7 +443,7 @@ const JavaScript = Module("javascript", { // Find any complete statements that we can eval before we eval our object. // This allows for things like: - // let doc = window.content.document; let elem = doc.createEle ... + // let doc = content.document; let elem = doc.createEle ... let prev = 0; for (let [, v] in Iterator(this._get(0).fullStatements)) { let key = this._str.substring(prev, v + 1); diff --git a/common/content/modes.js b/common/content/modes.js index 4f352bb7..f9d3596a 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -41,7 +41,7 @@ const Modes = Module("modes", { this.addMode("VISUAL", { char: "v", ownsFocus: true, display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : "") }, { leave: function (stack, newMode) { if (newMode.main == modes.CARET) { - let selection = window.content.getSelection(); + let selection = content.getSelection(); if (selection && !selection.isCollapsed) selection.collapseToStart(); }