1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4"use strict";
5
6var EXPORTED_SYMBOLS = [];
7
8for (let [key, val] of Object.entries({
9  /* Constants */
10  XHTML_NS: "http://www.w3.org/1999/xhtml",
11  XUL_NS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
12
13  NS_LOCAL_FILE_CONTRACTID: "@mozilla.org/file/local;1",
14  NS_GFXINFO_CONTRACTID: "@mozilla.org/gfx/info;1",
15  IO_SERVICE_CONTRACTID: "@mozilla.org/network/io-service;1",
16  DEBUG_CONTRACTID: "@mozilla.org/xpcom/debug;1",
17  NS_DIRECTORY_SERVICE_CONTRACTID: "@mozilla.org/file/directory_service;1",
18  NS_OBSERVER_SERVICE_CONTRACTID: "@mozilla.org/observer-service;1",
19
20  TYPE_REFTEST_EQUAL: '==',
21  TYPE_REFTEST_NOTEQUAL: '!=',
22  TYPE_LOAD: 'load',     // test without a reference (just test that it does
23                         // not assert, crash, hang, or leak)
24  TYPE_SCRIPT: 'script', // test contains individual test results
25  TYPE_PRINT: 'print',   // test and reference will be printed to PDF's and
26                         // compared structurally
27
28  // keep this in sync with reftest-content.js
29  URL_TARGET_TYPE_TEST: 0,      // first url
30  URL_TARGET_TYPE_REFERENCE: 1, // second url, if any
31
32  // The order of these constants matters, since when we have a status
33  // listed for a *manifest*, we combine the status with the status for
34  // the test by using the *larger*.
35  // FIXME: In the future, we may also want to use this rule for combining
36  // statuses that are on the same line (rather than making the last one
37  // win).
38  EXPECTED_PASS: 0,
39  EXPECTED_FAIL: 1,
40  EXPECTED_RANDOM: 2,
41  EXPECTED_FUZZY: 3,
42
43  // types of preference value we might want to set for a specific test
44  PREF_BOOLEAN: 0,
45  PREF_STRING: 1,
46  PREF_INTEGER: 2,
47
48  FOCUS_FILTER_ALL_TESTS: "all",
49  FOCUS_FILTER_NEEDS_FOCUS_TESTS: "needs-focus",
50  FOCUS_FILTER_NON_NEEDS_FOCUS_TESTS: "non-needs-focus",
51
52  // "<!--CLEAR-->"
53  BLANK_URL_FOR_CLEARING: "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E",
54
55  /* Globals */
56  g: {
57    loadTimeout: 0,
58    timeoutHook: null,
59    remote: false,
60    ignoreWindowSize: false,
61    shuffle: false,
62    repeat: null,
63    runUntilFailure: false,
64    cleanupPendingCrashes: false,
65    totalChunks: 0,
66    thisChunk: 0,
67    containingWindow: null,
68    urlFilterRegex: {},
69    contentGfxInfo: null,
70    focusFilterMode: "all",
71    compareRetainedDisplayLists: false,
72    isCoverageBuild: false,
73
74    browser: undefined,
75    // Are we testing web content loaded in a separate process?
76    browserIsRemote: undefined,        // bool
77    // Are we using <iframe mozbrowser>?
78    browserIsIframe: undefined,        // bool
79    browserMessageManager: undefined,  // bool
80    canvas1: undefined,
81    canvas2: undefined,
82    // gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
83    // RecordResult.
84    currentCanvas: null,
85    urls: undefined,
86    // Map from URI spec to the number of times it remains to be used
87    uriUseCounts: undefined,
88    // Map from URI spec to the canvas rendered for that URI
89    uriCanvases: undefined,
90    testResults: {
91      // Successful...
92      Pass: 0,
93      LoadOnly: 0,
94      // Unexpected...
95      Exception: 0,
96      FailedLoad: 0,
97      UnexpectedFail: 0,
98      UnexpectedPass: 0,
99      AssertionUnexpected: 0,
100      AssertionUnexpectedFixed: 0,
101      // Known problems...
102      KnownFail : 0,
103      AssertionKnown: 0,
104      Random : 0,
105      Skip: 0,
106      Slow: 0,
107    },
108    totalTests: 0,
109    currentURL: undefined,
110    currentURLTargetType: undefined,
111    testLog: [],
112    logLevel: undefined,
113    logFile: null,
114    logger: undefined,
115    server: undefined,
116    count: 0,
117    assertionCount: 0,
118
119    ioService: undefined,
120    debug: undefined,
121    windowUtils: undefined,
122
123    slowestTestTime: 0,
124    slowestTestURL: undefined,
125    failedUseWidgetLayers: false,
126
127    drawWindowFlags: undefined,
128
129    expectingProcessCrash: false,
130    expectedCrashDumpFiles: [],
131    unexpectedCrashDumpFiles: {},
132    crashDumpDir: undefined,
133    pendingCrashDumpDir: undefined,
134    failedNoPaint: false,
135    failedNoDisplayList: false,
136    failedDisplayList: false,
137    failedOpaqueLayer: false,
138    failedOpaqueLayerMessages: [],
139    failedAssignedLayer: false,
140    failedAssignedLayerMessages: [],
141
142    startAfter: undefined,
143    suiteStarted: false,
144    manageSuite: false,
145
146    // The enabled-state of the test-plugins, stored so they can be reset later
147    testPluginEnabledStates: null,
148    prefsToRestore: [],
149    httpServerPort: -1,
150
151    // whether to run slow tests or not
152    runSlowTests: true,
153
154    // whether we should skip caching canvases
155    noCanvasCache: false,
156    recycledCanvases: new Array(),
157    testPrintOutput: null,
158
159    manifestsLoaded: {},
160    // Only dump the sandbox once, because it doesn't depend on the
161    // manifest URL (yet!).
162    dumpedConditionSandbox: false,
163  }
164})) {
165  this[key] = val;
166  EXPORTED_SYMBOLS.push(key);
167}
168