@hominis/fireforge 0.19.4 → 0.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +13 -11
- package/dist/src/commands/furnace/create.d.ts +7 -7
- package/dist/src/commands/furnace/create.js +8 -8
- package/dist/src/commands/furnace/index.js +2 -2
- package/dist/src/commands/test.js +16 -8
- package/dist/src/core/marionette-port.d.ts +16 -6
- package/dist/src/core/marionette-port.js +32 -6
- package/dist/src/types/commands/options.d.ts +15 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,9 +12,14 @@
|
|
|
12
12
|
- **`modified-file-missing-header` — standard Mozilla MPL-2.0 block headers with wrapped line breaks.** The upstream fallback scan required a contiguous `Mozilla Public License` substring in the first few lines, so files that follow Mozilla’s usual `/* … Mozilla Public` / ` * License, v. 2.0 … */` wrap (including after Emacs/vim directive blocks) were warned despite a valid notice. `containsUpstreamLicenseText` in `src/core/license-headers.ts` now normalizes common block-comment continuation prefixes before matching, so forks need not add SPDX solely to satisfy patch lint.
|
|
13
13
|
- **`fireforge test` — `--marionette-port` auto-forward matches toolkit mochitests and mixed suites.** Auto-forward of `--setpref=marionette.port=<n>` previously keyed off a path heuristic that missed `toolkit/content/tests/**` widget HTML tests (no `/mochitest/` segment), so the preflight could use the operator’s port while mach still defaulted to **2828**. Forwarding now runs whenever `--marionette-port` is set unless `--mach-arg` explicitly includes `--flavor=xpcshell` / `xpcshell-tests` (the pref is unused there). `isMarionetteFlavor` also treats `toolkit/content/tests/` paths as Marionette-relevant unless they sit under `/tests/xpcshell/`, for consistency with other callers of that helper.
|
|
14
14
|
|
|
15
|
+
### Compatibility
|
|
16
|
+
|
|
17
|
+
- **`furnace create --with-tests` defaults to `browser-chrome` again** (not `mochikit`, which was the default after the `--test-style` split). Forks whose top-level chrome document has no `tabbrowser` should pass **`--test-style=mochikit`** explicitly. On macOS, toolkit MochiKit / mochitest-chrome-style widget tests can idle until ~370s with no subtests; README documents the tradeoff.
|
|
18
|
+
|
|
15
19
|
### Documentation
|
|
16
20
|
|
|
17
21
|
- **README — mochitest timeouts vs Marionette.** The Test harness section documents long idle timeouts (~370s, `TEST_END: TIMEOUT`) on fork custom chrome, `--marionette-port` behaviour with xpcshell flavor, and pointers to fork-side prefs and investigation (for example Hominis `AGENT_RULES.md`).
|
|
22
|
+
- **README — default test harness and macOS mochitest-chrome.** The README sections “Picking a test harness for `furnace create`”, “Test harness options”, and “Known upstream build issues” describe the browser-chrome default, macOS single-process idle timeout, explicit `--test-style=mochikit`, and `--with-tests` + `--xpcshell` resolution.
|
|
18
23
|
|
|
19
24
|
## 0.18.0
|
|
20
25
|
|
package/README.md
CHANGED
|
@@ -59,6 +59,8 @@ Your project now has `fireforge.json`, an `engine/` directory with Firefox sourc
|
|
|
59
59
|
|
|
60
60
|
- **macOS 15 (Darwin 25+) — `gecko-profiler` bindgen error `cannot find type _CharT in this scope`.** An Apple toolchain update changed `std::__CharT_pointer` to `_CharT_pointer` in the libc++ headers Firefox's bindgen walks, so `toolkit/library/rust/target-objects` fails during `mach build` even on a clean `fireforge bootstrap`. This is an upstream Firefox issue, not a FireForge bug. Two workarounds: pin Xcode's command line tools to a pre-September-2025 release via `xcode-select --install` / [Apple developer downloads](https://developer.apple.com/download/all/), or apply a one-line bindgen-basic-string-workaround patch (a downstream consumer may ship one in its patch queue). If you interrupt the resulting `fireforge build` and re-run `fireforge doctor`, the download/engine state is unaffected — the failure is isolated to the Rust compile phase.
|
|
61
61
|
|
|
62
|
+
- **macOS (including Apple Silicon) — toolkit / MochiKit widget tests idle until ~370s (`TEST_END: TIMEOUT`, no subtests).** The **mochitest-chrome** flavor used for `toolkit/content/tests/widgets/test_*.html` runs **single-process** (`e10s: false`), which interacts badly with headed or headless compositing (for example SWGL) in some setups. Prefer **`furnace create --with-tests`** (defaults to **`browser-chrome`**, multi-process) for interactive chrome coverage, or place tests alongside your fork's browser modules (for example `engine/browser/modules/<fork>/test/`). If you must use **`--test-style=mochikit`**, expect possible hangs on macOS. Details: [Picking a test harness for `furnace create`](#picking-a-test-harness-for-furnace-create), [Test harness options](#test-harness-options).
|
|
63
|
+
|
|
62
64
|
### Workflow Overview
|
|
63
65
|
|
|
64
66
|
1. Make changes inside the `engine/` directory.
|
|
@@ -417,15 +419,17 @@ The packaging-verification test that `--with-tests` scaffolds is what FireForge
|
|
|
417
419
|
|
|
418
420
|
### Picking a test harness for `furnace create`
|
|
419
421
|
|
|
420
|
-
`furnace create --with-tests` defaults to a
|
|
422
|
+
`furnace create --with-tests` defaults to a **browser-chrome** mochitest: `browser_<binary>_<tag>.js` under `engine/browser/base/content/test/<binary-name>/`, registered via `browser.toml` (and `browser/base/moz.build` when the scaffolder appends there). Use this when the component participates in real browser chrome (tabs, `gBrowser`, and similar).
|
|
423
|
+
|
|
424
|
+
**MochiKit** (`--test-style=mochikit`) is opt-in: it emits `test_<tag>.html` under `engine/toolkit/content/tests/widgets/`, loads the module via `chrome://global/`, and does not need a `tabbrowser` — so it is the right choice for bespoke chrome documents that omit the upstream tab strip. On **macOS**, that harness can hit a long idle timeout (see [Known upstream build issues](#known-upstream-build-issues)); prefer browser-chrome tests when your fork has a normal tabbed window.
|
|
421
425
|
|
|
422
426
|
Three styles are available via `--test-style`:
|
|
423
427
|
|
|
424
|
-
| Style | When to use
|
|
425
|
-
| ---------------- |
|
|
426
|
-
| `
|
|
427
|
-
| `
|
|
428
|
-
| `xpcshell` | Storage-layer, observer-driven, or ESM-loading code. Headless, no tabbrowser. Emits `test_<name>_module_loads.js` + `xpcshell.toml` (registration in `XPCSHELL_TESTS_MANIFESTS` is left to the operator).
|
|
428
|
+
| Style | When to use |
|
|
429
|
+
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
430
|
+
| `browser-chrome` | **Default** with `--with-tests`. Interactive chrome, tab strip, `gBrowser`. Requires a working `tabbrowser`. Emits `browser_<bin>_<tag>.js` and registers via `browser.toml` / `browser/base/moz.build`. |
|
|
431
|
+
| `mochikit` | Pure-UI custom elements on forks **without** a `tabbrowser`. Emits `test_<tag>.html` under `toolkit/content/tests/widgets/`. May be unreliable on macOS (mochitest-chrome / single-process). |
|
|
432
|
+
| `xpcshell` | Storage-layer, observer-driven, or ESM-loading code. Headless, no tabbrowser. Emits `test_<name>_module_loads.js` + `xpcshell.toml` (registration in `XPCSHELL_TESTS_MANIFESTS` is left to the operator). |
|
|
429
433
|
|
|
430
434
|
`--xpcshell` is preserved as an alias for `--test-style=xpcshell`; conflicting flag combinations (`--xpcshell --test-style=mochikit`) are rejected.
|
|
431
435
|
|
|
@@ -628,7 +632,7 @@ Set this in `furnace.json` to extend the list (forks with additional platform pr
|
|
|
628
632
|
|
|
629
633
|
### Test harness options
|
|
630
634
|
|
|
631
|
-
`fireforge furnace create --with-tests` scaffolds a **browser-chrome mochitest
|
|
635
|
+
`fireforge furnace create --with-tests` scaffolds a **browser-chrome mochitest** by default. Use this when the component renders UI that depends on the tab strip (`openLinkIn` → `URILoadingHelper`, `gBrowser`, etc.). On **macOS**, avoid relying on **`--test-style=mochikit`** (toolkit `test_*.html` under `toolkit/content/tests/widgets/`) for primary chrome/widget coverage: the **mochitest-chrome** flavor runs **single-process** (`e10s: false`) and has been observed to **idle ~370s** with no subtests (headless or headed compositing / SWGL). Prefer browser-chrome tests (multi-process); for forks that organize interactive tests under `engine/browser/modules/<fork>/test/`, extend that tree rather than adding new `test_<tag>.html` scaffolds when browser-chrome is sufficient.
|
|
632
636
|
|
|
633
637
|
`fireforge furnace create --xpcshell` scaffolds an **xpcshell test harness** instead. Use this when the component's code path is storage-only, observer-driven, or module-loading logic that does not touch a `tabbrowser`. xpcshell runs headless without browser chrome, so forks without an upstream tab strip can still cover these paths. The scaffolder writes `test_<name>_packaged.js` + `xpcshell.toml` into `engine/browser/base/content/test/<binary-name>-xpcshell/<component-name>/` and prints a note: registration in `XPCSHELL_TESTS_MANIFESTS` is the operator's call (the moz.build that should own the entry depends on where the component actually lives). `fireforge register <path>/xpcshell.toml` surfaces the same guidance when run directly rather than silently routing to a browser.toml-shaped advice.
|
|
634
638
|
|
|
@@ -636,13 +640,11 @@ The scaffolded xpcshell test is a **packaging probe**, not a module-load test. L
|
|
|
636
640
|
|
|
637
641
|
xpcshell has a chrome-URI boundary that is worth knowing before writing assertions: `chrome://global/*` (toolkit chrome) IS registered and resolvable from the harness, but `chrome://browser/*` (browser chrome) is NOT — even when `firefox-appdir = "browser"` is set in the xpcshell.toml, the manifest set xpcshell loads lags what the real browser loads, so `NetUtil.asyncFetch("chrome://browser/content/…")` can still fail with `NS_ERROR_FILE_NOT_FOUND` against an artifact that IS present in `obj-*/dist/`. Assertions that need browser chrome URIs belong in a browser-chrome mochitest (`furnace create --test-style=browser-chrome`).
|
|
638
642
|
|
|
639
|
-
|
|
643
|
+
If you pass **`--with-tests` and `--xpcshell` together**, FireForge resolves the harness to **xpcshell only** (`--xpcshell` takes precedence). To get the default browser-chrome mochitest as well, run a second `furnace create` with `--with-tests` only or add the browser test files manually.
|
|
640
644
|
|
|
641
645
|
### Mochitest stalls and `--marionette-port`
|
|
642
646
|
|
|
643
|
-
When you pass `--marionette-port <n>`, FireForge uses that port for the stale-listener probe and for
|
|
644
|
-
|
|
645
|
-
Some forks see mochitests end with **`TEST_END: TIMEOUT`** after on the order of **370 seconds** with **no harness output** — including runs where mozinfo reports `headless: false`, so the failure is not explained by SWGL headless alone. When tests wait on custom chrome (for example a fork tile shell that never sets a `_readyForTesting` gate), the hang is **engine-side**; use your fork’s test docs and `browser.toml` defaults (for Hominis-style trees, see the fork’s `AGENT_RULES.md` for `hominis.testing.*` prefs). Operationally: ensure Marionette port **2828** is free, pass **`--marionette-port`** when you use a non-default port (FireForge keeps preflight and mach consistent as above), and narrow the failure with `--doctor` or by splitting a lighter smoke test that does not depend on full chrome init.
|
|
647
|
+
When you pass `--marionette-port <n>`, FireForge uses that port for the **stale-listener probe** (before `mach test` runs) and for **`--doctor`**, forwards **`--setpref=marionette.port=<n>`** to `mach test` so the **browser Marionette listener** binds that port, and forwards **`--marionette=127.0.0.1:<n>`** so the **mochitest harness client** connects to the same endpoint (the client otherwise defaults to `127.0.0.1:2828`). If you already pass **`--mach-arg=--marionette=...`**, FireForge does not add a second client flag. If **`--mach-arg`** already forwards the port via **`--marionette-port=...`** or **`--setpref=marionette.port=...`**, FireForge skips duplicating the setpref (existing behaviour). The exception is an explicit **`--mach-arg --flavor=xpcshell`** (or **`--flavor=xpcshell-tests`**): that harness does not use the browser Marionette path, so FireForge skips both auto-forwarded flags and logs a short notice instead. Toolkit widget mochitests under `toolkit/content/tests/` (for example `test_*.html` next to `browser_*.js` suites) therefore stay aligned with the probe without duplicating **`--mach-arg=--setpref=marionette.port=…`**.
|
|
646
648
|
|
|
647
649
|
### Stale-build preflight on `fireforge test`
|
|
648
650
|
|
|
@@ -5,14 +5,14 @@ export type ResolvedTestStyle = 'mochikit' | 'browser-chrome' | 'xpcshell' | 'no
|
|
|
5
5
|
* Collapses `--with-tests`, `--xpcshell`, and `--test-style` into the single
|
|
6
6
|
* scaffold dispatch used inside the mutation phase.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Invariants:
|
|
9
9
|
* - `--xpcshell` alone is equivalent to `--test-style=xpcshell`.
|
|
10
|
-
* - `--with-tests` alone (no `--test-style`)
|
|
11
|
-
* (
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* - `--with-tests` alone (no `--test-style`) defaults to `browser-chrome`
|
|
11
|
+
* (multi-process mochitest; reliable on macOS for interactive chrome).
|
|
12
|
+
* Forks whose chrome document has no `tabbrowser` should pass
|
|
13
|
+
* `--test-style=mochikit` explicitly.
|
|
14
|
+
* - When both `--xpcshell` and `--with-tests` are set, `--xpcshell` wins
|
|
15
|
+
* (resolved style is `xpcshell` only).
|
|
16
16
|
* @throws InvalidArgumentError when flags conflict.
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveTestStyle(options: FurnaceCreateOptions): ResolvedTestStyle;
|
|
@@ -204,14 +204,14 @@ async function writeComponentFiles(componentDir, componentName, className, descr
|
|
|
204
204
|
* Collapses `--with-tests`, `--xpcshell`, and `--test-style` into the single
|
|
205
205
|
* scaffold dispatch used inside the mutation phase.
|
|
206
206
|
*
|
|
207
|
-
*
|
|
207
|
+
* Invariants:
|
|
208
208
|
* - `--xpcshell` alone is equivalent to `--test-style=xpcshell`.
|
|
209
|
-
* - `--with-tests` alone (no `--test-style`)
|
|
210
|
-
* (
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
209
|
+
* - `--with-tests` alone (no `--test-style`) defaults to `browser-chrome`
|
|
210
|
+
* (multi-process mochitest; reliable on macOS for interactive chrome).
|
|
211
|
+
* Forks whose chrome document has no `tabbrowser` should pass
|
|
212
|
+
* `--test-style=mochikit` explicitly.
|
|
213
|
+
* - When both `--xpcshell` and `--with-tests` are set, `--xpcshell` wins
|
|
214
|
+
* (resolved style is `xpcshell` only).
|
|
215
215
|
* @throws InvalidArgumentError when flags conflict.
|
|
216
216
|
*/
|
|
217
217
|
export function resolveTestStyle(options) {
|
|
@@ -226,7 +226,7 @@ export function resolveTestStyle(options) {
|
|
|
226
226
|
if (xpcshellFlag)
|
|
227
227
|
return 'xpcshell';
|
|
228
228
|
if (withTests)
|
|
229
|
-
return '
|
|
229
|
+
return 'browser-chrome';
|
|
230
230
|
return 'none';
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
@@ -71,9 +71,9 @@ function registerFurnaceInfoCommands(furnace, context) {
|
|
|
71
71
|
.option('-d, --description <desc>', 'Component description')
|
|
72
72
|
.option('--localized', 'Include Fluent l10n support')
|
|
73
73
|
.option('--no-register', 'Skip customElements.js registration')
|
|
74
|
-
.option('--with-tests', 'Scaffold a test harness (defaults to
|
|
74
|
+
.option('--with-tests', 'Scaffold a test harness (defaults to browser-chrome; use --test-style=mochikit for tabbrowser-less chrome — may be flaky on macOS)')
|
|
75
75
|
.option('--xpcshell', 'Scaffold an xpcshell test harness (for storage-layer code on forks without tabbrowser); equivalent to --test-style=xpcshell. Note: xpcshell resolves chrome://global/* URIs but not chrome://browser/* — use --test-style=browser-chrome for browser-chrome-dependent tests.')
|
|
76
|
-
.option('--test-style <style>',
|
|
76
|
+
.option('--test-style <style>', 'Override the harness written by --with-tests: browser-chrome (default, needs tabbrowser), mochikit (toolkit/widgets, non-tabbrowser chrome), or xpcshell (headless)', (value) => {
|
|
77
77
|
if (value !== 'mochikit' && value !== 'browser-chrome' && value !== 'xpcshell') {
|
|
78
78
|
throw new Error(`--test-style must be one of: mochikit, browser-chrome, xpcshell. Got: "${value}".`);
|
|
79
79
|
}
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { prepareBuildEnvironment } from '../core/build-prepare.js';
|
|
4
4
|
import { getProjectPaths, loadConfig } from '../core/config.js';
|
|
5
5
|
import { buildArtifactMismatchMessage, buildUI, hasBuildArtifacts, hasRunnableBundle, testWithOutput, } from '../core/mach.js';
|
|
6
|
-
import { assertMarionettePortAvailable, extractForwardedMarionettePort, shouldAutoForwardMarionettePortToMach, } from '../core/marionette-port.js';
|
|
6
|
+
import { assertMarionettePortAvailable, extractForwardedMarionettePort, forwardedMachArgsIncludeMarionetteClient, shouldAutoForwardMarionettePortToMach, } from '../core/marionette-port.js';
|
|
7
7
|
import { formatMarionettePreflightLine, reportMarionettePreflight, runMarionettePreflight, } from '../core/marionette-preflight.js';
|
|
8
8
|
import { checkStaleBuildForTest, formatStaleBuildWarning } from '../core/test-stale-check.js';
|
|
9
9
|
import { operatorAlreadySetAppPath, resolveXpcshellAppdirArg, } from '../core/xpcshell-appdir.js';
|
|
@@ -320,17 +320,21 @@ export async function testCommand(projectRoot, testPaths, options = {}) {
|
|
|
320
320
|
extraArgs.push(...options.machArg);
|
|
321
321
|
}
|
|
322
322
|
// Auto-forward the Marionette port to mach when `--marionette-port` is
|
|
323
|
-
// set.
|
|
324
|
-
// listener
|
|
325
|
-
//
|
|
323
|
+
// set. `--setpref=marionette.port=<n>` configures where the browser
|
|
324
|
+
// listener binds; `--marionette=127.0.0.1:<n>` tells the mochitest harness
|
|
325
|
+
// client to connect there (default client is 127.0.0.1:2828). xpcshell
|
|
326
|
+
// ignores both for browser Marionette.
|
|
326
327
|
//
|
|
327
|
-
// Skip forwarding when the operator already supplied an equivalent
|
|
328
|
-
// via `--mach-arg` — duplicates would be confusing without changing
|
|
328
|
+
// Skip setpref forwarding when the operator already supplied an equivalent
|
|
329
|
+
// arg via `--mach-arg` — duplicates would be confusing without changing
|
|
329
330
|
// semantics. Skip when mach args explicitly request `--flavor=xpcshell`
|
|
330
331
|
// (or `xpcshell-tests`): the preflight still honours `--marionette-port`,
|
|
331
332
|
// but mach does not use the marionette.port pref on that harness. Any
|
|
332
333
|
// other arg shape still forwards so toolkit widget paths and mixed suites
|
|
333
334
|
// stay aligned with the probe without duplicate `--mach-arg` flags.
|
|
335
|
+
//
|
|
336
|
+
// Skip auto `--marionette=...` when `--mach-arg` already includes a client
|
|
337
|
+
// `--marionette=...` (or two-token `--marionette host:port`).
|
|
334
338
|
if (options.marionettePort !== undefined) {
|
|
335
339
|
const operatorAlreadyForwarded = forwardedPort !== undefined;
|
|
336
340
|
const machArgs = options.machArg ?? [];
|
|
@@ -341,7 +345,11 @@ export async function testCommand(projectRoot, testPaths, options = {}) {
|
|
|
341
345
|
extraArgs.push(`--setpref=marionette.port=${options.marionettePort}`);
|
|
342
346
|
}
|
|
343
347
|
else {
|
|
344
|
-
info(`--marionette-port=${options.marionettePort} applied to the preflight probe, but --flavor=xpcshell is set — mach is not auto-configured with --setpref=marionette.port (xpcshell ignores
|
|
348
|
+
info(`--marionette-port=${options.marionettePort} applied to the preflight probe, but --flavor=xpcshell is set — mach is not auto-configured with --setpref=marionette.port or --marionette (xpcshell ignores the browser Marionette path). Pass --mach-arg --setpref=marionette.port=${options.marionettePort} explicitly if you still need mach to see the port.`);
|
|
349
|
+
}
|
|
350
|
+
if (shouldAutoForwardMarionettePortToMach(machArgs) &&
|
|
351
|
+
!forwardedMachArgsIncludeMarionetteClient(machArgs)) {
|
|
352
|
+
extraArgs.push(`--marionette=127.0.0.1:${options.marionettePort}`);
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
355
|
// xpcshell appdir auto-injection — see src/core/xpcshell-appdir.ts for the
|
|
@@ -409,7 +417,7 @@ export function registerTest(program, { getProjectRoot, withErrorHandling }) {
|
|
|
409
417
|
acc.push(value);
|
|
410
418
|
return acc;
|
|
411
419
|
}, [])
|
|
412
|
-
.option('--marionette-port <port>', 'Override the Marionette control port (default 2828) for the stale-browser probe, the --doctor preflight, and (unless --mach-arg includes --flavor=xpcshell)
|
|
420
|
+
.option('--marionette-port <port>', 'Override the Marionette control port (default 2828) for the stale-browser probe, the --doctor preflight, and (unless --mach-arg includes --flavor=xpcshell) auto-forwarded mach args: --setpref=marionette.port=<n> (browser listener) and --marionette=127.0.0.1:<n> (mochitest client). Omits the client flag when --mach-arg already sets --marionette. Use when 2828 is busy or CI assigns another port.', (raw) => {
|
|
413
421
|
const n = Number.parseInt(raw, 10);
|
|
414
422
|
if (!Number.isFinite(n) || n < 1 || n > 65535) {
|
|
415
423
|
throw new GeneralError(`--marionette-port must be an integer in 1..65535 (got "${raw}")`);
|
|
@@ -64,6 +64,15 @@ export declare function assertMarionettePortAvailable(port?: number, options?: {
|
|
|
64
64
|
* `undefined`.
|
|
65
65
|
*/
|
|
66
66
|
export declare function extractForwardedMarionettePort(machArgs: string[]): number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* True when forwarded mach args already set a Marionette **client** address
|
|
69
|
+
* for mach/mochitest (`--marionette=host:port` or `--marionette host:port`).
|
|
70
|
+
* Used only to avoid duplicating FireForge's auto-injected
|
|
71
|
+
* `--marionette=127.0.0.1:<n>`; this is not a full URL validator (IPv6, etc.).
|
|
72
|
+
*
|
|
73
|
+
* Deliberately does **not** treat `--marionette-port` as a client endpoint.
|
|
74
|
+
*/
|
|
75
|
+
export declare function forwardedMachArgsIncludeMarionetteClient(machArgs: string[]): boolean;
|
|
67
76
|
/**
|
|
68
77
|
* True when forwarded mach args explicitly select the xpcshell harness.
|
|
69
78
|
* Used so `--marionette-port` auto-forward skips `--setpref=marionette.port`
|
|
@@ -71,11 +80,12 @@ export declare function extractForwardedMarionettePort(machArgs: string[]): numb
|
|
|
71
80
|
*/
|
|
72
81
|
export declare function hasExplicitXpcshellFlavor(machArgs: string[]): boolean;
|
|
73
82
|
/**
|
|
74
|
-
* Whether `fireforge test` should append `--setpref=marionette.port=<n>`
|
|
75
|
-
* the operator passed `--marionette-port`.
|
|
76
|
-
* an explicit `--flavor=xpcshell` /
|
|
77
|
-
* under `toolkit/content/tests/`
|
|
78
|
-
* but still launch a
|
|
83
|
+
* Whether `fireforge test` should append `--setpref=marionette.port=<n>` and
|
|
84
|
+
* `--marionette=127.0.0.1:<n>` when the operator passed `--marionette-port`.
|
|
85
|
+
* Forwards for every harness except an explicit `--flavor=xpcshell` /
|
|
86
|
+
* `xpcshell-tests` (toolkit widget mochitests under `toolkit/content/tests/`
|
|
87
|
+
* do not match the older path-only heuristic but still launch a
|
|
88
|
+
* Marionette-driven browser).
|
|
79
89
|
*/
|
|
80
90
|
export declare function shouldAutoForwardMarionettePortToMach(machArgs: string[]): boolean;
|
|
81
91
|
/**
|
|
@@ -88,7 +98,7 @@ export declare function shouldAutoForwardMarionettePortToMach(machArgs: string[]
|
|
|
88
98
|
* Note: `fireforge test` auto-forward of `--marionette-port` to mach uses
|
|
89
99
|
* {@link shouldAutoForwardMarionettePortToMach} (mach-arg flavor gate) rather
|
|
90
100
|
* than this function alone, so toolkit paths without `/mochitest/` still get
|
|
91
|
-
* the pref when appropriate.
|
|
101
|
+
* the listener pref and harness `--marionette=127.0.0.1:<n>` when appropriate.
|
|
92
102
|
*
|
|
93
103
|
* @param testPaths - Engine-relative paths after `stripEnginePrefix`.
|
|
94
104
|
* @param machArgs - Forwarded mach args (post-`--mach-arg`).
|
|
@@ -260,6 +260,31 @@ export function extractForwardedMarionettePort(machArgs) {
|
|
|
260
260
|
}
|
|
261
261
|
return undefined;
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* True when forwarded mach args already set a Marionette **client** address
|
|
265
|
+
* for mach/mochitest (`--marionette=host:port` or `--marionette host:port`).
|
|
266
|
+
* Used only to avoid duplicating FireForge's auto-injected
|
|
267
|
+
* `--marionette=127.0.0.1:<n>`; this is not a full URL validator (IPv6, etc.).
|
|
268
|
+
*
|
|
269
|
+
* Deliberately does **not** treat `--marionette-port` as a client endpoint.
|
|
270
|
+
*/
|
|
271
|
+
export function forwardedMachArgsIncludeMarionetteClient(machArgs) {
|
|
272
|
+
const valueLooksLikeHostPort = (token) => /:[0-9]+$/.test(token) || /^\[[^]]+\]:[0-9]+$/.test(token);
|
|
273
|
+
for (let i = 0; i < machArgs.length; i++) {
|
|
274
|
+
const arg = machArgs[i];
|
|
275
|
+
if (arg === undefined)
|
|
276
|
+
continue;
|
|
277
|
+
if (arg.startsWith('--marionette=') && !arg.startsWith('--marionette-port=')) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
if (arg === '--marionette') {
|
|
281
|
+
const next = machArgs[i + 1];
|
|
282
|
+
if (next !== undefined && valueLooksLikeHostPort(next))
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
263
288
|
/**
|
|
264
289
|
* True when forwarded mach args explicitly select the xpcshell harness.
|
|
265
290
|
* Used so `--marionette-port` auto-forward skips `--setpref=marionette.port`
|
|
@@ -273,11 +298,12 @@ export function hasExplicitXpcshellFlavor(machArgs) {
|
|
|
273
298
|
return false;
|
|
274
299
|
}
|
|
275
300
|
/**
|
|
276
|
-
* Whether `fireforge test` should append `--setpref=marionette.port=<n>`
|
|
277
|
-
* the operator passed `--marionette-port`.
|
|
278
|
-
* an explicit `--flavor=xpcshell` /
|
|
279
|
-
* under `toolkit/content/tests/`
|
|
280
|
-
* but still launch a
|
|
301
|
+
* Whether `fireforge test` should append `--setpref=marionette.port=<n>` and
|
|
302
|
+
* `--marionette=127.0.0.1:<n>` when the operator passed `--marionette-port`.
|
|
303
|
+
* Forwards for every harness except an explicit `--flavor=xpcshell` /
|
|
304
|
+
* `xpcshell-tests` (toolkit widget mochitests under `toolkit/content/tests/`
|
|
305
|
+
* do not match the older path-only heuristic but still launch a
|
|
306
|
+
* Marionette-driven browser).
|
|
281
307
|
*/
|
|
282
308
|
export function shouldAutoForwardMarionettePortToMach(machArgs) {
|
|
283
309
|
return !hasExplicitXpcshellFlavor(machArgs);
|
|
@@ -292,7 +318,7 @@ export function shouldAutoForwardMarionettePortToMach(machArgs) {
|
|
|
292
318
|
* Note: `fireforge test` auto-forward of `--marionette-port` to mach uses
|
|
293
319
|
* {@link shouldAutoForwardMarionettePortToMach} (mach-arg flavor gate) rather
|
|
294
320
|
* than this function alone, so toolkit paths without `/mochitest/` still get
|
|
295
|
-
* the pref when appropriate.
|
|
321
|
+
* the listener pref and harness `--marionette=127.0.0.1:<n>` when appropriate.
|
|
296
322
|
*
|
|
297
323
|
* @param testPaths - Engine-relative paths after `stripEnginePrefix`.
|
|
298
324
|
* @param machArgs - Forwarded mach args (post-`--mach-arg`).
|
|
@@ -318,11 +318,12 @@ export interface TestOptions {
|
|
|
318
318
|
machArg?: string[];
|
|
319
319
|
/**
|
|
320
320
|
* Override the Marionette control port (default 2828) used by the
|
|
321
|
-
* stale-browser probe, the `--doctor` preflight, and
|
|
322
|
-
* `--
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
321
|
+
* stale-browser probe, the `--doctor` preflight, and (unless mach args set
|
|
322
|
+
* `--flavor=xpcshell` / `xpcshell-tests`) auto-forwarded mach flags:
|
|
323
|
+
* `--setpref=marionette.port=<n>` for the browser listener and
|
|
324
|
+
* `--marionette=127.0.0.1:<n>` for the mochitest harness client. Omits the
|
|
325
|
+
* client flag when `--mach-arg` already passes `--marionette`. Set when a
|
|
326
|
+
* stale process holds the default port or CI uses another port.
|
|
326
327
|
*/
|
|
327
328
|
marionettePort?: number;
|
|
328
329
|
}
|
|
@@ -425,15 +426,15 @@ export interface FurnaceCreateOptions {
|
|
|
425
426
|
/**
|
|
426
427
|
* Test harness style to scaffold when `--with-tests` is set.
|
|
427
428
|
*
|
|
428
|
-
* - `
|
|
429
|
-
* test
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
* `
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
429
|
+
* - `browser-chrome` (default when `--with-tests` is set without
|
|
430
|
+
* `--test-style`) — browser mochitest scaffold; requires a working
|
|
431
|
+
* `tabbrowser`. Prefer this for interactive chrome/widget coverage
|
|
432
|
+
* (including on macOS).
|
|
433
|
+
* - `mochikit` — opt-in MochiKit test at
|
|
434
|
+
* `engine/toolkit/content/tests/widgets/test_<tag>.html` that loads
|
|
435
|
+
* the component via `chrome://global/`. Use when the top-level chrome
|
|
436
|
+
* document lacks a `tabbrowser`; on macOS the toolkit mochitest-chrome
|
|
437
|
+
* flavor can be unreliable (long idle timeout).
|
|
437
438
|
* - `xpcshell` — equivalent to setting `--xpcshell`; headless, storage-only.
|
|
438
439
|
*/
|
|
439
440
|
testStyle?: 'mochikit' | 'browser-chrome' | 'xpcshell';
|