| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 return result->value.newLocal(isolate); | 512 return result->value.newLocal(isolate); |
| 513 | 513 |
| 514 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 514 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 515 v8::EscapableHandleScope handleScope(isolate); | 515 v8::EscapableHandleScope handleScope(isolate); |
| 516 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 516 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 517 configureV8TestInterfaceCheckSecurityTemplate(templ, isolate, currentWorldTy
pe); | 517 configureV8TestInterfaceCheckSecurityTemplate(templ, isolate, currentWorldTy
pe); |
| 518 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 518 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 519 return handleScope.Escape(templ); | 519 return handleScope.Escape(templ); |
| 520 } | 520 } |
| 521 | 521 |
| 522 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 522 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate) |
| 523 { | 523 { |
| 524 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 524 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 525 } | 525 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 526 | |
| 527 bool V8TestInterfaceCheckSecurity::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | |
| 528 { | |
| 529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 530 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 531 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 532 } | 526 } |
| 533 | 527 |
| 534 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te
stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) | 528 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te
stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) |
| 535 { | 529 { |
| 536 ASSERT(impl); | 530 ASSERT(impl); |
| 537 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get
(), isolate)); | 531 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get
(), isolate)); |
| 538 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 532 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 539 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 533 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 540 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 534 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 541 // the same object de-ref functions, though, so use that as the basis of
the check. | 535 // the same object de-ref functions, though, so use that as the basis of
the check. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 556 fromInternalPointer(object)->deref(); | 550 fromInternalPointer(object)->deref(); |
| 557 } | 551 } |
| 558 | 552 |
| 559 template<> | 553 template<> |
| 560 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 554 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
| 561 { | 555 { |
| 562 return toV8(impl, creationContext, isolate); | 556 return toV8(impl, creationContext, isolate); |
| 563 } | 557 } |
| 564 | 558 |
| 565 } // namespace WebCore | 559 } // namespace WebCore |
| OLD | NEW |