|
Lines 68-219
JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propert
a/Source/WebCore/bindings/js/JSDictionary.cpp_sec1
|
| 68 |
return PropertyFound; |
68 |
return PropertyFound; |
| 69 |
} |
69 |
} |
| 70 |
|
70 |
|
| 71 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result) |
71 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result) |
| 72 |
{ |
72 |
{ |
| 73 |
result = value.toBoolean(exec); |
73 |
result = value.toBoolean(exec); |
|
|
74 |
return true; |
| 74 |
} |
75 |
} |
| 75 |
|
76 |
|
| 76 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, int& result) |
77 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, int& result) |
| 77 |
{ |
78 |
{ |
| 78 |
result = value.toInt32(exec); |
79 |
result = value.toInt32(exec); |
|
|
80 |
return true; |
| 79 |
} |
81 |
} |
| 80 |
|
82 |
|
| 81 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result) |
83 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result) |
| 82 |
{ |
84 |
{ |
| 83 |
result = value.toUInt32(exec); |
85 |
result = value.toUInt32(exec); |
|
|
86 |
return true; |
| 84 |
} |
87 |
} |
| 85 |
|
88 |
|
| 86 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& result) |
89 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& result) |
| 87 |
{ |
90 |
{ |
| 88 |
result = static_cast<unsigned short>(value.toUInt32(exec)); |
91 |
result = static_cast<unsigned short>(value.toUInt32(exec)); |
|
|
92 |
return true; |
| 89 |
} |
93 |
} |
| 90 |
|
94 |
|
| 91 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long& result) |
95 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long& result) |
| 92 |
{ |
96 |
{ |
| 93 |
result = static_cast<unsigned long>(value.toUInt32(exec)); |
97 |
result = static_cast<unsigned long>(value.toUInt32(exec)); |
|
|
98 |
return true; |
| 94 |
} |
99 |
} |
| 95 |
|
100 |
|
| 96 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result) |
101 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result) |
| 97 |
{ |
102 |
{ |
| 98 |
double d = value.toNumber(exec); |
103 |
double d = value.toNumber(exec); |
| 99 |
doubleToInteger(d, result); |
104 |
doubleToInteger(d, result); |
|
|
105 |
return true; |
| 100 |
} |
106 |
} |
| 101 |
|
107 |
|
| 102 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result) |
108 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, double& result) |
| 103 |
{ |
109 |
{ |
| 104 |
result = value.toNumber(exec); |
110 |
result = value.toNumber(exec); |
|
|
111 |
return true; |
| 105 |
} |
112 |
} |
| 106 |
|
113 |
|
| 107 |
void JSDictionary::convertValue(JSC::ExecState* exec, JSC::JSValue value, Dictionary& result) |
114 |
bool JSDictionary::convertValue(JSC::ExecState* exec, JSC::JSValue value, Dictionary& result) |
| 108 |
{ |
115 |
{ |
| 109 |
result = Dictionary(exec, value); |
116 |
result = Dictionary(exec, value); |
|
|
117 |
return true; |
| 110 |
} |
118 |
} |
| 111 |
|
119 |
|
| 112 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, String& result) |
120 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, String& result) |
| 113 |
{ |
121 |
{ |
| 114 |
result = value.toString(exec)->value(exec); |
122 |
result = value.toString(exec)->value(exec); |
|
|
123 |
return !exec->hadException(); |
| 115 |
} |
124 |
} |
| 116 |
|
125 |
|
| 117 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& result) |
126 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& result) |
| 118 |
{ |
127 |
{ |
| 119 |
if (value.isUndefinedOrNull()) |
128 |
if (value.isUndefinedOrNull()) |
| 120 |
return; |
129 |
return false; |
|
|
130 |
|
| 131 |
if (!value.isObject()) |
| 132 |
return false; |
| 133 |
JSObject* object = asObject(value); |
| 134 |
if (!isJSArray(object) && !object->inherits(&JSArray::s_info)) |
| 135 |
return false; |
| 121 |
|
136 |
|
| 122 |
unsigned length = 0; |
137 |
unsigned length = 0; |
| 123 |
JSObject* object = toJSSequence(exec, value, length); |
138 |
object = toJSSequence(exec, value, length); |
| 124 |
if (exec->hadException()) |
139 |
if (exec->hadException()) |
| 125 |
return; |
140 |
return false; |
| 126 |
|
141 |
|
| 127 |
for (unsigned i = 0 ; i < length; ++i) { |
142 |
for (unsigned i = 0 ; i < length; ++i) { |
| 128 |
JSValue itemValue = object->get(exec, i); |
143 |
JSValue itemValue = object->get(exec, i); |
| 129 |
if (exec->hadException()) |
144 |
if (exec->hadException()) |
| 130 |
return; |
145 |
return false; |
| 131 |
result.append(itemValue.toString(exec)->value(exec)); |
146 |
result.append(itemValue.toString(exec)->value(exec)); |
| 132 |
} |
147 |
} |
|
|
148 |
|
| 149 |
return !exec->hadException(); |
| 133 |
} |
150 |
} |
| 134 |
|
151 |
|
| 135 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result) |
152 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result) |
| 136 |
{ |
153 |
{ |
| 137 |
result = ScriptValue(exec->globalData(), value); |
154 |
result = ScriptValue(exec->globalData(), value); |
|
|
155 |
return true; |
| 138 |
} |
156 |
} |
| 139 |
|
157 |
|
| 140 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr<SerializedScriptValue>& result) |
158 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr<SerializedScriptValue>& result) |
| 141 |
{ |
159 |
{ |
| 142 |
result = SerializedScriptValue::create(exec, value, 0, 0); |
160 |
result = SerializedScriptValue::create(exec, value, 0, 0); |
|
|
161 |
return !exec->hadException(); |
| 143 |
} |
162 |
} |
| 144 |
|
163 |
|
| 145 |
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result) |
164 |
bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result) |
| 146 |
{ |
165 |
{ |
| 147 |
result = toDOMWindow(value); |
166 |
result = toDOMWindow(value); |
|
|
167 |
return true; |
| 148 |
} |
168 |
} |
| 149 |
|
169 |
|
| 150 |
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result) |
170 |
bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result) |
| 151 |
{ |
171 |
{ |
| 152 |
result = toEventTarget(value); |
172 |
result = toEventTarget(value); |
|
|
173 |
return true; |
| 153 |
} |
174 |
} |
| 154 |
|
175 |
|
| 155 |
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result) |
176 |
bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result) |
| 156 |
{ |
177 |
{ |
| 157 |
result = toNode(value); |
178 |
result = toNode(value); |
|
|
179 |
return true; |
| 158 |
} |
180 |
} |
| 159 |
|
181 |
|
| 160 |
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Storage>& result) |
182 |
bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Storage>& result) |
| 161 |
{ |
183 |
{ |
| 162 |
result = toStorage(value); |
184 |
result = toStorage(value); |
|
|
185 |
return true; |
| 163 |
} |
186 |
} |
| 164 |
|
187 |
|
| 165 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result) |
188 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result) |
| 166 |
{ |
189 |
{ |
| 167 |
ArrayBufferArray arrayBuffers; |
190 |
ArrayBufferArray arrayBuffers; |
| 168 |
fillMessagePortArray(exec, value, result, arrayBuffers); |
191 |
fillMessagePortArray(exec, value, result, arrayBuffers); |
|
|
192 |
return true; |
| 169 |
} |
193 |
} |
| 170 |
|
194 |
|
| 171 |
#if ENABLE(VIDEO_TRACK) |
195 |
#if ENABLE(VIDEO_TRACK) |
| 172 |
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& result) |
196 |
bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& result) |
| 173 |
{ |
197 |
{ |
| 174 |
result = toTrack(value); |
198 |
result = toTrack(value); |
|
|
199 |
return true; |
| 175 |
} |
200 |
} |
| 176 |
#endif |
201 |
#endif |
| 177 |
|
202 |
|
| 178 |
#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) |
203 |
#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) |
| 179 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result) |
204 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result) |
| 180 |
{ |
205 |
{ |
| 181 |
result.clear(); |
206 |
result.clear(); |
| 182 |
|
207 |
|
| 183 |
if (value.isUndefinedOrNull()) |
208 |
if (value.isUndefinedOrNull()) |
| 184 |
return; |
209 |
return false; |
| 185 |
|
210 |
|
| 186 |
unsigned length = 0; |
211 |
unsigned length = 0; |
| 187 |
JSObject* object = toJSSequence(exec, value, length); |
212 |
JSObject* object = toJSSequence(exec, value, length); |
| 188 |
if (exec->hadException()) |
213 |
if (exec->hadException()) |
| 189 |
return; |
214 |
return false; |
| 190 |
|
215 |
|
| 191 |
for (unsigned i = 0 ; i < length; ++i) { |
216 |
for (unsigned i = 0 ; i < length; ++i) { |
| 192 |
JSValue itemValue = object->get(exec, i); |
217 |
JSValue itemValue = object->get(exec, i); |
| 193 |
if (exec->hadException()) |
218 |
if (exec->hadException()) |
| 194 |
return; |
219 |
return false; |
| 195 |
result.add(itemValue.toString(exec)->value(exec)); |
220 |
result.add(itemValue.toString(exec)->value(exec)); |
| 196 |
} |
221 |
} |
|
|
222 |
|
| 223 |
return !exec->hadException(); |
| 197 |
} |
224 |
} |
| 198 |
#endif |
225 |
#endif |
| 199 |
|
226 |
|
| 200 |
void JSDictionary::convertValue(ExecState* exec, JSValue value, ArrayValue& result) |
227 |
bool JSDictionary::convertValue(ExecState* exec, JSValue value, ArrayValue& result) |
| 201 |
{ |
228 |
{ |
| 202 |
if (value.isUndefinedOrNull()) |
229 |
if (value.isUndefinedOrNull()) |
| 203 |
return; |
230 |
return false; |
| 204 |
|
231 |
|
| 205 |
result = ArrayValue(exec, value); |
232 |
result = ArrayValue(exec, value); |
|
|
233 |
return true; |
| 206 |
} |
234 |
} |
| 207 |
|
235 |
|
| 208 |
void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<Uint8Array>& result) |
236 |
bool JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<Uint8Array>& result) |
| 209 |
{ |
237 |
{ |
| 210 |
result = toUint8Array(value); |
238 |
result = toUint8Array(value); |
|
|
239 |
return true; |
| 211 |
} |
240 |
} |
| 212 |
|
241 |
|
| 213 |
#if ENABLE(ENCRYPTED_MEDIA) |
242 |
#if ENABLE(ENCRYPTED_MEDIA) |
| 214 |
void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<MediaKeyError>& result) |
243 |
bool JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<MediaKeyError>& result) |
| 215 |
{ |
244 |
{ |
| 216 |
result = toMediaKeyError(value); |
245 |
result = toMediaKeyError(value); |
|
|
246 |
return true; |
| 217 |
} |
247 |
} |
| 218 |
#endif |
248 |
#endif |
| 219 |
|
249 |
|