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
Родитель f4304457ae
Коммит e224fead11
2 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {