From 794e1d40d8bc83c5b76d3b0d3af327ed1773e219 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 15 Jun 2016 18:15:47 +0300 Subject: [PATCH] TypeScript debug fixed --- tns-core-modules/debugger/webinspector.ios.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/debugger/webinspector.ios.ts b/tns-core-modules/debugger/webinspector.ios.ts index fdc5b44fa..762146c11 100644 --- a/tns-core-modules/debugger/webinspector.ios.ts +++ b/tns-core-modules/debugger/webinspector.ios.ts @@ -212,9 +212,15 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai * Loads a resource in the context of a frame on the inspected page without cross origin checks. */ loadResource(params: inspectorCommandTypes.NetworkDomain.LoadResourceMethodArguments): { content: string, mimeType: string, status: number } { + let appPath = NSBundle.mainBundle().bundlePath; + let pathUrl = params.url.replace("file://", appPath); + let fileManager = NSFileManager.defaultManager(); + let data = fileManager.fileExistsAtPath(pathUrl) ? fileManager.contentsAtPath(pathUrl) : undefined; + let content = data ? NSString.alloc().initWithDataEncoding(data, NSUTF8StringEncoding) : ""; + return { - content: "", - mimeType: "", + content: content.toString(), // Not sure why however we need to call toString() for NSString + mimeType: "application/octet-stream", status: 200 } }