| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- #pragma once
- namespace Js
- {
- class JavascriptStringObject : public DynamicObject
- {
- private:
- static PropertyId const specialPropertyIds[];
- protected:
- Field(JavascriptString*) value;
- DEFINE_VTABLE_CTOR(JavascriptStringObject, DynamicObject);
- DEFINE_MARSHAL_OBJECT_TO_SCRIPT_CONTEXT(JavascriptStringObject);
- JavascriptString* InternalUnwrap();
- private:
- bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext, BOOL* result);
- bool SetPropertyBuiltIns(PropertyId propertyId, PropertyOperationFlags flags, bool* result);
- bool GetSetterBuiltIns(PropertyId propertyId, PropertyValueInfo* info, DescriptorFlags* descriptorFlags);
- bool IsValidIndex(PropertyId propertyId, bool conditionMetBehavior);
- public:
- JavascriptStringObject(DynamicType * type);
- JavascriptStringObject(JavascriptString* value, DynamicType * type);
- static bool Is(Var aValue);
- static JavascriptStringObject* FromVar(Var aValue);
- static JavascriptStringObject* UnsafeFromVar(Var aValue);
- void Initialize(JavascriptString* value);
- JavascriptString* Unwrap() { return InternalUnwrap(); }
- virtual bool HasReadOnlyPropertiesInvisibleToTypeHandler() override { return true; }
- virtual DescriptorFlags GetItemSetter(uint32 index, Var* setterValue, ScriptContext* requestContext) override;
- virtual PropertyQueryFlags HasPropertyQuery(PropertyId propertyId) override;
- virtual BOOL IsConfigurable(PropertyId propertyId) override;
- virtual BOOL IsEnumerable(PropertyId propertyId) override;
- virtual BOOL IsWritable(PropertyId propertyId) override;
- virtual PropertyQueryFlags GetPropertyQuery(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
- virtual PropertyQueryFlags GetPropertyQuery(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
- virtual PropertyQueryFlags GetPropertyReferenceQuery(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
- virtual BOOL SetProperty(PropertyId propertyId, Var value, PropertyOperationFlags flags, PropertyValueInfo* info) override;
- virtual BOOL SetProperty(JavascriptString* propertyNameString, Var value, PropertyOperationFlags flags, PropertyValueInfo* info) override;
- virtual BOOL DeleteProperty(PropertyId propertyId, PropertyOperationFlags flags) override;
- virtual BOOL DeleteProperty(JavascriptString *propertyNameString, PropertyOperationFlags flags) override;
- virtual DescriptorFlags GetSetter(PropertyId propertyId, Var* setterValue, PropertyValueInfo* info, ScriptContext* requestContext) override;
- virtual DescriptorFlags GetSetter(JavascriptString* propertyNameString, Var* setterValue, PropertyValueInfo* info, ScriptContext* requestContext) override;
- virtual PropertyQueryFlags HasItemQuery(uint32 index) override;
- virtual PropertyQueryFlags GetItemQuery(Var originalInstance, uint32 index, Var* value, ScriptContext * requestContext) override;
- virtual PropertyQueryFlags GetItemReferenceQuery(Var originalInstance, uint32 index, Var* value, ScriptContext * requestContext) override;
- virtual BOOL SetItem(uint32 index, Var value, PropertyOperationFlags flags) override;
- virtual BOOL GetEnumerator(JavascriptStaticEnumerator * enumerator, EnumeratorFlags flags, ScriptContext* requestContext, EnumeratorCache * enumeratorCache = nullptr) override;
- virtual BOOL GetDiagValueString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext) override;
- virtual BOOL GetDiagTypeString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext) override;
- virtual BOOL GetSpecialPropertyName(uint32 index, JavascriptString ** propertyName, ScriptContext * requestContext) override;
- virtual uint GetSpecialPropertyCount() const override;
- virtual PropertyId const * GetSpecialPropertyIds() const override;
- #if ENABLE_TTD
- public:
- void SetValue_TTD(Js::Var val);
- virtual void MarkVisitKindSpecificPtrs(TTD::SnapshotExtractor* extractor) override;
- virtual TTD::NSSnapObjects::SnapObjectType GetSnapTag_TTD() const override;
- virtual void ExtractSnapObjectDataInto(TTD::NSSnapObjects::SnapObject* objData, TTD::SlabAllocator& alloc) override;
- #endif
- };
- }
|