Bug 1351193 - Part 1: Added new DataTransfer constructor, r=Nika

Deleted the old Chrome DataTransfer constructor because it was only used
for some tests which can be easily changed. Added a new constructor that
is not Chrome Only.

MozReview-Commit-ID: HjcgafSiWfM

--HG--
extra : rebase_source : 987afee2b6568bcf15c2ad99e715e6e0a112e3ed
This commit is contained in:
Anny Gakhokidze 2018-05-23 11:57:08 -04:00
parent 9d2274bc09
commit 10ee7497cf
4 changed files with 5 additions and 20 deletions

View File

@ -197,22 +197,12 @@ 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);
RefPtr<nsAtom> 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();
}

View File

@ -119,8 +119,7 @@ public:
}
static already_AddRefed<DataTransfer>
Constructor(const GlobalObject& aGlobal, const nsAString& aEventType,
bool aIsExternal, ErrorResult& aRv);
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
/**
* The actual effect that will be used, and should always be one of the

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;

View File

@ -1,4 +0,0 @@
[datatransfer-constructor-001.html]
[Verify DataTransfer constructor]
expected: FAIL