web-ext 7.2.0 → 7.3.0

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.
Files changed (70) hide show
  1. package/README.md +2 -2
  2. package/lib/cmd/build.js +18 -36
  3. package/lib/cmd/build.js.map +1 -1
  4. package/lib/cmd/docs.js +1 -0
  5. package/lib/cmd/docs.js.map +1 -1
  6. package/lib/cmd/index.js +3 -5
  7. package/lib/cmd/index.js.map +1 -1
  8. package/lib/cmd/lint.js +28 -17
  9. package/lib/cmd/lint.js.map +1 -1
  10. package/lib/cmd/run.js +19 -23
  11. package/lib/cmd/run.js.map +1 -1
  12. package/lib/cmd/sign.js +80 -47
  13. package/lib/cmd/sign.js.map +1 -1
  14. package/lib/config.js +18 -29
  15. package/lib/config.js.map +1 -1
  16. package/lib/errors.js +8 -18
  17. package/lib/errors.js.map +1 -1
  18. package/lib/extension-runners/base.js +2 -0
  19. package/lib/extension-runners/base.js.map +1 -1
  20. package/lib/extension-runners/chromium.js +36 -62
  21. package/lib/extension-runners/chromium.js.map +1 -1
  22. package/lib/extension-runners/firefox-android.js +65 -102
  23. package/lib/extension-runners/firefox-android.js.map +1 -1
  24. package/lib/extension-runners/firefox-desktop.js +29 -42
  25. package/lib/extension-runners/firefox-desktop.js.map +1 -1
  26. package/lib/extension-runners/index.js +33 -46
  27. package/lib/extension-runners/index.js.map +1 -1
  28. package/lib/firefox/index.js +59 -52
  29. package/lib/firefox/index.js.map +1 -1
  30. package/lib/firefox/package-identifiers.js +2 -0
  31. package/lib/firefox/package-identifiers.js.map +1 -1
  32. package/lib/firefox/preferences.js +14 -15
  33. package/lib/firefox/preferences.js.map +1 -1
  34. package/lib/firefox/rdp-client.js +16 -64
  35. package/lib/firefox/rdp-client.js.map +1 -1
  36. package/lib/firefox/remote.js +15 -30
  37. package/lib/firefox/remote.js.map +1 -1
  38. package/lib/main.js +4 -2
  39. package/lib/main.js.map +1 -1
  40. package/lib/program.js +74 -76
  41. package/lib/program.js.map +1 -1
  42. package/lib/util/adb.js +33 -63
  43. package/lib/util/adb.js.map +1 -1
  44. package/lib/util/artifacts.js +3 -5
  45. package/lib/util/artifacts.js.map +1 -1
  46. package/lib/util/desktop-notifier.js +1 -0
  47. package/lib/util/desktop-notifier.js.map +1 -1
  48. package/lib/util/file-exists.js +1 -2
  49. package/lib/util/file-exists.js.map +1 -1
  50. package/lib/util/file-filter.js +17 -19
  51. package/lib/util/file-filter.js.map +1 -1
  52. package/lib/util/is-directory.js +2 -1
  53. package/lib/util/is-directory.js.map +1 -1
  54. package/lib/util/logger.js +7 -12
  55. package/lib/util/logger.js.map +1 -1
  56. package/lib/util/manifest.js +6 -13
  57. package/lib/util/manifest.js.map +1 -1
  58. package/lib/util/promisify.js +7 -3
  59. package/lib/util/promisify.js.map +1 -1
  60. package/lib/util/stdin.js +2 -0
  61. package/lib/util/stdin.js.map +1 -1
  62. package/lib/util/submit-addon.js +288 -0
  63. package/lib/util/submit-addon.js.map +1 -0
  64. package/lib/util/temp-dir.js +8 -18
  65. package/lib/util/temp-dir.js.map +1 -1
  66. package/lib/util/updates.js +1 -1
  67. package/lib/util/updates.js.map +1 -1
  68. package/lib/watcher.js +14 -9
  69. package/lib/watcher.js.map +1 -1
  70. package/package.json +16 -14
@@ -1,7 +1,10 @@
1
+
2
+
1
3
  /**
2
4
  * This module provide an ExtensionRunner subclass that manage an extension executed
3
5
  * in a Firefox for Android instance.
4
6
  */
7
+
5
8
  import path from 'path';
6
9
  import readline from 'readline';
7
10
  import { withTempDir } from '../util/temp-dir.js';
@@ -20,36 +23,34 @@ const ignoredParams = {
20
23
  preInstall: '--pre-install',
21
24
  startUrl: '--start-url',
22
25
  args: '--args'
23
- }; // Default adbHost to 127.0.0.1 to prevent issues with nodejs 17
26
+ };
27
+
28
+ // Default adbHost to 127.0.0.1 to prevent issues with nodejs 17
24
29
  // (because if not specified adbkit may default to ipv6 while
25
30
  // adb may still only be listening on the ipv4 address),
26
31
  // see https://github.com/mozilla/web-ext/issues/2337.
27
-
28
32
  const DEFAULT_ADB_HOST = '127.0.0.1';
29
-
30
33
  const getIgnoredParamsWarningsMessage = optionName => {
31
34
  return `The Firefox for Android target does not support ${optionName}`;
32
35
  };
33
-
34
36
  /**
35
37
  * Implements an IExtensionRunner which manages a Firefox for Android instance.
36
38
  */
37
39
  export class FirefoxAndroidExtensionRunner {
38
40
  // Wait 3s before the next unix socket discovery loop.
39
- static unixSocketDiscoveryRetryInterval = 3 * 1000; // Wait for at most 3 minutes before giving up.
40
-
41
+ static unixSocketDiscoveryRetryInterval = 3 * 1000;
42
+ // Wait for at most 3 minutes before giving up.
41
43
  static unixSocketDiscoveryMaxTime = 3 * 60 * 1000;
42
-
43
44
  constructor(params) {
44
45
  this.params = params;
45
46
  this.cleanupCallbacks = new Set();
46
47
  this.adbExtensionsPathBySourceDir = new Map();
47
- this.reloadableExtensions = new Map(); // Print warning for not currently supported options (e.g. preInstall,
48
- // cloned profiles, browser console).
48
+ this.reloadableExtensions = new Map();
49
49
 
50
+ // Print warning for not currently supported options (e.g. preInstall,
51
+ // cloned profiles, browser console).
50
52
  this.printIgnoredParamsWarnings();
51
53
  }
52
-
53
54
  async run() {
54
55
  const {
55
56
  adbBin,
@@ -65,77 +66,76 @@ export class FirefoxAndroidExtensionRunner {
65
66
  await this.adbDevicesDiscoveryAndSelect();
66
67
  await this.apkPackagesDiscoveryAndSelect();
67
68
  await this.adbCheckRuntimePermissions();
68
- await this.adbForceStopSelectedPackage(); // Create profile prefs (with enabled remote RDP server), prepare the
69
+ await this.adbForceStopSelectedPackage();
70
+
71
+ // Create profile prefs (with enabled remote RDP server), prepare the
69
72
  // artifacts and temporary directory on the selected device, and
70
73
  // push the profile preferences to the remote profile dir.
74
+ await this.adbPrepareProfileDir();
71
75
 
72
- await this.adbPrepareProfileDir(); // NOTE: running Firefox for Android on the Android Emulator can be
76
+ // NOTE: running Firefox for Android on the Android Emulator can be
73
77
  // pretty slow, we can run the following 3 steps in parallel to speed up
74
78
  // it a bit.
75
-
76
- await Promise.all([// Start Firefox for Android instance if not started yet.
79
+ await Promise.all([
80
+ // Start Firefox for Android instance if not started yet.
77
81
  // (Fennec would run in an temporary profile and so it is explicitly
78
82
  // stopped, Fenix runs on its usual profile and so it may be already
79
83
  // running).
80
- this.adbStartSelectedPackage(), // Build and push to devices all the extension xpis
84
+ this.adbStartSelectedPackage(),
85
+ // Build and push to devices all the extension xpis
81
86
  // and keep track of the xpi built and uploaded by extension sourceDir.
82
- this.buildAndPushExtensions(), // Wait for RDP unix socket file created and
87
+ this.buildAndPushExtensions(),
88
+ // Wait for RDP unix socket file created and
83
89
  // Create an ADB forward connection on a free tcp port
84
- this.adbDiscoveryAndForwardRDPUnixSocket()]); // Connect to RDP socket on the local tcp server, install all the pushed extension
85
- // and keep track of the built and installed extension by extension sourceDir.
90
+ this.adbDiscoveryAndForwardRDPUnixSocket()]);
86
91
 
92
+ // Connect to RDP socket on the local tcp server, install all the pushed extension
93
+ // and keep track of the built and installed extension by extension sourceDir.
87
94
  await this.rdpInstallExtensions();
88
- } // Method exported from the IExtensionRunner interface.
95
+ }
96
+
97
+ // Method exported from the IExtensionRunner interface.
89
98
 
90
99
  /**
91
100
  * Returns the runner name.
92
101
  */
93
-
94
-
95
102
  getName() {
96
103
  return 'Firefox Android';
97
104
  }
105
+
98
106
  /**
99
107
  * Reloads all the extensions, collect any reload error and resolves to
100
108
  * an array composed by a single ExtensionRunnerReloadResult object.
101
109
  */
102
-
103
-
104
110
  async reloadAllExtensions() {
105
111
  const runnerName = this.getName();
106
112
  const reloadErrors = new Map();
107
-
108
113
  for (const {
109
114
  sourceDir
110
115
  } of this.params.extensions) {
111
116
  const [res] = await this.reloadExtensionBySourceDir(sourceDir);
112
-
113
117
  if (res.reloadError instanceof Error) {
114
118
  reloadErrors.set(sourceDir, res.reloadError);
115
119
  }
116
120
  }
117
-
118
121
  if (reloadErrors.size > 0) {
119
122
  return [{
120
123
  runnerName,
121
124
  reloadError: new MultiExtensionsReloadError(reloadErrors)
122
125
  }];
123
126
  }
124
-
125
127
  return [{
126
128
  runnerName
127
129
  }];
128
130
  }
131
+
129
132
  /**
130
133
  * Reloads a single extension, collect any reload error and resolves to
131
134
  * an array composed by a single ExtensionRunnerReloadResult object.
132
135
  */
133
-
134
-
135
136
  async reloadExtensionBySourceDir(extensionSourceDir) {
136
137
  const runnerName = this.getName();
137
138
  const addonId = this.reloadableExtensions.get(extensionSourceDir);
138
-
139
139
  if (!addonId) {
140
140
  return [{
141
141
  sourceDir: extensionSourceDir,
@@ -143,7 +143,6 @@ export class FirefoxAndroidExtensionRunner {
143
143
  runnerName
144
144
  }];
145
145
  }
146
-
147
146
  try {
148
147
  await this.buildAndPushExtension(extensionSourceDir);
149
148
  await this.remoteFirefox.reloadAddon(addonId);
@@ -154,44 +153,41 @@ export class FirefoxAndroidExtensionRunner {
154
153
  runnerName
155
154
  }];
156
155
  }
157
-
158
156
  return [{
159
157
  runnerName,
160
158
  sourceDir: extensionSourceDir
161
159
  }];
162
160
  }
161
+
163
162
  /**
164
163
  * Register a callback to be called when the runner has been exited
165
164
  * (e.g. the Firefox instance exits or the user has requested web-ext
166
165
  * to exit).
167
166
  */
168
-
169
-
170
167
  registerCleanup(fn) {
171
168
  this.cleanupCallbacks.add(fn);
172
169
  }
170
+
173
171
  /**
174
172
  * Exits the runner, by closing the managed Firefox instance.
175
173
  */
176
-
177
-
178
174
  async exit() {
179
175
  const {
180
176
  adbUtils,
181
177
  selectedAdbDevice,
182
178
  selectedArtifactsDir
183
179
  } = this;
184
- this.exiting = true; // If a Firefox for Android instance has been started,
185
- // we should ensure that it has been stopped when we exit.
180
+ this.exiting = true;
186
181
 
182
+ // If a Firefox for Android instance has been started,
183
+ // we should ensure that it has been stopped when we exit.
187
184
  await this.adbForceStopSelectedPackage();
188
-
189
185
  if (selectedArtifactsDir) {
190
186
  log.debug('Cleaning up artifacts directory on the Android device...');
191
187
  await adbUtils.clearArtifactsDir(selectedAdbDevice);
192
- } // Call all the registered cleanup callbacks.
193
-
188
+ }
194
189
 
190
+ // Call all the registered cleanup callbacks.
195
191
  for (const fn of this.cleanupCallbacks) {
196
192
  try {
197
193
  fn();
@@ -199,13 +195,13 @@ export class FirefoxAndroidExtensionRunner {
199
195
  log.error(error);
200
196
  }
201
197
  }
202
- } // Private helper methods.
198
+ }
203
199
 
200
+ // Private helper methods.
204
201
 
205
202
  getDeviceProfileDir() {
206
203
  return `${this.selectedArtifactsDir}/profile`;
207
204
  }
208
-
209
205
  printIgnoredParamsWarnings() {
210
206
  Object.keys(ignoredParams).forEach(ignoredParam => {
211
207
  if (this.params[ignoredParam]) {
@@ -213,7 +209,6 @@ export class FirefoxAndroidExtensionRunner {
213
209
  }
214
210
  });
215
211
  }
216
-
217
212
  async adbDevicesDiscoveryAndSelect() {
218
213
  const {
219
214
  adbUtils
@@ -224,30 +219,24 @@ export class FirefoxAndroidExtensionRunner {
224
219
  let devices = [];
225
220
  log.debug('Listing android devices');
226
221
  devices = await adbUtils.discoverDevices();
227
-
228
222
  if (devices.length === 0) {
229
223
  throw new UsageError('No Android device found through ADB. ' + 'Make sure the device is connected and USB debugging is enabled.');
230
224
  }
231
-
232
225
  if (!adbDevice) {
233
226
  const devicesMsg = devices.map(dev => ` - ${dev}`).join('\n');
234
227
  log.info(`\nAndroid devices found:\n${devicesMsg}`);
235
228
  throw new UsageError('Select an android device using --android-device=<name>');
236
229
  }
237
-
238
230
  const foundDevices = devices.filter(device => {
239
231
  return device === adbDevice;
240
232
  });
241
-
242
233
  if (foundDevices.length === 0) {
243
234
  const devicesMsg = JSON.stringify(devices);
244
235
  throw new UsageError(`Android device ${adbDevice} was not found in list: ${devicesMsg}`);
245
236
  }
246
-
247
237
  this.selectedAdbDevice = foundDevices[0];
248
238
  log.info(`Selected ADB device: ${this.selectedAdbDevice}`);
249
239
  }
250
-
251
240
  async apkPackagesDiscoveryAndSelect() {
252
241
  const {
253
242
  adbUtils,
@@ -255,43 +244,35 @@ export class FirefoxAndroidExtensionRunner {
255
244
  params: {
256
245
  firefoxApk
257
246
  }
258
- } = this; // Discovery and select a Firefox for Android version.
259
-
247
+ } = this;
248
+ // Discovery and select a Firefox for Android version.
260
249
  const packages = await adbUtils.discoverInstalledFirefoxAPKs(selectedAdbDevice, firefoxApk);
261
-
262
250
  if (packages.length === 0) {
263
251
  throw new UsageError('No Firefox packages were found on the selected Android device');
264
252
  }
265
-
266
253
  const pkgsListMsg = pkgs => {
267
254
  return pkgs.map(pkg => ` - ${pkg}`).join('\n');
268
255
  };
269
-
270
256
  if (!firefoxApk) {
271
257
  log.info(`\nPackages found:\n${pkgsListMsg(packages)}`);
272
-
273
258
  if (packages.length > 1) {
274
259
  throw new UsageError('Select one of the packages using --firefox-apk');
275
- } // If only one APK has been found, select it even if it has not been
276
- // specified explicitly on the comment line.
277
-
260
+ }
278
261
 
262
+ // If only one APK has been found, select it even if it has not been
263
+ // specified explicitly on the comment line.
279
264
  this.selectedFirefoxApk = packages[0];
280
265
  log.info(`Selected Firefox for Android APK: ${this.selectedFirefoxApk}`);
281
266
  return;
282
267
  }
283
-
284
268
  const filteredPackages = packages.filter(line => line === firefoxApk);
285
-
286
269
  if (filteredPackages.length === 0) {
287
270
  const pkgsList = pkgsListMsg(filteredPackages);
288
271
  throw new UsageError(`Package ${firefoxApk} was not found in list: ${pkgsList}`);
289
272
  }
290
-
291
273
  this.selectedFirefoxApk = filteredPackages[0];
292
274
  log.debug(`Selected Firefox for Android APK: ${this.selectedFirefoxApk}`);
293
275
  }
294
-
295
276
  async adbForceStopSelectedPackage() {
296
277
  const {
297
278
  adbUtils,
@@ -301,7 +282,6 @@ export class FirefoxAndroidExtensionRunner {
301
282
  log.info(`Stopping existing instances of ${selectedFirefoxApk}...`);
302
283
  await adbUtils.amForceStopAPK(selectedAdbDevice, selectedFirefoxApk);
303
284
  }
304
-
305
285
  async adbCheckRuntimePermissions() {
306
286
  const {
307
287
  adbUtils,
@@ -310,24 +290,20 @@ export class FirefoxAndroidExtensionRunner {
310
290
  } = this;
311
291
  log.debug(`Discovering Android version for ${selectedAdbDevice}...`);
312
292
  const androidVersion = await adbUtils.getAndroidVersionNumber(selectedAdbDevice);
313
-
314
293
  if (typeof androidVersion !== 'number' || Number.isNaN(androidVersion)) {
315
294
  throw new WebExtError(`Invalid Android version: ${androidVersion}`);
316
295
  }
317
-
318
296
  log.debug(`Detected Android version ${androidVersion}`);
319
-
320
297
  if (androidVersion < 23) {
321
298
  return;
322
299
  }
300
+ log.debug('Checking read/write permissions needed for web-ext' + `on ${selectedFirefoxApk}...`);
323
301
 
324
- log.debug('Checking read/write permissions needed for web-ext' + `on ${selectedFirefoxApk}...`); // Runtime permissions needed to Firefox to be able to access the
302
+ // Runtime permissions needed to Firefox to be able to access the
325
303
  // xpi file uploaded to the android device or emulator.
326
-
327
304
  const requiredPermissions = ['android.permission.READ_EXTERNAL_STORAGE'];
328
305
  await adbUtils.ensureRequiredAPKRuntimePermissions(selectedAdbDevice, selectedFirefoxApk, requiredPermissions);
329
306
  }
330
-
331
307
  async adbPrepareProfileDir() {
332
308
  const {
333
309
  adbUtils,
@@ -338,34 +314,33 @@ export class FirefoxAndroidExtensionRunner {
338
314
  firefoxApp,
339
315
  adbRemoveOldArtifacts
340
316
  }
341
- } = this; // Create the preferences file and the Fennec temporary profile.
342
-
317
+ } = this;
318
+ // Create the preferences file and the Fennec temporary profile.
343
319
  log.debug(`Preparing a temporary profile for ${selectedFirefoxApk}...`);
344
320
  const profile = await firefoxApp.createProfile({
345
321
  app: 'fennec',
346
322
  customPrefs
347
- }); // Check if there are any artifacts dirs from previous runs and
348
- // automatically remove them if adbRemoteOldArtifacts is true.
323
+ });
349
324
 
325
+ // Check if there are any artifacts dirs from previous runs and
326
+ // automatically remove them if adbRemoteOldArtifacts is true.
350
327
  const foundOldArtifacts = await adbUtils.detectOrRemoveOldArtifacts(selectedAdbDevice, adbRemoveOldArtifacts);
351
-
352
328
  if (foundOldArtifacts) {
353
329
  if (adbRemoveOldArtifacts) {
354
330
  log.info('Old web-ext artifacts have been found and removed ' + `from ${selectedAdbDevice} device`);
355
331
  } else {
356
332
  log.warn(`Old artifacts directories have been found on ${selectedAdbDevice} ` + 'device. Use --adb-remove-old-artifacts to remove them automatically.');
357
333
  }
358
- } // Choose a artifacts dir name for the assets pushed to the
359
- // Android device.
360
-
334
+ }
361
335
 
336
+ // Choose a artifacts dir name for the assets pushed to the
337
+ // Android device.
362
338
  this.selectedArtifactsDir = await adbUtils.getOrCreateArtifactsDir(selectedAdbDevice);
363
339
  const deviceProfileDir = this.getDeviceProfileDir();
364
340
  await adbUtils.runShellCommand(selectedAdbDevice, ['mkdir', '-p', deviceProfileDir]);
365
341
  await adbUtils.pushFile(selectedAdbDevice, path.join(profile.profileDir, 'user.js'), `${deviceProfileDir}/user.js`);
366
342
  log.debug(`Created temporary profile at ${deviceProfileDir}.`);
367
343
  }
368
-
369
344
  async adbStartSelectedPackage() {
370
345
  const {
371
346
  adbUtils,
@@ -380,7 +355,6 @@ export class FirefoxAndroidExtensionRunner {
380
355
  log.debug(`Using profile ${deviceProfileDir} (ignored by Fenix)`);
381
356
  await adbUtils.startFirefoxAPK(selectedAdbDevice, selectedFirefoxApk, firefoxApkComponent, deviceProfileDir);
382
357
  }
383
-
384
358
  async buildAndPushExtension(sourceDir) {
385
359
  const {
386
360
  adbUtils,
@@ -396,18 +370,15 @@ export class FirefoxAndroidExtensionRunner {
396
370
  } = await buildSourceDir(sourceDir, tmpDir.path());
397
371
  const extFileName = path.basename(extensionPath, '.zip');
398
372
  let adbExtensionPath = this.adbExtensionsPathBySourceDir.get(sourceDir);
399
-
400
373
  if (!adbExtensionPath) {
401
374
  adbExtensionPath = `${selectedArtifactsDir}/${extFileName}.xpi`;
402
375
  }
403
-
404
376
  log.debug(`Uploading ${extFileName} on the android device`);
405
377
  await adbUtils.pushFile(selectedAdbDevice, extensionPath, adbExtensionPath);
406
378
  log.debug(`Upload completed: ${adbExtensionPath}`);
407
379
  this.adbExtensionsPathBySourceDir.set(sourceDir, adbExtensionPath);
408
380
  });
409
381
  }
410
-
411
382
  async buildAndPushExtensions() {
412
383
  for (const {
413
384
  sourceDir
@@ -415,7 +386,6 @@ export class FirefoxAndroidExtensionRunner {
415
386
  await this.buildAndPushExtension(sourceDir);
416
387
  }
417
388
  }
418
-
419
389
  async adbDiscoveryAndForwardRDPUnixSocket() {
420
390
  const {
421
391
  adbUtils,
@@ -432,25 +402,22 @@ export class FirefoxAndroidExtensionRunner {
432
402
  let {
433
403
  unixSocketDiscoveryMaxTime
434
404
  } = FirefoxAndroidExtensionRunner;
435
-
436
405
  if (typeof adbDiscoveryTimeout === 'number') {
437
406
  unixSocketDiscoveryMaxTime = adbDiscoveryTimeout;
438
407
  }
439
-
440
408
  const handleCtrlC = (str, key) => {
441
409
  if (key.ctrl && key.name === 'c') {
442
410
  adbUtils.setUserAbortDiscovery(true);
443
411
  }
444
- }; // TODO: use noInput property to decide if we should
445
- // disable direct keypress handling.
446
-
412
+ };
447
413
 
414
+ // TODO: use noInput property to decide if we should
415
+ // disable direct keypress handling.
448
416
  if (isTTY(stdin)) {
449
417
  readline.emitKeypressEvents(stdin);
450
418
  setRawMode(stdin, true);
451
419
  stdin.on('keypress', handleCtrlC);
452
420
  }
453
-
454
421
  try {
455
422
  // Got a debugger socket file to connect.
456
423
  this.selectedRDPSocketFile = await adbUtils.discoverRDPUnixSocket(selectedAdbDevice, selectedFirefoxApk, {
@@ -462,17 +429,16 @@ export class FirefoxAndroidExtensionRunner {
462
429
  stdin.removeListener('keypress', handleCtrlC);
463
430
  }
464
431
  }
465
-
466
432
  log.debug(`RDP Socket File selected: ${this.selectedRDPSocketFile}`);
467
- const tcpPort = await findFreeTcpPort(); // Log the choosen tcp port at info level (useful to the user to be able
468
- // to connect the Firefox DevTools to the Firefox for Android instance).
433
+ const tcpPort = await findFreeTcpPort();
469
434
 
435
+ // Log the choosen tcp port at info level (useful to the user to be able
436
+ // to connect the Firefox DevTools to the Firefox for Android instance).
470
437
  log.info(`You can connect to this Android device on TCP port ${tcpPort}`);
471
438
  const forwardSocketSpec = this.selectedRDPSocketFile.startsWith('@') ? `localabstract:${this.selectedRDPSocketFile.substr(1)}` : `localfilesystem:${this.selectedRDPSocketFile}`;
472
439
  await adbUtils.setupForward(selectedAdbDevice, forwardSocketSpec, `tcp:${tcpPort}`);
473
440
  this.selectedTCPPort = tcpPort;
474
441
  }
475
-
476
442
  async rdpInstallExtensions() {
477
443
  const {
478
444
  selectedTCPPort,
@@ -483,37 +449,34 @@ export class FirefoxAndroidExtensionRunner {
483
449
  } = this;
484
450
  const remoteFirefox = this.remoteFirefox = await firefoxClient({
485
451
  port: selectedTCPPort
486
- }); // Exit and cleanup the extension runner if the connection to the
487
- // remote Firefox for Android instance has been closed.
452
+ });
488
453
 
454
+ // Exit and cleanup the extension runner if the connection to the
455
+ // remote Firefox for Android instance has been closed.
489
456
  remoteFirefox.client.on('end', () => {
490
457
  if (!this.exiting) {
491
458
  log.info('Exiting the device because Firefox for Android disconnected');
492
459
  this.exit();
493
460
  }
494
- }); // Install all the temporary addons.
461
+ });
495
462
 
463
+ // Install all the temporary addons.
496
464
  for (const extension of extensions) {
497
465
  const {
498
466
  sourceDir
499
467
  } = extension;
500
468
  const adbExtensionPath = this.adbExtensionsPathBySourceDir.get(sourceDir);
501
-
502
469
  if (!adbExtensionPath) {
503
470
  throw new WebExtError(`ADB extension path for "${sourceDir}" was unexpectedly empty`);
504
471
  }
505
-
506
472
  const addonId = await remoteFirefox.installTemporaryAddon(adbExtensionPath).then(installResult => {
507
473
  return installResult.addon.id;
508
474
  });
509
-
510
475
  if (!addonId) {
511
476
  throw new WebExtError('Received an empty addonId from ' + `remoteFirefox.installTemporaryAddon("${adbExtensionPath}")`);
512
477
  }
513
-
514
478
  this.reloadableExtensions.set(extension.sourceDir, addonId);
515
479
  }
516
480
  }
517
-
518
481
  }
519
482
  //# sourceMappingURL=firefox-android.js.map