Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Now we provide a reason of why start-up failed #630

Merged
merged 3 commits into from
Mar 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as utils from './utils';
import * as errors from './errors';

import * as nls from 'vscode-nls';
import { FinishedStartingUpEventArguments } from 'vscode-chrome-debug-core/lib/src/executionTimingsReporter';
let localize = nls.loadMessageBundle();

// Keep in sync with sourceMapPathOverrides package.json default
Expand Down Expand Up @@ -148,9 +149,17 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
}

protected onFrameNavigated(params: Crdp.Page.FrameNavigatedEvent): void {
if (params.frame.url === this._userRequestedUrl) {
const url = params.frame.url;
const requestedUrlNoAnchor = this._userRequestedUrl.split('#')[0]; // Frame navigated url doesn't include the anchor
if (url === requestedUrlNoAnchor || decodeURI(url) === requestedUrlNoAnchor) { // 'http://localhost:1234/test%20page' will use the not decoded version, 'http://localhost:1234/test page' will use the decoded version
// Chrome started to navigate to the user's requested url
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName);
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: true } as FinishedStartingUpEventArguments);
Copy link
Member

Choose a reason for hiding this comment

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

Do these all need a cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use the cast to make sure I'm sending the right properties.
If I don't put the cast, the object is of type any, and anything is considered valid.
If I put the cast, then the compiler will fail if I don't put the valid properties here.

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking 'emit' was typed here

} else if (url === 'chrome-error://chromewebdata/') {
// Chrome couldn't retrieve the web-page in the requested url
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: false, reasonForNotDetected: 'UnreachableURL'} as FinishedStartingUpEventArguments);
} else if (url.startsWith('chrome-error://')) {
// Uknown chrome error
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: false, reasonForNotDetected: 'UnknownChromeError'} as FinishedStartingUpEventArguments);
}
}

Expand Down