1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/nsIScriptChannel.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +/** 1.12 + * An interface representing a channel which will have to execute some sort of 1.13 + * program provided via its URI to compute the data it should return. 1.14 + * 1.15 + * If a channel implements this interface, the execution of the program in 1.16 + * question will be restricted in the following ways: 1.17 + * 1.18 + * - If the channel does not have an owner principal, the program will not be 1.19 + * executed at all, no matter what. This is necessary because in this 1.20 + * circumstance we have no way to tell whether script execution is allowed at 1.21 + * all for the originating security context of this channel. 1.22 + * - If the channel has an owner principal, how it is executed is controlled by 1.23 + * this interface. However if the owner principal does not subsume the 1.24 + * principal of the environment in which the program is to be executed the 1.25 + * execution will be forced to happen in a sandbox. 1.26 + */ 1.27 +[scriptable, uuid(33234b99-9588-4c7d-9da6-86b8b7cba565)] 1.28 +interface nsIScriptChannel : nsISupports 1.29 +{ 1.30 + /** 1.31 + * Possible ways of executing the program. 1.32 + */ 1.33 + 1.34 + /** 1.35 + * Don't execute at all. 1.36 + */ 1.37 + const unsigned long NO_EXECUTION = 0; 1.38 + 1.39 + /** 1.40 + * Execute in a sandbox, no matter how the various principals involved are 1.41 + * related to each other. 1.42 + */ 1.43 + const unsigned long EXECUTE_IN_SANDBOX = 1; 1.44 + 1.45 + /** 1.46 + * Execute against the target environment if the principals allow it. 1.47 + */ 1.48 + const unsigned long EXECUTE_NORMAL = 2; 1.49 + 1.50 + /** 1.51 + * Whether and how the program represented by this channel is to be executed. 1.52 + * The default value if this property has never been set on this channel MUST 1.53 + * be either EXECUTE_IN_SANDBOX or NO_EXECUTION. 1.54 + * 1.55 + * @throws NS_ERROR_INVALID_ARG when set to an unrecognized value. 1.56 + */ 1.57 + attribute unsigned long executionPolicy; 1.58 + 1.59 + /** 1.60 + * Control whether the program should be executed synchronosly when 1.61 + * the channel's AsyncOpen method is called or whether it should be 1.62 + * executed asynchronously. In both cases, any data that the 1.63 + * channel returns will be returned asynchronously; the only thing 1.64 + * this property affects is when the program executes. 1.65 + * 1.66 + * The default value of this property is TRUE. 1.67 + * 1.68 + * Setting this property after asyncOpen has been called on the 1.69 + * channel has no effect. 1.70 + */ 1.71 + attribute boolean executeAsync; 1.72 +};