Bug 1931913 - [wpt-sync] Update web-platform-tests to fb6c27f65c829cea708e497db128f58...
[gecko.git] / dom / base / nsIScriptChannel.idl
blob3a07904f918ef056a2b96ca19e632ad78b5dd910
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/. */
6 #include "nsISupports.idl"
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.
12 * If a channel implements this interface, the execution of the program in
13 * question will be restricted in the following ways:
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.
24 [uuid(33234b99-9588-4c7d-9da6-86b8b7cba565)]
25 interface nsIScriptChannel : nsISupports
27 /**
28 * Possible ways of executing the program.
31 /**
32 * Don't execute at all.
34 const unsigned long NO_EXECUTION = 0;
36 /**
37 * There used to be an EXECUTE_IN_SANDBOX = 1 value. It has been removed, but
38 * we're not changing the value of EXECUTE_NORMAL to avoid breaking compat.
41 /**
42 * Execute against the target environment if the principals allow it.
44 const unsigned long EXECUTE_NORMAL = 2;
46 /**
47 * Whether and how the program represented by this channel is to be executed.
48 * The default value if this property has never been set on this channel MUST
49 * be either EXECUTE_IN_SANDBOX or NO_EXECUTION.
51 * @throws NS_ERROR_INVALID_ARG when set to an unrecognized value.
53 attribute unsigned long executionPolicy;
55 /**
56 * Control whether the program should be executed synchronosly when
57 * the channel's AsyncOpen method is called or whether it should be
58 * executed asynchronously. In both cases, any data that the
59 * channel returns will be returned asynchronously; the only thing
60 * this property affects is when the program executes.
62 * The default value of this property is TRUE.
64 * Setting this property after asyncOpen has been called on the
65 * channel has no effect.
67 attribute boolean executeAsync;
69 /**
70 * Check whether this script channel is a document load. This is
71 * needed because script channels can lie about their
72 * LOAD_DOCUMENT_URI flag until they have run the script.
74 [notxpcom, nostdcall] readonly attribute boolean isDocumentLoad;