|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 /** |
|
9 * An interface representing a channel which will have to execute some sort of |
|
10 * program provided via its URI to compute the data it should return. |
|
11 * |
|
12 * If a channel implements this interface, the execution of the program in |
|
13 * question will be restricted in the following ways: |
|
14 * |
|
15 * - If the channel does not have an owner principal, the program will not be |
|
16 * executed at all, no matter what. This is necessary because in this |
|
17 * circumstance we have no way to tell whether script execution is allowed at |
|
18 * all for the originating security context of this channel. |
|
19 * - If the channel has an owner principal, how it is executed is controlled by |
|
20 * this interface. However if the owner principal does not subsume the |
|
21 * principal of the environment in which the program is to be executed the |
|
22 * execution will be forced to happen in a sandbox. |
|
23 */ |
|
24 [scriptable, uuid(33234b99-9588-4c7d-9da6-86b8b7cba565)] |
|
25 interface nsIScriptChannel : nsISupports |
|
26 { |
|
27 /** |
|
28 * Possible ways of executing the program. |
|
29 */ |
|
30 |
|
31 /** |
|
32 * Don't execute at all. |
|
33 */ |
|
34 const unsigned long NO_EXECUTION = 0; |
|
35 |
|
36 /** |
|
37 * Execute in a sandbox, no matter how the various principals involved are |
|
38 * related to each other. |
|
39 */ |
|
40 const unsigned long EXECUTE_IN_SANDBOX = 1; |
|
41 |
|
42 /** |
|
43 * Execute against the target environment if the principals allow it. |
|
44 */ |
|
45 const unsigned long EXECUTE_NORMAL = 2; |
|
46 |
|
47 /** |
|
48 * Whether and how the program represented by this channel is to be executed. |
|
49 * The default value if this property has never been set on this channel MUST |
|
50 * be either EXECUTE_IN_SANDBOX or NO_EXECUTION. |
|
51 * |
|
52 * @throws NS_ERROR_INVALID_ARG when set to an unrecognized value. |
|
53 */ |
|
54 attribute unsigned long executionPolicy; |
|
55 |
|
56 /** |
|
57 * Control whether the program should be executed synchronosly when |
|
58 * the channel's AsyncOpen method is called or whether it should be |
|
59 * executed asynchronously. In both cases, any data that the |
|
60 * channel returns will be returned asynchronously; the only thing |
|
61 * this property affects is when the program executes. |
|
62 * |
|
63 * The default value of this property is TRUE. |
|
64 * |
|
65 * Setting this property after asyncOpen has been called on the |
|
66 * channel has no effect. |
|
67 */ |
|
68 attribute boolean executeAsync; |
|
69 }; |