2004-05-13 22:34:18 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ft=cpp tw=78 sw=2 et ts=8 : */
|
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/. */
|
2000-05-05 09:28:49 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2015-02-20 19:54:12 +03:00
|
|
|
#include "nsIContentPolicyBase.idl"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-05-22 02:40:10 +04:00
|
|
|
interface nsIURI;
|
2004-05-13 22:34:18 +04:00
|
|
|
interface nsIDOMNode;
|
2013-09-23 03:23:30 +04:00
|
|
|
interface nsIPrincipal;
|
2000-05-05 09:28:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for content policy mechanism. Implementations of this
|
|
|
|
* interface can be used to control loading of various types of out-of-line
|
|
|
|
* content, or processing of certain types of in-line content.
|
2004-05-13 22:34:18 +04:00
|
|
|
*
|
|
|
|
* WARNING: do not block the caller from shouldLoad or shouldProcess (e.g.,
|
|
|
|
* by launching a dialog to prompt the user for something).
|
2000-05-05 09:28:49 +04:00
|
|
|
*/
|
|
|
|
|
2015-02-20 19:54:12 +03:00
|
|
|
[scriptable,uuid(447a2300-ab3c-11e4-bcd8-0800200c9a66)]
|
|
|
|
interface nsIContentPolicy : nsIContentPolicyBase
|
2000-05-05 09:28:49 +04:00
|
|
|
{
|
2004-05-13 22:34:18 +04:00
|
|
|
/**
|
|
|
|
* Should the resource at this location be loaded?
|
|
|
|
* ShouldLoad will be called before loading the resource at aContentLocation
|
|
|
|
* to determine whether to start the load at all.
|
|
|
|
*
|
|
|
|
* @param aContentType the type of content being tested. This will be one
|
|
|
|
* one of the TYPE_* constants.
|
|
|
|
*
|
|
|
|
* @param aContentLocation the location of the content being checked; must
|
|
|
|
* not be null
|
|
|
|
*
|
|
|
|
* @param aRequestOrigin OPTIONAL. the location of the resource that
|
|
|
|
* initiated this load request; can be null if
|
|
|
|
* inapplicable
|
|
|
|
*
|
2004-07-27 21:15:53 +04:00
|
|
|
* @param aContext OPTIONAL. the nsIDOMNode or nsIDOMWindow that
|
|
|
|
* initiated the request, or something that can QI
|
|
|
|
* to one of those; can be null if inapplicable.
|
2012-10-24 08:44:11 +04:00
|
|
|
* Note that for navigation events (new windows and
|
|
|
|
* link clicks), this is the NEW window.
|
2004-05-13 22:34:18 +04:00
|
|
|
*
|
|
|
|
* @param aMimeTypeGuess OPTIONAL. a guess for the requested content's
|
|
|
|
* MIME type, based on information available to
|
|
|
|
* the request initiator (e.g., an OBJECT's type
|
|
|
|
* attribute); does not reliably reflect the
|
|
|
|
* actual MIME type of the requested content
|
|
|
|
*
|
|
|
|
* @param aExtra an OPTIONAL argument, pass-through for non-Gecko
|
|
|
|
* callers to pass extra data to callees.
|
|
|
|
*
|
2012-10-24 08:44:11 +04:00
|
|
|
* @param aRequestPrincipal an OPTIONAL argument, defines the principal that
|
|
|
|
* caused the load. This is optional only for
|
|
|
|
* non-gecko code: all gecko code should set this
|
|
|
|
* argument. For navigation events, this is
|
|
|
|
* the principal of the page that caused this load.
|
|
|
|
*
|
2004-05-13 22:34:18 +04:00
|
|
|
* @return ACCEPT or REJECT_*
|
2005-11-17 21:17:32 +03:00
|
|
|
*
|
|
|
|
* @note shouldLoad can be called while the DOM and layout of the document
|
|
|
|
* involved is in an inconsistent state. This means that implementors of
|
|
|
|
* this method MUST NOT do any of the following:
|
|
|
|
* 1) Modify the DOM in any way (e.g. setting attributes is a no-no).
|
|
|
|
* 2) Query any DOM properties that depend on layout (e.g. offset*
|
|
|
|
* properties).
|
|
|
|
* 3) Query any DOM properties that depend on style (e.g. computed style).
|
|
|
|
* 4) Query any DOM properties that depend on the current state of the DOM
|
|
|
|
* outside the "context" node (e.g. lengths of node lists).
|
|
|
|
* 5) [JavaScript implementations only] Access properties of any sort on any
|
|
|
|
* object without using XPCNativeWrapper (either explicitly or
|
|
|
|
* implicitly). Due to various DOM0 things, this leads to item 4.
|
|
|
|
* If you do any of these things in your shouldLoad implementation, expect
|
|
|
|
* unpredictable behavior, possibly including crashes, content not showing
|
|
|
|
* up, content showing up doubled, etc. If you need to do any of the things
|
|
|
|
* above, do them off timeout or event.
|
2004-05-13 22:34:18 +04:00
|
|
|
*/
|
2012-11-21 05:28:34 +04:00
|
|
|
short shouldLoad(in nsContentPolicyType aContentType,
|
2004-05-13 22:34:18 +04:00
|
|
|
in nsIURI aContentLocation,
|
|
|
|
in nsIURI aRequestOrigin,
|
2004-07-27 21:15:53 +04:00
|
|
|
in nsISupports aContext,
|
2004-05-13 22:34:18 +04:00
|
|
|
in ACString aMimeTypeGuess,
|
2012-07-03 03:16:11 +04:00
|
|
|
in nsISupports aExtra,
|
|
|
|
[optional] in nsIPrincipal aRequestPrincipal);
|
2004-05-13 22:34:18 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Should the resource be processed?
|
|
|
|
* ShouldProcess will be called once all the information passed to it has
|
|
|
|
* been determined about the resource, typically after part of the resource
|
|
|
|
* has been loaded.
|
|
|
|
*
|
|
|
|
* @param aContentType the type of content being tested. This will be one
|
|
|
|
* one of the TYPE_* constants.
|
|
|
|
*
|
|
|
|
* @param aContentLocation OPTIONAL; the location of the resource being
|
|
|
|
* requested: MAY be, e.g., a post-redirection URI
|
|
|
|
* for the resource.
|
|
|
|
*
|
|
|
|
* @param aRequestOrigin OPTIONAL. the location of the resource that
|
|
|
|
* initiated this load request; can be null if
|
|
|
|
* inapplicable
|
|
|
|
*
|
2004-07-27 21:15:53 +04:00
|
|
|
* @param aContext OPTIONAL. the nsIDOMNode or nsIDOMWindow that
|
|
|
|
* initiated the request, or something that can QI
|
|
|
|
* to one of those; can be null if inapplicable.
|
2004-05-13 22:34:18 +04:00
|
|
|
*
|
|
|
|
* @param aMimeType the MIME type of the requested resource (e.g.,
|
|
|
|
* image/png), as reported by the networking library,
|
|
|
|
* if available (may be empty if inappropriate for
|
|
|
|
* the type, e.g., TYPE_REFRESH).
|
|
|
|
*
|
|
|
|
* @param aExtra an OPTIONAL argument, pass-through for non-Gecko
|
|
|
|
* callers to pass extra data to callees.
|
|
|
|
*
|
|
|
|
* @return ACCEPT or REJECT_*
|
2005-11-17 21:17:32 +03:00
|
|
|
*
|
|
|
|
* @note shouldProcess can be called while the DOM and layout of the document
|
|
|
|
* involved is in an inconsistent state. See the note on shouldLoad to see
|
|
|
|
* what this means for implementors of this method.
|
2004-05-13 22:34:18 +04:00
|
|
|
*/
|
2012-11-21 05:28:34 +04:00
|
|
|
short shouldProcess(in nsContentPolicyType aContentType,
|
2004-05-13 22:34:18 +04:00
|
|
|
in nsIURI aContentLocation,
|
|
|
|
in nsIURI aRequestOrigin,
|
2004-07-27 21:15:53 +04:00
|
|
|
in nsISupports aContext,
|
2004-05-13 22:34:18 +04:00
|
|
|
in ACString aMimeType,
|
2012-07-03 03:16:11 +04:00
|
|
|
in nsISupports aExtra,
|
|
|
|
[optional] in nsIPrincipal aRequestPrincipal);
|
2000-05-05 09:28:49 +04:00
|
|
|
};
|