Bug 1351193 - Added new DataTransfer constructor

This commit is contained in:
janekptacijarabaci
2018-07-20 07:46:50 +02:00
committed by Roy Tam
parent b2c7373dba
commit 6e67c59787
3 changed files with 5 additions and 17 deletions
+3 -14
View File
@@ -161,22 +161,11 @@ DataTransfer::~DataTransfer()
// static
already_AddRefed<DataTransfer>
DataTransfer::Constructor(const GlobalObject& aGlobal,
const nsAString& aEventType, bool aIsExternal,
ErrorResult& aRv)
DataTransfer::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsAutoCString onEventType("on");
AppendUTF16toUTF8(aEventType, onEventType);
nsCOMPtr<nsIAtom> eventTypeAtom = NS_Atomize(onEventType);
if (!eventTypeAtom) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
EventMessage eventMessage = nsContentUtils::GetEventMessage(eventTypeAtom);
RefPtr<DataTransfer> transfer = new DataTransfer(aGlobal.GetAsSupports(),
eventMessage, aIsExternal,
-1);
eCopy, /* is external */ false, /* clipboard type */ -1);
transfer->mEffectAllowed = nsIDragService::DRAGDROP_ACTION_NONE;
return transfer.forget();
}
+1 -2
View File
@@ -115,8 +115,7 @@ public:
}
static already_AddRefed<DataTransfer>
Constructor(const GlobalObject& aGlobal, const nsAString& aEventType,
bool aIsExternal, ErrorResult& aRv);
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
void GetDropEffect(nsString& aDropEffect)
{
+1 -1
View File
@@ -7,7 +7,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/#the-datatransfer-interface
*/
[ChromeConstructor(DOMString eventType, boolean isExternal)]
[Constructor]
interface DataTransfer {
attribute DOMString dropEffect;
attribute DOMString effectAllowed;