зеркало из https://github.com/mozilla/pjs.git
Bug 446274: make sure to properly enable the 'clear history' menu option if there is search bar state to clear, r=dao
This commit is contained in:
Родитель
9fb13865ed
Коммит
2b797a3ef1
|
@ -179,10 +179,10 @@ Sanitizer.prototype = {
|
|||
formdata: {
|
||||
clear: function ()
|
||||
{
|
||||
//Clear undo history of all searchBars
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManagerInterface.getEnumerator("navigator:browser");
|
||||
// Clear undo history of all searchBars
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManager.getEnumerator("navigator:browser");
|
||||
while (windows.hasMoreElements()) {
|
||||
var searchBar = windows.getNext().document.getElementById("searchbar");
|
||||
if (searchBar) {
|
||||
|
@ -195,9 +195,23 @@ Sanitizer.prototype = {
|
|||
.getService(Components.interfaces.nsIFormHistory2);
|
||||
formHistory.removeAllEntries();
|
||||
},
|
||||
|
||||
|
||||
get canClear()
|
||||
{
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManager.getEnumerator("navigator:browser");
|
||||
while (windows.hasMoreElements()) {
|
||||
var searchBar = windows.getNext().document.getElementById("searchbar");
|
||||
if (searchBar) {
|
||||
var transactionMgr = searchBar.textbox.editor.transactionManager;
|
||||
if (searchBar.value ||
|
||||
transactionMgr.numberOfUndoItems ||
|
||||
transactionMgr.numberOfRedoItems)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
|
||||
.getService(Components.interfaces.nsIFormHistory2);
|
||||
return formHistory.hasEntries;
|
||||
|
|
|
@ -157,10 +157,10 @@ Sanitizer.prototype = {
|
|||
formdata: {
|
||||
clear: function ()
|
||||
{
|
||||
//Clear undo history of all searchBars
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManagerInterface.getEnumerator("navigator:browser");
|
||||
// Clear undo history of all searchBars
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManager.getEnumerator("navigator:browser");
|
||||
while (windows.hasMoreElements()) {
|
||||
var searchBar = windows.getNext().document.getElementById("searchbar");
|
||||
if (searchBar) {
|
||||
|
@ -173,9 +173,23 @@ Sanitizer.prototype = {
|
|||
.getService(Components.interfaces.nsIFormHistory2);
|
||||
formHistory.removeAllEntries();
|
||||
},
|
||||
|
||||
|
||||
get canClear()
|
||||
{
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var windows = windowManager.getEnumerator("navigator:browser");
|
||||
while (windows.hasMoreElements()) {
|
||||
var searchBar = windows.getNext().document.getElementById("searchbar");
|
||||
if (searchBar) {
|
||||
var transactionMgr = searchBar.textbox.editor.transactionManager;
|
||||
if (searchBar.value ||
|
||||
transactionMgr.numberOfUndoItems ||
|
||||
transactionMgr.numberOfRedoItems)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
|
||||
.getService(Components.interfaces.nsIFormHistory2);
|
||||
return formHistory.hasEntries;
|
||||
|
|
Загрузка…
Ссылка в новой задаче