| 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 doNotCheckSecurityOnGetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 131 { |
| 132 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 133 v8SetReturnValueInt(info, imp->doNotCheckSecurityOnGetterLongAttribute()); |
| 134 } |
| 135 |
| 136 static void doNotCheckSecurityOnGetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 137 { |
| 138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 139 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnGetterLongAttribut
eAttributeGetter(info); |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 141 } |
| 142 |
| 143 static void doNotCheckSecurityOnGetterLongAttributeAttributeSetter(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->setDoNotCheckSecurityOnGetterLongAttribute(cppValue); |
| 148 } |
| 149 |
| 150 static void doNotCheckSecurityOnGetterLongAttributeAttributeSetterCallback(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::doNotCheckSecurityOnGetterLongAttribut
eAttributeSetter(jsValue, info); |
| 154 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 155 } |
| 156 |
| 157 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 158 { |
| 159 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 160 v8SetReturnValueInt(info, imp->doNotCheckSecurityOnSetterLongAttribute()); |
| 161 } |
| 162 |
| 163 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 164 { |
| 165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 166 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeGetter(info); |
| 167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 168 } |
| 169 |
| 170 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
:Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 171 { |
| 172 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 173 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
| 174 imp->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); |
| 175 } |
| 176 |
| 177 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v
oid>& info) |
| 178 { |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 180 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeSetter(jsValue, info); |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 182 } |
| 183 |
| 92 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) | 184 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) |
| 93 { | 185 { |
| 94 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); | 186 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); |
| 95 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); | 187 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); |
| 96 } | 188 } |
| 97 | 189 |
| 98 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) | 190 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) |
| 99 { | 191 { |
| 100 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); | 192 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); |
| 101 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); | 193 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); |
| 102 } | 194 } |
| 103 | 195 |
| 104 static void excitingFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 196 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 105 { | 197 { |
| 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()); | 198 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 111 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 199 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 112 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 200 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
| 113 exceptionState.throwIfNeeded(); | 201 exceptionState.throwIfNeeded(); |
| 114 return; | 202 return; |
| 115 } | 203 } |
| 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); | 204 imp->voidMethod(); |
| 117 imp->excitingFunction(nextChild); | |
| 118 } | 205 } |
| 119 | 206 |
| 120 static void excitingFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 207 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 121 { | 208 { |
| 122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 123 TestCheckSecurityInterfaceV8Internal::excitingFunctionMethod(info); | 210 TestCheckSecurityInterfaceV8Internal::voidMethodMethod(info); |
| 124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 125 } | 212 } |
| 126 | 213 |
| 127 static void postMessageMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 214 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 128 { | 215 { |
| 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()); | 216 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 134 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, message, info[0]); | 217 imp->doNotCheckSecurityVoidMethod(); |
| 135 imp->postMessage(message); | |
| 136 } | 218 } |
| 137 | 219 |
| 138 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 220 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 139 { | 221 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 222 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 141 TestCheckSecurityInterfaceV8Internal::postMessageMethod(info); | 223 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 224 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 143 } | 225 } |
| 144 | 226 |
| 145 static void postMessageAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>
& info) | 227 static void doNotCheckSecurityVoidMethodAttributeGetter(const v8::PropertyCallba
ckInfo<v8::Value>& info) |
| 146 { | 228 { |
| 147 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 229 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 148 static int privateTemplateUniqueKey; | 230 static int privateTemplateUniqueKey; |
| 149 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 231 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 150 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 232 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); | 233 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 | 234 |
| 153 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 235 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 154 if (holder.IsEmpty()) { | 236 if (holder.IsEmpty()) { |
| 155 // can only reach here by 'object.__proto__.func', and it should passed | 237 // can only reach here by 'object.__proto__.func', and it should passed |
| 156 // domain security check already | 238 // domain security check already |
| 157 v8SetReturnValue(info, privateTemplate->GetFunction()); | 239 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 158 return; | 240 return; |
| 159 } | 241 } |
| 160 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 242 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 161 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 243 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 162 static int sharedTemplateUniqueKey; | 244 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); | 245 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()); | 246 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 165 return; | 247 return; |
| 166 } | 248 } |
| 167 | 249 |
| 168 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("postMessage")); | 250 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("doNotCheckSecurityVoidMethod")); |
| 169 if (!hiddenValue.IsEmpty()) { | 251 if (!hiddenValue.IsEmpty()) { |
| 170 v8SetReturnValue(info, hiddenValue); | 252 v8SetReturnValue(info, hiddenValue); |
| 171 return; | 253 return; |
| 172 } | 254 } |
| 173 | 255 |
| 174 v8SetReturnValue(info, privateTemplate->GetFunction()); | 256 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 175 } | 257 } |
| 176 | 258 |
| 177 static void postMessageAttributeGetterCallback(v8::Local<v8::String>, const v8::
PropertyCallbackInfo<v8::Value>& info) | 259 static void doNotCheckSecurityVoidMethodAttributeGetterCallback(v8::Local<v8::St
ring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 178 { | 260 { |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 261 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 180 TestCheckSecurityInterfaceV8Internal::postMessageAttributeGetter(info); | 262 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodAttributeG
etter(info); |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 263 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 182 } | 264 } |
| 183 | 265 |
| 184 static void perWorldBindingsMethodWithDoNotCheckSecurityMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) | 266 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 185 { | 267 { |
| 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()); | 268 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 191 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); | 269 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
| 192 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); | |
| 193 } | 270 } |
| 194 | 271 |
| 195 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 272 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 196 { | 273 { |
| 197 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 274 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 198 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge
tCurrentContext()); | 275 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"); | 276 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 205 } | 277 } |
| 206 | 278 |
| 207 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetter(const v8
::PropertyCallbackInfo<v8::Value>& info) | 279 static void doNotCheckSecurityPerWorldBindingsVoidMethodAttributeGetter(const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 208 { | 280 { |
| 209 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 281 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 210 static int privateTemplateUniqueKey; | 282 static int privateTemplateUniqueKey; |
| 211 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 283 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 212 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 284 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); | 285 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 | 286 |
| 215 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 287 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 216 if (holder.IsEmpty()) { | 288 if (holder.IsEmpty()) { |
| 289 // can only reach here by 'object.__proto__.func', and it should passed |
| 290 // domain security check already |
| 291 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 292 return; |
| 293 } |
| 294 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 295 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 296 static int sharedTemplateUniqueKey; |
| 297 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); |
| 298 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 299 return; |
| 300 } |
| 301 |
| 302 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); |
| 303 if (!hiddenValue.IsEmpty()) { |
| 304 v8SetReturnValue(info, hiddenValue); |
| 305 return; |
| 306 } |
| 307 |
| 308 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 309 } |
| 310 |
| 311 static void doNotCheckSecurityPerWorldBindingsVoidMethodAttributeGetterCallback(
v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 312 { |
| 313 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 314 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodAttributeGetter(info); |
| 315 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 316 } |
| 317 |
| 318 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 319 { |
| 320 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 321 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
| 322 } |
| 323 |
| 324 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 325 { |
| 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 327 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); |
| 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 329 } |
| 330 |
| 331 static void doNotCheckSecurityPerWorldBindingsVoidMethodAttributeGetterForMainWo
rld(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 332 { |
| 333 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 334 static int privateTemplateUniqueKey; |
| 335 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 336 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 337 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); |
| 338 |
| 339 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 340 if (holder.IsEmpty()) { |
| 217 // can only reach here by 'object.__proto__.func', and it should passed | 341 // can only reach here by 'object.__proto__.func', and it should passed |
| 218 // domain security check already | 342 // domain security check already |
| 219 v8SetReturnValue(info, privateTemplate->GetFunction()); | 343 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 220 return; | 344 return; |
| 221 } | 345 } |
| 222 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 346 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 223 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 347 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 224 static int sharedTemplateUniqueKey; | 348 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); | 349 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()); | 350 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 227 return; | 351 return; |
| 228 } | 352 } |
| 229 | 353 |
| 230 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); | 354 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); |
| 231 if (!hiddenValue.IsEmpty()) { | 355 if (!hiddenValue.IsEmpty()) { |
| 232 v8SetReturnValue(info, hiddenValue); | 356 v8SetReturnValue(info, hiddenValue); |
| 233 return; | 357 return; |
| 234 } | 358 } |
| 235 | 359 |
| 236 v8SetReturnValue(info, privateTemplate->GetFunction()); | 360 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 237 } | 361 } |
| 238 | 362 |
| 239 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallback(
v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 363 static void doNotCheckSecurityPerWorldBindingsVoidMethodAttributeGetterCallbackF
orMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) |
| 240 { | 364 { |
| 241 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 365 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 242 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityAttributeGetter(info); | 366 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodAttributeGetterForMainWorld(info); |
| 243 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 367 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 244 } | 368 } |
| 245 | 369 |
| 246 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) | 370 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 247 { | 371 { |
| 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()); | 372 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 253 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); | 373 imp->doNotCheckSecurityReadOnlyVoidMethod(); |
| 254 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); | |
| 255 } | 374 } |
| 256 | 375 |
| 257 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 376 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 258 { | 377 { |
| 259 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 378 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 260 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityMethodForMainWorld(info); | 379 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
thod(info); |
| 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 380 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 262 } | 381 } |
| 263 | 382 |
| 264 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterForMainWo
rld(const v8::PropertyCallbackInfo<v8::Value>& info) | 383 static void doNotCheckSecurityReadOnlyVoidMethodAttributeGetter(const v8::Proper
tyCallbackInfo<v8::Value>& info) |
| 265 { | 384 { |
| 266 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 385 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 267 static int privateTemplateUniqueKey; | 386 static int privateTemplateUniqueKey; |
| 268 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 387 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 269 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 388 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); | 389 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 | 390 |
| 272 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 391 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 273 if (holder.IsEmpty()) { | 392 if (holder.IsEmpty()) { |
| 393 // can only reach here by 'object.__proto__.func', and it should passed |
| 394 // domain security check already |
| 395 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 396 return; |
| 397 } |
| 398 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 399 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 400 static int sharedTemplateUniqueKey; |
| 401 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); |
| 402 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 403 return; |
| 404 } |
| 405 |
| 406 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("doNotCheckSecurityReadOnlyVoidMethod")); |
| 407 if (!hiddenValue.IsEmpty()) { |
| 408 v8SetReturnValue(info, hiddenValue); |
| 409 return; |
| 410 } |
| 411 |
| 412 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 413 } |
| 414 |
| 415 static void doNotCheckSecurityReadOnlyVoidMethodAttributeGetterCallback(v8::Loca
l<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 416 { |
| 417 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 418 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodAt
tributeGetter(info); |
| 419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 420 } |
| 421 |
| 422 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 423 { |
| 424 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 425 imp->doNotCheckSecurityUnforgeableVoidMethod(); |
| 426 } |
| 427 |
| 428 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
| 429 { |
| 430 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 431 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); |
| 432 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 433 } |
| 434 |
| 435 static void doNotCheckSecurityUnforgeableVoidMethodAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 436 { |
| 437 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 438 static int privateTemplateUniqueKey; |
| 439 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 440 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 441 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); |
| 442 |
| 443 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 444 if (holder.IsEmpty()) { |
| 274 // can only reach here by 'object.__proto__.func', and it should passed | 445 // can only reach here by 'object.__proto__.func', and it should passed |
| 275 // domain security check already | 446 // domain security check already |
| 276 v8SetReturnValue(info, privateTemplate->GetFunction()); | 447 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 277 return; | 448 return; |
| 278 } | 449 } |
| 279 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 450 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 280 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 451 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 281 static int sharedTemplateUniqueKey; | 452 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); | 453 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()); | 454 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 284 return; | 455 return; |
| 285 } | 456 } |
| 286 | 457 |
| 287 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); | 458 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("doNotCheckSecurityUnforgeableVoidMethod")); |
| 288 if (!hiddenValue.IsEmpty()) { | 459 if (!hiddenValue.IsEmpty()) { |
| 289 v8SetReturnValue(info, hiddenValue); | 460 v8SetReturnValue(info, hiddenValue); |
| 290 return; | 461 return; |
| 291 } | 462 } |
| 292 | 463 |
| 293 v8SetReturnValue(info, privateTemplate->GetFunction()); | 464 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 294 } | 465 } |
| 295 | 466 |
| 296 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallbackF
orMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) | 467 static void doNotCheckSecurityUnforgeableVoidMethodAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 297 { | 468 { |
| 298 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 469 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 299 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityAttributeGetterForMainWorld(info); | 470 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dAttributeGetter(info); |
| 300 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 471 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 301 } | 472 } |
| 302 | 473 |
| 303 static void TestCheckSecurityInterfaceDomainSafeFunctionSetter(v8::Local<v8::Str
ing> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& i
nfo) | 474 static void TestCheckSecurityInterfaceDomainSafeFunctionSetter(v8::Local<v8::Str
ing> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& i
nfo) |
| 304 { | 475 { |
| 305 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); | 476 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); |
| 306 if (holder.IsEmpty()) | 477 if (holder.IsEmpty()) |
| 307 return; | 478 return; |
| 308 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 479 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 309 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 480 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 310 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 481 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
| 311 exceptionState.throwIfNeeded(); | 482 exceptionState.throwIfNeeded(); |
| 312 return; | 483 return; |
| 313 } | 484 } |
| 314 | 485 |
| 315 info.This()->SetHiddenValue(name, jsValue); | 486 info.This()->SetHiddenValue(name, jsValue); |
| 316 } | 487 } |
| 317 | 488 |
| 318 } // namespace TestCheckSecurityInterfaceV8Internal | 489 } // namespace TestCheckSecurityInterfaceV8Internal |
| 319 | 490 |
| 320 static const V8DOMConfiguration::AttributeConfiguration V8TestCheckSecurityInter
faceAttributes[] = { | 491 static const V8DOMConfiguration::AttributeConfiguration V8TestCheckSecurityInter
faceAttributes[] = { |
| 321 {"excitingAttr", TestCheckSecurityInterfaceV8Internal::excitingAttrAttribute
GetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_
cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 492 {"longAttribute", TestCheckSecurityInterfaceV8Internal::longAttributeAttribu
teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati
c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 493 {"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 */}, |
| 494 {"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 */}, |
| 495 {"doNotCheckSecurityOnGetterLongAttribute", TestCheckSecurityInterfaceV8Inte
rnal::doNotCheckSecurityOnGetterLongAttributeAttributeGetterCallback, TestCheckS
ecurityInterfaceV8Internal::doNotCheckSecurityOnGetterLongAttributeAttributeSett
erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_ca
st<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 496 {"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 */}, |
| 497 }; |
| 498 |
| 499 static const V8DOMConfiguration::MethodConfiguration V8TestCheckSecurityInterfac
eMethods[] = { |
| 500 {"voidMethod", TestCheckSecurityInterfaceV8Internal::voidMethodMethodCallbac
k, 0, 0}, |
| 322 }; | 501 }; |
| 323 | 502 |
| 324 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCheckSecurityInterfaceTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 503 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCheckSecurityInterfaceTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
| 325 { | 504 { |
| 326 functionTemplate->ReadOnlyPrototype(); | 505 functionTemplate->ReadOnlyPrototype(); |
| 327 | 506 |
| 328 v8::Local<v8::Signature> defaultSignature; | 507 v8::Local<v8::Signature> defaultSignature; |
| 329 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestCheckSecurityInterface", v8::Local<v8::FunctionTemplate>(), V8TestChec
kSecurityInterface::internalFieldCount, | 508 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestCheckSecurityInterface", v8::Local<v8::FunctionTemplate>(), V8TestChec
kSecurityInterface::internalFieldCount, |
| 330 V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu
rityInterfaceAttributes), | 509 V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu
rityInterfaceAttributes), |
| 331 0, 0, | 510 0, 0, |
| 332 0, 0, | 511 V8TestCheckSecurityInterfaceMethods, WTF_ARRAY_LENGTH(V8TestCheckSecurit
yInterfaceMethods), |
| 333 isolate, currentWorldType); | 512 isolate, currentWorldType); |
| 334 UNUSED_PARAM(defaultSignature); | 513 UNUSED_PARAM(defaultSignature); |
| 335 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 514 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 336 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 515 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 337 UNUSED_PARAM(instanceTemplate); | 516 UNUSED_PARAM(instanceTemplate); |
| 338 UNUSED_PARAM(prototypeTemplate); | 517 UNUSED_PARAM(prototypeTemplate); |
| 339 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
Interface::wrapperTypeInfo))); | 518 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
Interface::wrapperTypeInfo))); |
| 340 | 519 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityVoid
Method"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodAttr
ibuteGetterCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInte
rfaceDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::
PropertyAttribute>(v8::DontDelete)); |
| 341 // Custom Signature 'excitingFunction' | |
| 342 const int excitingFunctionArgc = 1; | |
| 343 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc]
= { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
ntWorldType) }; | |
| 344 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(fun
ctionTemplate, excitingFunctionArgc, excitingFunctionArgv); | |
| 345 prototypeTemplate->Set(v8::String::NewSymbol("excitingFunction"), v8::Functi
onTemplate::New(TestCheckSecurityInterfaceV8Internal::excitingFunctionMethodCall
back, v8Undefined(), excitingFunctionSignature, 1)); | |
| 346 | |
| 347 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') | |
| 348 prototypeTemplate->SetAccessor(v8::String::NewSymbol("postMessage"), TestChe
ckSecurityInterfaceV8Internal::postMessageAttributeGetterCallback, TestCheckSecu
rityInterfaceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8U
ndefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)
); | |
| 349 | |
| 350 // Function 'perWorldBindingsMethodWithDoNotCheckSecurity' (Extended Attribu
tes: 'DoNotCheckSecurity PerWorldBindings ActivityLogging') | |
| 351 if (currentWorldType == MainWorld) { | 520 if (currentWorldType == MainWorld) { |
| 352 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityAttributeGetterCallbackForMainWorld, TestCheckSe
curityInterfaceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v
8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelet
e)); | 521 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity
PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe
curityPerWorldBindingsVoidMethodAttributeGetterCallbackForMainWorld, TestCheckSe
curityInterfaceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v
8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelet
e)); |
| 353 } else { | 522 } else { |
| 354 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityAttributeGetterCallback, TestCheckSecurityInterf
aceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8Undefined()
, v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 523 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity
PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe
curityPerWorldBindingsVoidMethodAttributeGetterCallback, TestCheckSecurityInterf
aceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8Undefined()
, v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 355 } | 524 } |
| 525 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityRead
OnlyVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOn
lyVoidMethodAttributeGetterCallback, 0, v8Undefined(), v8::ALL_CAN_READ, static_
cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)); |
| 526 instanceTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityUnfor
geableVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnfo
rgeableVoidMethodAttributeGetterCallback, TestCheckSecurityInterfaceV8Internal::
TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_R
EAD, static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 356 | 527 |
| 357 // Custom toString template | 528 // Custom toString template |
| 358 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 529 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); |
| 359 return functionTemplate; | 530 return functionTemplate; |
| 360 } | 531 } |
| 361 | 532 |
| 362 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 533 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 363 { | 534 { |
| 364 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 535 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 365 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 536 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 576 V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 406 return wrapper; | 577 return wrapper; |
| 407 } | 578 } |
| 408 | 579 |
| 409 void V8TestCheckSecurityInterface::derefObject(void* object) | 580 void V8TestCheckSecurityInterface::derefObject(void* object) |
| 410 { | 581 { |
| 411 fromInternalPointer(object)->deref(); | 582 fromInternalPointer(object)->deref(); |
| 412 } | 583 } |
| 413 | 584 |
| 414 } // namespace WebCore | 585 } // namespace WebCore |
| OLD | NEW |