Fixing nsbeta2+ bugs 17351 and 33018, doing document.write(...) on a document in a newly opened window wasn't working properly, the written HTML was replaced by the URL given to window.open(), the fix is to cancel ongoing loads for the new window before starting to write to it. r=vidur

This commit is contained in:
jst@netscape.com
2000-06-08 22:51:06 +00:00
parent 605cc8573c
commit b44f45a235
2 changed files with 30 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
#include "nsIWebShell.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebNavigation.h"
#include "nsIBaseWindow.h"
#include "nsIWebShellServices.h"
#include "nsIDocumentLoader.h"
@@ -1869,6 +1870,20 @@ nsresult
nsHTMLDocument::OpenCommon(nsIURI* aSourceURL)
{
nsresult result = NS_OK;
// Stop current loads targetted at the window this document is in.
if (mScriptGlobalObject) {
nsCOMPtr<nsIDocShell> docshell;
mScriptGlobalObject->GetDocShell(getter_AddRefs(docshell));
if (docshell) {
nsCOMPtr<nsIWebNavigation> wn(do_QueryInterface(docshell));
if(wn) {
wn->Stop();
}
}
}
// The open occurred after the document finished loading.
// So we reset the document and create a new one.
if (nsnull == mParser) {