private void FreezeObject(IeJsValue objValue) { IeJsValue objectValue = IeJsValue.GlobalObject.GetProperty("Object"); IeJsValue freezeMethodValue = objectValue.GetProperty("freeze"); freezeMethodValue.CallFunction(objectValue, objValue); }
public override object CallFunction(string functionName, params object[] args) { object result = InvokeScript(() => { IeJsValue globalObj = IeJsValue.GlobalObject; IeJsPropertyId functionId = IeJsPropertyId.FromString(functionName); bool functionExist = globalObj.HasProperty(functionId); if (!functionExist) { throw new JsRuntimeException( string.Format(CommonStrings.Runtime_FunctionNotExist, functionName)); } IeJsValue resultValue; IeJsValue functionValue = globalObj.GetProperty(functionId); if (args.Length > 0) { IeJsValue[] processedArgs = MapToScriptType(args); foreach (IeJsValue processedArg in processedArgs) { AddReferenceToValue(processedArg); } IeJsValue[] allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray(); resultValue = functionValue.CallFunction(allProcessedArgs); foreach (IeJsValue processedArg in processedArgs) { RemoveReferenceToValue(processedArg); } } else { resultValue = functionValue.CallFunction(globalObj); } return(MapToHostType(resultValue)); }); return(result); }