From 2b5dd1db41188dad2ae5dbd228bb57463229752d Mon Sep 17 00:00:00 2001
From: "rpotts%netscape.com" <rpotts%netscape.com>
Date: Mon, 19 Oct 1998 20:41:50 +0000
Subject: [PATCH] Move the call to stop before firing the BeginLoadURL
 notification...  This will keep the BeginLoad/EndLoad notifications paired
 correctly...

---
 docshell/base/nsWebShell.cpp | 13 ++++++++-----
 webshell/src/nsWebShell.cpp  | 13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp
index 83f2b3109ce6..593c7e0bd9d6 100644
--- a/docshell/base/nsWebShell.cpp
+++ b/docshell/base/nsWebShell.cpp
@@ -1083,6 +1083,10 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
   }
   ShowHistory();
 
+  // Stop loading the current document (if any...).  This call may result in
+  // firing an EndLoadURL notification for the old document...
+  Stop();
+
   // Tell web-shell-container we are loading a new url
   if (nsnull != mContainer) {
     rv = mContainer->BeginLoadURL(this, urlSpec);
@@ -1091,8 +1095,6 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
     }
   }
 
-  Stop();
-
   rv = mDocLoader->LoadDocument(urlSpec,       // URL string
                                 nsnull,         // Command
                                 this,           // Container
@@ -1185,6 +1187,10 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
     mHistoryIndex = aHistoryIndex;
     ShowHistory();
 
+    // Stop loading the current document (if any...).  This call may result in
+    // firing an EndLoadURL notification for the old document...
+    Stop();
+
     // Tell web-shell-container we are loading a new url
     if (nsnull != mContainer) {
       rv = mContainer->BeginLoadURL(this, urlSpec);
@@ -1193,9 +1199,6 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
       }
     }
 
-    // Stop any documents that are currently being loaded...
-    mDocLoader->Stop();
-
     rv = mDocLoader->LoadDocument(urlSpec,        // URL string
                                   nsnull,         // Command
                                   this,           // Container
diff --git a/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp
index 83f2b3109ce6..593c7e0bd9d6 100644
--- a/webshell/src/nsWebShell.cpp
+++ b/webshell/src/nsWebShell.cpp
@@ -1083,6 +1083,10 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
   }
   ShowHistory();
 
+  // Stop loading the current document (if any...).  This call may result in
+  // firing an EndLoadURL notification for the old document...
+  Stop();
+
   // Tell web-shell-container we are loading a new url
   if (nsnull != mContainer) {
     rv = mContainer->BeginLoadURL(this, urlSpec);
@@ -1091,8 +1095,6 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
     }
   }
 
-  Stop();
-
   rv = mDocLoader->LoadDocument(urlSpec,       // URL string
                                 nsnull,         // Command
                                 this,           // Container
@@ -1185,6 +1187,10 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
     mHistoryIndex = aHistoryIndex;
     ShowHistory();
 
+    // Stop loading the current document (if any...).  This call may result in
+    // firing an EndLoadURL notification for the old document...
+    Stop();
+
     // Tell web-shell-container we are loading a new url
     if (nsnull != mContainer) {
       rv = mContainer->BeginLoadURL(this, urlSpec);
@@ -1193,9 +1199,6 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
       }
     }
 
-    // Stop any documents that are currently being loaded...
-    mDocLoader->Stop();
-
     rv = mDocLoader->LoadDocument(urlSpec,        // URL string
                                   nsnull,         // Command
                                   this,           // Container