Basic cookie inspection working in Chrome dev tools.

This commit is contained in:
AndySterland 2015-04-11 21:46:25 -07:00
Родитель 76fdd2e35e
Коммит df2085f6fd
3 изменённых файлов: 52 добавлений и 25 удалений

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

@ -31,9 +31,7 @@
<TypeScriptCompile Include="Page.ts" />
<TypeScriptCompile Include="Runtime.ts" />
</ItemGroup>
<ItemGroup>
<Folder Include="DOM\" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
</PropertyGroup>

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

@ -41,7 +41,7 @@ module F12.Proxy {
}
}
export class PageHandler implements IDomainHandler{
export class PageHandler implements IDomainHandler {
constructor() {
}
@ -70,7 +70,7 @@ module F12.Proxy {
return processedResult;
}
private deleteCookie(request: IWebKitRequest):IWebKitResponse {
private deleteCookie(request: IWebKitRequest): IWebKitResponse {
var processedResult: any = {};
var cookieName: string = request.params.cookieName;
var url: string = request.params.url;
@ -108,6 +108,38 @@ module F12.Proxy {
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) {
var processedResult;
@ -124,6 +156,10 @@ module F12.Proxy {
processedResult = this.deleteCookie(request);
break;
case "getResourceTree":
processedResult = this.getResourceTree(request);
break;
default:
processedResult = {};
break;

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

@ -254,13 +254,6 @@ module F12.Proxy {
if (request) {
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") {
return host.postMessageToEngine("browser", this._isAtBreakpoint, JSON.stringify(request));
}
@ -516,7 +509,7 @@ module F12.Proxy {
case "setBreakpointByUrl":
if (this._documentMap.has(request.params.url)) {
try{
try {
var docId: number = this._documentMap.get(request.params.url);
var lineEndings = this.GetLineEndings(docId);