Remove 'cwd' property, fix #124
This commit is contained in:
Родитель
6f6399999c
Коммит
25b5b94d8b
|
@ -108,4 +108,5 @@ General things to try if you're having issues:
|
|||
* Ensure nothing else is using port 9222, or specify a different port in your launch config
|
||||
* Check the console for warnings that this extension prints in some cases when it can't attach
|
||||
* Ensure the code in Chrome matches the code in Code. Chrome may cache an old version.
|
||||
* If you were previously using the `cwd` property in your launch config with the `file` property, you need to specify an absolute path for `file` instead, e.g. `"${workspaceRoot}/index.html"`.
|
||||
* File a bug in this extension's [GitHub repo](https://github.com/Microsoft/vscode-webkit-debug). Set the "diagnosticLogging" field in your launch config and attach the logs when filing a bug.
|
||||
|
|
|
@ -20,11 +20,11 @@ export class PathTransformer implements IDebugTransformer {
|
|||
private _pendingBreakpointsByPath = new Map<string, IPendingBreakpoint>();
|
||||
|
||||
public launch(args: ILaunchRequestArgs): void {
|
||||
this._webRoot = utils.getWebRoot(args);
|
||||
this._webRoot = args.webRoot;
|
||||
}
|
||||
|
||||
public attach(args: IAttachRequestArgs): void {
|
||||
this._webRoot = utils.getWebRoot(args);
|
||||
this._webRoot = args.webRoot;
|
||||
}
|
||||
|
||||
public setBreakpoints(args: ISetBreakpointsArgs): Promise<void> {
|
||||
|
|
|
@ -37,7 +37,7 @@ export class SourceMapTransformer implements IDebugTransformer {
|
|||
|
||||
private init(args: ILaunchRequestArgs | IAttachRequestArgs): void {
|
||||
if (args.sourceMaps) {
|
||||
this._webRoot = utils.getWebRoot(args);
|
||||
this._webRoot = args.webRoot;
|
||||
this._sourceMaps = new SourceMaps(this._webRoot);
|
||||
this._requestSeqToSetBreakpointsArgs = new Map<number, ISetBreakpointsArgs>();
|
||||
this._allRuntimeScriptPaths = new Set<string>();
|
||||
|
|
10
package.json
10
package.json
|
@ -94,11 +94,6 @@
|
|||
"description": "A url to open in the browser",
|
||||
"default": "http://mysite.com/index.html"
|
||||
},
|
||||
"cwd": {
|
||||
"type": "string",
|
||||
"description": "DEPRECATED - renamed to webRoot",
|
||||
"default": "."
|
||||
},
|
||||
"webRoot": {
|
||||
"type": "string",
|
||||
"description": "When the 'url' field is specified, this specifies the workspace absolute path to the webserver root.",
|
||||
|
@ -157,11 +152,6 @@
|
|||
"description": "When true, the adapter logs its own diagnostic info to the console",
|
||||
"default": false
|
||||
},
|
||||
"cwd": {
|
||||
"type": "string",
|
||||
"description": "DEPRECATED - renamed to webRoot",
|
||||
"default": "."
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "Will search for a tab with this EXACT url and attach to it, if found",
|
||||
|
|
|
@ -47,8 +47,6 @@ suite('SourceMapTransformer', () => {
|
|||
mockery.registerMock('./sourceMaps', { SourceMaps: StubSourceMaps });
|
||||
}
|
||||
|
||||
utilsMock.expects('getWebRoot').returns(undefined);
|
||||
|
||||
let SourceMapTransformer = require(MODULE_UNDER_TEST).SourceMapTransformer;
|
||||
const transformer = new SourceMapTransformer();
|
||||
transformer.launch(<ILaunchRequestArgs><any>{
|
||||
|
|
|
@ -330,20 +330,6 @@ suite('Utilities', () => {
|
|||
});
|
||||
});
|
||||
|
||||
suite('getWebRoot()', () => {
|
||||
test('takes absolute webRoot as is', () => {
|
||||
assert.equal(getUtilities().getWebRoot({ webRoot: 'c:\\project\\webRoot', cwd: 'c:\\project\\cwd' }), 'c:\\project\\webRoot');
|
||||
});
|
||||
|
||||
test('resolves relative webroot against cwd', () => {
|
||||
assert.equal(getUtilities().getWebRoot({ webRoot: '..\\webRoot', cwd: 'c:\\project\\cwd' }), 'c:\\project\\webRoot');
|
||||
});
|
||||
|
||||
test('uses cwd when webRoot is missing', () => {
|
||||
assert.equal(getUtilities().getWebRoot({ webRoot: '', cwd: 'c:\\project\\cwd' }), 'c:\\project\\cwd');
|
||||
});
|
||||
});
|
||||
|
||||
suite('getUrl', () => {
|
||||
const URL = 'http://testsite.com/testfile';
|
||||
const RESPONSE = 'response';
|
||||
|
@ -442,8 +428,8 @@ suite('Utilities', () => {
|
|||
assert.equal(getUtilities().pathToFileURL('/code/app.js'), 'file:///code/app.js');
|
||||
});
|
||||
|
||||
test('encodes as URI', () => {
|
||||
assert.equal(getUtilities().pathToFileURL('c:\\path with spaces'), 'file:///c:/path%20with%20spaces');
|
||||
test('encodes as URI and forces forwards slash', () => {
|
||||
assert.equal(getUtilities().pathToFileURL('c:\\path with spaces\\blah.js'), 'file:///c:/path%20with%20spaces/blah.js');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -218,7 +218,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('file:///c:/a.js') >= 0);
|
||||
assert(args.indexOf('file:///c:/path%20with%20space/index.html') >= 0);
|
||||
assert(args.indexOf('abc') >= 0);
|
||||
assert(args.indexOf('def') >= 0);
|
||||
spawnCalled = true;
|
||||
|
@ -235,7 +235,7 @@ suite('WebKitDebugAdapter', () => {
|
|||
platform: () => 'win32'
|
||||
});
|
||||
const wkda = instantiateWKDA();
|
||||
return wkda.launch({ file: 'a.js', runtimeArgs: ['abc', 'def'], cwd: 'c:/' }).then(() => {
|
||||
return wkda.launch({ file: 'c:\\path with space\\index.html', runtimeArgs: ['abc', 'def'] }).then(() => {
|
||||
assert(spawnCalled);
|
||||
});
|
||||
});
|
||||
|
@ -289,7 +289,7 @@ suite('WebKitDebugAdapter', () => {
|
|||
});
|
||||
|
||||
function attach(wkda: _WebKitDebugAdapter): Promise<void> {
|
||||
return wkda.attach({ port: 9222, cwd: 'c:/' });
|
||||
return wkda.attach({ port: 9222 });
|
||||
}
|
||||
|
||||
class DefaultMockWebKitConnection {
|
||||
|
|
|
@ -358,25 +358,6 @@ export function errP(msg: any): Promise<any> {
|
|||
return Promise.reject(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the webRoot from a launch/attach request. The webRoot is the directory that the
|
||||
* files are served from by a web server, (or the directory that they would be served from, and which
|
||||
* sourceRoot may be relative to).
|
||||
*/
|
||||
export function getWebRoot(args: ILaunchRequestArgs | IAttachRequestArgs): string {
|
||||
let webRoot: string;
|
||||
if (args.webRoot) {
|
||||
webRoot = args.webRoot;
|
||||
if (!path.isAbsolute(webRoot)) {
|
||||
webRoot = path.resolve(args.cwd, webRoot);
|
||||
}
|
||||
} else {
|
||||
webRoot = args.cwd;
|
||||
}
|
||||
|
||||
return webRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to GET the contents of a url
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments {
|
||||
cwd: string; /* Automatically set by VS Code to the currently opened folder */
|
||||
webRoot?: string;
|
||||
runtimeArgs?: string[];
|
||||
runtimeExecutable?: string;
|
||||
|
@ -13,7 +12,6 @@ interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments {
|
|||
}
|
||||
|
||||
interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments {
|
||||
cwd: string; /* Automatically set by VS Code to the currently opened folder */
|
||||
url?: string;
|
||||
webRoot?: string;
|
||||
port: number;
|
||||
|
|
|
@ -97,7 +97,7 @@ export class WebKitDebugAdapter implements IDebugAdapter {
|
|||
|
||||
let launchUrl: string;
|
||||
if (args.file) {
|
||||
launchUrl = 'file:///' + path.resolve(args.cwd, args.file);
|
||||
launchUrl = utils.pathToFileURL(args.file);
|
||||
} else if (args.url) {
|
||||
launchUrl = args.url;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче