diff --git a/browser/metro/base/content/contenthandlers/FormHelper.js b/browser/metro/base/content/contenthandlers/FormHelper.js index 09ab120101d..1fe7307e6d8 100644 --- a/browser/metro/base/content/contenthandlers/FormHelper.js +++ b/browser/metro/base/content/contenthandlers/FormHelper.js @@ -129,7 +129,7 @@ FormAssistant.prototype = { } // Don't re-open when navigating to avoid repopulating list when changing selection. - if (this._isAutocomplete(aElement) && this._open && this._isNavigationKey(aEvent)) { + if (this._isAutocomplete(aElement) && this._open && Util.isNavigationKey(aEvent.keyCode)) { return false; } @@ -293,22 +293,6 @@ FormAssistant.prototype = { } }, - _isNavigationKey: function (aEvent) { - // Ignore navigation keys - if (aEvent.keyCode) { - let navigationKeys = [ - aEvent.DOM_VK_DOWN, - aEvent.DOM_VK_UP, - aEvent.DOM_VK_LEFT, - aEvent.DOM_VK_RIGHT, - aEvent.DOM_VK_PAGE_UP, - aEvent.DOM_VK_PAGE_DOWN]; - - return navigationKeys.indexOf(aEvent.keyCode) != -1; - } - return false; - }, - _executeDelayed: function formHelperExecuteSoon(aCallback) { let self = this; let timer = new Util.Timeout(function() { diff --git a/browser/metro/base/content/helperui/MenuUI.js b/browser/metro/base/content/helperui/MenuUI.js index 0cbbd15e45d..38458dcb17c 100644 --- a/browser/metro/base/content/helperui/MenuUI.js +++ b/browser/metro/base/content/helperui/MenuUI.js @@ -50,7 +50,6 @@ var AutofillMenuUI = { show: function show(aAnchorRect, aSuggestionsList) { this.commands.addEventListener("select", this, true); - window.addEventListener("keypress", this, true); this._anchorRect = aAnchorRect; this._emptyCommands(); @@ -72,7 +71,6 @@ var AutofillMenuUI = { }, hide: function hide () { - window.removeEventListener("keypress", this, true); this.commands.removeEventListener("select", this, true); this._menuPopup.hide(); @@ -80,30 +78,6 @@ var AutofillMenuUI = { handleEvent: function (aEvent) { switch (aEvent.type) { - case "keypress": - switch (aEvent.keyCode) { - case aEvent.DOM_VK_ESCAPE: - this.hide(); - break; - - case aEvent.DOM_VK_DOWN: - this.commands.moveByOffset(1, true, false); - break; - - case aEvent.DOM_VK_UP: - this.commands.moveByOffset(-1, true, false); - break; - - case aEvent.DOM_VK_PAGE_DOWN: - this.commands.moveByOffset(this.commands.scrollOnePage(1), true, false); - break; - - case aEvent.DOM_VK_PAGE_UP: - this.commands.moveByOffset(this.commands.scrollOnePage(-1), true, false); - break; - } - break; - case "select": FormHelperUI.doAutoComplete(this.commands.value); break; @@ -527,12 +501,47 @@ MenuPopup.prototype = { handleEvent: function handleEvent(aEvent) { switch (aEvent.type) { case "keypress": - if (!this._wantTypeBehind) { + // this.commands is not holding focus and not processing key events. + // Proxying events so that they're handled properly. + + // Avoid recursion + if (aEvent.mine) + break; + + let ev = document.createEvent("KeyboardEvent"); + ev.initKeyEvent( + "keypress", // in DOMString typeArg, + false, // in boolean canBubbleArg, + true, // in boolean cancelableArg, + null, // in nsIDOMAbstractView viewArg, Specifies UIEvent.view. This value may be null. + aEvent.ctrlKey, // in boolean ctrlKeyArg, + aEvent.altKey, // in boolean altKeyArg, + aEvent.shiftKey, // in boolean shiftKeyArg, + aEvent.metaKey, // in boolean metaKeyArg, + aEvent.keyCode, // in unsigned long keyCodeArg, + aEvent.charCode); // in unsigned long charCodeArg); + + ev.mine = true; + this.commands.dispatchEvent(ev); + + switch (aEvent.keyCode) { + case aEvent.DOM_VK_ESCAPE: + this.hide(); + break; + + case aEvent.DOM_VK_RETURN: + this.commands.currentItem.click(); + break; + } + + if (Util.isNavigationKey(aEvent.keyCode)) { + aEvent.stopPropagation(); + aEvent.preventDefault(); + } else if (!this._wantTypeBehind) { // Hide the context menu so you can't type behind it. aEvent.stopPropagation(); aEvent.preventDefault(); - if (aEvent.keyCode != aEvent.DOM_VK_ESCAPE) - this.hide(); + this.hide(); } break; case "blur": diff --git a/browser/metro/modules/ContentUtil.jsm b/browser/metro/modules/ContentUtil.jsm index f62b33afd97..2f113fc14ab 100644 --- a/browser/metro/modules/ContentUtil.jsm +++ b/browser/metro/modules/ContentUtil.jsm @@ -6,6 +6,7 @@ this.EXPORTED_SYMBOLS = ["ContentUtil"]; const XHTML_NS = "http://www.w3.org/1999/xhtml"; +const nsIDOMKeyEvent = Components.interfaces.nsIDOMKeyEvent; this.ContentUtil = { populateFragmentFromString: function populateFragmentFromString(fragment, str) { @@ -87,6 +88,19 @@ this.ContentUtil = { // Return the modified object return target; - } + }, + // Checks if a keycode is used for list navigation. + isNavigationKey: function (keyCode) { + let navigationKeys = [ + nsIDOMKeyEvent.DOM_VK_DOWN, + nsIDOMKeyEvent.DOM_VK_UP, + nsIDOMKeyEvent.DOM_VK_LEFT, + nsIDOMKeyEvent.DOM_VK_RIGHT, + nsIDOMKeyEvent.DOM_VK_PAGE_UP, + nsIDOMKeyEvent.DOM_VK_PAGE_DOWN, + nsIDOMKeyEvent.DOM_VK_ESCAPE]; + + return navigationKeys.indexOf(keyCode) != -1; + } }; diff --git a/mobile/android/base/animation/AnimationUtils.java b/mobile/android/base/animation/AnimationUtils.java index adfda1341ec..63e8e168ec4 100644 --- a/mobile/android/base/animation/AnimationUtils.java +++ b/mobile/android/base/animation/AnimationUtils.java @@ -9,7 +9,7 @@ package org.mozilla.gecko.animation; import android.content.Context; public class AnimationUtils { - private static long mShortDuration; + private static long mShortDuration = -1; public static long getShortDuration(Context context) { if (mShortDuration < 0) { diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 81c0924d2f3..fd97271d303 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -527,12 +527,13 @@ ThreadActor.prototype = { eventLoop.resolve(); }, + /** + * Remove all debuggees and clear out the thread's sources. + */ clearDebuggees: function () { if (this.dbg) { this.dbg.removeAllDebuggees(); } - this.conn.removeActorPool(this._threadLifetimePool || undefined); - this._threadLifetimePool = null; this._sources = null; }, @@ -636,6 +637,8 @@ ThreadActor.prototype = { this._state = "exited"; this.clearDebuggees(); + this.conn.removeActorPool(this._threadLifetimePool); + this._threadLifetimePool = null; if (this._prettyPrintWorker) { this._prettyPrintWorker.removeEventListener(