mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +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.
|
* 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 } {
|
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 {
|
return {
|
||||||
content: "",
|
content: content.toString(), // Not sure why however we need to call toString() for NSString
|
||||||
mimeType: "",
|
mimeType: "application/octet-stream",
|
||||||
status: 200
|
status: 200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user