Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 #include "config.h" | 31 #include "config.h" |
| 32 #include "bindings/core/v8/V8DOMWrapper.h" | 32 #include "bindings/core/v8/V8DOMWrapper.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/V8Binding.h" | 34 #include "bindings/core/v8/V8Binding.h" |
| 35 #include "bindings/core/v8/V8HTMLCollection.h" | 35 #include "bindings/core/v8/V8HTMLCollection.h" |
| 36 #include "bindings/core/v8/V8HTMLDocument.h" | 36 #include "bindings/core/v8/V8HTMLDocument.h" |
| 37 #include "bindings/core/v8/V8Location.h" | |
| 37 #include "bindings/core/v8/V8ObjectConstructor.h" | 38 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 38 #include "bindings/core/v8/V8PerContextData.h" | 39 #include "bindings/core/v8/V8PerContextData.h" |
| 39 #include "bindings/core/v8/V8PerIsolateData.h" | 40 #include "bindings/core/v8/V8PerIsolateData.h" |
| 40 #include "bindings/core/v8/V8ScriptRunner.h" | 41 #include "bindings/core/v8/V8ScriptRunner.h" |
| 41 #include "bindings/core/v8/V8Window.h" | 42 #include "bindings/core/v8/V8Window.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 static v8::Local<v8::Object> wrapInShadowTemplate(v8::Local<v8::Object> wrapper, ScriptWrappable* scriptWrappable, v8::Isolate* isolate) | 46 static v8::Local<v8::Object> wrapInShadowTemplate(v8::Local<v8::Object> wrapper, ScriptWrappable* scriptWrappable, v8::Isolate* isolate) |
| 46 { | 47 { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 65 if (!V8ScriptRunner::instantiateObject(isolate, shadowConstructor).ToLocal(& shadow)) | 66 if (!V8ScriptRunner::instantiateObject(isolate, shadowConstructor).ToLocal(& shadow)) |
| 66 return v8::Local<v8::Object>(); | 67 return v8::Local<v8::Object>(); |
| 67 if (!v8CallBoolean(shadow->SetPrototype(isolate->GetCurrentContext(), wrappe r))) | 68 if (!v8CallBoolean(shadow->SetPrototype(isolate->GetCurrentContext(), wrappe r))) |
| 68 return v8::Local<v8::Object>(); | 69 return v8::Local<v8::Object>(); |
| 69 V8DOMWrapper::setNativeInfo(wrapper, &V8HTMLDocument::wrapperTypeInfo, scrip tWrappable); | 70 V8DOMWrapper::setNativeInfo(wrapper, &V8HTMLDocument::wrapperTypeInfo, scrip tWrappable); |
| 70 return shadow; | 71 return shadow; |
| 71 } | 72 } |
| 72 | 73 |
| 73 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Loca l<v8::Object> creationContext, const WrapperTypeInfo* type, ScriptWrappable* scr iptWrappable) | 74 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Loca l<v8::Object> creationContext, const WrapperTypeInfo* type, ScriptWrappable* scr iptWrappable) |
| 74 { | 75 { |
| 75 V8WrapperInstantiationScope scope(creationContext, isolate); | 76 bool withSecurityCheck = !type->equals(&V8Window::wrapperTypeInfo) && !type- >equals(&V8Location::wrapperTypeInfo); |
|
haraken
2015/07/30 10:43:36
I guess this might regress performance. As comment
Yuki
2015/07/30 11:00:54
It seems that the CL is enabling the security chec
haraken
2015/07/30 11:08:06
Thanks, that totally makes sense to me.
- Remove
| |
| 77 V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityChec k); | |
| 76 | 78 |
| 77 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); | 79 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); |
| 78 v8::Local<v8::Object> wrapper; | 80 v8::Local<v8::Object> wrapper; |
| 79 if (perContextData) { | 81 if (perContextData) { |
| 80 wrapper = perContextData->createWrapperFromCache(type); | 82 wrapper = perContextData->createWrapperFromCache(type); |
| 81 } else { | 83 } else { |
| 82 v8::Local<v8::Function> function; | 84 v8::Local<v8::Function> function; |
| 83 if (!type->domTemplate(isolate)->GetFunction(isolate->GetCurrentContext( )).ToLocal(&function)) | 85 if (!type->domTemplate(isolate)->GetFunction(isolate->GetCurrentContext( )).ToLocal(&function)) |
| 84 return v8::Local<v8::Object>(); | 86 return v8::Local<v8::Object>(); |
| 85 if (!V8ObjectConstructor::newInstance(isolate, function).ToLocal(&wrappe r)) | 87 if (!V8ObjectConstructor::newInstance(isolate, function).ToLocal(&wrappe r)) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 return false; | 120 return false; |
| 119 | 121 |
| 120 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); | 122 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); |
| 121 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); | 123 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); |
| 122 return untrustedScriptWrappable | 124 return untrustedScriptWrappable |
| 123 && untrustedWrapperTypeInfo | 125 && untrustedWrapperTypeInfo |
| 124 && untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; | 126 && untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; |
| 125 } | 127 } |
| 126 | 128 |
| 127 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |