-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adds binaryArgs to pass additional flags to Firefox binary #1563
Changes from 8 commits
420b395
f6cd95f
7a8d346
0076326
baa8cab
14af123
117553b
28cb262
41a85b1
22753b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ export type FirefoxRunnerParams = {| | |
'no-remote'?: boolean, | ||
'foreground'?: boolean, | ||
'listen': number, | ||
'binary-args'?: Array<string> | string, | ||
'args'?: Array<string> | string, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You cannot simply rename Revert all changes in this file (and use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so just keep args only for cli? all other code will remain as is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The external interface of |
||
'env'?: { | ||
[key: string]: string | ||
}, | ||
|
@@ -122,7 +122,6 @@ export type FirefoxRunOptions = {| | |
fxRunner?: FirefoxRunnerFn, | ||
findRemotePort?: RemotePortFinderFn, | ||
firefoxBinary?: string, | ||
binaryArgs?: Array<string>, | ||
args?: Array<any>, | ||
|}; | ||
|
||
|
@@ -134,7 +133,7 @@ export async function run( | |
{ | ||
fxRunner = defaultFxRunner, | ||
findRemotePort = defaultRemotePortFinder, | ||
firefoxBinary, binaryArgs, | ||
firefoxBinary, args, | ||
}: FirefoxRunOptions = {} | ||
): Promise<FirefoxInfo> { | ||
|
||
|
@@ -143,9 +142,9 @@ export async function run( | |
const remotePort = await findRemotePort(); | ||
|
||
const results = await fxRunner({ | ||
args, | ||
// if this is falsey, fxRunner tries to find the default one. | ||
'binary': firefoxBinary, | ||
'binary-args': binaryArgs, | ||
// This ensures a new instance of Firefox is created. It has nothing | ||
// to do with the devtools remote debugger. | ||
'no-remote': true, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ describe('util/extension-runners/firefox-desktop', () => { | |
})); | ||
}); | ||
|
||
async function testBinaryArgs(extensionRunnerParams, expectedBinaryArgs) { | ||
async function testArgs(extensionRunnerParams, expectedArgs) { | ||
const {params} = prepareExtensionRunnerParams({ | ||
params: { | ||
...extensionRunnerParams, | ||
|
@@ -172,36 +172,44 @@ describe('util/extension-runners/firefox-desktop', () => { | |
params.firefoxApp.run, | ||
sinon.match.any, | ||
sinon.match.has( | ||
'binaryArgs', | ||
sinon.match.array.deepEquals(expectedBinaryArgs) | ||
'args', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one should also be |
||
sinon.match.array.deepEquals(expectedArgs) | ||
) | ||
); | ||
} | ||
|
||
it('passes -jsconsole when --browser-console is specified', async () => { | ||
await testBinaryArgs({ | ||
await testArgs({ | ||
browserConsole: true, | ||
}, [ | ||
'-jsconsole', | ||
]); | ||
}); | ||
|
||
it('passes single url parameter to Firefox when specified', async () => { | ||
await testBinaryArgs({ | ||
await testArgs({ | ||
startUrl: 'url1', | ||
}, [ | ||
'--url', 'url1', | ||
]); | ||
}); | ||
|
||
it('passes multiple url parameters to Firefox when specified', async () => { | ||
await testBinaryArgs({ | ||
await testArgs({ | ||
startUrl: ['url1', 'url2'], | ||
}, [ | ||
'--url', 'url1', '--url', 'url2', | ||
]); | ||
}); | ||
|
||
it('passes args to Firefox', async () => { | ||
await testArgs({ | ||
args: ['-headless=true', '-jsconsole'], | ||
}, [ | ||
'-headless=true', '-jsconsole', | ||
]); | ||
}); | ||
|
||
it('passes a custom Firefox profile when specified', async () => { | ||
const {params} = prepareExtensionRunnerParams({ | ||
params: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this version of the PR the arguments are still prepended instead of appended. Restore the
binaryArgs
variable and usebinaryArgs.push(...args);
before passing it tofirefoxApp.run
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, looks like I misunderstood you. Does it look fine now - 28cb262?