Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Fix #53391 - check both /json/list and /json
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jul 16, 2018
1 parent c52c605 commit 387267c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/chrome/chromeTargetDiscoveryStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,20 @@ export class ChromeTargetDiscovery implements ITargetDiscoveryStrategy, IObserva
// Get the browser and the protocol version
this._getVersionData(address, port);

// Temporary workaround till Edge fixes this bug: https://microsoft.visualstudio.com/OS/_workitems?id=15517727&fullScreen=false&_a=edit
// Chrome and Node alias /json to /json/list so this should work too
const url = `http://${address}:${port}/json/list`;
this.logger.log(`Discovering targets via ${url}`);

/* __GDPR__FRAGMENT__
"StepNames" : {
"Attach.RequestDebuggerTargetsInformation" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.events.emitStepStarted('Attach.RequestDebuggerTargetsInformation');
const jsonResponse = await utils.getURL(url, { headers: { Host: 'localhost' } })

const checkDiscoveryEndpoint = (url: string) => {
this.logger.log(`Discovering targets via ${url}`);
return utils.getURL(url, { headers: { Host: 'localhost' } });
};

const jsonResponse = await checkDiscoveryEndpoint(`http://${address}:${port}/json/list`)
.catch(() => checkDiscoveryEndpoint(`http://${address}:${port}/json`))
.catch(e => utils.errP(localize('attach.cannotConnect', 'Cannot connect to the target: {0}', e.message)));

/* __GDPR__FRAGMENT__
Expand Down

0 comments on commit 387267c

Please sign in to comment.