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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user