Apply getter check to determine if API is exposed as property or as method for iOS backward compatibility

This commit is contained in:
Panayot Cankov
2016-09-12 12:54:38 +03:00
parent e9c7c5a749
commit b81c034f67
29 changed files with 174 additions and 113 deletions

View File

@@ -3,6 +3,8 @@ var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBacken
import * as debuggerDomains from "./debugger";
import * as utils from "utils/utils";
declare var __inspectorTimestamp;
const frameId = "NativeScriptMainFrameIdentifier";
@@ -212,9 +214,9 @@ 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 appPath = utils.ios.getter(NSBundle, NSBundle.mainBundle).bundlePath;
let pathUrl = params.url.replace("file://", appPath);
let fileManager = NSFileManager.defaultManager();
let fileManager = utils.ios.getter(NSFileManager, NSFileManager.defaultManager);
let data = fileManager.fileExistsAtPath(pathUrl) ? fileManager.contentsAtPath(pathUrl) : undefined;
let content = data ? NSString.alloc().initWithDataEncoding(data, NSUTF8StringEncoding) : "";