コード例 #1
0
 public override bool Delete(EcmaPropertyKey propertyKey)
 {
     if (IsBoundedVariable(propertyKey))
     {
         EnsureTainted();
         taintedLevel[propertyKey.ToArrayIndex()] = TaintLevel.BindingTainted;
     }
     return(base.Delete(propertyKey));
 }
コード例 #2
0
 public static bool TryIndexByPropertyKey(IList list, EcmaPropertyKey propertyKey, out EcmaValue value)
 {
     if (propertyKey.IsArrayIndex && list != null)
     {
         long index = propertyKey.ToArrayIndex();
         if (index < list.Count)
         {
             value = new EcmaValue(list[(int)index]);
             return(true);
         }
     }
     value = default;
     return(false);
 }
コード例 #3
0
 public static bool TryIndexByPropertyKey(string str, EcmaPropertyKey propertyKey, out EcmaValue value)
 {
     if (propertyKey.IsArrayIndex && str != null)
     {
         long index = propertyKey.ToArrayIndex();
         if (index < str.Length)
         {
             value = new EcmaValue(new String(str[(int)index], 1));
             return(true);
         }
     }
     value = default;
     return(false);
 }
コード例 #4
0
 public override bool DefineOwnProperty(EcmaPropertyKey propertyKey, EcmaPropertyDescriptor descriptor)
 {
     if (IsBoundedVariable(propertyKey))
     {
         int index = (int)propertyKey.ToArrayIndex();
         EnsureTainted();
         if (taintedLevel[index] != TaintLevel.BindingTainted)
         {
             if (descriptor.HasValue)
             {
                 arguments[index] = descriptor.Value;
             }
             taintedLevel[index] = !descriptor.IsAccessorDescriptor && (!descriptor.HasWritable || descriptor.Writable) ? TaintLevel.AttributeTainted : TaintLevel.BindingTainted;
         }
     }
     return(base.DefineOwnProperty(propertyKey, descriptor));
 }
コード例 #5
0
        public override EcmaPropertyDescriptor GetOwnProperty(EcmaPropertyKey propertyKey)
        {
            EcmaPropertyDescriptor current = base.GetOwnProperty(propertyKey);

            if (EcmaValueUtility.TryIndexByPropertyKey(arguments, propertyKey, out EcmaValue value))
            {
                if (taintedLevel == null)
                {
                    return(new EcmaPropertyDescriptor(value, EcmaPropertyAttributes.DefaultDataProperty));
                }
                if (taintedLevel[propertyKey.ToArrayIndex()] == TaintLevel.AttributeTainted)
                {
                    current.Value = value;
                }
            }
            return(current);
        }
コード例 #6
0
 private bool IsBoundedVariable(EcmaPropertyKey propertyKey)
 {
     return(propertyKey.IsArrayIndex && propertyKey.ToArrayIndex() < arguments.Length);
 }