From 7e3c994ce3a1d468dab6b54ae17acb11ad8db9f2 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Thu, 16 Feb 2012 00:02:55 -0500 Subject: [PATCH] browser_element_focus: fix error with xul textboxes, xulrunner>=8 An error was dumped to console in XULRunner 8, if you open about:config in a buffer and hit tab. TypeError: elem.wrappedJSObject is undefined chrome://conkeror/content/element.js:368 browser_element_focus([object Object],[object XULElement])@chrome://conkeror/content/element.js:368 ... Console error: [JavaScript Warning: "reference to undefined property elem.wrappedJSObject" {file: "chrome://conkeror/content/element.js" line: 368}] Category: chrome javascript --- modules/element.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/element.js b/modules/element.js index d25901b..28ac598 100644 --- a/modules/element.js +++ b/modules/element.js @@ -364,8 +364,12 @@ function browser_element_focus (buffer, elem) { if (! dom_node_or_window_p(elem)) return; - if (elem instanceof Ci.nsIDOMXULTextBoxElement) - elem = elem.wrappedJSObject.inputField; // focus the input field + if (elem instanceof Ci.nsIDOMXULTextBoxElement) { + if (elem.wrappedJSObject) + elem = elem.wrappedJSObject.inputField; // focus the input field + else + elem = elem.inputField; + } browser_set_element_focus(buffer, elem); if (elem instanceof Ci.nsIDOMWindow) -- 2.11.4.GIT