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 25 matching lines...) Expand all Loading... |
36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
37 #include "bindings/v8/BindingSecurity.h" | 37 #include "bindings/v8/BindingSecurity.h" |
38 #include "bindings/v8/ExceptionMessages.h" | 38 #include "bindings/v8/ExceptionMessages.h" |
39 #include "bindings/v8/ExceptionState.h" | 39 #include "bindings/v8/ExceptionState.h" |
40 #include "bindings/v8/V8Binding.h" | 40 #include "bindings/v8/V8Binding.h" |
41 #include "bindings/v8/V8DOMConfiguration.h" | 41 #include "bindings/v8/V8DOMConfiguration.h" |
42 #include "bindings/v8/V8DOMWrapper.h" | 42 #include "bindings/v8/V8DOMWrapper.h" |
43 #include "core/dom/ContextFeatures.h" | 43 #include "core/dom/ContextFeatures.h" |
44 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
45 #include "platform/TraceEvent.h" | 45 #include "platform/TraceEvent.h" |
46 #include "wtf/UnusedParam.h" | |
47 | 46 |
48 namespace WebCore { | 47 namespace WebCore { |
49 | 48 |
50 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob
ject) | 49 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob
ject) |
51 { | 50 { |
52 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 51 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
53 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri
ty::wrapperTypeInfo); | 52 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri
ty::wrapperTypeInfo); |
54 else | 53 else |
55 ASSERT_NOT_REACHED(); | 54 ASSERT_NOT_REACHED(); |
56 } | 55 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 481 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
483 { | 482 { |
484 functionTemplate->ReadOnlyPrototype(); | 483 functionTemplate->ReadOnlyPrototype(); |
485 | 484 |
486 v8::Local<v8::Signature> defaultSignature; | 485 v8::Local<v8::Signature> defaultSignature; |
487 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceCheckSecurity::internalFieldCount, | 486 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceCheckSecurity::internalFieldCount, |
488 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface
CheckSecurityAttributes), | 487 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface
CheckSecurityAttributes), |
489 0, 0, | 488 0, 0, |
490 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe
ckSecurityMethods), | 489 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe
ckSecurityMethods), |
491 isolate, currentWorldType); | 490 isolate, currentWorldType); |
492 UNUSED_PARAM(defaultSignature); | 491 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
493 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 492 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
494 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | |
495 UNUSED_PARAM(instanceTemplate); | |
496 UNUSED_PARAM(prototypeTemplate); | |
497 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern
al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec
kSecurity::wrapperTypeInfo))); | 493 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern
al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec
kSecurity::wrapperTypeInfo))); |
498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityVoidMethod", v8::String::kInternalizedString), TestInterfaceCheckSecurity
V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestInte
rfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMethodSetterCa
llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::
DontDelete)); | 494 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityVoidMethod", v8::String::kInternalizedString), TestInterfaceCheckSecurity
V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestInte
rfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMethodSetterCa
llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::
DontDelete)); |
499 if (currentWorldType == MainWorld) { | 495 if (currentWorldType == MainWorld) { |
500 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallbackForMainWorld, TestInterfaceCheckSecurityV8Internal::Te
stInterfaceCheckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C
AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 496 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallbackForMainWorld, TestInterfaceCheckSecurityV8Internal::Te
stInterfaceCheckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C
AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
501 } else { | 497 } else { |
502 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceC
heckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); | 498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceC
heckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); |
503 } | 499 } |
504 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestInterfaceCheck
SecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa
llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v
8::DontDelete | v8::ReadOnly)); | 500 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestInterfaceCheck
SecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa
llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v
8::DontDelete | v8::ReadOnly)); |
505 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe
curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestInterfaceChe
ckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet
terCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOri
ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr
opertyAttribute>(v8::DontDelete)); | 501 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe
curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestInterfaceChe
ckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet
terCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOri
ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr
opertyAttribute>(v8::DontDelete)); |
506 | 502 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 fromInternalPointer(object)->deref(); | 557 fromInternalPointer(object)->deref(); |
562 } | 558 } |
563 | 559 |
564 template<> | 560 template<> |
565 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 561 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
566 { | 562 { |
567 return toV8(impl, creationContext, isolate); | 563 return toV8(impl, creationContext, isolate); |
568 } | 564 } |
569 | 565 |
570 } // namespace WebCore | 566 } // namespace WebCore |
OLD | NEW |