Basic cookie inspection working in Chrome dev tools.
This commit is contained in:
Родитель
76fdd2e35e
Коммит
df2085f6fd
|
@ -31,9 +31,7 @@
|
||||||
<TypeScriptCompile Include="Page.ts" />
|
<TypeScriptCompile Include="Page.ts" />
|
||||||
<TypeScriptCompile Include="Runtime.ts" />
|
<TypeScriptCompile Include="Runtime.ts" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="DOM\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -41,9 +41,9 @@ module F12.Proxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PageHandler implements IDomainHandler{
|
export class PageHandler implements IDomainHandler {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCookies(): IWebKitResponse {
|
private getCookies(): IWebKitResponse {
|
||||||
|
@ -69,14 +69,14 @@ module F12.Proxy {
|
||||||
|
|
||||||
return processedResult;
|
return processedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteCookie(request: IWebKitRequest):IWebKitResponse {
|
private deleteCookie(request: IWebKitRequest): IWebKitResponse {
|
||||||
var processedResult: any = {};
|
var processedResult: any = {};
|
||||||
var cookieName: string = request.params.cookieName;
|
var cookieName: string = request.params.cookieName;
|
||||||
var url: string = request.params.url;
|
var url: string = request.params.url;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resources.cookies.deleteCookie(cookieName, url);
|
resources.cookies.deleteCookie(cookieName, url);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
processedResult = {
|
processedResult = {
|
||||||
error: ex
|
error: ex
|
||||||
|
@ -88,7 +88,7 @@ module F12.Proxy {
|
||||||
|
|
||||||
private navigate(request: IWebKitRequest): IWebKitResponse {
|
private navigate(request: IWebKitRequest): IWebKitResponse {
|
||||||
var processedResult: any = {};
|
var processedResult: any = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (request.params.url) {
|
if (request.params.url) {
|
||||||
browser.executeScript("window.location.href = '" + request.params.url + "'");
|
browser.executeScript("window.location.href = '" + request.params.url + "'");
|
||||||
|
@ -108,6 +108,38 @@ module F12.Proxy {
|
||||||
return processedResult;
|
return processedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getResourceTree(request: IWebKitRequest): IWebKitResponse {
|
||||||
|
var processedResult: any = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
var url = browser.document.parentWindow.location.href;
|
||||||
|
var mimeType = "text/html";
|
||||||
|
// Casting to any as the default lib.d.ts does not have it on the Location object
|
||||||
|
var securityOrigin = (<any>browser.document.parentWindow.location).origin;
|
||||||
|
|
||||||
|
processedResult = {
|
||||||
|
result: {
|
||||||
|
frameTree: {
|
||||||
|
frame: {
|
||||||
|
id: "1500.1",
|
||||||
|
loaderId: "1500.2",
|
||||||
|
url: url,
|
||||||
|
mimeType: mimeType,
|
||||||
|
securityOrigin: securityOrigin
|
||||||
|
},
|
||||||
|
resources: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} catch (ex) {
|
||||||
|
processedResult = {
|
||||||
|
error: ex
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return processedResult;
|
||||||
|
}
|
||||||
|
|
||||||
public processMessage(method: string, request: IWebKitRequest) {
|
public processMessage(method: string, request: IWebKitRequest) {
|
||||||
var processedResult;
|
var processedResult;
|
||||||
|
|
||||||
|
@ -124,6 +156,10 @@ module F12.Proxy {
|
||||||
processedResult = this.deleteCookie(request);
|
processedResult = this.deleteCookie(request);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "getResourceTree":
|
||||||
|
processedResult = this.getResourceTree(request);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
processedResult = {};
|
processedResult = {};
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -254,13 +254,6 @@ module F12.Proxy {
|
||||||
if (request) {
|
if (request) {
|
||||||
var methodParts = request.method.split(".");
|
var methodParts = request.method.split(".");
|
||||||
|
|
||||||
// This is a hack to get console in VS showing up so that it can work at a breakpoint
|
|
||||||
if (methodParts[0] === "Page" && methodParts[1] === "getResourceTree") {
|
|
||||||
var r = JSON.parse('{"result":{"frameTree":{"frame":{"id":"1500.1","loaderId":"1500.2","url":"http://f12host/clock/","mimeType":"text/html","securityOrigin":"http://f12host"},"resources":[{ "url": "http://f12host/clock/imgs/clock1.jpg", "type": "Image", "mimeType": "image/jpeg" }, { "url": "http://f12host/clock/app.css", "type": "Stylesheet", "mimeType": "text/css" }, { "url": "http://f12host/clock/app.js", "type": "Script", "mimeType": "application/javascript" }, { "url": "http://f12host/clock/clock.js", "type": "Script", "mimeType": "application/javascript" }] } } }');
|
|
||||||
this.PostResponse(request.id, r);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._isAtBreakpoint && methodParts[0] !== "Debugger") {
|
if (!this._isAtBreakpoint && methodParts[0] !== "Debugger") {
|
||||||
return host.postMessageToEngine("browser", this._isAtBreakpoint, JSON.stringify(request));
|
return host.postMessageToEngine("browser", this._isAtBreakpoint, JSON.stringify(request));
|
||||||
}
|
}
|
||||||
|
@ -398,7 +391,7 @@ module F12.Proxy {
|
||||||
result: this.GetRemoteObjectFromProp(prop)
|
result: this.GetRemoteObjectFromProp(prop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "getProperties":
|
case "getProperties":
|
||||||
var id = parseInt(request.params.objectId);
|
var id = parseInt(request.params.objectId);
|
||||||
|
@ -516,7 +509,7 @@ module F12.Proxy {
|
||||||
|
|
||||||
case "setBreakpointByUrl":
|
case "setBreakpointByUrl":
|
||||||
if (this._documentMap.has(request.params.url)) {
|
if (this._documentMap.has(request.params.url)) {
|
||||||
try{
|
try {
|
||||||
var docId: number = this._documentMap.get(request.params.url);
|
var docId: number = this._documentMap.get(request.params.url);
|
||||||
|
|
||||||
var lineEndings = this.GetLineEndings(docId);
|
var lineEndings = this.GetLineEndings(docId);
|
||||||
|
@ -536,13 +529,13 @@ module F12.Proxy {
|
||||||
locations: [location]
|
locations: [location]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this.PostResponse(0, {
|
this.PostResponse(0, {
|
||||||
error: { description: "Invalid request" }
|
error: { description: "Invalid request" }
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
processedResult = {
|
processedResult = {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче