Bug 1455052 part 9. Stop using nsIDOMEvent in DataTransferItem. r=masayuki

I couldn't figure out a way to do this without giving Event an IID....

MozReview-Commit-ID: LdXmsQSHeIc
This commit is contained in:
Boris Zbarsky 2018-04-20 12:55:31 -04:00
parent 0ba35d199f
commit a3ea17eac1
3 changed files with 14 additions and 5 deletions

View File

@ -326,10 +326,9 @@ DataTransferItem::GetAsEntry(nsIPrincipal& aSubjectPrincipal,
if (target) {
global = target->GetOwnerGlobal();
} else {
nsCOMPtr<nsIDOMEvent> event =
do_QueryInterface(mDataTransfer->GetParentObject());
RefPtr<Event> event = do_QueryObject(mDataTransfer->GetParentObject());
if (event) {
global = event->InternalDOMEvent()->GetParentObject();
global = event->GetParentObject();
}
}
@ -469,8 +468,8 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback,
if (parent && !global) {
if (nsCOMPtr<dom::EventTarget> target = do_QueryInterface(parent)) {
global = target->GetOwnerGlobal();
} else if (nsCOMPtr<nsIDOMEvent> event = do_QueryInterface(parent)) {
global = event->InternalDOMEvent()->GetParentObject();
} else if (RefPtr<Event> event = do_QueryObject(parent)) {
global = event->GetParentObject();
}
}
if (global) {

View File

@ -137,6 +137,7 @@ Event::~Event()
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Event)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(Event)
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
NS_INTERFACE_MAP_END

View File

@ -46,10 +46,17 @@ class XULCommandEvent;
#include "mozilla/dom/GeneratedEventList.h"
#undef GENERATED_EVENT
// IID for Event
#define NS_EVENT_IID \
{ 0x71139716, 0x4d91, 0x4dee, \
{ 0xba, 0xf9, 0xe3, 0x3b, 0x80, 0xc1, 0x61, 0x61 } }
class Event : public nsIDOMEvent,
public nsWrapperCache
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_EVENT_IID)
Event(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent);
@ -393,6 +400,8 @@ private:
bool mOriginalWantsPopupControlCheck;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Event, NS_EVENT_IID)
} // namespace dom
} // namespace mozilla