| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 template <typename T> void V8_USE(T) { } | 74 template <typename T> void V8_USE(T) { } |
| 75 | 75 |
| 76 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 76 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 77 { | 77 { |
| 78 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | 78 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); |
| 79 if (UNLIKELY(info.Length() < 1)) { | 79 if (UNLIKELY(info.Length() < 1)) { |
| 80 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 80 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 81 exceptionState.throwIfNeeded(); | 81 exceptionState.throwIfNeeded(); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 84 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 85 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | 85 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); |
| 86 RefPtr<TestInterfaceEmpty> result = imp->item(index, exceptionState); | 86 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); |
| 87 if (exceptionState.throwIfNeeded()) | 87 if (exceptionState.throwIfNeeded()) |
| 88 return; | 88 return; |
| 89 v8SetReturnValue(info, result.release()); | 89 v8SetReturnValue(info, result.release()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 92 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 93 { | 93 { |
| 94 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 94 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 95 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMethod(info); | 95 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMethod(info); |
| 96 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 97 } | 97 } |
| 98 | 98 |
| 99 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 99 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 100 { | 100 { |
| 101 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "
TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate(
)); | 101 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "
TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate(
)); |
| 102 if (UNLIKELY(info.Length() < 2)) { | 102 if (UNLIKELY(info.Length() < 2)) { |
| 103 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 103 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
| 104 exceptionState.throwIfNeeded(); | 104 exceptionState.throwIfNeeded(); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 107 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 108 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | 108 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); |
| 109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); | 109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); |
| 110 String result = imp->setItem(index, value, exceptionState); | 110 String result = impl->setItem(index, value, exceptionState); |
| 111 if (exceptionState.throwIfNeeded()) | 111 if (exceptionState.throwIfNeeded()) |
| 112 return; | 112 return; |
| 113 v8SetReturnValueString(info, result, info.GetIsolate()); | 113 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 116 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 117 { | 117 { |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 119 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setItemMethod(info
); | 119 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setItemMethod(info
); |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 121 } | 121 } |
| 122 | 122 |
| 123 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 123 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 124 { | 124 { |
| 125 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem"
, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsola
te()); | 125 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem"
, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsola
te()); |
| 126 if (UNLIKELY(info.Length() < 1)) { | 126 if (UNLIKELY(info.Length() < 1)) { |
| 127 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 127 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 128 exceptionState.throwIfNeeded(); | 128 exceptionState.throwIfNeeded(); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 131 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 132 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | 132 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); |
| 133 bool result = imp->deleteItem(index, exceptionState); | 133 bool result = impl->deleteItem(index, exceptionState); |
| 134 if (exceptionState.throwIfNeeded()) | 134 if (exceptionState.throwIfNeeded()) |
| 135 return; | 135 return; |
| 136 v8SetReturnValueBool(info, result); | 136 v8SetReturnValueBool(info, result); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 139 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 140 { | 140 { |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 142 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteItemMethod(i
nfo); | 142 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteItemMethod(i
nfo); |
| 143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 144 } | 144 } |
| 145 | 145 |
| 146 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 146 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 147 { | 147 { |
| 148 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | 148 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); |
| 149 if (UNLIKELY(info.Length() < 1)) { | 149 if (UNLIKELY(info.Length() < 1)) { |
| 150 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 150 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 151 exceptionState.throwIfNeeded(); | 151 exceptionState.throwIfNeeded(); |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 154 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 155 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | 155 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
| 156 RefPtr<TestInterfaceEmpty> result = imp->namedItem(name, exceptionState); | 156 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); |
| 157 if (exceptionState.throwIfNeeded()) | 157 if (exceptionState.throwIfNeeded()) |
| 158 return; | 158 return; |
| 159 v8SetReturnValue(info, result.release()); | 159 v8SetReturnValue(info, result.release()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 162 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 163 { | 163 { |
| 164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 165 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedItemMethod(in
fo); | 165 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedItemMethod(in
fo); |
| 166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 167 } | 167 } |
| 168 | 168 |
| 169 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 169 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 170 { | 170 { |
| 171 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte
m", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIso
late()); | 171 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte
m", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIso
late()); |
| 172 if (UNLIKELY(info.Length() < 2)) { | 172 if (UNLIKELY(info.Length() < 2)) { |
| 173 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 173 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
| 174 exceptionState.throwIfNeeded(); | 174 exceptionState.throwIfNeeded(); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 177 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 178 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | 178 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
| 179 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); | 179 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); |
| 180 String result = imp->setNamedItem(name, value, exceptionState); | 180 String result = impl->setNamedItem(name, value, exceptionState); |
| 181 if (exceptionState.throwIfNeeded()) | 181 if (exceptionState.throwIfNeeded()) |
| 182 return; | 182 return; |
| 183 v8SetReturnValueString(info, result, info.GetIsolate()); | 183 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>
& info) | 186 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>
& info) |
| 187 { | 187 { |
| 188 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 188 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 189 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setNamedItemMethod
(info); | 189 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setNamedItemMethod
(info); |
| 190 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 190 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 191 } | 191 } |
| 192 | 192 |
| 193 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 193 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 194 { | 194 { |
| 195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed
Item", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.Get
Isolate()); | 195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed
Item", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.Get
Isolate()); |
| 196 if (UNLIKELY(info.Length() < 1)) { | 196 if (UNLIKELY(info.Length() < 1)) { |
| 197 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 197 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 198 exceptionState.throwIfNeeded(); | 198 exceptionState.throwIfNeeded(); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 201 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 202 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | 202 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
| 203 bool result = imp->deleteNamedItem(name, exceptionState); | 203 bool result = impl->deleteNamedItem(name, exceptionState); |
| 204 if (exceptionState.throwIfNeeded()) | 204 if (exceptionState.throwIfNeeded()) |
| 205 return; | 205 return; |
| 206 v8SetReturnValueBool(info, result); | 206 v8SetReturnValueBool(info, result); |
| 207 } | 207 } |
| 208 | 208 |
| 209 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 209 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 210 { | 210 { |
| 211 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 211 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 212 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet
hod(info); | 212 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet
hod(info); |
| 213 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 213 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 214 } | 214 } |
| 215 | 215 |
| 216 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 216 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 217 { | 217 { |
| 218 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 218 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 219 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | 219 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); |
| 220 RefPtr<TestInterfaceEmpty> result = imp->item(index, exceptionState); | 220 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); |
| 221 if (exceptionState.throwIfNeeded()) | 221 if (exceptionState.throwIfNeeded()) |
| 222 return; | 222 return; |
| 223 if (!result) | 223 if (!result) |
| 224 return; | 224 return; |
| 225 v8SetReturnValueFast(info, WTF::getPtr(result.release()), imp); | 225 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
| 226 } | 226 } |
| 227 | 227 |
| 228 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 228 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 229 { | 229 { |
| 230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 231 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet
ter(index, info); | 231 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet
ter(index, info); |
| 232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 233 } | 233 } |
| 234 | 234 |
| 235 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 235 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 236 { | 236 { |
| 237 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 237 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 238 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 238 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
| 239 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | 239 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); |
| 240 bool result = imp->setItem(index, propertyValue, exceptionState); | 240 bool result = impl->setItem(index, propertyValue, exceptionState); |
| 241 if (exceptionState.throwIfNeeded()) | 241 if (exceptionState.throwIfNeeded()) |
| 242 return; | 242 return; |
| 243 if (!result) | 243 if (!result) |
| 244 return; | 244 return; |
| 245 v8SetReturnValue(info, jsValue); | 245 v8SetReturnValue(info, jsValue); |
| 246 } | 246 } |
| 247 | 247 |
| 248 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 248 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 249 { | 249 { |
| 250 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 250 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 251 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet
ter(index, jsValue, info); | 251 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet
ter(index, jsValue, info); |
| 252 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 252 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 253 } | 253 } |
| 254 | 254 |
| 255 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | 255 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) |
| 256 { | 256 { |
| 257 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 257 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 258 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestS
pecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | 258 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestS
pecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); |
| 259 DeleteResult result = imp->deleteItem(index, exceptionState); | 259 DeleteResult result = impl->deleteItem(index, exceptionState); |
| 260 if (exceptionState.throwIfNeeded()) | 260 if (exceptionState.throwIfNeeded()) |
| 261 return; | 261 return; |
| 262 if (result != DeleteUnknownProperty) | 262 if (result != DeleteUnknownProperty) |
| 263 return v8SetReturnValueBool(info, result == DeleteSuccess); | 263 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 264 } | 264 } |
| 265 | 265 |
| 266 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 266 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
| 267 { | 267 { |
| 268 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 268 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 269 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel
eter(index, info); | 269 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel
eter(index, info); |
| 270 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 270 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 271 } | 271 } |
| 272 | 272 |
| 273 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 273 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 274 { | 274 { |
| 275 if (info.Holder()->HasRealNamedProperty(name)) | 275 if (info.Holder()->HasRealNamedProperty(name)) |
| 276 return; | 276 return; |
| 277 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 277 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 278 return; | 278 return; |
| 279 | 279 |
| 280 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 280 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 281 AtomicString propertyName = toCoreAtomicString(name); | 281 AtomicString propertyName = toCoreAtomicString(name); |
| 282 v8::String::Utf8Value namedProperty(name); | 282 v8::String::Utf8Value namedProperty(name); |
| 283 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | 283 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); |
| 284 RefPtr<TestInterfaceEmpty> result = imp->namedItem(propertyName, exceptionSt
ate); | 284 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); |
| 285 if (exceptionState.throwIfNeeded()) | 285 if (exceptionState.throwIfNeeded()) |
| 286 return; | 286 return; |
| 287 if (!result) | 287 if (!result) |
| 288 return; | 288 return; |
| 289 v8SetReturnValueFast(info, WTF::getPtr(result.release()), imp); | 289 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
| 290 } | 290 } |
| 291 | 291 |
| 292 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 292 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 293 { | 293 { |
| 294 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 294 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 295 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette
r(name, info); | 295 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette
r(name, info); |
| 296 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 296 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 297 } | 297 } |
| 298 | 298 |
| 299 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 299 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 300 { | 300 { |
| 301 if (info.Holder()->HasRealNamedProperty(name)) | 301 if (info.Holder()->HasRealNamedProperty(name)) |
| 302 return; | 302 return; |
| 303 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 303 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 304 return; | 304 return; |
| 305 | 305 |
| 306 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 306 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 307 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 307 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 308 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 308 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
| 309 v8::String::Utf8Value namedProperty(name); | 309 v8::String::Utf8Value namedProperty(name); |
| 310 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | 310 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); |
| 311 bool result = imp->setNamedItem(propertyName, propertyValue, exceptionState)
; | 311 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); |
| 312 if (exceptionState.throwIfNeeded()) | 312 if (exceptionState.throwIfNeeded()) |
| 313 return; | 313 return; |
| 314 if (!result) | 314 if (!result) |
| 315 return; | 315 return; |
| 316 v8SetReturnValue(info, jsValue); | 316 v8SetReturnValue(info, jsValue); |
| 317 } | 317 } |
| 318 | 318 |
| 319 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 319 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 320 { | 320 { |
| 321 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 321 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 322 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette
r(name, jsValue, info); | 322 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette
r(name, jsValue, info); |
| 323 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 323 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 324 } | 324 } |
| 325 | 325 |
| 326 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 326 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 327 { | 327 { |
| 328 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 328 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 329 AtomicString propertyName = toCoreAtomicString(name); | 329 AtomicString propertyName = toCoreAtomicString(name); |
| 330 v8::String::Utf8Value namedProperty(name); | 330 v8::String::Utf8Value namedProperty(name); |
| 331 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | 331 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); |
| 332 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 332 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 333 if (exceptionState.throwIfNeeded()) | 333 if (exceptionState.throwIfNeeded()) |
| 334 return; | 334 return; |
| 335 if (!result) | 335 if (!result) |
| 336 return; | 336 return; |
| 337 v8SetReturnValueInt(info, v8::None); | 337 v8SetReturnValueInt(info, v8::None); |
| 338 } | 338 } |
| 339 | 339 |
| 340 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 340 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 341 { | 341 { |
| 342 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 342 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 343 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery
(name, info); | 343 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery
(name, info); |
| 344 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 344 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 345 } | 345 } |
| 346 | 346 |
| 347 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | 347 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
| 348 { | 348 { |
| 349 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 349 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 350 AtomicString propertyName = toCoreAtomicString(name); | 350 AtomicString propertyName = toCoreAtomicString(name); |
| 351 v8::String::Utf8Value namedProperty(name); | 351 v8::String::Utf8Value namedProperty(name); |
| 352 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsol
ate()); | 352 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsol
ate()); |
| 353 DeleteResult result = imp->deleteNamedItem(propertyName, exceptionState); | 353 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); |
| 354 if (exceptionState.throwIfNeeded()) | 354 if (exceptionState.throwIfNeeded()) |
| 355 return; | 355 return; |
| 356 if (result != DeleteUnknownProperty) | 356 if (result != DeleteUnknownProperty) |
| 357 return v8SetReturnValueBool(info, result == DeleteSuccess); | 357 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 358 } | 358 } |
| 359 | 359 |
| 360 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | 360 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
| 361 { | 361 { |
| 362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 363 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet
er(name, info); | 363 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet
er(name, info); |
| 364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 365 } | 365 } |
| 366 | 366 |
| 367 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 367 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 368 { | 368 { |
| 369 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); | 369 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); |
| 370 Vector<String> names; | 370 Vector<String> names; |
| 371 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | 371 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); |
| 372 imp->namedPropertyEnumerator(names, exceptionState); | 372 impl->namedPropertyEnumerator(names, exceptionState); |
| 373 if (exceptionState.throwIfNeeded()) | 373 if (exceptionState.throwIfNeeded()) |
| 374 return; | 374 return; |
| 375 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 375 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 376 for (size_t i = 0; i < names.size(); ++i) | 376 for (size_t i = 0; i < names.size(); ++i) |
| 377 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 377 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 378 v8SetReturnValue(info, v8names); | 378 v8SetReturnValue(info, v8names); |
| 379 } | 379 } |
| 380 | 380 |
| 381 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 381 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 382 { | 382 { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 fromInternalPointer(object)->deref(); | 469 fromInternalPointer(object)->deref(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 template<> | 472 template<> |
| 473 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio
n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 473 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio
n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 474 { | 474 { |
| 475 return toV8(impl, creationContext, isolate); | 475 return toV8(impl, creationContext, isolate); |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace WebCore | 478 } // namespace WebCore |
| OLD | NEW |