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 23 matching lines...) Expand all Loading... |
34 #include "V8TestInterfaceCheckSecurity.h" | 34 #include "V8TestInterfaceCheckSecurity.h" |
35 | 35 |
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/V8DOMConfiguration.h" | 40 #include "bindings/v8/V8DOMConfiguration.h" |
41 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
44 #include "wtf/UnusedParam.h" | |
45 | 44 |
46 namespace WebCore { | 45 namespace WebCore { |
47 | 46 |
48 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob
ject) | 47 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob
ject) |
49 { | 48 { |
50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 49 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri
ty::wrapperTypeInfo); | 50 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri
ty::wrapperTypeInfo); |
52 else | 51 else |
53 ASSERT_NOT_REACHED(); | 52 ASSERT_NOT_REACHED(); |
54 } | 53 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 479 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
481 { | 480 { |
482 functionTemplate->ReadOnlyPrototype(); | 481 functionTemplate->ReadOnlyPrototype(); |
483 | 482 |
484 v8::Local<v8::Signature> defaultSignature; | 483 v8::Local<v8::Signature> defaultSignature; |
485 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceCheckSecurity::internalFieldCount, | 484 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceCheckSecurity::internalFieldCount, |
486 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface
CheckSecurityAttributes), | 485 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface
CheckSecurityAttributes), |
487 0, 0, | 486 0, 0, |
488 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe
ckSecurityMethods), | 487 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe
ckSecurityMethods), |
489 isolate, currentWorldType); | 488 isolate, currentWorldType); |
490 UNUSED_PARAM(defaultSignature); | 489 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
491 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 490 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
492 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | |
493 UNUSED_PARAM(instanceTemplate); | |
494 UNUSED_PARAM(prototypeTemplate); | |
495 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern
al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec
kSecurity::wrapperTypeInfo))); | 491 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern
al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec
kSecurity::wrapperTypeInfo))); |
496 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)); | 492 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)); |
497 if (currentWorldType == MainWorld) { | 493 if (currentWorldType == MainWorld) { |
498 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)); | 494 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)); |
499 } else { | 495 } else { |
500 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)); | 496 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)); |
501 } | 497 } |
502 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)); | 498 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)); |
503 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)); | 499 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)); |
504 | 500 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 fromInternalPointer(object)->deref(); | 555 fromInternalPointer(object)->deref(); |
560 } | 556 } |
561 | 557 |
562 template<> | 558 template<> |
563 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 559 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
564 { | 560 { |
565 return toV8(impl, creationContext, isolate); | 561 return toV8(impl, creationContext, isolate); |
566 } | 562 } |
567 | 563 |
568 } // namespace WebCore | 564 } // namespace WebCore |
OLD | NEW |