Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/cmd/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type CmdRunParams = {|
startUrl?: Array<string>,
target?: Array<string>,
args?: Array<string>,
firefoxPreview: Array<string>,

// Android CLI options.
adbBin?: string,
Expand Down Expand Up @@ -89,6 +90,7 @@ export default async function run(
startUrl,
target,
args,
firefoxPreview = [],
// Android CLI options.
adbBin,
adbHost,
Expand Down Expand Up @@ -126,7 +128,12 @@ export default async function run(

// Create an alias for --pref since it has been transformed into an
// object containing one or more preferences.
const customPrefs = pref;
const customPrefs: FirefoxPreferences = {...pref};
if (firefoxPreview.includes('mv3')) {
log.info('Configuring Firefox preferences for Manifest V3');
customPrefs['extensions.manifestV3.enabled'] = true;
}

const manifestData = await getValidatedManifest(sourceDir);

const profileDir = firefoxProfile || chromiumProfile;
Expand Down
6 changes: 6 additions & 0 deletions src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,12 @@ Example: $0 --help run.
demandOption: false,
type: 'array',
},
'firefox-preview': {
describe: 'Turn on developer preview features in Firefox',
demandOption: false,
default: ['mv3'],
type: 'array',
},
// Firefox for Android CLI options.
'adb-bin': {
describe: 'Specify a custom path to the adb binary',
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test-cmd/test.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,22 @@ describe('run', () => {
);
});
});

describe('firefox-preview', () => {
it('supports the MV3 preview', async () => {
const cmd = await prepareRun();
const runOptions = {
firefoxPreview: ['mv3'],
};

await cmd.run(runOptions);

sinon.assert.calledOnce(desktopRunnerStub);
const runnerParams = desktopRunnerStub.firstCall.args[0];

assert.deepEqual(runnerParams.customPrefs, {
'extensions.manifestV3.enabled': true,
});
});
});
});
10 changes: 10 additions & 0 deletions tests/unit/test.program.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,16 @@ describe('program.main', () => {
}
});

it('sets the default firefox preview to "mv3"', async () => {
const fakeCommands = fake(commands, {
run: () => Promise.resolve(),
});

await execProgram(['run', '--firefox-preview'], {commands: fakeCommands});

const {firefoxPreview} = fakeCommands.run.firstCall.args[0];
assert.deepEqual(firefoxPreview, ['mv3']);
});
});

describe('program.defaultVersionGetter', () => {
Expand Down