Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Conversation

@changsi-an
Copy link
Contributor

host sends supportsLaunchUnelevatedProcessRequest flag.

Now PZ host is capable of supporting a launchUnelevated request from DA. If supportsLaunchUnelevatedProcessRequest flag is set through initialize request, DA will choose to use host's ability to launch Chrome unelevated (when needed).

spawnChromeUnelevatedWithWindowsScriptHost() is extracted old code.

spawnChromeUnelevatedWithPineZorro() is the new logic to ask host to launch Chrome unelevated.

@changsi-an
Copy link
Contributor Author

@digeff @roblourens @rakatyal

@changsi-an changsi-an changed the title Call host to launch Chrome unelevated if Call host to launch Chrome unelevated if host sends supportsLaunchUnelevatedProcessRequest flag. Jun 1, 2018

private async spawnChromeUnelevatedWithPineZorro(chromePath: string, chromeArgs: string[]): Promise<number> {
return new Promise<number>((resolve, reject) => {
this._session.sendRequest("launchUnelevated", {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are wrapping sendRequest in a promise in a similar way here: https://github.com/Microsoft/vscode-chrome-debug-core/blob/47782a37b6df5efd3a50bf1813019c0068a984fe/src/transformers/fallbackToClientPathTransformer.ts#L36
Would it make sense to extract the async sendRequest logic someplace else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need telemetry?

Copy link
Contributor Author

@changsi-an changsi-an Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@digeff The two usages are not quite the same, they are very different in the parameters they each have respectively. Having a common utility function will carry the different parameters as well, it almost like repeating this code. So extracting a common logic does not improve much, but reduces readability.

@roblourens if the operation does not succeed it will reject, and the call will get an exception thrown then telemetry handler will capture that. Otherwise, there is C# telemetry implemented in the host for each PZ extension request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@changsi-an would we know from the telemetry that the error happened because of Chrome launch failure when running as Administrator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhanvikapila Yes, the admin flag is right on the same DA event (clientRequest/launch). The C# error is on a separate event.

logger.log(`Parsed output file and got Chrome PID ${pidStr}`);
this._chromePID = parseInt(pidStr, 10);
if (this._doesHostSupportLaunchUnelevatedProcessRequest) {
chromePid = await this.spawnChromeUnelevatedWithPineZorro(chromePath, chromeArgs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be equivalent to use this._chromePID here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

'meteor://💻app/*': '${webRoot}/*'
};

interface IExtendedInitializeRequestArgumetns extends DebugProtocol.InitializeRequestArguments{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

return null
}

private async spawnChromeUnelevatedWithPineZorro(chromePath: string, chromeArgs: string[]): Promise<number> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe don't name this specifically for pinezorro, just "WithClient"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


private async spawnChromeUnelevatedWithPineZorro(chromePath: string, chromeArgs: string[]): Promise<number> {
return new Promise<number>((resolve, reject) => {
this._session.sendRequest("launchUnelevated", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need telemetry?

host sends supportsLaunchUnelevatedProcessRequest flag.
@changsi-an
Copy link
Contributor Author

PTAL

@rakatyal
Copy link
Contributor

rakatyal commented Jun 1, 2018

Can we add tests for this change?

@roblourens
Copy link
Member

@changsi-an LMK when this is ready to merge. I'm ok with or without tests.

@changsi-an
Copy link
Contributor Author

@roblourens Please help merge it now. I will submit a PR for unit test later.

@roblourens roblourens merged commit f26a832 into microsoft:master Jun 4, 2018
@roblourens roblourens added this to the June 2018 milestone Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.