2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2002-02-17 22:28:13 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2010-04-18 22:27:18 +04:00
|
|
|
interface nsIDOMDragEvent;
|
2002-03-01 01:19:04 +03:00
|
|
|
|
2015-11-11 01:15:03 +03:00
|
|
|
[scriptable, uuid(69E14F91-2E09-4CA6-A511-A715C99A2804)]
|
|
|
|
interface nsIDroppedLinkItem : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Returns the URL of the link.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the link name.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the MIME-Type.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString type;
|
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(21B5C25A-28A9-47BD-8431-FA9116305DED)]
|
2010-04-18 22:27:18 +04:00
|
|
|
interface nsIDroppedLinkHandler : nsISupports
|
2002-02-17 22:28:13 +03:00
|
|
|
{
|
2002-03-01 01:19:04 +03:00
|
|
|
/**
|
2010-04-18 22:27:18 +04:00
|
|
|
* Determines if a link being dragged can be dropped and returns true if so.
|
|
|
|
* aEvent should be a dragenter or dragover event.
|
2002-03-01 01:19:04 +03:00
|
|
|
*
|
2010-04-18 22:27:18 +04:00
|
|
|
* 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.
|
2002-03-01 01:19:04 +03:00
|
|
|
*/
|
2011-08-07 09:03:32 +04:00
|
|
|
boolean canDropLink(in nsIDOMDragEvent aEvent, in boolean aAllowSameDocument);
|
2010-04-18 22:27:18 +04:00
|
|
|
|
2002-03-01 01:19:04 +03:00
|
|
|
/**
|
2010-04-18 22:27:18 +04:00
|
|
|
* 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
|
2012-01-31 05:58:30 +04:00
|
|
|
* 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
|
2010-04-18 22:27:18 +04:00
|
|
|
* the receiving target should not load the uri for security reasons. This
|
2012-01-31 05:58:30 +04:00
|
|
|
* 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).
|
2010-04-18 22:27:18 +04:00
|
|
|
*
|
|
|
|
* aName is filled in with the link title if it exists, or an empty string
|
|
|
|
* otherwise.
|
2002-03-01 01:19:04 +03:00
|
|
|
*/
|
2012-01-31 05:58:30 +04:00
|
|
|
AString dropLink(in nsIDOMDragEvent aEvent, out AString aName,
|
|
|
|
[optional] in boolean aDisallowInherit);
|
2015-11-11 01:15:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 count of links is 0, 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).
|
|
|
|
*/
|
|
|
|
void dropLinks(in nsIDOMDragEvent aEvent,
|
|
|
|
[optional] in boolean aDisallowInherit,
|
|
|
|
[optional] out unsigned long aCount,
|
|
|
|
[retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);
|
2002-02-17 22:28:13 +03:00
|
|
|
};
|