1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_SATTIC_MODULE_PROXY_HANDLER_H 17 #define ECMASCRIPT_SATTIC_MODULE_PROXY_HANDLER_H 18 19 #include "ecmascript/js_object.h" 20 #include "ecmascript/js_tagged_value.h" 21 #include "ecmascript/js_proxy.h" 22 #include "ecmascript/js_function.h" 23 24 namespace panda::ecmascript { 25 class StaticModuleProxyHandler { 26 public: 27 static JSHandle<JSProxy> CreateStaticModuleProxyHandler(JSThread *thread, 28 const JSHandle<JSTaggedValue> exportObject); 29 // [[SetPrototypeOf]] 30 static JSTaggedValue SetPrototype(EcmaRuntimeCallInfo *argv); 31 32 // [[GetPrototypeOf]] 33 static JSTaggedValue GetPrototype(EcmaRuntimeCallInfo *argv); 34 35 // [[PreventExtensions]] 36 static JSTaggedValue PreventExtensions(EcmaRuntimeCallInfo *argv); 37 // [[GetOwnProperty]] 38 static JSTaggedValue GetOwnProperty(EcmaRuntimeCallInfo *argv); 39 40 static bool GetOwnPropertyInternal(JSThread *thread, const JSHandle<JSTaggedValue> &obj, 41 const JSHandle<JSTaggedValue> &key, PropertyDescriptor &desc); 42 // [[DefineOwnProperty]] ( P, Desc ) 43 static JSTaggedValue DefineOwnProperty(EcmaRuntimeCallInfo *argv); 44 // [[HasProperty]] 45 static JSTaggedValue HasProperty(EcmaRuntimeCallInfo *argv); 46 // [[Get]] ( P, Receiver ) 47 static JSTaggedValue GetProperty(EcmaRuntimeCallInfo *argv); 48 49 static JSTaggedValue GetPropertyInternal(JSThread *thread, const JSHandle<JSTaggedValue> &obj, 50 const JSHandle<JSTaggedValue> &key); 51 // [[Set]] ( P, V, Receiver ) 52 static JSTaggedValue SetProperty(EcmaRuntimeCallInfo *argv); 53 // [[Delete]] ( P ) 54 static JSTaggedValue DeleteProperty(EcmaRuntimeCallInfo *argv); 55 // [[OwnPropertyKeys]] 56 static JSTaggedValue OwnPropertyKeys(EcmaRuntimeCallInfo *argv); 57 58 static JSTaggedValue OwnEnumPropertyKeys(EcmaRuntimeCallInfo *argv); 59 60 static JSTaggedValue IsExtensible(EcmaRuntimeCallInfo *argv); 61 62 private: 63 static int const FIRST = 0; 64 static int const SECOND = 1; 65 static int const THIRD = 2; 66 }; 67 } // namespace panda::ecmascript 68 #endif // ECMASCRIPT_SATTIC_MODULE_PROXY_HANDLER_H 69