зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1410629 - Clear user-entered search term already after location change. r=sebastian
This is to avoid a situation where after searching and then navigating to a different URL, the user can already see the new URL (after location change), but not yet edit it (currently, the search term is only dropped after pageshow). Because location change is too early for checking the documentURI for the presence of an error page in case the load failed, we switch to checking the request's status instead. We still have to explicitly check for "about:neterror" as well, though, since the way our intent handling code displays an error page in case of an unknown protocol technically counts as a successful pageload. MozReview-Commit-ID: 8e6WQlD0sf3 --HG-- extra : rebase_source : fa80f45c2bc7b87934907e0386f8c26cd998eb04
This commit is contained in:
Родитель
4747b91a36
Коммит
bba185434e
|
@ -4124,7 +4124,6 @@ Tab.prototype = {
|
|||
metadata: this.metatags,
|
||||
});
|
||||
|
||||
// Reset isSearch so that the userRequested term will be erased on next page load
|
||||
this.metatags = null;
|
||||
|
||||
if (docURI.startsWith("about:certerror") || docURI.startsWith("about:blocked")) {
|
||||
|
@ -4318,13 +4317,6 @@ Tab.prototype = {
|
|||
if (aEvent.originalTarget.defaultView != this.browser.contentWindow)
|
||||
return;
|
||||
|
||||
let target = aEvent.originalTarget;
|
||||
let docURI = target.documentURI;
|
||||
if (!docURI.startsWith("about:neterror") && !this.isSearch) {
|
||||
// If this wasn't an error page and the user isn't search, don't retain the typed entry
|
||||
this.userRequested = "";
|
||||
}
|
||||
|
||||
GlobalEventDispatcher.sendRequest({
|
||||
type: "Content:PageShow",
|
||||
tabID: this.id,
|
||||
|
@ -4332,8 +4324,6 @@ Tab.prototype = {
|
|||
fromCache: Tabs.useCache
|
||||
});
|
||||
|
||||
this.isSearch = false;
|
||||
|
||||
if (!aEvent.persisted && Services.prefs.getBoolPref("browser.ui.linkify.phone")) {
|
||||
if (!this._linkifier)
|
||||
this._linkifier = new Linkifier();
|
||||
|
@ -4502,6 +4492,13 @@ Tab.prototype = {
|
|||
ExternalApps.updatePageActionUri(fixedURI);
|
||||
}
|
||||
|
||||
if (Components.isSuccessCode(aRequest.status) &&
|
||||
!fixedURI.displaySpec.startsWith("about:neterror") && !this.isSearch) {
|
||||
// If this won't end up in an error page and the user isn't searching,
|
||||
// don't retain the typed entry.
|
||||
this.userRequested = "";
|
||||
}
|
||||
|
||||
let message = {
|
||||
type: "Content:LocationChange",
|
||||
tabID: this.id,
|
||||
|
@ -4519,6 +4516,9 @@ Tab.prototype = {
|
|||
|
||||
notifyManifestStatus(this);
|
||||
|
||||
// Reset isSearch so that the userRequested term will be erased on next location change.
|
||||
this.isSearch = false;
|
||||
|
||||
if (!sameDocument) {
|
||||
// XXX This code assumes that this is the earliest hook we have at which
|
||||
// browser.contentDocument is changed to the new document we're loading
|
||||
|
|
Загрузка…
Ссылка в новой задаче