зеркало из https://github.com/mozilla/pjs.git
Fixing the second part of bug 11213. Don't call nsIScriptGlobalObject::SetNewDocument() after leaving print-preview since that well clear the JS scope and cancel all timers that might have queued up while in print-preview mode. Patch by rods@netscape.com, r=peterv@netscape.com, sr=jst@netscape.com
This commit is contained in:
Родитель
d355dd941a
Коммит
b8f238c153
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 0 -*- */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
|
@ -1008,22 +1008,27 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget,
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
mPresContext->SetLinkHandler(linkHandler);
|
||||||
|
|
||||||
|
if (!mIsDoingPrintPreview) {
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
nsCOMPtr<nsIScriptGlobalObjectOwner> owner;
|
nsCOMPtr<nsIScriptGlobalObjectOwner> owner;
|
||||||
requestor->GetInterface(NS_GET_IID(nsIScriptGlobalObjectOwner),
|
requestor->GetInterface(NS_GET_IID(nsIScriptGlobalObjectOwner),
|
||||||
getter_AddRefs(owner));
|
getter_AddRefs(owner));
|
||||||
if (nsnull != owner) {
|
|
||||||
|
if (owner) {
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
|
||||||
|
if (global) {
|
||||||
mDocument->SetScriptGlobalObject(global);
|
mDocument->SetScriptGlobalObject(global);
|
||||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||||
if (nsnull != domdoc) {
|
|
||||||
|
if (domdoc) {
|
||||||
global->SetNewDocument(domdoc, PR_TRUE);
|
global->SetNewDocument(domdoc, PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the ViewManager and Root View...
|
// Create the ViewManager and Root View...
|
||||||
rv = MakeWindow(aParentWidget, aBounds);
|
rv = MakeWindow(aParentWidget, aBounds);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 0 -*- */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
|
@ -1008,22 +1008,27 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget,
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
mPresContext->SetLinkHandler(linkHandler);
|
||||||
|
|
||||||
|
if (!mIsDoingPrintPreview) {
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
nsCOMPtr<nsIScriptGlobalObjectOwner> owner;
|
nsCOMPtr<nsIScriptGlobalObjectOwner> owner;
|
||||||
requestor->GetInterface(NS_GET_IID(nsIScriptGlobalObjectOwner),
|
requestor->GetInterface(NS_GET_IID(nsIScriptGlobalObjectOwner),
|
||||||
getter_AddRefs(owner));
|
getter_AddRefs(owner));
|
||||||
if (nsnull != owner) {
|
|
||||||
|
if (owner) {
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
|
||||||
|
if (global) {
|
||||||
mDocument->SetScriptGlobalObject(global);
|
mDocument->SetScriptGlobalObject(global);
|
||||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||||
if (nsnull != domdoc) {
|
|
||||||
|
if (domdoc) {
|
||||||
global->SetNewDocument(domdoc, PR_TRUE);
|
global->SetNewDocument(domdoc, PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the ViewManager and Root View...
|
// Create the ViewManager and Root View...
|
||||||
rv = MakeWindow(aParentWidget, aBounds);
|
rv = MakeWindow(aParentWidget, aBounds);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче