| 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 16 matching lines...) Expand all  Loading... | 
|   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
|   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|   29  */ |   29  */ | 
|   30  |   30  | 
|   31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |   31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 
|   32  |   32  | 
|   33 #include "config.h" |   33 #include "config.h" | 
|   34 #include "V8TestCheckSecurityInterface.h" |   34 #include "V8TestCheckSecurityInterface.h" | 
|   35  |   35  | 
|   36 #include "RuntimeEnabledFeatures.h" |   36 #include "RuntimeEnabledFeatures.h" | 
|   37 #include "V8Node.h" |  | 
|   38 #include "bindings/v8/BindingSecurity.h" |   37 #include "bindings/v8/BindingSecurity.h" | 
|   39 #include "bindings/v8/ExceptionMessages.h" |   38 #include "bindings/v8/ExceptionMessages.h" | 
|   40 #include "bindings/v8/ExceptionState.h" |   39 #include "bindings/v8/ExceptionState.h" | 
|   41 #include "bindings/v8/ScriptController.h" |   40 #include "bindings/v8/ScriptController.h" | 
|   42 #include "bindings/v8/V8Binding.h" |   41 #include "bindings/v8/V8Binding.h" | 
|   43 #include "bindings/v8/V8DOMActivityLogger.h" |  | 
|   44 #include "bindings/v8/V8DOMConfiguration.h" |   42 #include "bindings/v8/V8DOMConfiguration.h" | 
|   45 #include "bindings/v8/V8DOMWrapper.h" |   43 #include "bindings/v8/V8DOMWrapper.h" | 
|   46 #include "core/dom/ContextFeatures.h" |   44 #include "core/dom/ContextFeatures.h" | 
|   47 #include "core/dom/Document.h" |   45 #include "core/dom/Document.h" | 
|   48 #include "platform/TraceEvent.h" |   46 #include "platform/TraceEvent.h" | 
|   49 #include "wtf/UnusedParam.h" |   47 #include "wtf/UnusedParam.h" | 
|   50  |   48  | 
|   51 namespace WebCore { |   49 namespace WebCore { | 
|   52  |   50  | 
|   53 static void initializeScriptWrappableForInterface(TestCheckSecurityInterface* ob
     ject) |   51 static void initializeScriptWrappableForInterface(TestCheckSecurityInterface* ob
     ject) | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|   69     WebCore::initializeScriptWrappableForInterface(object); |   67     WebCore::initializeScriptWrappableForInterface(object); | 
|   70 } |   68 } | 
|   71  |   69  | 
|   72 namespace WebCore { |   70 namespace WebCore { | 
|   73 const WrapperTypeInfo V8TestCheckSecurityInterface::wrapperTypeInfo = { V8TestCh
     eckSecurityInterface::GetTemplate, V8TestCheckSecurityInterface::derefObject, 0,
      0, 0, V8TestCheckSecurityInterface::installPerContextEnabledMethods, 0, Wrapper
     TypeObjectPrototype }; |   71 const WrapperTypeInfo V8TestCheckSecurityInterface::wrapperTypeInfo = { V8TestCh
     eckSecurityInterface::GetTemplate, V8TestCheckSecurityInterface::derefObject, 0,
      0, 0, V8TestCheckSecurityInterface::installPerContextEnabledMethods, 0, Wrapper
     TypeObjectPrototype }; | 
|   74  |   72  | 
|   75 namespace TestCheckSecurityInterfaceV8Internal { |   73 namespace TestCheckSecurityInterfaceV8Internal { | 
|   76  |   74  | 
|   77 template <typename T> void V8_USE(T) { } |   75 template <typename T> void V8_USE(T) { } | 
|   78  |   76  | 
|   79 static void excitingAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value
     >& info) |   77 static void longAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
     e>& info) | 
|   80 { |   78 { | 
|   81     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); |   79     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
|   82     v8SetReturnValueInt(info, imp->excitingAttr()); |   80     v8SetReturnValueInt(info, imp->longAttribute()); | 
|   83 } |   81 } | 
|   84  |   82  | 
|   85 static void excitingAttrAttributeGetterCallback(v8::Local<v8::String>, const v8:
     :PropertyCallbackInfo<v8::Value>& info) |   83 static void longAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8
     ::PropertyCallbackInfo<v8::Value>& info) | 
|   86 { |   84 { | 
|   87     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |   85     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
|   88     TestCheckSecurityInterfaceV8Internal::excitingAttrAttributeGetter(info); |   86     TestCheckSecurityInterfaceV8Internal::longAttributeAttributeGetter(info); | 
|   89     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |   87     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|   90 } |   88 } | 
|   91  |   89  | 
 |   90 static void doNotCheckSecurityLongAttributeAttributeGetter(const v8::PropertyCal
     lbackInfo<v8::Value>& info) | 
 |   91 { | 
 |   92     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |   93     v8SetReturnValueInt(info, imp->doNotCheckSecurityLongAttribute()); | 
 |   94 } | 
 |   95  | 
 |   96 static void doNotCheckSecurityLongAttributeAttributeGetterCallback(v8::Local<v8:
     :String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |   97 { | 
 |   98     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
 |   99     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityLongAttributeAttribu
     teGetter(info); | 
 |  100     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  101 } | 
 |  102  | 
 |  103 static void doNotCheckSecurityLongAttributeAttributeSetter(v8::Local<v8::Value> 
     jsValue, const v8::PropertyCallbackInfo<void>& info) | 
 |  104 { | 
 |  105     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  106     V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 
 |  107     imp->setDoNotCheckSecurityLongAttribute(cppValue); | 
 |  108 } | 
 |  109  | 
 |  110 static void doNotCheckSecurityLongAttributeAttributeSetterCallback(v8::Local<v8:
     :String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& in
     fo) | 
 |  111 { | 
 |  112     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 
 |  113     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityLongAttributeAttribu
     teSetter(jsValue, info); | 
 |  114     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  115 } | 
 |  116  | 
 |  117 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetter(const v8::Pro
     pertyCallbackInfo<v8::Value>& info) | 
 |  118 { | 
 |  119     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  120     v8SetReturnValueInt(info, imp->doNotCheckSecurityReadonlyLongAttribute()); | 
 |  121 } | 
 |  122  | 
 |  123 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback(v8::L
     ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  124 { | 
 |  125     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
 |  126     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadonlyLongAttribut
     eAttributeGetter(info); | 
 |  127     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  128 } | 
 |  129  | 
 |  130 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
     pertyCallbackInfo<v8::Value>& info) | 
 |  131 { | 
 |  132     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  133     v8SetReturnValueInt(info, imp->doNotCheckSecurityOnSetterLongAttribute()); | 
 |  134 } | 
 |  135  | 
 |  136 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
     ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  137 { | 
 |  138     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
 |  139     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
     eAttributeGetter(info); | 
 |  140     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  141 } | 
 |  142  | 
 |  143 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
     :Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 
 |  144 { | 
 |  145     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  146     V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 
 |  147     imp->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); | 
 |  148 } | 
 |  149  | 
 |  150 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
     ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v
     oid>& info) | 
 |  151 { | 
 |  152     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 
 |  153     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
     eAttributeSetter(jsValue, info); | 
 |  154     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  155 } | 
 |  156  | 
|   92 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
     Type type, v8::Local<v8::Value>) |  157 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
     Type type, v8::Local<v8::Value>) | 
|   93 { |  158 { | 
|   94     TestCheckSecurityInterface* imp =  V8TestCheckSecurityInterface::toNative(ho
     st); |  159     TestCheckSecurityInterface* imp =  V8TestCheckSecurityInterface::toNative(ho
     st); | 
|   95     return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
     curityError); |  160     return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
     curityError); | 
|   96 } |  161 } | 
|   97  |  162  | 
|   98 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
     ::AccessType type, v8::Local<v8::Value>) |  163 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
     ::AccessType type, v8::Local<v8::Value>) | 
|   99 { |  164 { | 
|  100     TestCheckSecurityInterface* imp =  V8TestCheckSecurityInterface::toNative(ho
     st); |  165     TestCheckSecurityInterface* imp =  V8TestCheckSecurityInterface::toNative(ho
     st); | 
|  101     return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
     curityError); |  166     return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
     curityError); | 
|  102 } |  167 } | 
|  103  |  168  | 
|  104 static void excitingFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& in
     fo) |  169 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 
|  105 { |  170 { | 
|  106     if (UNLIKELY(info.Length() < 1)) { |  | 
|  107         throwTypeError(ExceptionMessages::failedToExecute("excitingFunction", "T
     estCheckSecurityInterface", ExceptionMessages::notEnoughArguments(1, info.Length
     ())), info.GetIsolate()); |  | 
|  108         return; |  | 
|  109     } |  | 
|  110     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); |  171     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
|  111     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |  172     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 
|  112     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
     ) { |  173     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
     ) { | 
|  113         exceptionState.throwIfNeeded(); |  174         exceptionState.throwIfNeeded(); | 
|  114         return; |  175         return; | 
|  115     } |  176     } | 
|  116     V8TRYCATCH_VOID(Node*, nextChild, V8Node::hasInstance(info[0], info.GetIsola
     te(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::C
     ast(info[0])) : 0); |  177     imp->voidMethod(); | 
|  117     imp->excitingFunction(nextChild); |  | 
|  118 } |  178 } | 
|  119  |  179  | 
|  120 static void excitingFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Va
     lue>& info) |  180 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& 
     info) | 
|  121 { |  181 { | 
|  122     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |  182     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
|  123     TestCheckSecurityInterfaceV8Internal::excitingFunctionMethod(info); |  183     TestCheckSecurityInterfaceV8Internal::voidMethodMethod(info); | 
|  124     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  184     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  125 } |  185 } | 
|  126  |  186  | 
|  127 static void postMessageMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |  187 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
     ::Value>& info) | 
|  128 { |  188 { | 
|  129     if (UNLIKELY(info.Length() < 1)) { |  | 
|  130         throwTypeError(ExceptionMessages::failedToExecute("postMessage", "TestCh
     eckSecurityInterface", ExceptionMessages::notEnoughArguments(1, info.Length())),
      info.GetIsolate()); |  | 
|  131         return; |  | 
|  132     } |  | 
|  133     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); |  189     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
|  134     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, message, info[0]); |  190     imp->doNotCheckSecurityVoidMethod(); | 
|  135     imp->postMessage(message); |  | 
|  136 } |  191 } | 
|  137  |  192  | 
|  138 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
      info) |  193 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
     kInfo<v8::Value>& info) | 
|  139 { |  194 { | 
|  140     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |  195     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
|  141     TestCheckSecurityInterfaceV8Internal::postMessageMethod(info); |  196     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodMethod(inf
     o); | 
|  142     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  197     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  143 } |  198 } | 
|  144  |  199  | 
|  145 static void postMessageOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8:
     :Value>& info) |  200 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert
     yCallbackInfo<v8::Value>& info) | 
|  146 { |  201 { | 
|  147     // This is only for getting a unique pointer which we can pass to privateTem
     plate. |  202     // This is only for getting a unique pointer which we can pass to privateTem
     plate. | 
|  148     static int privateTemplateUniqueKey; |  203     static int privateTemplateUniqueKey; | 
|  149     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |  204     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 
|  150     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |  205     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 
|  151     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     postMessageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::f
     rom(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeIn
     fo, currentWorldType)), 1); |  206     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(V8
     PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterfa
     ce::wrapperTypeInfo, currentWorldType)), 0); | 
|  152  |  207  | 
|  153     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |  208     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 
|  154     if (holder.IsEmpty()) { |  209     if (holder.IsEmpty()) { | 
|  155         // can only reach here by 'object.__proto__.func', and it should passed |  210         // can only reach here by 'object.__proto__.func', and it should passed | 
|  156         // domain security check already |  211         // domain security check already | 
|  157         v8SetReturnValue(info, privateTemplate->GetFunction()); |  212         v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  158         return; |  213         return; | 
|  159     } |  214     } | 
|  160     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); |  215     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
|  161     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { |  216     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { | 
|  162         static int sharedTemplateUniqueKey; |  217         static int sharedTemplateUniqueKey; | 
|  163         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::postMessageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData:
     :from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperType
     Info, currentWorldType)), 1); |  218         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(
     V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInter
     face::wrapperTypeInfo, currentWorldType)), 0); | 
|  164         v8SetReturnValue(info, sharedTemplate->GetFunction()); |  219         v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
|  165         return; |  220         return; | 
|  166     } |  221     } | 
|  167  |  222  | 
|  168     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("postMessage")); |  223     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("doNotCheckSecurityVoidMethod")); | 
|  169     if (!hiddenValue.IsEmpty()) { |  224     if (!hiddenValue.IsEmpty()) { | 
|  170         v8SetReturnValue(info, hiddenValue); |  225         v8SetReturnValue(info, hiddenValue); | 
|  171         return; |  226         return; | 
|  172     } |  227     } | 
|  173  |  228  | 
|  174     v8SetReturnValue(info, privateTemplate->GetFunction()); |  229     v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  175 } |  230 } | 
|  176  |  231  | 
|  177 static void postMessageOriginSafeMethodGetterCallback(v8::Local<v8::String>, con
     st v8::PropertyCallbackInfo<v8::Value>& info) |  232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
     <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
|  178 { |  233 { | 
|  179     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |  234     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
|  180     TestCheckSecurityInterfaceV8Internal::postMessageOriginSafeMethodGetter(info
     ); |  235     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodOriginSafe
     MethodGetter(info); | 
|  181     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  236     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  182 } |  237 } | 
|  183  |  238  | 
|  184 static void perWorldBindingsMethodWithDoNotCheckSecurityMethod(const v8::Functio
     nCallbackInfo<v8::Value>& info) |  239 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
     nCallbackInfo<v8::Value>& info) | 
|  185 { |  240 { | 
|  186     if (UNLIKELY(info.Length() < 1)) { |  | 
|  187         throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
     dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
     oughArguments(1, info.Length())), info.GetIsolate()); |  | 
|  188         return; |  | 
|  189     } |  | 
|  190     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); |  241     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
|  191     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); |  242     imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 
|  192     imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |  | 
|  193 } |  243 } | 
|  194  |  244  | 
|  195 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback(const v8:
     :FunctionCallbackInfo<v8::Value>& info) |  245 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
     :FunctionCallbackInfo<v8::Value>& info) | 
|  196 { |  246 { | 
|  197     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |  247     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
|  198     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge
     tCurrentContext()); |  248     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
     MethodMethod(info); | 
|  199     if (contextData && contextData->activityLogger()) { |  | 
|  200         Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle
     <v8::Value> >(info, 0); |  | 
|  201         contextData->activityLogger()->log("TestCheckSecurityInterface.perWorldB
     indingsMethodWithDoNotCheckSecurity", info.Length(), loggerArgs.data(), "Method"
     ); |  | 
|  202     } |  | 
|  203     TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
     curityMethod(info); |  | 
|  204     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  249     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  205 } |  250 } | 
|  206  |  251  | 
|  207 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetter(c
     onst v8::PropertyCallbackInfo<v8::Value>& info) |  252 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c
     onst v8::PropertyCallbackInfo<v8::Value>& info) | 
|  208 { |  253 { | 
|  209     // This is only for getting a unique pointer which we can pass to privateTem
     plate. |  254     // This is only for getting a unique pointer which we can pass to privateTem
     plate. | 
|  210     static int privateTemplateUniqueKey; |  255     static int privateTemplateUniqueKey; | 
|  211     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |  256     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 
|  212     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |  257     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 
|  213     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8::S
     ignature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestChec
     kSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |  258     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S
     ignature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestChec
     kSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
|  214  |  259  | 
|  215     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |  260     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 
|  216     if (holder.IsEmpty()) { |  261     if (holder.IsEmpty()) { | 
 |  262         // can only reach here by 'object.__proto__.func', and it should passed | 
 |  263         // domain security check already | 
 |  264         v8SetReturnValue(info, privateTemplate->GetFunction()); | 
 |  265         return; | 
 |  266     } | 
 |  267     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
 |  268     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { | 
 |  269         static int sharedTemplateUniqueKey; | 
 |  270         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8:
     :Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCh
     eckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
 |  271         v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
 |  272         return; | 
 |  273     } | 
 |  274  | 
 |  275     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); | 
 |  276     if (!hiddenValue.IsEmpty()) { | 
 |  277         v8SetReturnValue(info, hiddenValue); | 
 |  278         return; | 
 |  279     } | 
 |  280  | 
 |  281     v8SetReturnValue(info, privateTemplate->GetFunction()); | 
 |  282 } | 
 |  283  | 
 |  284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
     llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  285 { | 
 |  286     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
 |  287     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
     MethodOriginSafeMethodGetter(info); | 
 |  288     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  289 } | 
 |  290  | 
 |  291 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
      v8::FunctionCallbackInfo<v8::Value>& info) | 
 |  292 { | 
 |  293     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  294     imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 
 |  295 } | 
 |  296  | 
 |  297 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
     ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 
 |  298 { | 
 |  299     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
 |  300     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
     MethodMethodForMainWorld(info); | 
 |  301     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  302 } | 
 |  303  | 
 |  304 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo
     rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  305 { | 
 |  306     // This is only for getting a unique pointer which we can pass to privateTem
     plate. | 
 |  307     static int privateTemplateUniqueKey; | 
 |  308     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 
 |  309     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 
 |  310     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi
     ned(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate
     (&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
 |  311  | 
 |  312     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 
 |  313     if (holder.IsEmpty()) { | 
|  217         // can only reach here by 'object.__proto__.func', and it should passed |  314         // can only reach here by 'object.__proto__.func', and it should passed | 
|  218         // domain security check already |  315         // domain security check already | 
|  219         v8SetReturnValue(info, privateTemplate->GetFunction()); |  316         v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  220         return; |  317         return; | 
|  221     } |  318     } | 
|  222     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); |  319     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
|  223     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { |  320     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { | 
|  224         static int sharedTemplateUniqueKey; |  321         static int sharedTemplateUniqueKey; | 
|  225         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8:
     :Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCh
     eckSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |  322         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde
     fined(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTempla
     te(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
|  226         v8SetReturnValue(info, sharedTemplate->GetFunction()); |  323         v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
|  227         return; |  324         return; | 
|  228     } |  325     } | 
|  229  |  326  | 
|  230     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); |  327     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); | 
|  231     if (!hiddenValue.IsEmpty()) { |  328     if (!hiddenValue.IsEmpty()) { | 
|  232         v8SetReturnValue(info, hiddenValue); |  329         v8SetReturnValue(info, hiddenValue); | 
|  233         return; |  330         return; | 
|  234     } |  331     } | 
|  235  |  332  | 
|  236     v8SetReturnValue(info, privateTemplate->GetFunction()); |  333     v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  237 } |  334 } | 
|  238  |  335  | 
|  239 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCa
     llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |  336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
     llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
     ue>& info) | 
|  240 { |  337 { | 
|  241     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |  338     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
|  242     TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
     curityOriginSafeMethodGetter(info); |  339     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
     MethodOriginSafeMethodGetterForMainWorld(info); | 
|  243     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  340     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  244 } |  341 } | 
|  245  |  342  | 
|  246 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodForMainWorld(const
      v8::FunctionCallbackInfo<v8::Value>& info) |  343 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
     kInfo<v8::Value>& info) | 
|  247 { |  344 { | 
|  248     if (UNLIKELY(info.Length() < 1)) { |  | 
|  249         throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
     dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
     oughArguments(1, info.Length())), info.GetIsolate()); |  | 
|  250         return; |  | 
|  251     } |  | 
|  252     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); |  345     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
|  253     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); |  346     imp->doNotCheckSecurityReadOnlyVoidMethod(); | 
|  254     imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |  | 
|  255 } |  347 } | 
|  256  |  348  | 
|  257 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWor
     ld(const v8::FunctionCallbackInfo<v8::Value>& info) |  349 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
     nCallbackInfo<v8::Value>& info) | 
|  258 { |  350 { | 
|  259     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |  351     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
|  260     TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
     curityMethodForMainWorld(info); |  352     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
     thod(info); | 
|  261     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  353     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  262 } |  354 } | 
|  263  |  355  | 
|  264 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterFo
     rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) |  356 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8:
     :PropertyCallbackInfo<v8::Value>& info) | 
|  265 { |  357 { | 
|  266     // This is only for getting a unique pointer which we can pass to privateTem
     plate. |  358     // This is only for getting a unique pointer which we can pass to privateTem
     plate. | 
|  267     static int privateTemplateUniqueKey; |  359     static int privateTemplateUniqueKey; | 
|  268     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |  360     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 
|  269     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |  361     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 
|  270     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Undefi
     ned(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate
     (&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |  362     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature
     ::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurit
     yInterface::wrapperTypeInfo, currentWorldType)), 0); | 
|  271  |  363  | 
|  272     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |  364     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 
|  273     if (holder.IsEmpty()) { |  365     if (holder.IsEmpty()) { | 
 |  366         // can only reach here by 'object.__proto__.func', and it should passed | 
 |  367         // domain security check already | 
 |  368         v8SetReturnValue(info, privateTemplate->GetFunction()); | 
 |  369         return; | 
 |  370     } | 
 |  371     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
 |  372     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { | 
 |  373         static int sharedTemplateUniqueKey; | 
 |  374         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu
     re::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecur
     ityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
 |  375         v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
 |  376         return; | 
 |  377     } | 
 |  378  | 
 |  379     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("doNotCheckSecurityReadOnlyVoidMethod")); | 
 |  380     if (!hiddenValue.IsEmpty()) { | 
 |  381         v8SetReturnValue(info, hiddenValue); | 
 |  382         return; | 
 |  383     } | 
 |  384  | 
 |  385     v8SetReturnValue(info, privateTemplate->GetFunction()); | 
 |  386 } | 
 |  387  | 
 |  388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v
     8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  389 { | 
 |  390     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
 |  391     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodOr
     iginSafeMethodGetter(info); | 
 |  392     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  393 } | 
 |  394  | 
 |  395 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
     backInfo<v8::Value>& info) | 
 |  396 { | 
 |  397     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
     o.Holder()); | 
 |  398     imp->doNotCheckSecurityUnforgeableVoidMethod(); | 
 |  399 } | 
 |  400  | 
 |  401 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
     tionCallbackInfo<v8::Value>& info) | 
 |  402 { | 
 |  403     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 
 |  404     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
     dMethod(info); | 
 |  405     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
 |  406 } | 
 |  407  | 
 |  408 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const 
     v8::PropertyCallbackInfo<v8::Value>& info) | 
 |  409 { | 
 |  410     // This is only for getting a unique pointer which we can pass to privateTem
     plate. | 
 |  411     static int privateTemplateUniqueKey; | 
 |  412     WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 
 |  413     V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 
 |  414     v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
     rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
     doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat
     ure::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecu
     rityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
 |  415  | 
 |  416     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 
 |  417     if (holder.IsEmpty()) { | 
|  274         // can only reach here by 'object.__proto__.func', and it should passed |  418         // can only reach here by 'object.__proto__.func', and it should passed | 
|  275         // domain security check already |  419         // domain security check already | 
|  276         v8SetReturnValue(info, privateTemplate->GetFunction()); |  420         v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  277         return; |  421         return; | 
|  278     } |  422     } | 
|  279     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); |  423     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
|  280     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { |  424     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
     rityError)) { | 
|  281         static int sharedTemplateUniqueKey; |  425         static int sharedTemplateUniqueKey; | 
|  282         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Unde
     fined(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTempla
     te(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |  426         v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
     currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
     ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign
     ature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSe
     curityInterface::wrapperTypeInfo, currentWorldType)), 0); | 
|  283         v8SetReturnValue(info, sharedTemplate->GetFunction()); |  427         v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
|  284         return; |  428         return; | 
|  285     } |  429     } | 
|  286  |  430  | 
|  287     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); |  431     v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
     ewSymbol("doNotCheckSecurityUnforgeableVoidMethod")); | 
|  288     if (!hiddenValue.IsEmpty()) { |  432     if (!hiddenValue.IsEmpty()) { | 
|  289         v8SetReturnValue(info, hiddenValue); |  433         v8SetReturnValue(info, hiddenValue); | 
|  290         return; |  434         return; | 
|  291     } |  435     } | 
|  292  |  436  | 
|  293     v8SetReturnValue(info, privateTemplate->GetFunction()); |  437     v8SetReturnValue(info, privateTemplate->GetFunction()); | 
|  294 } |  438 } | 
|  295  |  439  | 
|  296 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCa
     llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
     ue>& info) |  440 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac
     k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 
|  297 { |  441 { | 
|  298     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |  442     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 
|  299     TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
     curityOriginSafeMethodGetterForMainWorld(info); |  443     TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
     dOriginSafeMethodGetter(info); | 
|  300     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  444     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  301 } |  445 } | 
|  302  |  446  | 
|  303 static void TestCheckSecurityInterfaceOriginSafeMethodSetter(v8::Local<v8::Strin
     g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
     o) |  447 static void TestCheckSecurityInterfaceOriginSafeMethodSetter(v8::Local<v8::Strin
     g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
     o) | 
|  304 { |  448 { | 
|  305     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
     late()))); |  449     v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
     TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
     late()))); | 
|  306     if (holder.IsEmpty()) |  450     if (holder.IsEmpty()) | 
|  307         return; |  451         return; | 
|  308     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); |  452     TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
     der); | 
|  309     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |  453     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 
|  310     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
     ) { |  454     if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
     ) { | 
|  311         exceptionState.throwIfNeeded(); |  455         exceptionState.throwIfNeeded(); | 
|  312         return; |  456         return; | 
|  313     } |  457     } | 
|  314  |  458  | 
|  315     info.This()->SetHiddenValue(name, jsValue); |  459     info.This()->SetHiddenValue(name, jsValue); | 
|  316 } |  460 } | 
|  317  |  461  | 
|  318 static void TestCheckSecurityInterfaceOriginSafeMethodSetterCallback(v8::Local<v
     8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
     id>& info) |  462 static void TestCheckSecurityInterfaceOriginSafeMethodSetterCallback(v8::Local<v
     8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
     id>& info) | 
|  319 { |  463 { | 
|  320     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |  464     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 
|  321     TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMe
     thodSetter(name, jsValue, info); |  465     TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMe
     thodSetter(name, jsValue, info); | 
|  322     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |  466     TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 
|  323 } |  467 } | 
|  324  |  468  | 
|  325 } // namespace TestCheckSecurityInterfaceV8Internal |  469 } // namespace TestCheckSecurityInterfaceV8Internal | 
|  326  |  470  | 
|  327 static const V8DOMConfiguration::AttributeConfiguration V8TestCheckSecurityInter
     faceAttributes[] = { |  471 static const V8DOMConfiguration::AttributeConfiguration V8TestCheckSecurityInter
     faceAttributes[] = { | 
|  328     {"excitingAttr", TestCheckSecurityInterfaceV8Internal::excitingAttrAttribute
     GetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_
     cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |  472     {"longAttribute", TestCheckSecurityInterfaceV8Internal::longAttributeAttribu
     teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati
     c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 
 |  473     {"doNotCheckSecurityLongAttribute", TestCheckSecurityInterfaceV8Internal::do
     NotCheckSecurityLongAttributeAttributeGetterCallback, TestCheckSecurityInterface
     V8Internal::doNotCheckSecurityLongAttributeAttributeSetterCallback, 0, 0, 0, sta
     tic_cast<v8::AccessControl>(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE), static_cast<v
     8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 
 |  474     {"doNotCheckSecurityReadonlyLongAttribute", TestCheckSecurityInterfaceV8Inte
     rnal::doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0
     , static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_cast<v8::PropertyAttr
     ibute>(v8::None), 0 /* on instance */}, | 
 |  475     {"doNotCheckSecurityOnSetterLongAttribute", TestCheckSecurityInterfaceV8Inte
     rnal::doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback, TestCheckS
     ecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttributeAttributeSett
     erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_WRITE), static_c
     ast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 
 |  476 }; | 
 |  477  | 
 |  478 static const V8DOMConfiguration::MethodConfiguration V8TestCheckSecurityInterfac
     eMethods[] = { | 
 |  479     {"voidMethod", TestCheckSecurityInterfaceV8Internal::voidMethodMethodCallbac
     k, 0, 0}, | 
|  329 }; |  480 }; | 
|  330  |  481  | 
|  331 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCheckSecurityInterfaceTem
     plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
     rapperWorldType currentWorldType) |  482 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCheckSecurityInterfaceTem
     plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
     rapperWorldType currentWorldType) | 
|  332 { |  483 { | 
|  333     functionTemplate->ReadOnlyPrototype(); |  484     functionTemplate->ReadOnlyPrototype(); | 
|  334  |  485  | 
|  335     v8::Local<v8::Signature> defaultSignature; |  486     v8::Local<v8::Signature> defaultSignature; | 
|  336     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
     ate, "TestCheckSecurityInterface", v8::Local<v8::FunctionTemplate>(), V8TestChec
     kSecurityInterface::internalFieldCount, |  487     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
     ate, "TestCheckSecurityInterface", v8::Local<v8::FunctionTemplate>(), V8TestChec
     kSecurityInterface::internalFieldCount, | 
|  337         V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu
     rityInterfaceAttributes), |  488         V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu
     rityInterfaceAttributes), | 
|  338         0, 0, |  489         0, 0, | 
|  339         0, 0, |  490         V8TestCheckSecurityInterfaceMethods, WTF_ARRAY_LENGTH(V8TestCheckSecurit
     yInterfaceMethods), | 
|  340         isolate, currentWorldType); |  491         isolate, currentWorldType); | 
|  341     UNUSED_PARAM(defaultSignature); |  492     UNUSED_PARAM(defaultSignature); | 
|  342     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); |  493     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); | 
|  343     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); |  494     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); | 
|  344     UNUSED_PARAM(instanceTemplate); |  495     UNUSED_PARAM(instanceTemplate); | 
|  345     UNUSED_PARAM(prototypeTemplate); |  496     UNUSED_PARAM(prototypeTemplate); | 
|  346     instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
     al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
     ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
     Interface::wrapperTypeInfo))); |  497     instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
     al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
     ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
     Interface::wrapperTypeInfo))); | 
|  347  |  498     prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityVoid
     Method"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodOrig
     inSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecur
     ityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta
     tic_cast<v8::PropertyAttribute>(v8::DontDelete)); | 
|  348     // Custom Signature 'excitingFunction' |  | 
|  349     const int excitingFunctionArgc = 1; |  | 
|  350     v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] 
     = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
     ntWorldType) }; |  | 
|  351     v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(fun
     ctionTemplate, excitingFunctionArgc, excitingFunctionArgv); |  | 
|  352     prototypeTemplate->Set(v8::String::NewSymbol("excitingFunction"), v8::Functi
     onTemplate::New(TestCheckSecurityInterfaceV8Internal::excitingFunctionMethodCall
     back, v8Undefined(), excitingFunctionSignature, 1)); |  | 
|  353  |  | 
|  354     // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') |  | 
|  355     prototypeTemplate->SetAccessor(v8::String::NewSymbol("postMessage"), TestChe
     ckSecurityInterfaceV8Internal::postMessageOriginSafeMethodGetterCallback, TestCh
     eckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetter
     Callback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8
     ::DontDelete)); |  | 
|  356  |  | 
|  357     // Function 'perWorldBindingsMethodWithDoNotCheckSecurity' (Extended Attribu
     tes: 'DoNotCheckSecurity PerWorldBindings ActivityLogging') |  | 
|  358     if (currentWorldType == MainWorld) { |  499     if (currentWorldType == MainWorld) { | 
|  359         prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
     thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
     ingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCallbackForMainWorld, Test
     CheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSett
     erCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(
     v8::DontDelete)); |  500         prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity
     PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe
     curityPerWorldBindingsVoidMethodOriginSafeMethodGetterCallbackForMainWorld, Test
     CheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSett
     erCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(
     v8::DontDelete)); | 
|  360     } else { |  501     } else { | 
|  361         prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
     thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
     ingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCallback, TestCheckSecurit
     yInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetterCallback, 
     v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDele
     te)); |  502         prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity
     PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe
     curityPerWorldBindingsVoidMethodOriginSafeMethodGetterCallback, TestCheckSecurit
     yInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetterCallback, 
     v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDele
     te)); | 
|  362     } |  503     } | 
 |  504     prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityRead
     OnlyVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOn
     lyVoidMethodOriginSafeMethodGetterCallback, 0, v8Undefined(), v8::ALL_CAN_READ, 
     static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)); | 
 |  505     instanceTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityUnfor
     geableVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnfo
     rgeableVoidMethodOriginSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Int
     ernal::TestCheckSecurityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), 
     v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 
|  363  |  506  | 
|  364     // Custom toString template |  507     // Custom toString template | 
|  365     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); |  508     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); | 
|  366     return functionTemplate; |  509     return functionTemplate; | 
|  367 } |  510 } | 
|  368  |  511  | 
|  369 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
     solate* isolate, WrapperWorldType currentWorldType) |  512 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
     solate* isolate, WrapperWorldType currentWorldType) | 
|  370 { |  513 { | 
|  371     V8PerIsolateData* data = V8PerIsolateData::from(isolate); |  514     V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 
|  372     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); |  515     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  412     V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
      &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |  555     V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
      &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 
|  413     return wrapper; |  556     return wrapper; | 
|  414 } |  557 } | 
|  415  |  558  | 
|  416 void V8TestCheckSecurityInterface::derefObject(void* object) |  559 void V8TestCheckSecurityInterface::derefObject(void* object) | 
|  417 { |  560 { | 
|  418     fromInternalPointer(object)->deref(); |  561     fromInternalPointer(object)->deref(); | 
|  419 } |  562 } | 
|  420  |  563  | 
|  421 } // namespace WebCore |  564 } // namespace WebCore | 
| OLD | NEW |