summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/environment.rst
blob: 928fa3bc8ba4ef82e5b4a73abbdfc2d0a753d1b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Environment
===========

These environments are available by specifying a comment at the top of the file,
e.g.

.. code-block:: js

   /* eslint-env mozilla/chrome-worker */

There are also built-in ESLint environments available as well. Find them here: http://eslint.org/docs/user-guide/configuring#specifying-environments

browser-window
--------------

Defines the environment for scripts that are in the main browser.xhtml scope.

chrome-script
-------------

Defines the environment for scripts loaded by
``SpecialPowers.loadChromeScript``.

chrome-worker
-------------

Defines the environment for chrome workers. This differs from normal workers by
the fact that `ctypes` can be accessed as well.

frame-script
------------

Defines the environment for scripts loaded by ``Services.mm.loadFrameScript``.

jsm
---

Defines the environment for jsm files (javascript modules).

privileged
----------

Defines the environment for privileged JS files.

process-script
--------------

Defines the environment for scripts loaded by
``Services.ppmm.loadProcessScript``.

remote-page
-----------

Defines the environment for scripts loaded with ``<script src="...">`` in
``about:`` pages.

simpletest
----------

Defines the environment for scripts that use the SimpleTest mochitest harness.

sjs
---

Defines the environment for sjs files.

special-powers-sandbox
----------------------

Defines the environment for scripts evaluated inside ``SpecialPowers`` sandbox
with the default options.

testharness
-----------

Defines the environment the globals that are injected from
:searchfox:`dom/imptests/testharness.js <dom/imptests/testharness.js>`.

It is injected automatically into (x)html files which include:

.. code-block:: html

    <script src="/resources/testharness.js"></script>

It may need to be included manually in JavaScript files which are loaded into
the same scope.

xpcshell
--------

Defines the environment for xpcshell test files.