зеркало из https://github.com/mozilla/gecko-dev.git
Fix for 45248, r=ben
This commit is contained in:
Родитель
e38c3b84b6
Коммит
62efdcb050
|
@ -1103,7 +1103,10 @@ NS_IMETHODIMP
|
|||
nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument)
|
||||
{
|
||||
if (aOldDocument != aNewDocument) {
|
||||
mFirstHandler = nsnull;
|
||||
if (mFirstHandler) {
|
||||
mFirstHandler->MarkForDeath();
|
||||
mFirstHandler = nsnull;
|
||||
}
|
||||
|
||||
if (mNextBinding)
|
||||
mNextBinding->ChangeDocument(aOldDocument, aNewDocument);
|
||||
|
|
|
@ -376,6 +376,9 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
|
@ -493,6 +496,9 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
|
@ -606,6 +612,9 @@ nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
|||
NS_IMETHODIMP
|
||||
nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// This is a special-case optimization to make command handling fast.
|
||||
// It isn't really a part of XBL, but it helps speed things up.
|
||||
nsAutoString command;
|
||||
|
|
|
@ -92,6 +92,10 @@ public:
|
|||
|
||||
void RemoveEventHandlers();
|
||||
|
||||
void MarkForDeath() {
|
||||
if (mNextHandler) mNextHandler->MarkForDeath(); mHandlerElement = mBoundElement = nsnull;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
|
||||
inline PRBool MouseEventMatched(nsIDOMMouseEvent* aMouseEvent);
|
||||
|
|
|
@ -2183,9 +2183,6 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
|
|||
nsresult rv;
|
||||
|
||||
if (aDocument != mDocument) {
|
||||
|
||||
mListenerManager = nsnull;
|
||||
|
||||
nsCOMPtr<nsIXULDocument> rdfDoc;
|
||||
if (mDocument) {
|
||||
// Release the named reference to the script object so it can
|
||||
|
@ -2219,6 +2216,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
|
|||
}
|
||||
}
|
||||
|
||||
mListenerManager = nsnull;
|
||||
|
||||
mDocument = aDocument; // not refcounted
|
||||
|
||||
if (mBoxObject) {
|
||||
|
|
|
@ -1103,7 +1103,10 @@ NS_IMETHODIMP
|
|||
nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument)
|
||||
{
|
||||
if (aOldDocument != aNewDocument) {
|
||||
mFirstHandler = nsnull;
|
||||
if (mFirstHandler) {
|
||||
mFirstHandler->MarkForDeath();
|
||||
mFirstHandler = nsnull;
|
||||
}
|
||||
|
||||
if (mNextBinding)
|
||||
mNextBinding->ChangeDocument(aOldDocument, aNewDocument);
|
||||
|
|
|
@ -376,6 +376,9 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
|
@ -493,6 +496,9 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
|
@ -606,6 +612,9 @@ nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
|||
NS_IMETHODIMP
|
||||
nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// This is a special-case optimization to make command handling fast.
|
||||
// It isn't really a part of XBL, but it helps speed things up.
|
||||
nsAutoString command;
|
||||
|
|
|
@ -92,6 +92,10 @@ public:
|
|||
|
||||
void RemoveEventHandlers();
|
||||
|
||||
void MarkForDeath() {
|
||||
if (mNextHandler) mNextHandler->MarkForDeath(); mHandlerElement = mBoundElement = nsnull;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
|
||||
inline PRBool MouseEventMatched(nsIDOMMouseEvent* aMouseEvent);
|
||||
|
|
|
@ -2183,9 +2183,6 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
|
|||
nsresult rv;
|
||||
|
||||
if (aDocument != mDocument) {
|
||||
|
||||
mListenerManager = nsnull;
|
||||
|
||||
nsCOMPtr<nsIXULDocument> rdfDoc;
|
||||
if (mDocument) {
|
||||
// Release the named reference to the script object so it can
|
||||
|
@ -2219,6 +2216,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
|
|||
}
|
||||
}
|
||||
|
||||
mListenerManager = nsnull;
|
||||
|
||||
mDocument = aDocument; // not refcounted
|
||||
|
||||
if (mBoxObject) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче