Пример #1
0
        public override bool Delete(EcmaPropertyKey propertyKey)
        {
            RuntimeObject target = ThrowIfProxyRevoked();
            RuntimeObject trap   = handler.GetMethod(WellKnownProperty.DeleteProperty);

            if (trap == null)
            {
                return(target.Delete(propertyKey));
            }
            if (!(bool)trap.Call(handler, target, propertyKey.ToValue()))
            {
                return(false);
            }
            EcmaPropertyDescriptor descriptor = target.GetOwnProperty(propertyKey);

            if (descriptor == null)
            {
                return(true);
            }
            if (!descriptor.Configurable)
            {
                throw new EcmaTypeErrorException(InternalString.Error.InvalidTrapResult);
            }
            return(true);
        }
Пример #2
0
 public static bool DeletePropertyOrThrow(this RuntimeObject obj, EcmaPropertyKey propertyKey)
 {
     Guard.ArgumentNotNull(obj, "obj");
     if (!obj.Delete(propertyKey))
     {
         throw new EcmaTypeErrorException(InternalString.Error.DeletePropertyThrow);
     }
     return(true);
 }