diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index 74b8f18b7b0..14ceba53adf 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -37,7 +37,7 @@ + onpopuphiding="if (event.target == this) { gContextMenu = null; }"> diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7290e25cc06..61e48e446ca 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4436,11 +4436,6 @@ nsContextMenu.prototype = { // Show if user clicked on something which has metadata. this.showItem( "context-metadata", this.onMetaDataItem ); }, - // called when the menu is going away - hiding : function() { - InlineSpellCheckerUI.clearSuggestionsFromMenu(); - InlineSpellCheckerUI.clearDictionaryListFromMenu(); - }, // Set various context menu attributes based on the state of the world. setTarget : function ( node, event ) { const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; @@ -4465,6 +4460,15 @@ nsContextMenu.prototype = { this.inFrame = false; this.hasBGImage = false; this.bgImageURL = ""; + + // Clear any old spellchecking items from the menu, this used to + // be in the menu hiding code but wasn't getting called in all + // situations. Here, we can ensure it gets cleaned up any time the + // menu is shown. Note: must be before uninit because that clears the + // internal vars + InlineSpellCheckerUI.clearSuggestionsFromMenu(); + InlineSpellCheckerUI.clearDictionaryListFromMenu(); + InlineSpellCheckerUI.uninit(); // Remember the node that was clicked. diff --git a/toolkit/content/inlineSpellCheckUI.js b/toolkit/content/inlineSpellCheckUI.js index b11b9829d1b..2a84268aeb3 100644 --- a/toolkit/content/inlineSpellCheckUI.js +++ b/toolkit/content/inlineSpellCheckUI.js @@ -37,6 +37,14 @@ # ***** END LICENSE BLOCK ***** var InlineSpellCheckerUI = { + mOverMisspelling: false, + mMisspelling: "", + mMenu: null, + mSpellSuggestions: [], // text of words + mSuggestionItems: [], // menuitem nodes + mDictionaryMenu: null, + mDictionaryNames: [], + mDictionaryItems: [], // Call this function to initialize for a given edit element init: function(inputElt) @@ -58,8 +66,8 @@ var InlineSpellCheckerUI = { this.mOverMisspelling = false; this.mMisspelling = ""; this.mMenu = null; - this.mSpellSuggestions = []; // text of words - this.mSuggestionItems = []; // menuitem nodes + this.mSpellSuggestions = []; + this.mSuggestionItems = []; this.mDictionaryMenu = null; this.mDictionaryNames = []; this.mDictionaryItems = [];