X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fmodules%2Fjavascript.jsm;fp=common%2Fmodules%2Fjavascript.jsm;h=a4d1ab6bf435024c35d1cb68e0ce64bcaf133414;hb=9044153cb63835e39b9de8ec4ade237c03e3888a;hp=e85b8ca41f3002ae3151226b519139c254ab5a64;hpb=70740024f9c028c1fd63e1a1850ab062ff956054;p=dactyl.git diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index e85b8ca..a4d1ab6 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -2,7 +2,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -"use strict"; +/* use strict */ let { getOwnPropertyNames } = Object; @@ -10,8 +10,7 @@ try { Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("javascript", { - exports: ["JavaScript", "javascript"], - use: ["messages", "services", "template", "util"] + exports: ["JavaScript", "javascript"] }, this); let isPrototypeOf = Object.prototype.isPrototypeOf; @@ -44,13 +43,13 @@ var JavaScript = Module("javascript", { } }), - globals: Class.memoize(function () [ + globals: Class.Memoize(function () [ [this.modules.userContext, /*L*/"Global Variables"], [this.modules, "modules"], [this.window, "window"] ]), - toplevel: Class.memoize(function () this.modules.jsmodules), + toplevel: Class.Memoize(function () this.modules.jsmodules), lazyInit: true, @@ -103,7 +102,7 @@ var JavaScript = Module("javascript", { let completions = [k for (k in this.iter(obj, toplevel))]; if (obj === this.modules) // Hack. - completions = completions.concat([k for (k in this.iter(this.modules.jsmodules, toplevel))]); + completions = array.uniq(completions.concat([k for (k in this.iter(this.modules.jsmodules, toplevel))])); return completions; }, @@ -593,8 +592,10 @@ var JavaScript = Module("javascript", { // Wait for a keypress before completing when there's no key if (!this.context.tabPressed && key == "" && obj.length > 1) { + let message = this.context.message || ""; this.context.waitingForTab = true; - this.context.message = _("completion.waitingForKeyPress"); + this.context.message = <>{message} + {_("completion.waitingForKeyPress")}; return null; } @@ -612,17 +613,17 @@ var JavaScript = Module("javascript", { return null; }, - magicalNames: Class.memoize(function () Object.getOwnPropertyNames(Cu.Sandbox(this.window), true).sort()), + magicalNames: Class.Memoize(function () Object.getOwnPropertyNames(Cu.Sandbox(this.window), true).sort()), /** * A list of properties of the global object which are not * enumerable by any standard method. */ - globalNames: Class.memoize(function () let (self = this) array.uniq([ - "Array", "ArrayBuffer", "AttributeName", "Boolean", "Components", + globalNames: Class.Memoize(function () let (self = this) array.uniq([ + "Array", "ArrayBuffer", "AttributeName", "Audio", "Boolean", "Components", "CSSFontFaceStyleDecl", "CSSGroupRuleRuleList", "CSSNameSpaceRule", - "CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date", - "Error", "EvalError", "Float32Array", "Float64Array", "Function", + "CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date", "Error", + "EvalError", "File", "Float32Array", "Float64Array", "Function", "HTMLDelElement", "HTMLInsElement", "HTMLSpanElement", "Infinity", "InnerModalContentWindow", "InnerWindow", "Int16Array", "Int32Array", "Int8Array", "InternalError", "Iterator", "JSON", "KeyboardEvent", @@ -700,7 +701,7 @@ var JavaScript = Module("javascript", { modes.addMode("REPL", { description: "JavaScript Read Eval Print Loop", bases: [modes.COMMAND_LINE], - displayName: Class.memoize(function () this.name) + displayName: Class.Memoize(function () this.name) }); }, commandline: function initCommandLine(dactyl, modules, window) { @@ -718,7 +719,7 @@ var JavaScript = Module("javascript", { try { var result = dactyl.userEval(js, this.context); - var xml = util.objectToString(result, true); + var xml = result === undefined ? "" : util.objectToString(result, true); } catch (e) { util.reportError(e); @@ -746,7 +747,7 @@ var JavaScript = Module("javascript", { count: 0, - message: Class.memoize(function () { + message: Class.Memoize(function () { default xml namespace = XHTML; util.xmlToDom(
, this.document, this); @@ -762,7 +763,7 @@ var JavaScript = Module("javascript", { init.supercall(this); let self = this; - let sandbox = isinstance(context, ["Sandbox"]); + let sandbox = true || isinstance(context, ["Sandbox"]); this.context = modules.newContext(context, !sandbox); this.js = modules.JavaScript();