зеркало из https://github.com/mozilla/pjs.git
Bug 18553, better fix which should cause fewer problems. Clear event listeners
before every document load, including the first, except when setNewDocument is called from document.open. r=heikki, sr=jst
This commit is contained in:
Родитель
0b534c4eae
Коммит
fa4e5530e9
|
@ -950,7 +950,7 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget,
|
|||
mDocument->SetScriptGlobalObject(global);
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||
if (nsnull != domdoc) {
|
||||
global->SetNewDocument(domdoc);
|
||||
global->SetNewDocument(domdoc, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ DocumentViewerImpl::Close()
|
|||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
if (globalObject) {
|
||||
globalObject->SetNewDocument(nsnull);
|
||||
globalObject->SetNewDocument(nsnull, PR_TRUE);
|
||||
}
|
||||
// out of band cleanup of webshell
|
||||
mDocument->SetScriptGlobalObject(nsnull);
|
||||
|
@ -1286,7 +1286,7 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
|
|||
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
||||
mDocument->SetScriptGlobalObject(global);
|
||||
global->SetNewDocument(aDocument);
|
||||
global->SetNewDocument(aDocument, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2105,7 +2105,7 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL)
|
|||
nsCOMPtr<nsIDOMDocument> kungFuDeathGrip =
|
||||
do_QueryInterface((nsIHTMLDocument*)this);
|
||||
|
||||
result = mScriptGlobalObject->SetNewDocument(kungFuDeathGrip);
|
||||
result = mScriptGlobalObject->SetNewDocument(kungFuDeathGrip, PR_FALSE);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
|
|
@ -116,7 +116,8 @@ public:
|
|||
// nsIScriptGlobalObject methods
|
||||
NS_IMETHOD SetContext(nsIScriptContext *aContext);
|
||||
NS_IMETHOD GetContext(nsIScriptContext **aContext);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners);
|
||||
NS_IMETHOD SetDocShell(nsIDocShell *aDocShell);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell);
|
||||
NS_IMETHOD SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
|
@ -238,7 +239,8 @@ nsXBLDocGlobalObject::GetContext(nsIScriptContext **aContext)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLDocGlobalObject::SetNewDocument(nsIDOMDocument *aDocument)
|
||||
nsXBLDocGlobalObject::SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -84,7 +84,8 @@ public:
|
|||
// nsIScriptGlobalObject methods
|
||||
NS_IMETHOD SetContext(nsIScriptContext *aContext);
|
||||
NS_IMETHOD GetContext(nsIScriptContext **aContext);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners);
|
||||
NS_IMETHOD SetDocShell(nsIDocShell *aDocShell);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell);
|
||||
NS_IMETHOD SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
|
@ -636,7 +637,8 @@ nsXULPDGlobalObject::GetContext(nsIScriptContext **aContext)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPDGlobalObject::SetNewDocument(nsIDOMDocument *aDocument)
|
||||
nsXULPDGlobalObject::SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -66,7 +66,8 @@ public:
|
|||
|
||||
NS_IMETHOD SetContext(nsIScriptContext *aContext)=0;
|
||||
NS_IMETHOD GetContext(nsIScriptContext **aContext)=0;
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument)=0;
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners)=0;
|
||||
NS_IMETHOD SetDocShell(nsIDocShell *aDocShell)=0;
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell)=0;
|
||||
NS_IMETHOD SetOpenerWindow(nsIDOMWindowInternal *aOpener)=0;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
JSURLLoadBlockedWarning=Attempt to load a javascript: URL from one host\nin a window displaying content from another host\nwas blocked by the security manager.
|
|
@ -288,7 +288,8 @@ NS_IMETHODIMP GlobalWindowImpl::GetContext(nsIScriptContext ** aContext)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument)
|
||||
NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument,
|
||||
PRBool removeEventListeners)
|
||||
{
|
||||
if (!aDocument) {
|
||||
if (mDocument) {
|
||||
|
@ -376,7 +377,7 @@ NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument)
|
|||
doc = nsnull; // Forces release now
|
||||
}
|
||||
|
||||
if (mListenerManager) {
|
||||
if (removeEventListeners && mListenerManager) {
|
||||
mListenerManager->RemoveAllListeners(PR_FALSE);
|
||||
mListenerManager = nsnull;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,8 @@ public:
|
|||
// nsIScriptGlobalObject
|
||||
NS_IMETHOD SetContext(nsIScriptContext *aContext);
|
||||
NS_IMETHOD GetContext(nsIScriptContext **aContext);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD SetNewDocument(nsIDOMDocument *aDocument,
|
||||
PRBool removeEventListeners);
|
||||
NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
||||
NS_IMETHOD SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
|
|
|
@ -950,7 +950,7 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget,
|
|||
mDocument->SetScriptGlobalObject(global);
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||
if (nsnull != domdoc) {
|
||||
global->SetNewDocument(domdoc);
|
||||
global->SetNewDocument(domdoc, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ DocumentViewerImpl::Close()
|
|||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
if (globalObject) {
|
||||
globalObject->SetNewDocument(nsnull);
|
||||
globalObject->SetNewDocument(nsnull, PR_TRUE);
|
||||
}
|
||||
// out of band cleanup of webshell
|
||||
mDocument->SetScriptGlobalObject(nsnull);
|
||||
|
@ -1286,7 +1286,7 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
|
|||
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
||||
mDocument->SetScriptGlobalObject(global);
|
||||
global->SetNewDocument(aDocument);
|
||||
global->SetNewDocument(aDocument, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче