mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 496317 - Remove nsPopupBlockedEvent, r+sr=sicking
--HG-- extra : rebase_source : 354385de35d48a6f2c911c20175b1715c89c9196
This commit is contained in:
parent
b40171b242
commit
c1e420fdbe
@ -88,7 +88,7 @@ NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresCon
|
|||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsPopupBlockedEvent* aEvent);
|
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMTextEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsTextEvent* aEvent);
|
NS_NewDOMTextEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsTextEvent* aEvent);
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -943,12 +943,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
|||||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_POPUPBLOCKED_EVENT:
|
|
||||||
{
|
|
||||||
NS_WARNING("nsPopupBlockedEvent should never be an external event!");
|
|
||||||
newEvent = new nsPopupBlockedEvent(PR_FALSE, msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NS_BEFORE_PAGE_UNLOAD_EVENT:
|
case NS_BEFORE_PAGE_UNLOAD_EVENT:
|
||||||
{
|
{
|
||||||
newEvent = new nsBeforePageUnloadEvent(PR_FALSE, msg);
|
newEvent = new nsBeforePageUnloadEvent(PR_FALSE, msg);
|
||||||
|
@ -41,35 +41,6 @@
|
|||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
nsDOMPopupBlockedEvent::nsDOMPopupBlockedEvent(nsPresContext* aPresContext,
|
|
||||||
nsPopupBlockedEvent* aEvent)
|
|
||||||
: nsDOMEvent(aPresContext, aEvent ? aEvent :
|
|
||||||
new nsPopupBlockedEvent(PR_FALSE, 0))
|
|
||||||
{
|
|
||||||
NS_ASSERTION(mEvent->eventStructType == NS_POPUPBLOCKED_EVENT, "event type mismatch");
|
|
||||||
|
|
||||||
if (aEvent) {
|
|
||||||
mEventIsInternal = PR_FALSE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mEventIsInternal = PR_TRUE;
|
|
||||||
mEvent->time = PR_Now();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDOMPopupBlockedEvent::~nsDOMPopupBlockedEvent()
|
|
||||||
{
|
|
||||||
if (mEventIsInternal) {
|
|
||||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
|
||||||
NS_IF_RELEASE(event->mPopupWindowURI);
|
|
||||||
|
|
||||||
delete event;
|
|
||||||
mEvent = nsnull;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
NS_IMPL_ADDREF_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
NS_IMPL_RELEASE_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
||||||
|
|
||||||
@ -89,22 +60,10 @@ nsDOMPopupBlockedEvent::InitPopupBlockedEvent(const nsAString & aTypeArg,
|
|||||||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
|
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
switch (mEvent->eventStructType)
|
mRequestingWindow = do_GetWeakReference(aRequestingWindow);
|
||||||
{
|
mPopupWindowURI = aPopupWindowURI;
|
||||||
case NS_POPUPBLOCKED_EVENT:
|
mPopupWindowFeatures = aPopupWindowFeatures;
|
||||||
{
|
mPopupWindowName = aPopupWindowName;
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
|
||||||
event->mRequestingWindow = do_GetWeakReference(aRequestingWindow);
|
|
||||||
event->mPopupWindowURI = aPopupWindowURI;
|
|
||||||
NS_IF_ADDREF(event->mPopupWindowURI);
|
|
||||||
event->mPopupWindowFeatures = aPopupWindowFeatures;
|
|
||||||
event->mPopupWindowName = aPopupWindowName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,12 +71,8 @@ NS_IMETHODIMP
|
|||||||
nsDOMPopupBlockedEvent::GetRequestingWindow(nsIDOMWindow **aRequestingWindow)
|
nsDOMPopupBlockedEvent::GetRequestingWindow(nsIDOMWindow **aRequestingWindow)
|
||||||
{
|
{
|
||||||
*aRequestingWindow = nsnull;
|
*aRequestingWindow = nsnull;
|
||||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
if (mRequestingWindow)
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
CallQueryReferent(mRequestingWindow.get(), aRequestingWindow);
|
||||||
if (event->mRequestingWindow) {
|
|
||||||
CallQueryReferent(event->mRequestingWindow.get(), aRequestingWindow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK; // Don't throw an exception
|
return NS_OK; // Don't throw an exception
|
||||||
}
|
}
|
||||||
@ -126,43 +81,30 @@ NS_IMETHODIMP
|
|||||||
nsDOMPopupBlockedEvent::GetPopupWindowURI(nsIURI **aPopupWindowURI)
|
nsDOMPopupBlockedEvent::GetPopupWindowURI(nsIURI **aPopupWindowURI)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPopupWindowURI);
|
NS_ENSURE_ARG_POINTER(aPopupWindowURI);
|
||||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
*aPopupWindowURI = mPopupWindowURI;
|
||||||
*aPopupWindowURI = event->mPopupWindowURI;
|
NS_IF_ADDREF(*aPopupWindowURI);
|
||||||
NS_IF_ADDREF(*aPopupWindowURI);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
*aPopupWindowURI = 0;
|
|
||||||
return NS_OK; // Don't throw an exception
|
return NS_OK; // Don't throw an exception
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMPopupBlockedEvent::GetPopupWindowFeatures(nsAString &aPopupWindowFeatures)
|
nsDOMPopupBlockedEvent::GetPopupWindowFeatures(nsAString &aPopupWindowFeatures)
|
||||||
{
|
{
|
||||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
aPopupWindowFeatures = mPopupWindowFeatures;
|
||||||
aPopupWindowFeatures = event->mPopupWindowFeatures;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
aPopupWindowFeatures.Truncate();
|
|
||||||
return NS_OK; // Don't throw an exception
|
return NS_OK; // Don't throw an exception
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMPopupBlockedEvent::GetPopupWindowName(nsAString &aPopupWindowName)
|
nsDOMPopupBlockedEvent::GetPopupWindowName(nsAString &aPopupWindowName)
|
||||||
{
|
{
|
||||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
aPopupWindowName = mPopupWindowName;
|
||||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
|
||||||
aPopupWindowName = event->mPopupWindowName;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
aPopupWindowName.Truncate();
|
|
||||||
return NS_OK; // Don't throw an exception
|
return NS_OK; // Don't throw an exception
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aInstancePtrResult,
|
nsresult NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsPopupBlockedEvent *aEvent)
|
nsEvent *aEvent)
|
||||||
{
|
{
|
||||||
nsDOMPopupBlockedEvent* it = new nsDOMPopupBlockedEvent(aPresContext, aEvent);
|
nsDOMPopupBlockedEvent* it = new nsDOMPopupBlockedEvent(aPresContext, aEvent);
|
||||||
if (nsnull == it) {
|
if (nsnull == it) {
|
||||||
|
@ -41,14 +41,15 @@
|
|||||||
|
|
||||||
#include "nsIDOMPopupBlockedEvent.h"
|
#include "nsIDOMPopupBlockedEvent.h"
|
||||||
#include "nsDOMEvent.h"
|
#include "nsDOMEvent.h"
|
||||||
|
#include "nsIURI.h"
|
||||||
|
|
||||||
class nsDOMPopupBlockedEvent : public nsIDOMPopupBlockedEvent,
|
class nsDOMPopupBlockedEvent : public nsIDOMPopupBlockedEvent,
|
||||||
public nsDOMEvent
|
public nsDOMEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
nsDOMPopupBlockedEvent(nsPresContext* aPresContext, nsPopupBlockedEvent* aEvent);
|
nsDOMPopupBlockedEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||||
virtual ~nsDOMPopupBlockedEvent();
|
: nsDOMEvent(aPresContext, aEvent) {}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
@ -57,6 +58,11 @@ public:
|
|||||||
|
|
||||||
// nsIDOMPopupBlockedEvent Interface
|
// nsIDOMPopupBlockedEvent Interface
|
||||||
NS_DECL_NSIDOMPOPUPBLOCKEDEVENT
|
NS_DECL_NSIDOMPOPUPBLOCKEDEVENT
|
||||||
|
protected:
|
||||||
|
nsWeakPtr mRequestingWindow;
|
||||||
|
nsCOMPtr<nsIURI> mPopupWindowURI;
|
||||||
|
nsString mPopupWindowFeatures;
|
||||||
|
nsString mPopupWindowName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsDOMPopupBlockedEvent_h__
|
#endif // nsDOMPopupBlockedEvent_h__
|
||||||
|
@ -640,10 +640,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||||||
case NS_DRAG_EVENT:
|
case NS_DRAG_EVENT:
|
||||||
return NS_NewDOMDragEvent(aDOMEvent, aPresContext,
|
return NS_NewDOMDragEvent(aDOMEvent, aPresContext,
|
||||||
static_cast<nsDragEvent*>(aEvent));
|
static_cast<nsDragEvent*>(aEvent));
|
||||||
case NS_POPUPBLOCKED_EVENT:
|
|
||||||
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext,
|
|
||||||
static_cast<nsPopupBlockedEvent*>
|
|
||||||
(aEvent));
|
|
||||||
case NS_TEXT_EVENT:
|
case NS_TEXT_EVENT:
|
||||||
return NS_NewDOMTextEvent(aDOMEvent, aPresContext,
|
return NS_NewDOMTextEvent(aDOMEvent, aPresContext,
|
||||||
static_cast<nsTextEvent*>(aEvent));
|
static_cast<nsTextEvent*>(aEvent));
|
||||||
|
@ -89,7 +89,7 @@ class nsHashKey;
|
|||||||
#define NS_FORM_EVENT 21
|
#define NS_FORM_EVENT 21
|
||||||
#define NS_POPUP_EVENT 23
|
#define NS_POPUP_EVENT 23
|
||||||
#define NS_COMMAND_EVENT 24
|
#define NS_COMMAND_EVENT 24
|
||||||
#define NS_POPUPBLOCKED_EVENT 25
|
|
||||||
#define NS_BEFORE_PAGE_UNLOAD_EVENT 26
|
#define NS_BEFORE_PAGE_UNLOAD_EVENT 26
|
||||||
#define NS_UI_EVENT 27
|
#define NS_UI_EVENT 27
|
||||||
#define NS_PAGETRANSITION_EVENT 29
|
#define NS_PAGETRANSITION_EVENT 29
|
||||||
@ -1205,24 +1205,6 @@ public:
|
|||||||
nsCOMPtr<nsIAtom> command;
|
nsCOMPtr<nsIAtom> command;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* blocked popup window event
|
|
||||||
*/
|
|
||||||
class nsPopupBlockedEvent : public nsEvent
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsPopupBlockedEvent(PRBool isTrusted, PRUint32 msg)
|
|
||||||
: nsEvent(isTrusted, msg, NS_POPUPBLOCKED_EVENT),
|
|
||||||
mPopupWindowURI(nsnull)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsWeakPtr mRequestingWindow;
|
|
||||||
nsIURI* mPopupWindowURI; // owning reference
|
|
||||||
nsString mPopupWindowFeatures;
|
|
||||||
nsString mPopupWindowName;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOM UIEvent
|
* DOM UIEvent
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user