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,9 +41,9 @@ module F12.Proxy {
}
}
export class PageHandler implements IDomainHandler{
export class PageHandler implements IDomainHandler {
constructor() {
}
private getCookies(): IWebKitResponse {
@ -69,14 +69,14 @@ 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;
try {
resources.cookies.deleteCookie(cookieName, url);
resources.cookies.deleteCookie(cookieName, url);
} catch (ex) {
processedResult = {
error: ex
@ -88,7 +88,7 @@ module F12.Proxy {
private navigate(request: IWebKitRequest): IWebKitResponse {
var processedResult: any = {};
try {
if (request.params.url) {
browser.executeScript("window.location.href = '" + 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));
}
@ -398,7 +391,7 @@ module F12.Proxy {
result: this.GetRemoteObjectFromProp(prop)
}
}
break;
break;
case "getProperties":
var id = parseInt(request.params.objectId);
@ -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);
@ -536,13 +529,13 @@ module F12.Proxy {
locations: [location]
}
};
} catch (ex) {
this.PostResponse(0, {
error: { description: "Invalid request" }
});
return;
}
} catch (ex) {
this.PostResponse(0, {
error: { description: "Invalid request" }
});
return;
}
} else {
processedResult = {