зеркало из https://github.com/mozilla/pjs.git
Fix bug 42895 (nsbeta2+), a huge leak whenever a text input receieves an event, by propogating SetDocument(null,...) calls to the anonymous content in ender-lite widgets so that script objects for that content are unrooted. r=hyatt, mjudge
This commit is contained in:
Родитель
ae155355ca
Коммит
fe84ff14d9
|
@ -53,6 +53,7 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIEditor.h"
|
||||
|
||||
#include "nsIPresState.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
@ -291,6 +292,31 @@ nsHTMLInputElement::SetParent(nsIContent* aParent)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers)
|
||||
{
|
||||
#ifdef ENDER_LITE
|
||||
// We must tell the anonymous content to remove roots holding their
|
||||
// JS Objects
|
||||
// XXX This is somewhat ugly, and could go away if the anonymous
|
||||
// content creation is done in XBL.
|
||||
if (!aDocument && aDeep) {
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);
|
||||
if (NS_SUCCEEDED(rv) && formControlFrame) {
|
||||
nsCOMPtr<textControlPlace> textControlFrame(do_QueryInterface(formControlFrame));
|
||||
if (textControlFrame) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
textControlFrame->GetEditor(getter_AddRefs(editor));
|
||||
if (editor) {
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
editor->GetRootElement(getter_AddRefs(root));
|
||||
if (root) {
|
||||
nsCOMPtr<nsIContent> rootContent( do_QueryInterface(root) );
|
||||
rootContent->SetDocument(nsnull, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return mInner.SetDocumentForFormControls(aDocument, aDeep, aCompileEventHandlers, this, mForm);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIEditor.h"
|
||||
|
||||
#include "nsIPresState.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
@ -291,6 +292,31 @@ nsHTMLInputElement::SetParent(nsIContent* aParent)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers)
|
||||
{
|
||||
#ifdef ENDER_LITE
|
||||
// We must tell the anonymous content to remove roots holding their
|
||||
// JS Objects
|
||||
// XXX This is somewhat ugly, and could go away if the anonymous
|
||||
// content creation is done in XBL.
|
||||
if (!aDocument && aDeep) {
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);
|
||||
if (NS_SUCCEEDED(rv) && formControlFrame) {
|
||||
nsCOMPtr<textControlPlace> textControlFrame(do_QueryInterface(formControlFrame));
|
||||
if (textControlFrame) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
textControlFrame->GetEditor(getter_AddRefs(editor));
|
||||
if (editor) {
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
editor->GetRootElement(getter_AddRefs(root));
|
||||
if (root) {
|
||||
nsCOMPtr<nsIContent> rootContent( do_QueryInterface(root) );
|
||||
rootContent->SetDocument(nsnull, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return mInner.SetDocumentForFormControls(aDocument, aDeep, aCompileEventHandlers, this, mForm);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче