@@ -11,27 +11,66 @@ index a4746096241ebaaf7b3eca40a6d8b0fd13191118..77e6517fe29ea97112d36b6464139f95
1111 browser: args.browser.name,
1212 buildId: args.browser.buildId,
1313diff --git a/lib/cjs/install.js b/lib/cjs/install.js
14- index 35c7229df92528c119d5836d9c863a7de01f0977..4dd7270586f9fed89f740d0e97802d0b7e75dbf1 100644
14+ index 35c7229df92528c119d5836d9c863a7de01f0977..81ebebf19eb5a4f956f67061281341b3d53ae9bd 100644
1515--- a/lib/cjs/install.js
1616+++ b/lib/cjs/install.js
17- @@ -48,10 +48,12 @@ async function install(options) {
18- throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
19- }
20- const url = getDownloadUrl(options.browser, options.platform, options.buildId, options.baseUrl);
21- + console.log('install url', options, url);
22- try {
23- return await installUrl(url, options);
24- }
25- catch (err) {
26- + console.log('install catch', options, err);
27- // If custom baseUrl is provided, do not fall back to CfT dashboard.
28- if (options.baseUrl && !options.forceFallbackForTesting) {
29- throw err;
30- @@ -84,6 +86,7 @@ async function install(options) {
17+ @@ -84,6 +84,7 @@ async function install(options) {
3118 const backupUrl = version.downloads[options.browser]?.find(link => {
3219 return link['platform'] === platform;
3320 })?.url;
3421+ console.log('install backupUrl', options, backupUrl);
3522 if (backupUrl) {
3623 // If the URL is the same, skip the retry.
3724 if (backupUrl === url.toString()) {
25+ @@ -140,10 +141,12 @@ async function installUrl(url, options) {
26+ downloadProgressCallback = await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId);
27+ }
28+ const fileName = decodeURIComponent(url.toString()).split('/').pop();
29+ + console.log('installUrl fileName', options.browser, fileName);
30+ (0, node_assert_1.default)(fileName, `A malformed download URL was found: ${url}.`);
31+ const cache = new Cache_js_1.Cache(options.cacheDir);
32+ const browserRoot = cache.browserRoot(options.browser);
33+ const archivePath = node_path_1.default.join(browserRoot, `${options.buildId}-${fileName}`);
34+ + console.log('installUrl browserRoot', options.browser, browserRoot);
35+ if (!(0, node_fs_1.existsSync)(browserRoot)) {
36+ await (0, promises_1.mkdir)(browserRoot, { recursive: true });
37+ }
38+ @@ -158,6 +161,7 @@ async function installUrl(url, options) {
39+ return archivePath;
40+ }
41+ const outputPath = cache.installationDir(options.browser, options.platform, options.buildId);
42+ + console.log('installUrl outputPath', options.browser, outputPath);
43+ try {
44+ if ((0, node_fs_1.existsSync)(outputPath)) {
45+ const installedBrowser = new Cache_js_1.InstalledBrowser(cache, options.browser, options.buildId, options.platform);
46+ @@ -170,6 +174,7 @@ async function installUrl(url, options) {
47+ }
48+ return installedBrowser;
49+ }
50+ + console.log('installUrl Downloading binary', options.browser, url);
51+ debugInstall(`Downloading binary from ${url}`);
52+ try {
53+ debugTime('download');
54+ @@ -178,6 +183,7 @@ async function installUrl(url, options) {
55+ finally {
56+ debugTimeEnd('download');
57+ }
58+ + console.log('installUrl', options.browser, `Installing ${archivePath} to ${outputPath}`);
59+ debugInstall(`Installing ${archivePath} to ${outputPath}`);
60+ try {
61+ debugTime('extract');
62+ @@ -186,12 +192,14 @@ async function installUrl(url, options) {
63+ finally {
64+ debugTimeEnd('extract');
65+ }
66+ + console.log('installUrl', options.browser, 'before InstalledBrowser');
67+ const installedBrowser = new Cache_js_1.InstalledBrowser(cache, options.browser, options.buildId, options.platform);
68+ if (options.buildIdAlias) {
69+ const metadata = installedBrowser.readMetadata();
70+ metadata.aliases[options.buildIdAlias] = options.buildId;
71+ installedBrowser.writeMetadata(metadata);
72+ }
73+ + console.log('installUrl', options.browser, 'runSetup');
74+ await runSetup(installedBrowser);
75+ if (options.installDeps) {
76+ await installDeps(installedBrowser);
0 commit comments