Bug 324354: Ctrl-Z (undo) reveals visited URLs AFTER clearing history, patch by Martijn Wargers <martijn.martijn@gmail.com>, r=mconnor

git-svn-id: svn://10.0.0.236/trunk@188663 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2006-02-01 15:22:15 +00:00
parent 42c83dfcda
commit eec2154644
3 changed files with 30 additions and 1 deletions

View File

@@ -242,6 +242,18 @@ const gSessionHistoryObserver = {
backCommand.setAttribute("disabled", "true");
var fwdCommand = document.getElementById("Browser:Forward");
fwdCommand.setAttribute("disabled", "true");
//Clear undo history of all URL Bars
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var windows = windowManagerInterface.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
var urlBar = windows.getNext().gURLBar;
if (urlBar) {
urlBar.editor.enableUndo(false);
urlBar.editor.enableUndo(true);
}
}
}
};

View File

@@ -151,6 +151,19 @@ 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");
while (windows.hasMoreElements()) {
var searchBar = windows.getNext().document.getElementById("searchbar");
if (searchBar) {
searchBar.mTextbox.value = "";
searchBar.mTextbox.editor.enableUndo(false);
searchBar.mTextbox.editor.enableUndo(true);
}
}
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory);
formHistory.removeAllEntries();

View File

@@ -389,9 +389,13 @@
doCommand: function (aCommand)
{
// Clear the searchbar and its undo history
this.mOuter.value = "";
this.mOuter.editor.enableUndo(false);
this.mOuter.editor.enableUndo(true);
this.mOuter.formHistSvc.removeEntriesForName(
this.mOuter.getAttribute("autocompletesearchparam"));
this.mOuter.value = "";
}
})
]]></field>