Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceCheckSecurity.cpp

Issue 104873018: Remove raw DOM templates from V8 bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 19 matching lines...) Expand all
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 "V8TestInterfaceCheckSecurity.h" 34 #include "V8TestInterfaceCheckSecurity.h"
35 35
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "bindings/v8/BindingSecurity.h" 37 #include "bindings/v8/BindingSecurity.h"
38 #include "bindings/v8/ExceptionState.h" 38 #include "bindings/v8/ExceptionState.h"
39 #include "bindings/v8/V8DOMConfiguration.h" 39 #include "bindings/v8/V8DOMConfiguration.h"
40 #include "bindings/v8/V8ObjectConstructor.h"
40 #include "core/dom/ContextFeatures.h" 41 #include "core/dom/ContextFeatures.h"
41 #include "core/dom/Document.h" 42 #include "core/dom/Document.h"
42 #include "platform/TraceEvent.h" 43 #include "platform/TraceEvent.h"
43 44
44 namespace WebCore { 45 namespace WebCore {
45 46
46 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob ject) 47 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob ject)
47 { 48 {
48 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 49 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
49 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri ty::wrapperTypeInfo); 50 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri ty::wrapperTypeInfo);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf o); 192 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf o);
192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 193 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
193 } 194 }
194 195
195 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert yCallbackInfo<v8::Value>& info) 196 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert yCallbackInfo<v8::Value>& info)
196 { 197 {
197 // This is only for getting a unique pointer which we can pass to privateTem plate. 198 // This is only for getting a unique pointer which we can pass to privateTem plate.
198 static int privateTemplateUniqueKey; 199 static int privateTemplateUniqueKey;
199 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 200 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
200 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 201 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
201 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(in fo.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMTemplate(&V8Te stInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 202 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(in fo.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), cu rrentWorldType)), 0);
202 203
203 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)); 204 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType));
204 if (holder.IsEmpty()) { 205 if (holder.IsEmpty()) {
205 // This is only reachable via |object.__proto__.func|, in which case it 206 // This is only reachable via |object.__proto__.func|, in which case it
206 // has already passed the same origin security check 207 // has already passed the same origin security check
207 v8SetReturnValue(info, privateTemplate->GetFunction()); 208 v8SetReturnValue(info, privateTemplate->GetFunction());
208 return; 209 return;
209 } 210 }
210 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 211 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
211 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 212 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
212 static int sharedTemplateUniqueKey; 213 static int sharedTemplateUniqueKey;
213 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMTemplate(&V8 TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 214 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)), 0);
214 v8SetReturnValue(info, sharedTemplate->GetFunction()); 215 v8SetReturnValue(info, sharedTemplate->GetFunction());
215 return; 216 return;
216 } 217 }
217 218
218 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityVoidMethod", v8::String::kInter nalizedString)); 219 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityVoidMethod", v8::String::kInter nalizedString));
219 if (!hiddenValue.IsEmpty()) { 220 if (!hiddenValue.IsEmpty()) {
220 v8SetReturnValue(info, hiddenValue); 221 v8SetReturnValue(info, hiddenValue);
221 return; 222 return;
222 } 223 }
223 224
(...skipping 19 matching lines...) Expand all
243 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethod(info); 244 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethod(info);
244 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 245 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
245 } 246 }
246 247
247 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c onst v8::PropertyCallbackInfo<v8::Value>& info) 248 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c onst v8::PropertyCallbackInfo<v8::Value>& info)
248 { 249 {
249 // This is only for getting a unique pointer which we can pass to privateTem plate. 250 // This is only for getting a unique pointer which we can pass to privateTem plate.
250 static int privateTemplateUniqueKey; 251 static int privateTemplateUniqueKey;
251 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 252 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
252 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 253 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
253 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S ignature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawD OMTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0 ); 254 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S ignature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info. GetIsolate(), currentWorldType)), 0);
254 255
255 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)); 256 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType));
256 if (holder.IsEmpty()) { 257 if (holder.IsEmpty()) {
257 // This is only reachable via |object.__proto__.func|, in which case it 258 // This is only reachable via |object.__proto__.func|, in which case it
258 // has already passed the same origin security check 259 // has already passed the same origin security check
259 v8SetReturnValue(info, privateTemplate->GetFunction()); 260 v8SetReturnValue(info, privateTemplate->GetFunction());
260 return; 261 return;
261 } 262 }
262 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 263 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
263 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 264 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
264 static int sharedTemplateUniqueKey; 265 static int sharedTemplateUniqueKey;
265 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->ra wDOMTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 266 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(inf o.GetIsolate(), currentWorldType)), 0);
266 v8SetReturnValue(info, sharedTemplate->GetFunction()); 267 v8SetReturnValue(info, sharedTemplate->GetFunction());
267 return; 268 return;
268 } 269 }
269 270
270 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString)); 271 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString));
271 if (!hiddenValue.IsEmpty()) { 272 if (!hiddenValue.IsEmpty()) {
272 v8SetReturnValue(info, hiddenValue); 273 v8SetReturnValue(info, hiddenValue);
273 return; 274 return;
274 } 275 }
275 276
(...skipping 19 matching lines...) Expand all
295 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethodForMainWorld(info); 296 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethodForMainWorld(info);
296 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
297 } 298 }
298 299
299 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) 300 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
300 { 301 {
301 // This is only for getting a unique pointer which we can pass to privateTem plate. 302 // This is only for getting a unique pointer which we can pass to privateTem plate.
302 static int privateTemplateUniqueKey; 303 static int privateTemplateUniqueKey;
303 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 304 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
304 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 305 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
305 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi ned(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsol ate())->rawDOMTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWo rldType)), 0); 306 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi ned(), v8::Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTe mplate(info.GetIsolate(), currentWorldType)), 0);
306 307
307 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)); 308 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType));
308 if (holder.IsEmpty()) { 309 if (holder.IsEmpty()) {
309 // This is only reachable via |object.__proto__.func|, in which case it 310 // This is only reachable via |object.__proto__.func|, in which case it
310 // has already passed the same origin security check 311 // has already passed the same origin security check
311 v8SetReturnValue(info, privateTemplate->GetFunction()); 312 v8SetReturnValue(info, privateTemplate->GetFunction());
312 return; 313 return;
313 } 314 }
314 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 315 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
315 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 316 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
316 static int sharedTemplateUniqueKey; 317 static int sharedTemplateUniqueKey;
317 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIs olate())->rawDOMTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, current WorldType)), 0); 318 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::dom Template(info.GetIsolate(), currentWorldType)), 0);
318 v8SetReturnValue(info, sharedTemplate->GetFunction()); 319 v8SetReturnValue(info, sharedTemplate->GetFunction());
319 return; 320 return;
320 } 321 }
321 322
322 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString)); 323 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString));
323 if (!hiddenValue.IsEmpty()) { 324 if (!hiddenValue.IsEmpty()) {
324 v8SetReturnValue(info, hiddenValue); 325 v8SetReturnValue(info, hiddenValue);
325 return; 326 return;
326 } 327 }
327 328
(...skipping 19 matching lines...) Expand all
347 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe thod(info); 348 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe thod(info);
348 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 349 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
349 } 350 }
350 351
351 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8: :PropertyCallbackInfo<v8::Value>& info) 352 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8: :PropertyCallbackInfo<v8::Value>& info)
352 { 353 {
353 // This is only for getting a unique pointer which we can pass to privateTem plate. 354 // This is only for getting a unique pointer which we can pass to privateTem plate.
354 static int privateTemplateUniqueKey; 355 static int privateTemplateUniqueKey;
355 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 356 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
356 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 357 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
357 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature ::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMTempla te(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 358 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature ::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsola te(), currentWorldType)), 0);
358 359
359 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)); 360 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType));
360 if (holder.IsEmpty()) { 361 if (holder.IsEmpty()) {
361 // This is only reachable via |object.__proto__.func|, in which case it 362 // This is only reachable via |object.__proto__.func|, in which case it
362 // has already passed the same origin security check 363 // has already passed the same origin security check
363 v8SetReturnValue(info, privateTemplate->GetFunction()); 364 v8SetReturnValue(info, privateTemplate->GetFunction());
364 return; 365 return;
365 } 366 }
366 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 367 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
367 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 368 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
368 static int sharedTemplateUniqueKey; 369 static int sharedTemplateUniqueKey;
369 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMTemp late(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 370 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIso late(), currentWorldType)), 0);
370 v8SetReturnValue(info, sharedTemplate->GetFunction()); 371 v8SetReturnValue(info, sharedTemplate->GetFunction());
371 return; 372 return;
372 } 373 }
373 374
374 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod", v8::String ::kInternalizedString)); 375 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod", v8::String ::kInternalizedString));
375 if (!hiddenValue.IsEmpty()) { 376 if (!hiddenValue.IsEmpty()) {
376 v8SetReturnValue(info, hiddenValue); 377 v8SetReturnValue(info, hiddenValue);
377 return; 378 return;
378 } 379 }
379 380
(...skipping 19 matching lines...) Expand all
399 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho dMethod(info); 400 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho dMethod(info);
400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 401 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
401 } 402 }
402 403
403 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 404 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
404 { 405 {
405 // This is only for getting a unique pointer which we can pass to privateTem plate. 406 // This is only for getting a unique pointer which we can pass to privateTem plate.
406 static int privateTemplateUniqueKey; 407 static int privateTemplateUniqueKey;
407 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 408 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
408 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 409 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
409 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat ure::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMTem plate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 410 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal:: doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat ure::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIs olate(), currentWorldType)), 0);
410 411
411 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)); 412 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType));
412 if (holder.IsEmpty()) { 413 if (holder.IsEmpty()) {
413 // This is only reachable via |object.__proto__.func|, in which case it 414 // This is only reachable via |object.__proto__.func|, in which case it
414 // has already passed the same origin security check 415 // has already passed the same origin security check
415 v8SetReturnValue(info, privateTemplate->GetFunction()); 416 v8SetReturnValue(info, privateTemplate->GetFunction());
416 return; 417 return;
417 } 418 }
418 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 419 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
419 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 420 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
420 static int sharedTemplateUniqueKey; 421 static int sharedTemplateUniqueKey;
421 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawDOMT emplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); 422 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.Get Isolate(), currentWorldType)), 0);
422 v8SetReturnValue(info, sharedTemplate->GetFunction()); 423 v8SetReturnValue(info, sharedTemplate->GetFunction());
423 return; 424 return;
424 } 425 }
425 426
426 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod", v8::Str ing::kInternalizedString)); 427 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod", v8::Str ing::kInternalizedString));
427 if (!hiddenValue.IsEmpty()) { 428 if (!hiddenValue.IsEmpty()) {
428 v8SetReturnValue(info, hiddenValue); 429 v8SetReturnValue(info, hiddenValue);
429 return; 430 return;
430 } 431 }
431 432
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 {"longAttribute", TestInterfaceCheckSecurityV8Internal::longAttributeAttribu teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 469 {"longAttribute", TestInterfaceCheckSecurityV8Internal::longAttributeAttribu teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
469 {"doNotCheckSecurityLongAttribute", TestInterfaceCheckSecurityV8Internal::do NotCheckSecurityLongAttributeAttributeGetterCallback, TestInterfaceCheckSecurity 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 */}, 470 {"doNotCheckSecurityLongAttribute", TestInterfaceCheckSecurityV8Internal::do NotCheckSecurityLongAttributeAttributeGetterCallback, TestInterfaceCheckSecurity 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 */},
470 {"doNotCheckSecurityReadonlyLongAttribute", TestInterfaceCheckSecurityV8Inte rnal::doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0 , static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_cast<v8::PropertyAttr ibute>(v8::None), 0 /* on instance */}, 471 {"doNotCheckSecurityReadonlyLongAttribute", TestInterfaceCheckSecurityV8Inte rnal::doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0 , static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_cast<v8::PropertyAttr ibute>(v8::None), 0 /* on instance */},
471 {"doNotCheckSecurityOnSetterLongAttribute", TestInterfaceCheckSecurityV8Inte rnal::doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback, TestInterf aceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttributeAttributeSett erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_WRITE), static_c ast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 472 {"doNotCheckSecurityOnSetterLongAttribute", TestInterfaceCheckSecurityV8Inte rnal::doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback, TestInterf aceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttributeAttributeSett erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_WRITE), static_c ast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
472 }; 473 };
473 474
474 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceCheckSecurit yMethods[] = { 475 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceCheckSecurit yMethods[] = {
475 {"voidMethod", TestInterfaceCheckSecurityV8Internal::voidMethodMethodCallbac k, 0, 0}, 476 {"voidMethod", TestInterfaceCheckSecurityV8Internal::voidMethodMethodCallbac k, 0, 0},
476 }; 477 };
477 478
478 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W rapperWorldType currentWorldType) 479 static void configureV8TestInterfaceCheckSecurityTemplate(v8::Handle<v8::Functio nTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorld Type)
479 { 480 {
480 functionTemplate->ReadOnlyPrototype(); 481 functionTemplate->ReadOnlyPrototype();
481 482
482 v8::Local<v8::Signature> defaultSignature; 483 v8::Local<v8::Signature> defaultSignature;
483 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte rfaceCheckSecurity::internalFieldCount, 484 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte rfaceCheckSecurity::internalFieldCount,
484 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface CheckSecurityAttributes), 485 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface CheckSecurityAttributes),
485 0, 0, 486 0, 0,
486 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe ckSecurityMethods), 487 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe ckSecurityMethods),
487 isolate, currentWorldType); 488 isolate, currentWorldType);
488 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 489 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
489 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 490 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
490 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec kSecurity::wrapperTypeInfo))); 491 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec kSecurity::wrapperTypeInfo)));
491 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityVoidMethod", v8::String::kInternalizedString), TestInterfaceCheckSecurity V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestInte rfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMethodSetterCa llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8:: DontDelete)); 492 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityVoidMethod", v8::String::kInternalizedString), TestInterfaceCheckSecurity V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestInte rfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMethodSetterCa llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8:: DontDelete));
492 if (currentWorldType == MainWorld) { 493 if (currentWorldType == MainWorld) {
493 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallbackForMainWorld, TestInterfaceCheckSecurityV8Internal::Te stInterfaceCheckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); 494 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallbackForMainWorld, TestInterfaceCheckSecurityV8Internal::Te stInterfaceCheckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete));
494 } else { 495 } else {
495 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceC heckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete)); 496 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceC heckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete));
496 } 497 }
497 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestInterfaceCheck SecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v 8::DontDelete | v8::ReadOnly)); 498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestInterfaceCheck SecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v 8::DontDelete | v8::ReadOnly));
498 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestInterfaceChe ckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet terCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOri ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr opertyAttribute>(v8::DontDelete)); 499 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestInterfaceChe ckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet terCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOri ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr opertyAttribute>(v8::DontDelete));
499 500
500 // Custom toString template 501 // Custom toString template
501 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 502 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
502 return functionTemplate;
503 } 503 }
504 504
505 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCheckSecurity::domTemplate(v8::I solate* isolate, WrapperWorldType currentWorldType) 505 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCheckSecurity::domTemplate(v8::I solate* isolate, WrapperWorldType currentWorldType)
506 { 506 {
507 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 507 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
508 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 508 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
509 if (result != data->templateMap(currentWorldType).end()) 509 if (result != data->templateMap(currentWorldType).end())
510 return result->value.newLocal(isolate); 510 return result->value.newLocal(isolate);
511 511
512 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 512 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
513 v8::EscapableHandleScope handleScope(isolate); 513 v8::EscapableHandleScope handleScope(isolate);
514 v8::Local<v8::FunctionTemplate> templ = 514 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
515 ConfigureV8TestInterfaceCheckSecurityTemplate(data->rawDOMTemplate(&wrap perTypeInfo, currentWorldType), isolate, currentWorldType); 515 configureV8TestInterfaceCheckSecurityTemplate(templ, isolate, currentWorldTy pe);
516 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 516 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
517 return handleScope.Escape(templ); 517 return handleScope.Escape(templ);
518 } 518 }
519 519
520 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate, WrapperWorldType currentWorldType) 520 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate, WrapperWorldType currentWorldType)
521 { 521 {
522 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 522 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
523 } 523 }
524 524
525 bool V8TestInterfaceCheckSecurity::hasInstanceInAnyWorld(v8::Handle<v8::Value> j sValue, v8::Isolate* isolate) 525 bool V8TestInterfaceCheckSecurity::hasInstanceInAnyWorld(v8::Handle<v8::Value> j sValue, v8::Isolate* isolate)
(...skipping 28 matching lines...) Expand all
554 fromInternalPointer(object)->deref(); 554 fromInternalPointer(object)->deref();
555 } 555 }
556 556
557 template<> 557 template<>
558 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 558 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
559 { 559 {
560 return toV8(impl, creationContext, isolate); 560 return toV8(impl, creationContext, isolate);
561 } 561 }
562 562
563 } // namespace WebCore 563 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceConstructor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698