OLD | NEW |
1 {##############################################################################} | 1 {##############################################################################} |
2 {% macro attribute_getter(attribute, world_suffix) %} | 2 {% macro attribute_getter(attribute, world_suffix) %} |
3 {% filter conditional(attribute.conditional_string) %} | 3 {% filter conditional(attribute.conditional_string) %} |
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
7 {%- else %} | 7 {%- else %} |
8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
9 {%- endif %}) | 9 {%- endif %}) |
10 { | 10 { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 return false; | 352 return false; |
353 ScriptState* scriptState = ScriptState::from(context); | 353 ScriptState* scriptState = ScriptState::from(context); |
354 if (!scriptState->executionContext()) | 354 if (!scriptState->executionContext()) |
355 return false; | 355 return false; |
356 | 356 |
357 ScriptState::Scope scope(scriptState); | 357 ScriptState::Scope scope(scriptState); |
358 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 358 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
359 | 359 |
360 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 360 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
361 v8::TryCatch block; | 361 v8::TryCatch block; |
362 V8RethrowTryCatchScope rethrow(block); | |
363 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s
criptState, "{{cpp_class}}", "{{attribute.name}}", holder); | 362 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s
criptState, "{{cpp_class}}", "{{attribute.name}}", holder); |
364 if (block.HasCaught()) { | 363 if (block.HasCaught()) { |
365 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 364 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { |
366 // FIXME: We should support more exceptions. | 365 // FIXME: We should support more exceptions. |
367 RELEASE_ASSERT_NOT_REACHED(); | 366 RELEASE_ASSERT_NOT_REACHED(); |
368 } | 367 } |
| 368 block.ReThrow(); |
369 return false; | 369 return false; |
370 } | 370 } |
371 {{attribute.private_script_v8_value_to_local_cpp_value}}; | 371 {{attribute.private_script_v8_value_to_local_cpp_value}}; |
372 RELEASE_ASSERT(!exceptionState.hadException()); | 372 RELEASE_ASSERT(!exceptionState.hadException()); |
373 *result = cppValue; | 373 *result = cppValue; |
374 return true; | 374 return true; |
375 } | 375 } |
376 {% endmacro %} | 376 {% endmacro %} |
377 | 377 |
378 | 378 |
379 {% macro attribute_setter_implemented_in_private_script(attribute) %} | 379 {% macro attribute_setter_implemented_in_private_script(attribute) %} |
380 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) | 380 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) |
381 { | 381 { |
382 if (!frame) | 382 if (!frame) |
383 return false; | 383 return false; |
384 v8::HandleScope handleScope(toIsolate(frame)); | 384 v8::HandleScope handleScope(toIsolate(frame)); |
385 ScriptForbiddenScope::AllowUserAgentScript script; | 385 ScriptForbiddenScope::AllowUserAgentScript script; |
386 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); | 386 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
387 if (context.IsEmpty()) | 387 if (context.IsEmpty()) |
388 return false; | 388 return false; |
389 ScriptState* scriptState = ScriptState::from(context); | 389 ScriptState* scriptState = ScriptState::from(context); |
390 if (!scriptState->executionContext()) | 390 if (!scriptState->executionContext()) |
391 return false; | 391 return false; |
392 | 392 |
393 ScriptState::Scope scope(scriptState); | 393 ScriptState::Scope scope(scriptState); |
394 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 394 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
395 | 395 |
396 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 396 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
397 v8::TryCatch block; | 397 v8::TryCatch block; |
398 V8RethrowTryCatchScope rethrow(block); | |
399 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); | 398 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); |
400 if (block.HasCaught()) { | 399 if (block.HasCaught()) { |
401 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 400 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { |
402 // FIXME: We should support more exceptions. | 401 // FIXME: We should support more exceptions. |
403 RELEASE_ASSERT_NOT_REACHED(); | 402 RELEASE_ASSERT_NOT_REACHED(); |
404 } | 403 } |
| 404 block.ReThrow(); |
405 return false; | 405 return false; |
406 } | 406 } |
407 return true; | 407 return true; |
408 } | 408 } |
409 {% endmacro %} | 409 {% endmacro %} |
OLD | NEW |