diff --git a/webshell/tests/viewer/nsXPBaseWindow.cpp b/webshell/tests/viewer/nsXPBaseWindow.cpp index d0ab9fa99fd1..9e3ffeef1c4d 100644 --- a/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -465,6 +465,8 @@ NS_IMETHODIMP nsXPBaseWindow::AddEventListener(nsIDOMNode * aNode) { nsIDOMEventReceiver * receiver; + NS_PRECONDITION(nsnull != aNode, "adding event listener to null node"); + if (NS_OK == aNode->QueryInterface(kIDOMEventReceiverIID, (void**) &receiver)) { receiver->AddEventListener((nsIDOMMouseListener*)this, kIDOMMouseListenerIID); NS_RELEASE(receiver); @@ -478,6 +480,8 @@ NS_IMETHODIMP nsXPBaseWindow::RemoveEventListener(nsIDOMNode * aNode) { nsIDOMEventReceiver * receiver; + NS_PRECONDITION(nsnull != aNode, "removing event listener from null node"); + if (NS_OK == aNode->QueryInterface(kIDOMEventReceiverIID, (void**) &receiver)) { receiver->RemoveEventListener(this, kIDOMMouseListenerIID); NS_RELEASE(receiver);