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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 {% endfilter %} | 338 {% endfilter %} |
339 {% endmacro %} | 339 {% endmacro %} |
340 | 340 |
341 | 341 |
342 {##############################################################################} | 342 {##############################################################################} |
343 {% macro attribute_getter_implemented_in_private_script(attribute) %} | 343 {% macro attribute_getter_implemented_in_private_script(attribute) %} |
344 bool {{v8_class}}::{{attribute.name}}AttributeGetterImplementedInPrivateScript(L
ocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) | 344 bool {{v8_class}}::{{attribute.name}}AttributeGetterImplementedInPrivateScript(L
ocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) |
345 { | 345 { |
346 if (!frame) | 346 if (!frame) |
347 return false; | 347 return false; |
| 348 v8::HandleScope handleScope(toIsolate(frame)); |
| 349 ScriptForbiddenScope::AllowUserAgentScript script; |
348 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); | 350 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
349 if (context.IsEmpty()) | 351 if (context.IsEmpty()) |
350 return false; | 352 return false; |
351 ScriptState* scriptState = ScriptState::from(context); | 353 ScriptState* scriptState = ScriptState::from(context); |
352 if (!scriptState->executionContext()) | 354 if (!scriptState->executionContext()) |
353 return false; | 355 return false; |
354 | 356 |
355 ScriptState::Scope scope(scriptState); | 357 ScriptState::Scope scope(scriptState); |
356 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()); |
357 | 359 |
(...skipping 14 matching lines...) Expand all Loading... |
372 return true; | 374 return true; |
373 } | 375 } |
374 {% endmacro %} | 376 {% endmacro %} |
375 | 377 |
376 | 378 |
377 {% macro attribute_setter_implemented_in_private_script(attribute) %} | 379 {% macro attribute_setter_implemented_in_private_script(attribute) %} |
378 bool {{v8_class}}::{{attribute.name}}AttributeSetterImplementedInPrivateScript(L
ocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cpp
Value) | 380 bool {{v8_class}}::{{attribute.name}}AttributeSetterImplementedInPrivateScript(L
ocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cpp
Value) |
379 { | 381 { |
380 if (!frame) | 382 if (!frame) |
381 return false; | 383 return false; |
| 384 v8::HandleScope handleScope(toIsolate(frame)); |
| 385 ScriptForbiddenScope::AllowUserAgentScript script; |
382 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); | 386 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
383 if (context.IsEmpty()) | 387 if (context.IsEmpty()) |
384 return false; | 388 return false; |
385 ScriptState* scriptState = ScriptState::from(context); | 389 ScriptState* scriptState = ScriptState::from(context); |
386 if (!scriptState->executionContext()) | 390 if (!scriptState->executionContext()) |
387 return false; | 391 return false; |
388 | 392 |
389 ScriptState::Scope scope(scriptState); | 393 ScriptState::Scope scope(scriptState); |
390 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()); |
391 | 395 |
392 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()
); |
393 v8::TryCatch block; | 397 v8::TryCatch block; |
394 V8RethrowTryCatchScope rethrow(block); | 398 V8RethrowTryCatchScope rethrow(block); |
395 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); | 399 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); |
396 if (block.HasCaught()) { | 400 if (block.HasCaught()) { |
397 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 401 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { |
398 // FIXME: We should support exceptions other than DOM exceptions. | 402 // FIXME: We should support exceptions other than DOM exceptions. |
399 RELEASE_ASSERT_NOT_REACHED(); | 403 RELEASE_ASSERT_NOT_REACHED(); |
400 } | 404 } |
401 return false; | 405 return false; |
402 } | 406 } |
403 return true; | 407 return true; |
404 } | 408 } |
405 {% endmacro %} | 409 {% endmacro %} |
OLD | NEW |