Add file:/// to url for filtering in attach

This commit is contained in:
Rob Lourens 2015-11-10 16:36:56 -08:00
Родитель 83e164579c
Коммит ff26f80ffc
3 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -223,7 +223,7 @@ suite('WebKitDebugAdapter', () => {
// Just assert that the chrome path is some string with 'chrome' in the path, and there are >0 args
assert(chromePath.toLowerCase().indexOf('chrome') >= 0);
assert(args.indexOf('--remote-debugging-port=9222') >= 0);
assert(args.indexOf('c:/a.js') >= 0);
assert(args.indexOf('file:///c:/a.js') >= 0);
assert(args.indexOf('abc') >= 0);
assert(args.indexOf('def') >= 0);
spawnCalled = true;

Просмотреть файл

@ -134,11 +134,15 @@ export class WebKitConnection {
try {
const responseArray = JSON.parse(jsonResponse);
if (Array.isArray(responseArray)) {
// Filter out extension targets and other things
let pages = responseArray.filter(target => target && target.type === 'page');
// If a url was specified (launch mode), try to filter to that url
if (url) {
const urlPages = pages.filter(page => utils.canonicalizeUrl(page.url) === utils.canonicalizeUrl(url));
if (!urlPages.length) {
Logger.log(`Can't find a page with url: ` + url);
Logger.log('pages: ' + JSON.stringify(pages.map(page => page.url)));
} else {
pages = urlPages;
}
@ -160,7 +164,7 @@ export class WebKitConnection {
// JSON.parse can throw
}
return utils.errP('Got response, but no valid target pages found');
return utils.errP('Got response from target app, but no valid target pages found');
});
}

Просмотреть файл

@ -96,7 +96,7 @@ export class WebKitDebugAdapter implements IDebugAdapter {
let launchUrl: string;
if (args.file) {
launchUrl = path.resolve(args.cwd, args.file);
launchUrl = 'file:///' + path.resolve(args.cwd, args.file).replace(/\/\//g, '/');
} else if (args.url) {
launchUrl = args.url;
} else {