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

Commit a5611dc

Browse files
digeffroblourens
authored andcommitted
Now we provide a reason of why start-up failed (#630)
* Now we provide a reason of why start-up failed * Remove unneeded line
1 parent 2e15d5f commit a5611dc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/chromeDebugAdapter.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as utils from './utils';
1616
import * as errors from './errors';
1717

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

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

150151
protected onFrameNavigated(params: Crdp.Page.FrameNavigatedEvent): void {
151-
if (params.frame.url === this._userRequestedUrl) {
152+
const url = params.frame.url;
153+
const requestedUrlNoAnchor = this._userRequestedUrl.split('#')[0]; // Frame navigated url doesn't include the anchor
154+
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
152155
// Chrome started to navigate to the user's requested url
153-
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName);
156+
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: true } as FinishedStartingUpEventArguments);
157+
} else if (url === 'chrome-error://chromewebdata/') {
158+
// Chrome couldn't retrieve the web-page in the requested url
159+
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: false, reasonForNotDetected: 'UnreachableURL'} as FinishedStartingUpEventArguments);
160+
} else if (url.startsWith('chrome-error://')) {
161+
// Uknown chrome error
162+
this.events.emit(ChromeDebugSession.FinishedStartingUpEventName, { requestedContentWasDetected: false, reasonForNotDetected: 'UnknownChromeError'} as FinishedStartingUpEventArguments);
154163
}
155164
}
156165

0 commit comments

Comments
 (0)