1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/public/nsIDroppedLinkHandler.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIDOMDragEvent; 1.11 +interface nsIURI; 1.12 + 1.13 +[scriptable, uuid(6B58A5A7-76D0-4E93-AB2E-4DE108683FF8)] 1.14 +interface nsIDroppedLinkHandler : nsISupports 1.15 +{ 1.16 + /** 1.17 + * Determines if a link being dragged can be dropped and returns true if so. 1.18 + * aEvent should be a dragenter or dragover event. 1.19 + * 1.20 + * If aAllowSameDocument is false, drops are only allowed if the document 1.21 + * of the source of the drag is different from the destination. This check 1.22 + * includes any parent, sibling and child frames in the same content tree. 1.23 + * If true, the source is not checked. 1.24 + */ 1.25 + boolean canDropLink(in nsIDOMDragEvent aEvent, in boolean aAllowSameDocument); 1.26 + 1.27 + /** 1.28 + * Given a drop event aEvent, determines the link being dragged and returns 1.29 + * it. If a uri is returned the caller can, for instance, load it. If null 1.30 + * is returned, there is no valid link to be dropped. 1.31 + * 1.32 + * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if 1.33 + * the receiving target should not load the uri for security reasons. This 1.34 + * will occur if any of the following conditions are true: 1.35 + * - the source of the drag initiated a link for dragging that 1.36 + * it itself cannot access. This prevents a source document from tricking 1.37 + * the user into a dragging a chrome url, for example. 1.38 + * - aDisallowInherit is true, and the URI being dropped would inherit the 1.39 + * current document's security context (URI_INHERITS_SECURITY_CONTEXT). 1.40 + * 1.41 + * aName is filled in with the link title if it exists, or an empty string 1.42 + * otherwise. 1.43 + */ 1.44 + AString dropLink(in nsIDOMDragEvent aEvent, out AString aName, 1.45 + [optional] in boolean aDisallowInherit); 1.46 +};