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    useDrawSnapshot: undefined,        // bool
81    canvas1: undefined,
82    canvas2: undefined,
83    // gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
84    // RecordResult.
85    currentCanvas: null,
86    urls: undefined,
87    // Map from URI spec to the number of times it remains to be used
88    uriUseCounts: undefined,
89    // Map from URI spec to the canvas rendered for that URI
90    uriCanvases: undefined,
91    testResults: {
92      // Successful...
93      Pass: 0,
94      LoadOnly: 0,
95      // Unexpected...
96      Exception: 0,
97      FailedLoad: 0,
98      UnexpectedFail: 0,
99      UnexpectedPass: 0,
100      AssertionUnexpected: 0,
101      AssertionUnexpectedFixed: 0,
102      // Known problems...
103      KnownFail : 0,
104      AssertionKnown: 0,
105      Random : 0,
106      Skip: 0,
107      Slow: 0,
108    },
109    totalTests: 0,
110    currentURL: undefined,
111    currentURLTargetType: undefined,
112    testLog: [],
113    logLevel: undefined,
114    logFile: null,
115    logger: undefined,
116    server: undefined,
117    count: 0,
118    assertionCount: 0,
119
120    ioService: undefined,
121    debug: undefined,
122    windowUtils: undefined,
123
124    slowestTestTime: 0,
125    slowestTestURL: undefined,
126    failedUseWidgetLayers: false,
127
128    drawWindowFlags: undefined,
129
130    expectingProcessCrash: false,
131    expectedCrashDumpFiles: [],
132    unexpectedCrashDumpFiles: {},
133    crashDumpDir: undefined,
134    pendingCrashDumpDir: undefined,
135    failedNoPaint: false,
136    failedNoDisplayList: false,
137    failedDisplayList: false,
138    failedOpaqueLayer: false,
139    failedOpaqueLayerMessages: [],
140    failedAssignedLayer: false,
141    failedAssignedLayerMessages: [],
142
143    startAfter: undefined,
144    suiteStarted: false,
145    manageSuite: false,
146
147    prefsToRestore: [],
148    httpServerPort: -1,
149
150    // whether to run slow tests or not
151    runSlowTests: true,
152
153    // whether we should skip caching canvases
154    noCanvasCache: false,
155    recycledCanvases: new Array(),
156    testPrintOutput: null,
157
158    manifestsLoaded: {},
159    // Only dump the sandbox once, because it doesn't depend on the
160    // manifest URL (yet!).
161    dumpedConditionSandbox: false,
162  }
163})) {
164  this[key] = val;
165  EXPORTED_SYMBOLS.push(key);
166}
167