diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-07-20 11:10:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-20 11:10:53 +0200 |
commit | cba8e7b14e7703fbe032e41acfaf7f1ba9536aaf (patch) | |
tree | 2446c6613b238c3de3087b0850e0e2941a832135 | |
parent | edc1da82d86d3c86512f42403c84ee68a4f682a3 (diff) | |
parent | 568e27db3f80bfb19e3e80a9b21e26b6d9ebb152 (diff) | |
download | uxp-cba8e7b14e7703fbe032e41acfaf7f1ba9536aaf.tar.gz |
Merge pull request #651 from janekptacijarabaci/dom_DataTransfer_constructor_1
Dom data transfer constructor
-rw-r--r-- | dom/bindings/test/test_dom_xrays.html | 2 | ||||
-rw-r--r-- | dom/events/DataTransfer.cpp | 17 | ||||
-rw-r--r-- | dom/events/DataTransfer.h | 3 | ||||
-rw-r--r-- | dom/webidl/DataTransfer.webidl | 2 | ||||
-rw-r--r-- | testing/web-platform/meta/html/dom/interfaces.html.ini | 3 | ||||
-rw-r--r-- | toolkit/content/tests/chrome/window_browser_drop.xul | 14 |
6 files changed, 7 insertions, 34 deletions
diff --git a/dom/bindings/test/test_dom_xrays.html b/dom/bindings/test/test_dom_xrays.html index 0700db2f8b..15d7013ade 100644 --- a/dom/bindings/test/test_dom_xrays.html +++ b/dom/bindings/test/test_dom_xrays.html @@ -172,7 +172,7 @@ function test() // Check that DataTransfer's .types has the hack to alias contains() // to includes(). - var dataTransfer = new win.DataTransfer("foo", true); + var dataTransfer = new win.DataTransfer(); is(dataTransfer.types.contains, dataTransfer.types.includes, "Should have contains() set up as an alias to includes()"); // Waive Xrays on the dataTransfer itself, since the .types we get is diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 2c6ecdd56a..45c72e6629 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -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(); } diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index 7c6b0b8c1e..344593ed0a 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -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) { diff --git a/dom/webidl/DataTransfer.webidl b/dom/webidl/DataTransfer.webidl index 206d808049..dd44e1ddce 100644 --- a/dom/webidl/DataTransfer.webidl +++ b/dom/webidl/DataTransfer.webidl @@ -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; diff --git a/testing/web-platform/meta/html/dom/interfaces.html.ini b/testing/web-platform/meta/html/dom/interfaces.html.ini index 8dbbe4969c..59e445a3e7 100644 --- a/testing/web-platform/meta/html/dom/interfaces.html.ini +++ b/testing/web-platform/meta/html/dom/interfaces.html.ini @@ -1594,9 +1594,6 @@ [Path2D interface: operation addPathByStrokingText(DOMString,CanvasDrawingStyles,SVGMatrix,Path2D,unrestricted double)] expected: FAIL - [DataTransfer interface object length] - expected: FAIL - [Window interface: operation showModalDialog(DOMString,any)] disabled: if e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=981796 diff --git a/toolkit/content/tests/chrome/window_browser_drop.xul b/toolkit/content/tests/chrome/window_browser_drop.xul index 8a22ccce90..2d9bcd2a1a 100644 --- a/toolkit/content/tests/chrome/window_browser_drop.xul +++ b/toolkit/content/tests/chrome/window_browser_drop.xul @@ -31,7 +31,7 @@ function dropOnRemoteBrowserAsync(browser, data, shouldExpectStateChange) { }); } - let dataTransfer = new content.DataTransfer("dragstart", false); + let dataTransfer = new content.DataTransfer(); for (let i = 0; i < data.length; i++) { let types = data[i]; for (let j = 0; j < types.length; j++) { @@ -166,18 +166,6 @@ function* dropLinksOnBrowser(browser, type) { data: "http://www.mozilla.org/\nMozilla.org\nhttp://www.example.com/\nExample.com" } ] ], "text/x-moz-url with 2 URLs drop on browser " + type); - // Dropping multiple items should open multiple pages. - yield* expectLink(browser, - [ { url: "http://www.example.com/", - name: "Example.com" }, - { url: "http://www.mozilla.org/", - name: "http://www.mozilla.org/" }], - [ [ { type: "text/x-moz-url", - data: "http://www.example.com/\nExample.com" } ], - [ { type: "text/plain", - data: "http://www.mozilla.org/" } ] ], - "text/x-moz-url and text/plain drop on browser " + type); - // Dropping single item with multiple types should open single page. yield* expectLink(browser, [ { url: "http://www.example.org/", |