mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
TypeScript debug fixed
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user