Example #1
0
 public static string GetEventHandlerAttr(mdr.DObject obj, string name)
 {
     var ehp = obj.GetPropertyDescriptor(name).GetProperty() as EventHandlerProperty;
     if (ehp == null)
         throw new Exception("Invalid Event " + name);
     return GetEventHandlerAttr(obj, ehp.EventType, name);
 }
Example #2
0
 public static bool CallProperty(mdr.DObject input, string propName, out mdr.DValue output)
 {
   if (input != null)
   {
     var propDesc = input.GetPropertyDescriptor(propName);
     var prop = new mdr.DValue();
     propDesc.Get(input, ref prop);
     mdr.DFunction func = null;
     if (prop.ValueType == mdr.ValueTypes.Function)
     {
       func = prop.AsDFunction();
       //if (toString != null)
       //{
       mdr.CallFrame callFrame = new mdr.CallFrame();
       callFrame.This = (input);
       callFrame.Function = func;
       func.Call(ref callFrame);
       if (ValueTypesHelper.IsPrimitive(callFrame.Return.ValueType))
       {
         output = callFrame.Return;
         return true;
       }
     }
   }
   output = new mdr.DValue();
   output.SetUndefined();
   return false;
 }
Example #3
0
        public static void SetEventHandlerAttr(mdr.DObject obj, string name, string script)
        {
#if ENABLE_RR
            if (RecordReplayManager.Instance != null && RecordReplayManager.Instance.RecordEnabled)
            {
                RecordReplayManager.Instance.Record("Element", null, "SetEventHandlerAttr", false, obj, name, script);
            }
#endif
            var ehp = obj.GetPropertyDescriptor(name).GetProperty() as EventHandlerProperty;
            if (ehp == null)
                throw new Exception("Invalid Event " + name);
            SetEventHandlerAttr(obj, ehp.EventType, name, script);
        }
Example #4
0
 private void fillArray(DInt8Array dst, mdr.DArrayBase src)
 {
     for (int i = 0; i < dst.ByteLength / dst.TypeSize; ++i)
     {
         byte value = (byte)src.GetPropertyDescriptor(i).Get(src).AsInt8();
         dst.AddPropertyDescriptor(i).Set(dst, value);
     }
 }
Example #5
0
 private void fillArray(DUint32Array dst, mdr.DArrayBase src)
 {
     for (int i = 0; i < dst.ByteLength / dst.TypeSize; ++i)
     {
         UInt32 value = src.GetPropertyDescriptor(i).Get(src).AsUInt32();
         dst.AddPropertyDescriptor(i).Set(dst, value);
     }
 }
Example #6
0
 public static void SetEventHandlerAttr(mdr.DObject obj, EventTypes type,
                                        string name, string script)
 {
     var targetElement = obj.FirstInPrototypeChainAs<HTMLElement>();
     targetElement.PrimSetEventHandlerAttr(type, script);
     var prgFunc = HTMLRuntime.Instance.PrepareScript(script);
     var pd = obj.GetPropertyDescriptor(name);
     pd.Set(obj,prgFunc);
 }