|
|
|
Lines 1004-1019
ScriptedIndirectProxyHandler::defaultVal
|
Link Here
|
|---|
|
| 1004 |
* This function is only here to prevent bug 757063. It will be removed when |
1004 |
* This function is only here to prevent bug 757063. It will be removed when |
| 1005 |
* the direct proxy refactor is complete. |
1005 |
* the direct proxy refactor is complete. |
| 1006 |
*/ |
1006 |
*/ |
| 1007 |
return BaseProxyHandler::defaultValue(cx, proxy, hint, vp); |
1007 |
return BaseProxyHandler::defaultValue(cx, proxy, hint, vp); |
| 1008 |
} |
1008 |
} |
| 1009 |
|
1009 |
|
| 1010 |
ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; |
1010 |
ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; |
| 1011 |
|
1011 |
|
|
|
1012 |
static JSObject * |
| 1013 |
GetDirectProxyHandlerObject(JSObject *proxy) |
| 1014 |
{ |
| 1015 |
return GetProxyExtra(proxy, 0).toObjectOrNull(); |
| 1016 |
} |
| 1017 |
|
| 1018 |
/* Derived class for all scripted direct proxy handlers. */ |
| 1019 |
class ScriptedDirectProxyHandler : public DirectProxyHandler { |
| 1020 |
public: |
| 1021 |
ScriptedDirectProxyHandler(); |
| 1022 |
virtual ~ScriptedDirectProxyHandler(); |
| 1023 |
|
| 1024 |
/* ES5 Harmony fundamental proxy traps. */ |
| 1025 |
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, |
| 1026 |
PropertyDescriptor *desc); |
| 1027 |
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, |
| 1028 |
PropertyDescriptor *desc); |
| 1029 |
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, |
| 1030 |
PropertyDescriptor *desc); |
| 1031 |
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoIdVector &props); |
| 1032 |
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp); |
| 1033 |
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props); |
| 1034 |
|
| 1035 |
/* ES5 Harmony derived proxy traps. */ |
| 1036 |
virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); |
| 1037 |
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); |
| 1038 |
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp); |
| 1039 |
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, |
| 1040 |
Value *vp); |
| 1041 |
virtual bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); |
| 1042 |
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp); |
| 1043 |
|
| 1044 |
static ScriptedDirectProxyHandler singleton; |
| 1045 |
}; |
| 1046 |
|
| 1047 |
static int sScriptedDirectProxyHandlerFamily = 0; |
| 1048 |
|
| 1049 |
ScriptedDirectProxyHandler::ScriptedDirectProxyHandler() |
| 1050 |
: DirectProxyHandler(&sScriptedDirectProxyHandlerFamily) |
| 1051 |
{ |
| 1052 |
} |
| 1053 |
|
| 1054 |
ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler() |
| 1055 |
{ |
| 1056 |
} |
| 1057 |
|
| 1058 |
bool |
| 1059 |
ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, |
| 1060 |
bool set, PropertyDescriptor *desc) |
| 1061 |
{ |
| 1062 |
JS_NOT_REACHED("not yet implemented"); |
| 1063 |
return false; |
| 1064 |
} |
| 1065 |
|
| 1066 |
bool |
| 1067 |
ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, |
| 1068 |
bool set, PropertyDescriptor *desc) |
| 1069 |
{ |
| 1070 |
JS_NOT_REACHED("not yet implemented"); |
| 1071 |
return false; |
| 1072 |
} |
| 1073 |
|
| 1074 |
bool |
| 1075 |
ScriptedDirectProxyHandler::defineProperty(JSContext *cx, JSObject *proxy, jsid id, |
| 1076 |
PropertyDescriptor *desc) |
| 1077 |
{ |
| 1078 |
JS_NOT_REACHED("not yet implemented"); |
| 1079 |
return false; |
| 1080 |
} |
| 1081 |
|
| 1082 |
bool |
| 1083 |
ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, JSObject *proxy, |
| 1084 |
AutoIdVector &props) |
| 1085 |
{ |
| 1086 |
JS_NOT_REACHED("not yet implemented"); |
| 1087 |
return false; |
| 1088 |
} |
| 1089 |
|
| 1090 |
bool |
| 1091 |
ScriptedDirectProxyHandler::delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) |
| 1092 |
{ |
| 1093 |
JS_NOT_REACHED("not yet implemented"); |
| 1094 |
return false; |
| 1095 |
} |
| 1096 |
|
| 1097 |
bool |
| 1098 |
ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) |
| 1099 |
{ |
| 1100 |
JS_NOT_REACHED("not yet implemented"); |
| 1101 |
return false; |
| 1102 |
} |
| 1103 |
|
| 1104 |
bool |
| 1105 |
ScriptedDirectProxyHandler::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp) |
| 1106 |
{ |
| 1107 |
JS_NOT_REACHED("not yet implemented"); |
| 1108 |
return false; |
| 1109 |
} |
| 1110 |
|
| 1111 |
bool |
| 1112 |
ScriptedDirectProxyHandler::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp) |
| 1113 |
{ |
| 1114 |
JS_NOT_REACHED("not yet implemented"); |
| 1115 |
return false; |
| 1116 |
} |
| 1117 |
|
| 1118 |
bool |
| 1119 |
ScriptedDirectProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, |
| 1120 |
Value *vp) |
| 1121 |
{ |
| 1122 |
JS_NOT_REACHED("not yet implemented"); |
| 1123 |
return false; |
| 1124 |
} |
| 1125 |
|
| 1126 |
bool |
| 1127 |
ScriptedDirectProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, |
| 1128 |
bool strict, Value *vp) |
| 1129 |
{ |
| 1130 |
JS_NOT_REACHED("not yet implemented"); |
| 1131 |
return false; |
| 1132 |
} |
| 1133 |
|
| 1134 |
bool |
| 1135 |
ScriptedDirectProxyHandler::keys(JSContext *cx, JSObject *proxy, AutoIdVector &props) |
| 1136 |
{ |
| 1137 |
JS_NOT_REACHED("not yet implemented"); |
| 1138 |
return false; |
| 1139 |
} |
| 1140 |
|
| 1141 |
bool |
| 1142 |
ScriptedDirectProxyHandler::iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp) |
| 1143 |
{ |
| 1144 |
JS_NOT_REACHED("not yet implemented"); |
| 1145 |
return false; |
| 1146 |
} |
| 1147 |
|
| 1148 |
ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton; |
| 1149 |
|
| 1012 |
bool |
1150 |
bool |
| 1013 |
Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, |
1151 |
Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, |
| 1014 |
PropertyDescriptor *desc) |
1152 |
PropertyDescriptor *desc) |
| 1015 |
{ |
1153 |
{ |
| 1016 |
JS_CHECK_RECURSION(cx, return false); |
1154 |
JS_CHECK_RECURSION(cx, return false); |
| 1017 |
return GetProxyHandler(proxy)->getPropertyDescriptor(cx, proxy, id, set, desc); |
1155 |
return GetProxyHandler(proxy)->getPropertyDescriptor(cx, proxy, id, set, desc); |
| 1018 |
} |
1156 |
} |
| 1019 |
|
1157 |
|