browser/base/content/newtab/dragDataHelper.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b506317968cc
1 #ifdef 0
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #endif
6
7 let gDragDataHelper = {
8 get mimeType() {
9 return "text/x-moz-url";
10 },
11
12 getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) {
13 let dt = aEvent.dataTransfer;
14 if (!dt || !dt.types.contains(this.mimeType)) {
15 return null;
16 }
17
18 let data = dt.getData(this.mimeType) || "";
19 let [url, title] = data.split(/[\r\n]+/);
20 return {url: url, title: title};
21 }
22 };

mercurial