зеркало из https://github.com/mozilla/gecko-dev.git
Bug 87969. Add URL to history when pasting a URL into the window via middle-click. r=mconner,a=asa,patch by Wolfgang Rosenauer
This commit is contained in:
Родитель
2e54275977
Коммит
3be669f8a7
|
@ -2023,7 +2023,7 @@ function handleURLBarCommand(aTriggeringEvent)
|
|||
canonizeUrl(aTriggeringEvent, postData);
|
||||
|
||||
try {
|
||||
addToUrlbarHistory();
|
||||
addToUrlbarHistory(gURLBar.value);
|
||||
} catch (ex) {
|
||||
// Things may go wrong when adding url to session history,
|
||||
// but don't let that interfere with the loading of the url.
|
||||
|
@ -2772,12 +2772,11 @@ function FillHistoryMenu(aParent, aMenu)
|
|||
return true;
|
||||
}
|
||||
|
||||
function addToUrlbarHistory()
|
||||
function addToUrlbarHistory(aUrlToAdd)
|
||||
{
|
||||
var urlToAdd = gURLBar.value;
|
||||
if (!urlToAdd)
|
||||
if (!aUrlToAdd)
|
||||
return;
|
||||
if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs
|
||||
if (aUrlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs
|
||||
return;
|
||||
|
||||
if (!gGlobalHistory)
|
||||
|
@ -2788,8 +2787,8 @@ function addToUrlbarHistory()
|
|||
gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Components.interfaces.nsIURIFixup);
|
||||
try {
|
||||
if (urlToAdd.indexOf(" ") == -1) {
|
||||
var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0);
|
||||
if (aUrlToAdd.indexOf(" ") == -1) {
|
||||
var fixedUpURI = gURIFixup.createFixupURI(aUrlToAdd, 0);
|
||||
gGlobalHistory.markPageAsTyped(fixedUpURI);
|
||||
}
|
||||
}
|
||||
|
@ -4917,6 +4916,13 @@ function middleMousePaste(event)
|
|||
if (!url)
|
||||
return;
|
||||
|
||||
try {
|
||||
addToUrlbarHistory(url);
|
||||
} catch (ex) {
|
||||
// Things may go wrong when adding url to session history,
|
||||
// but don't let that interfere with the loading of the url.
|
||||
}
|
||||
|
||||
openUILink(url,
|
||||
event,
|
||||
true /* ignore the fact this is a middle click */);
|
||||
|
|
Загрузка…
Ссылка в новой задаче