зеркало из https://github.com/mozilla/gecko-dev.git
81061 - implement folder deletion in history.
73927 - use batch deleting for history (a speedup of 30000% for a few hundred items!). 63292 - session additions to global history are lost on a crash. 112308 - 2M history.dat file adds 30% to startup time. 96753 - changing history grouping doesn't update open sidebar panels. 98776 - support context menus on folders in global history. 124665 - can't clear global history after startup if you don't have a homepage. 93233 - with large history, clear history appears to hang. 92613 - shouldn't store chrome uris in global history. 59816 - clear history button should be disabled if history is empty; add count attr to nsIBrowserHistory. 104231 - last typed web location remains after clearing all history. r=ben sr=alecf
This commit is contained in:
Родитель
e153cfd6d8
Коммит
46537bd278
|
@ -39,15 +39,26 @@
|
|||
{
|
||||
parent.hPrefWindow.registerOKCallbackFunc(onHistoryOK);
|
||||
|
||||
var button = document.getElementById("ClearUrlBarHistoryButton");
|
||||
var urlbarHistButton = document.getElementById("ClearUrlBarHistoryButton");
|
||||
try {
|
||||
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(button.getAttribute("prefstring"));
|
||||
button.disabled = ( urlBarHist.count == 0 ) || isBtnLocked ;
|
||||
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(urlbarHistButton.getAttribute("prefstring"));
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var lastUrl = pref.getComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsWString).data;
|
||||
urlbarHistButton.disabled = ( urlBarHist.count == 0 && !lastUrl ) || isBtnLocked ;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
|
||||
var globalHistButton = document.getElementById("browserClearHistory");
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
if (globalHistory.count == 0)
|
||||
globalHistButton.disabled = true;
|
||||
|
||||
}
|
||||
|
||||
function onHistoryOK()
|
||||
|
@ -93,6 +104,14 @@
|
|||
var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
urlBarHistory.clearHistory();
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var str = Components.classes["@mozilla.org/supports-wstring;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsWString);
|
||||
str.data = "";
|
||||
pref.setComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsWString,
|
||||
str);
|
||||
button.setAttribute("disabled","true");
|
||||
}
|
||||
]]>
|
||||
|
|
Загрузка…
Ссылка в новой задаче