michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * An interface representing a channel which will have to execute some sort of michael@0: * program provided via its URI to compute the data it should return. michael@0: * michael@0: * If a channel implements this interface, the execution of the program in michael@0: * question will be restricted in the following ways: michael@0: * michael@0: * - If the channel does not have an owner principal, the program will not be michael@0: * executed at all, no matter what. This is necessary because in this michael@0: * circumstance we have no way to tell whether script execution is allowed at michael@0: * all for the originating security context of this channel. michael@0: * - If the channel has an owner principal, how it is executed is controlled by michael@0: * this interface. However if the owner principal does not subsume the michael@0: * principal of the environment in which the program is to be executed the michael@0: * execution will be forced to happen in a sandbox. michael@0: */ michael@0: [scriptable, uuid(33234b99-9588-4c7d-9da6-86b8b7cba565)] michael@0: interface nsIScriptChannel : nsISupports michael@0: { michael@0: /** michael@0: * Possible ways of executing the program. michael@0: */ michael@0: michael@0: /** michael@0: * Don't execute at all. michael@0: */ michael@0: const unsigned long NO_EXECUTION = 0; michael@0: michael@0: /** michael@0: * Execute in a sandbox, no matter how the various principals involved are michael@0: * related to each other. michael@0: */ michael@0: const unsigned long EXECUTE_IN_SANDBOX = 1; michael@0: michael@0: /** michael@0: * Execute against the target environment if the principals allow it. michael@0: */ michael@0: const unsigned long EXECUTE_NORMAL = 2; michael@0: michael@0: /** michael@0: * Whether and how the program represented by this channel is to be executed. michael@0: * The default value if this property has never been set on this channel MUST michael@0: * be either EXECUTE_IN_SANDBOX or NO_EXECUTION. michael@0: * michael@0: * @throws NS_ERROR_INVALID_ARG when set to an unrecognized value. michael@0: */ michael@0: attribute unsigned long executionPolicy; michael@0: michael@0: /** michael@0: * Control whether the program should be executed synchronosly when michael@0: * the channel's AsyncOpen method is called or whether it should be michael@0: * executed asynchronously. In both cases, any data that the michael@0: * channel returns will be returned asynchronously; the only thing michael@0: * this property affects is when the program executes. michael@0: * michael@0: * The default value of this property is TRUE. michael@0: * michael@0: * Setting this property after asyncOpen has been called on the michael@0: * channel has no effect. michael@0: */ michael@0: attribute boolean executeAsync; michael@0: };