diff --git a/common/content/events.js b/common/content/events.js index ca872006..5d1ad674 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -901,7 +901,9 @@ var Events = Module("events", { if (elem == null && urlbar && urlbar.inputField == this._lastFocus) util.threadYield(true); // Why? --Kris - while (modes.main.ownsFocus && modes.topOfStack.params.ownsFocus != elem + while (modes.main.ownsFocus + && modes.topOfStack.params.ownsFocus != elem + && modes.topOfStack.params.ownsFocus != win && !modes.topOfStack.params.holdFocus) modes.pop(null, { fromFocus: true }); } diff --git a/common/content/modes.js b/common/content/modes.js index e24911b6..e6a6ccaa 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -291,7 +291,6 @@ var Modes = Module("modes", { inSet: false, - // helper function to set both modes in one go set: function set(mainMode, extendedMode, params, stack) { var delayed, oldExtended, oldMain, prev, push; @@ -628,7 +627,8 @@ var Modes = Module("modes", { opts); }, prefs: function initPrefs() { - prefs.watch("accessibility.browsewithcaret", function () modes.onCaretChange.apply(modes, arguments)); + prefs.watch("accessibility.browsewithcaret", + function () { modes.onCaretChange.apply(modes, arguments) }); } }); diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 1cdffec1..133e6f20 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -48,6 +48,16 @@ var RangeFinder = Module("rangefinder", { prefs.safeSet("accessibility.typeaheadfind", false); }, + cleanup: function cleanup() { + for (let doc in util.iterDocuments()) { + let find = overlay.getData(doc, "range-find", null); + if (find) + find.highlight(true); + + overlay.setData(doc, "range-find", null); + } + }, + get commandline() this.modules.commandline, get modes() this.modules.modes, get options() this.modules.options, @@ -719,7 +729,6 @@ var RangeFind = Class("RangeFind", { this.range = range; this.document = range.startContainer.ownerDocument; this.window = this.document.defaultView; - this.docShell = util.docShell(this.window); if (this.selection == null) return false; @@ -727,6 +736,8 @@ var RangeFind = Class("RangeFind", { this.save(); }, + docShell: Class.Memoize(function () util.docShell(this.window)), + intersects: function (range) RangeFind.intersects(this.range, range), save: function save() { diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 1cd2a6b1..1b95dbd2 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -972,7 +972,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), object = Iterator(object); hasValue = false; } - for (let i in object) { + let keyIter = object; + if ("__iterator__" in object && !callable(object.__iterator__)) + keyIter = keys(object) + + for (let i in keyIter) { let value = ]]>; try { value = object[i];