1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * Constant flags that describe how a document is sandboxed according to the
12 #ifndef nsSandboxFlags_h___
13 #define nsSandboxFlags_h___
16 * This constant denotes the lack of a sandbox attribute/directive.
18 const unsigned long SANDBOXED_NONE
= 0x0;
21 * This flag prevents content from navigating browsing contexts other than
22 * itself, browsing contexts nested inside it, the top-level browsing context
23 * and browsing contexts that it has opened.
24 * As it is always on for sandboxed browsing contexts, it is used implicitly
25 * within the code by checking that the overall flags are non-zero.
26 * It is only uesd directly when the sandbox flags are initially set up.
28 const unsigned long SANDBOXED_NAVIGATION
= 0x1;
31 * This flag prevents content from creating new auxiliary browsing contexts,
32 * e.g. using the target attribute, or the window.open() method.
34 const unsigned long SANDBOXED_AUXILIARY_NAVIGATION
= 0x2;
37 * This flag prevents content from navigating their top-level browsing
40 const unsigned long SANDBOXED_TOPLEVEL_NAVIGATION
= 0x4;
43 * This flag prevents content from instantiating plugins, whether using the
44 * embed element, the object element, or through navigation of a nested browsing
45 * context, unless those plugins can be secured.
47 const unsigned long SANDBOXED_PLUGINS
= 0x8;
50 * This flag forces content into a unique origin, thus preventing it from
51 * accessing other content from the same origin.
52 * This flag also prevents script from reading from or writing to the
53 * document.cookie IDL attribute, and blocks access to localStorage.
55 const unsigned long SANDBOXED_ORIGIN
= 0x10;
58 * This flag blocks form submission.
60 const unsigned long SANDBOXED_FORMS
= 0x20;
63 * This flag blocks the document from acquiring pointerlock.
65 const unsigned long SANDBOXED_POINTER_LOCK
= 0x40;
68 * This flag blocks script execution.
70 const unsigned long SANDBOXED_SCRIPTS
= 0x80;
73 * This flag blocks features that trigger automatically, such as
74 * automatically playing a video or automatically focusing a form control.
76 const unsigned long SANDBOXED_AUTOMATIC_FEATURES
= 0x100;
79 * This flag prevents URL schemes that use storage areas from being able to
80 * access the origin's data.
82 // We don't have an explicit representation of this one, apparently?
83 // const unsigned long SANDBOXED_STORAGE_AREA_URLS = 0x200;
86 * This flag blocks the document from changing document.domain.
88 const unsigned long SANDBOXED_DOMAIN
= 0x400;
91 * This flag prevents content from using window.alert(), window.confirm(),
92 * window.print(), window.prompt() and the beforeunload event from putting up
95 const unsigned long SANDBOXED_MODALS
= 0x800;
98 * This flag prevents content from escaping the sandbox by ensuring that any
99 * auxiliary browsing context it creates inherits the content's active
100 * sandboxing flag set.
102 const unsigned long SANDBOX_PROPAGATES_TO_AUXILIARY_BROWSING_CONTEXTS
= 0x1000;
105 * This flag prevents locking screen orientation.
107 const unsigned long SANDBOXED_ORIENTATION_LOCK
= 0x2000;
110 * This flag disables the Presentation API.
112 const unsigned long SANDBOXED_PRESENTATION
= 0x4000;
115 * This flag disables access to the first-party storage area by user activation.
117 const unsigned long SANDBOXED_STORAGE_ACCESS
= 0x8000;
120 * This flag prevents content from navigating their top-level browsing
121 * context only when the user hasn't interacted with the browser.
123 const unsigned long SANDBOXED_TOPLEVEL_NAVIGATION_USER_ACTIVATION
= 0x20000;
126 * This flag disables content from initiating or instantiating downloads,
127 * whether through downloading hyperlinks or through navigation that gets
128 * handled as a download.
130 const unsigned long SANDBOXED_ALLOW_DOWNLOADS
= 0x10000;
133 * This flag prevents content from navigating to custom protocols.
135 const unsigned long SANDBOXED_TOPLEVEL_NAVIGATION_CUSTOM_PROTOCOLS
= 0x40000;
137 const unsigned long SANDBOX_ALL_FLAGS
= 0xFFFFF;