From 22610a10a991395b6f5701decaa0280812380928 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 5 Nov 2010 15:03:50 -0400 Subject: [PATCH] Work around more Tracemonkey brokenness. --- common/content/events.js | 11 ++++++----- common/content/javascript.js | 13 ++++++++++--- common/modules/base.jsm | 3 +-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 8b869753..d3ddc26e 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -476,13 +476,14 @@ const Events = Module("events", { if (/^key/.test(event.type)) { let charCode = event.type == "keyup" ? 0 : event.charCode; // Why? --Kris if (charCode == 0) { - if (event.keyCode in this._code_key) + if (event.keyCode in this._code_key) { key = this._code_key[event.keyCode]; - if (event.shiftKey && (key.length > 1 || event.ctrlKey || event.altKey || event.metaKey) || event.dactylShift) - modifier += "S-"; - if (!modifier && /^[a-z0-9]$/i.test(key)) - return key; + if (event.shiftKey && (key.length > 1 || event.ctrlKey || event.altKey || event.metaKey) || event.dactylShift) + modifier += "S-"; + if (!modifier && /^[a-z0-9]$/i.test(key)) + return key; + } } // [Ctrl-Bug] special handling of mysterious , , , , bugs (OS/X) // (i.e., cntrl codes 27--31) diff --git a/common/content/javascript.js b/common/content/javascript.js index 65a48afa..f82adcd7 100644 --- a/common/content/javascript.js +++ b/common/content/javascript.js @@ -35,8 +35,6 @@ const JavaScript = Module("javascript", { }, iter: function iter(obj, toplevel) { - "use strict"; - if (obj == null) return; @@ -60,6 +58,8 @@ const JavaScript = Module("javascript", { // Things we can dereference if (!obj || ["object", "string", "function"].indexOf(typeof obj) === -1) return []; + if (isinstance(obj, ["Sandbox"]) && !toplevel) // Temporary hack. + return []; if (jsmodules.isPrototypeOf(obj) && !toplevel) return []; @@ -79,8 +79,14 @@ const JavaScript = Module("javascript", { return cache[key]; context[JavaScript.EVAL_TMP] = tmp; + context[JavaScript.EVAL_EXPORT] = function export(obj) cache[key] = obj; try { - return cache[key] = dactyl.userEval(arg, context, "[Command Line Completion]", 1); + if (tmp != null) // Temporary hack until bug 609949 is fixed. + dactyl.userEval(JavaScript.EVAL_EXPORT + "(" + arg + ")", context, "[Command Line Completion]", 1); + else + cache[key] = dactyl.userEval(arg, context, "[Command Line Completion]", 1); + + return cache[key]; } catch (e) { this.context.message = "Error: " + e; @@ -585,6 +591,7 @@ const JavaScript = Module("javascript", { } }, { EVAL_TMP: "__dactyl_eval_tmp", + EVAL_EXPORT: "__dactyl_eval_export", /** * A map of argument completion functions for named methods. The diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 8eacbdaa..c9b0bdf1 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -217,8 +217,7 @@ function debuggerProperties(obj) { * @returns {Generator} */ function prototype(obj) - // Temporary hack: - typeof obj === "xml" || obj.__proto__ !== obj.__proto__ ? null : + /* Temporary hack: */ typeof obj === "xml" || obj.__proto__ !== obj.__proto__ ? null : obj.__proto__ || Object.getPrototypeOf(obj) || XPCNativeWrapper.unwrap(obj).__proto__ || Object.getPrototypeOf(XPCNativeWrapper.unwrap(obj));