Skip to content

Commit 47d7230

Browse files
committed
feat: web-ext run --pre-install no longer connects to the remote debugger. This allows you to run the extension even if there are problems connecting to the debugger.
1 parent 924a93f commit 47d7230

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/cmd/run.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export default function run(
9898
'--pre-install');
9999
noReload = true;
100100
}
101+
// When not pre-installing the extension, we require a remote
102+
// connection to Firefox.
103+
const requiresRemote = !preInstall;
101104

102105
function createRunner() {
103106
return getValidatedManifest(sourceDir)
@@ -142,19 +145,24 @@ export default function run(
142145
});
143146
})
144147
.then((config) => {
145-
return firefoxClient().then((client) => {
146-
return {client, ...config};
147-
});
148+
if (requiresRemote) {
149+
return firefoxClient().then((client) => {
150+
return {client, ...config};
151+
});
152+
} else {
153+
return config;
154+
}
148155
})
149156
.then((config) => {
150157
return new Promise(
151158
(resolve) => {
152-
const {runner, client} = config;
159+
const {runner} = config;
153160
if (installed) {
154161
log.debug('Not installing as temporary add-on because the ' +
155162
'add-on was already installed');
156163
resolve();
157164
} else {
165+
const {client} = config;
158166
resolve(runner.installAsTemporaryAddon(client));
159167
}
160168
})

tests/test-cmd/test.run.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ describe('run', () => {
182182
});
183183
});
184184

185+
it('will not connect to the debugger when using --pre-install', () => {
186+
const cmd = prepareRun();
187+
const {firefoxClient} = cmd.options;
188+
189+
return cmd.run({preInstall: true}).then(() => {
190+
assert.equal(firefoxClient.called, false);
191+
});
192+
});
193+
185194
it('allows you to opt out of extension reloading', () => {
186195
const cmd = prepareRun();
187196
const {reloadStrategy} = cmd.options;

0 commit comments

Comments
 (0)