Bug 790305 - Don't add history entries for redirects or error pages. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Wed, 24 Oct 2012 09:04:44 -0700
changeset 111261 8c8c0b8e97f8cb65ecc0ede8bca5038a2743f7e2
parent 111260 5da9c2f970b0970a4a68e3183838dc115e72f48e
child 111262 161dd84a24fc53105aae2a707cd952946d0704f6
push id23738
push userryanvm@gmail.com
push dateThu, 25 Oct 2012 01:50:40 +0000
treeherdermozilla-central@3fb7c935a625 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs790305
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 790305 - Don't add history entries for redirects or error pages. r=mfinkle
mobile/android/base/Tab.java
toolkit/components/places/nsAndroidHistory.cpp
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -232,17 +232,16 @@ public class Tab {
         return mExternal;
     }
 
     public synchronized void updateURL(String url) {
         if (url != null && url.length() > 0) {
             mUrl = url;
             Log.d(LOGTAG, "Updated URL for tab with id: " + mId);
             updateBookmark();
-            updateHistory(mUrl, mTitle);
         }
     }
 
     public void setDocumentURI(String documentURI) {
         mDocumentURI = documentURI;
     }
 
     public String getDocumentURI() {
@@ -291,17 +290,17 @@ public class Tab {
         });
     }
 
     public void setState(int state) {
         mState = state;
 
         if (mState != Tab.STATE_LOADING)
             mEnteringReaderMode = false;
-        }
+    }
 
     public int getState() {
         return mState;
     }
 
     public void setZoomConstraints(ZoomConstraints constraints) {
         mZoomConstraints = constraints;
     }
@@ -494,17 +493,16 @@ public class Tab {
         return true;
     }
 
     void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
         if (event.equals("New")) {
             final String url = message.getString("url");
             mHistoryIndex++;
             mHistorySize = mHistoryIndex + 1;
-            addHistory(url);
         } else if (event.equals("Back")) {
             if (!canDoBack()) {
                 Log.e(LOGTAG, "Received unexpected back notification");
                 return;
             }
             mHistoryIndex--;
         } else if (event.equals("Forward")) {
             if (!canDoForward()) {
--- a/toolkit/components/places/nsAndroidHistory.cpp
+++ b/toolkit/components/places/nsAndroidHistory.cpp
@@ -84,16 +84,22 @@ NS_IMETHODIMP
 nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlags)
 {
   if (!aURI)
     return NS_OK;
 
   if (!(aFlags & VisitFlags::TOP_LEVEL))
     return NS_OK;
 
+  if (aFlags & VisitFlags::REDIRECT_SOURCE)
+    return NS_OK;
+
+  if (aFlags & VisitFlags::UNRECOVERABLE_ERROR)
+    return NS_OK;
+
   AndroidBridge *bridge = AndroidBridge::Bridge();
   if (bridge) {
     nsAutoCString uri;
     nsresult rv = aURI->GetSpec(uri);
     if (NS_FAILED(rv)) return rv;
     NS_ConvertUTF8toUTF16 uriString(uri);
     bridge->MarkURIVisited(uriString);
   }