summaryrefslogtreecommitdiffstats
path: root/dom/base/nsIDroppedLinkHandler.idl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/base/nsIDroppedLinkHandler.idl
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/nsIDroppedLinkHandler.idl')
-rw-r--r--dom/base/nsIDroppedLinkHandler.idl109
1 files changed, 109 insertions, 0 deletions
diff --git a/dom/base/nsIDroppedLinkHandler.idl b/dom/base/nsIDroppedLinkHandler.idl
new file mode 100644
index 0000000000..4967894e82
--- /dev/null
+++ b/dom/base/nsIDroppedLinkHandler.idl
@@ -0,0 +1,109 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+#include "nsIPrincipal.idl"
+#include "nsIContentSecurityPolicy.idl"
+
+webidl DragEvent;
+webidl DataTransfer;
+
+[scriptable, uuid(69E14F91-2E09-4CA6-A511-A715C99A2804)]
+interface nsIDroppedLinkItem : nsISupports
+{
+ /**
+ * Returns the URL of the link.
+ */
+ readonly attribute AString url;
+
+ /**
+ * Returns the link name.
+ */
+ readonly attribute AString name;
+
+ /**
+ * Returns the MIME-Type.
+ */
+ readonly attribute AString type;
+};
+
+[scriptable, uuid(21B5C25A-28A9-47BD-8431-FA9116305DED)]
+interface nsIDroppedLinkHandler : nsISupports
+{
+ /**
+ * Determines if a link being dragged can be dropped and returns true if so.
+ * aEvent should be a dragenter or dragover event.
+ *
+ * If aAllowSameDocument is false, drops are only allowed if the document
+ * of the source of the drag is different from the destination. This check
+ * includes any parent, sibling and child frames in the same content tree.
+ * If true, the source is not checked.
+ */
+ boolean canDropLink(in DragEvent aEvent, in boolean aAllowSameDocument);
+
+ /**
+ * Given a drop event aEvent, determines the link being dragged and returns
+ * it. If a uri is returned the caller can, for instance, load it. If null
+ * is returned, there is no valid link to be dropped.
+ *
+ * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if
+ * the receiving target should not load the uri for security reasons. This
+ * will occur if any of the following conditions are true:
+ * - the source of the drag initiated a link for dragging that
+ * it itself cannot access. This prevents a source document from tricking
+ * the user into a dragging a chrome url, for example.
+ * - aDisallowInherit is true, and the URI being dropped would inherit the
+ * current document's security context (URI_INHERITS_SECURITY_CONTEXT).
+ *
+ * aName is filled in with the link title if it exists, or an empty string
+ * otherwise.
+ */
+ AString dropLink(in DragEvent aEvent, out AString aName,
+ [optional] in boolean aDisallowInherit);
+
+ /**
+ * Given a drop event aEvent, determines links being dragged and returns
+ * them. If links are returned the caller can, for instance, load them. If
+ * the returned array is empty, there is no valid link to be dropped.
+ *
+ * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if
+ * the receiving target should not load the uri for security reasons. This
+ * will occur if any of the following conditions are true:
+ * - the source of the drag initiated a link for dragging that
+ * it itself cannot access. This prevents a source document from tricking
+ * the user into a dragging a chrome url, for example.
+ * - aDisallowInherit is true, and the URI being dropped would inherit the
+ * current document's security context (URI_INHERITS_SECURITY_CONTEXT).
+ */
+ Array<nsIDroppedLinkItem> dropLinks(in DragEvent aEvent,
+ [optional] in boolean aDisallowInherit);
+
+ /**
+ * Given a drop event aEvent, validate the extra URIs for the event,
+ * this is used when the caller extracts yet another URIs from the dropped
+ * text, like home button that splits the text with "|".
+ */
+ void validateURIsForDrop(in DragEvent aEvent,
+ in Array<AString> aURIs,
+ [optional] in boolean aDisallowInherit);
+
+ /**
+ * Given a dataTransfer, allows caller to determine and verify links being
+ * dragged. Since drag/drop performs a roundtrip of parent, child, parent,
+ * it allows the parent to verify that the child did not modify links
+ * being dropped.
+ */
+ Array<nsIDroppedLinkItem> queryLinks(in DataTransfer aDataTransfer);
+
+ /**
+ * Given a drop event aEvent, determines the triggering principal for the
+ * event and returns it.
+ */
+ nsIPrincipal getTriggeringPrincipal(in DragEvent aEvent);
+
+ /**
+ * Given a drop event aEvent, determines the CSP for the event and returns it.
+ */
+ nsIContentSecurityPolicy getCSP(in DragEvent aEvent);
+};