Bug 708071 - Make the spell checking UI not hold on to a document in memory when spelling suggestion is invoked through the context menu. r=gavin

This commit is contained in:
Dão Gottwald 2011-12-07 15:45:44 +01:00
Родитель e6afd9509c
Коммит 161a558a6e
4 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -279,7 +279,11 @@
if (gContextMenu.shouldDisplay)
updateEditUIVisibility();
return gContextMenu.shouldDisplay;"
onpopuphiding="if (event.target == this) { gContextMenu = null; updateEditUIVisibility(); }">
onpopuphiding="if (event.target != this)
return;
gContextMenu.hiding();
gContextMenu = null;
updateEditUIVisibility();">
#include browser-context.inc
</menupopup>

Просмотреть файл

@ -97,6 +97,12 @@ nsContextMenu.prototype = {
this.initItems();
},
hiding: function CM_hiding() {
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit();
},
initItems: function CM_initItems() {
this.initPageMenuSeparator();
this.initOpenItems();
@ -488,16 +494,6 @@ nsContextMenu.prototype = {
this.onEditableArea = false;
this.isDesignMode = false;
// 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.
this.target = aNode;

Просмотреть файл

@ -87,8 +87,10 @@
if (gContextMenu.shouldDisplay)
document.popupNode = this.triggerNode;
return gContextMenu.shouldDisplay;"
onpopuphiding="if (event.target == this)
gContextMenu = null;">
onpopuphiding="if (event.target != this)
return;
gContextMenu.hiding();
gContextMenu = null;">
#include browser-context.inc
</menupopup>
</popupset>

Просмотреть файл

@ -69,6 +69,7 @@ InlineSpellChecker.prototype = {
this.mDictionaryMenu = null;
this.mDictionaryNames = [];
this.mDictionaryItems = [];
this.mWordNode = null;
},
// for each UI event, you must call this function, it will compute the