public override bool Delete(EcmaPropertyKey propertyKey) { if (IsBoundedVariable(propertyKey)) { EnsureTainted(); taintedLevel[propertyKey.ToArrayIndex()] = TaintLevel.BindingTainted; } return(base.Delete(propertyKey)); }
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); }
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); }
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)); }
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); }
private bool IsBoundedVariable(EcmaPropertyKey propertyKey) { return(propertyKey.IsArrayIndex && propertyKey.ToArrayIndex() < arguments.Length); }