summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2018-04-28 14:41:28 +0300
committerJustOff <Off.Just.Off@gmail.com>2018-04-28 14:41:28 +0300
commitfd10ee105af74c5559c0021c2ada0997e943ac87 (patch)
treec59a9fdd7b5e4443584c6c68e108308c73fd2935 /application
parent46a069ec79c9342dc1bb1c2f1b450dad412aeb3f (diff)
downloadUXP-fd10ee105af74c5559c0021c2ada0997e943ac87.tar
UXP-fd10ee105af74c5559c0021c2ada0997e943ac87.tar.gz
UXP-fd10ee105af74c5559c0021c2ada0997e943ac87.tar.lz
UXP-fd10ee105af74c5559c0021c2ada0997e943ac87.tar.xz
UXP-fd10ee105af74c5559c0021c2ada0997e943ac87.zip
Use `urlbarChangeTracker` instead of `userTypedClear` to track address bar changes
Diffstat (limited to 'application')
-rw-r--r--application/palemoon/base/content/tabbrowser.xml41
-rw-r--r--application/palemoon/components/sessionstore/SessionStore.jsm8
2 files changed, 20 insertions, 29 deletions
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index a7cc6deea..48a853993 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -570,6 +570,12 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
+ let location, originalLocation;
+ try {
+ aRequest.QueryInterface(nsIChannel)
+ location = aRequest.URI;
+ originalLocation = aRequest.originalURI;
+ } catch (ex) {}
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.mRequestCount++;
@@ -588,16 +594,8 @@
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
- // It's okay to clear what the user typed when we start
- // loading a document. If the user types, this counter gets
- // set to zero, if the document load ends without an
- // onLocationChange, this counter gets decremented
- // (so we keep it while switching tabs after failed loads)
- // We need to add 2 because loadURIWithFlags may have
- // cancelled a pending load which would have cleared
- // its anchor scroll detection temporary increment.
if (aWebProgress.isTopLevel)
- this.mBrowser.userTypedClear += 2;
+ this.mBrowser.urlbarChangeTracker.startedLoad();
if (this._shouldShowProgress(aRequest)) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
@@ -625,8 +623,8 @@
this.mTab.removeAttribute("progress");
if (aWebProgress.isTopLevel) {
- if (!Components.isSuccessCode(aStatus) &&
- !isTabEmpty(this.mTab)) {
+ let isSuccessful = Components.isSuccessCode(aStatus);
+ if (!isSuccessful && !isTabEmpty(this.mTab)) {
// Restore the current document's location in case the
// request was stopped (possibly from a content script)
// before the location changed.
@@ -635,14 +633,8 @@
if (this.mTab.selected && gURLBar)
URLBarSetURI();
- } else {
- // The document is done loading, we no longer want the
- // value cleared.
-
- if (this.mBrowser.userTypedClear > 1)
- this.mBrowser.userTypedClear -= 2;
- else if (this.mBrowser.userTypedClear > 0)
- this.mBrowser.userTypedClear--;
+ } else if (isSuccessful) {
+ this.mBrowser.urlbarChangeTracker.finishedLoad();
}
if (!this.mBrowser.mIconURL)
@@ -652,8 +644,6 @@
if (this.mBlank)
this.mBlank = false;
- var location = aRequest.QueryInterface(nsIChannel).URI;
-
// For keyword URIs clear the user typed value since they will be changed into real URIs
if (location.scheme == "keyword")
this.mBrowser.userTypedValue = null;
@@ -696,13 +686,12 @@
let topLevel = aWebProgress.isTopLevel;
if (topLevel) {
- // If userTypedClear > 0, the document loaded correctly and we should be
- // clearing the user typed value. We also need to clear the typed value
+ // We need to clear the typed value
// if the document failed to load, to make sure the urlbar reflects the
// failed URI (particularly for SSL errors). However, don't clear the value
// if the error page's URI is about:blank, because that causes complete
// loss of urlbar contents for invalid URI errors (see bug 867957).
- if (this.mBrowser.userTypedClear > 0 ||
+ if (this.mBrowser.didStartLoadSinceLastUserTyping() ||
((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
aLocation.spec != "about:blank"))
this.mBrowser.userTypedValue = null;
@@ -2976,10 +2965,6 @@
]]></body>
</method>
- <property name="userTypedClear"
- onget="return this.mCurrentBrowser.userTypedClear;"
- onset="return this.mCurrentBrowser.userTypedClear = val;"/>
-
<property name="userTypedValue"
onget="return this.mCurrentBrowser.userTypedValue;"
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
diff --git a/application/palemoon/components/sessionstore/SessionStore.jsm b/application/palemoon/components/sessionstore/SessionStore.jsm
index f7c495be8..b8d126e21 100644
--- a/application/palemoon/components/sessionstore/SessionStore.jsm
+++ b/application/palemoon/components/sessionstore/SessionStore.jsm
@@ -1951,7 +1951,13 @@ var SessionStoreInternal = {
// userTypedValue.
if (browser.userTypedValue) {
tabData.userTypedValue = browser.userTypedValue;
- tabData.userTypedClear = browser.userTypedClear;
+ // We always used to keep track of the loading state as an integer, where
+ // '0' indicated the user had typed since the last load (or no load was
+ // ongoing), and any positive value indicated we had started a load since
+ // the last time the user typed in the URL bar. Mimic this to keep the
+ // session store representation in sync, even though we now represent this
+ // more explicitly:
+ tabData.userTypedClear = browser.didStartLoadSinceLastUserTyping() ? 1 : 0;
} else {
delete tabData.userTypedValue;
delete tabData.userTypedClear;