1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
6 #include
"nsIPrincipal.idl"
7 #include
"nsIContentSecurityPolicy.idl"
12 [scriptable
, uuid(69E14F91
-2E09
-4CA6
-A511
-A715C99A2804
)]
13 interface nsIDroppedLinkItem
: nsISupports
16 * Returns the URL of the link.
18 readonly attribute AString url
;
21 * Returns the link name.
23 readonly attribute AString name
;
26 * Returns the MIME-Type.
28 readonly attribute AString type
;
31 [scriptable
, uuid(21B5C25A
-28A9
-47BD
-8431-FA9116305DED
)]
32 interface nsIDroppedLinkHandler
: nsISupports
35 * Determines if a link being dragged can be dropped and returns true if so.
36 * aEvent should be a dragenter or dragover event.
38 * If aAllowSameDocument is false, drops are only allowed if the document
39 * of the source of the drag is different from the destination. This check
40 * includes any parent, sibling and child frames in the same content tree.
41 * If true, the source is not checked.
43 boolean canDropLink
(in DragEvent aEvent
, in boolean aAllowSameDocument
);
46 * Given a drop event aEvent, determines links being dragged and returns
47 * them. If links are returned the caller can, for instance, load them. If
48 * the returned array is empty, there is no valid link to be dropped.
50 * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if
51 * the receiving target should not load the uri for security reasons. This
52 * will occur if any of the following conditions are true:
53 * - the source of the drag initiated a link for dragging that
54 * it itself cannot access. This prevents a source document from tricking
55 * the user into a dragging a chrome url, for example.
56 * - aDisallowInherit is true, and the URI being dropped would inherit the
57 * current document's security context (URI_INHERITS_SECURITY_CONTEXT).
59 Array
<nsIDroppedLinkItem
> dropLinks
(in DragEvent aEvent
,
60 [optional] in boolean aDisallowInherit
);
63 * Given a drop event aEvent, validate the extra URIs for the event,
64 * this is used when the caller extracts yet another URIs from the dropped
65 * text, like home button that splits the text with "|".
67 void validateURIsForDrop
(in DragEvent aEvent
,
68 in Array
<AString
> aURIs
,
69 [optional] in boolean aDisallowInherit
);
72 * Given a dataTransfer, allows caller to determine and verify links being
73 * dragged. Since drag/drop performs a roundtrip of parent, child, parent,
74 * it allows the parent to verify that the child did not modify links
77 Array
<nsIDroppedLinkItem
> queryLinks
(in DataTransfer aDataTransfer
);
80 * Given a drop event aEvent, determines the triggering principal for the
81 * event and returns it.
83 nsIPrincipal getTriggeringPrincipal
(in DragEvent aEvent
);
86 * Given a drop event aEvent, determines the CSP for the event and returns it.
88 nsIContentSecurityPolicy getCsp
(in DragEvent aEvent
);