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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp

Issue 1753363002: Revert of Instantiate instance templates instead of doing construct calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // cross-origin script access to a few properties of Location is allowed. 77 // cross-origin script access to a few properties of Location is allowed.
78 // Location already implements the necessary security checks. 78 // Location already implements the necessary security checks.
79 bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo); 79 bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo);
80 V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityChec k); 80 V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityChec k);
81 81
82 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); 82 V8PerContextData* perContextData = V8PerContextData::from(scope.context());
83 v8::Local<v8::Object> wrapper; 83 v8::Local<v8::Object> wrapper;
84 if (perContextData) { 84 if (perContextData) {
85 wrapper = perContextData->createWrapperFromCache(type); 85 wrapper = perContextData->createWrapperFromCache(type);
86 } else { 86 } else {
87 if (!type->domTemplate(isolate)->InstanceTemplate()->NewInstance(scope.c ontext()).ToLocal(&wrapper)) 87 v8::Local<v8::Function> function;
88 if (!type->domTemplate(isolate)->GetFunction(isolate->GetCurrentContext( )).ToLocal(&function))
89 return v8::Local<v8::Object>();
90 if (!V8ObjectConstructor::newInstance(isolate, function).ToLocal(&wrappe r))
88 return v8::Local<v8::Object>(); 91 return v8::Local<v8::Object>();
89 } 92 }
90 93
91 if (type == &V8HTMLDocument::wrapperTypeInfo && !wrapper.IsEmpty()) 94 if (type == &V8HTMLDocument::wrapperTypeInfo && !wrapper.IsEmpty())
92 wrapper = wrapInShadowTemplate(wrapper, scriptWrappable, isolate); 95 wrapper = wrapInShadowTemplate(wrapper, scriptWrappable, isolate);
93 96
94 return wrapper; 97 return wrapper;
95 } 98 }
96 99
97 bool V8DOMWrapper::isWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value) 100 bool V8DOMWrapper::isWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 v8::Isolate* isolate = m_context->GetIsolate(); 150 v8::Isolate* isolate = m_context->GetIsolate();
148 // TODO(jochen): Currently, Location is the only object for which we can rea ch this code path. Should be generalized. 151 // TODO(jochen): Currently, Location is the only object for which we can rea ch this code path. Should be generalized.
149 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location ", isolate->GetCurrentContext()->Global(), isolate); 152 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location ", isolate->GetCurrentContext()->Global(), isolate);
150 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); 153 LocalDOMWindow* callingWindow = callingDOMWindow(isolate);
151 DOMWindow* targetWindow = toDOMWindow(m_context); 154 DOMWindow* targetWindow = toDOMWindow(m_context);
152 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi ndow)); 155 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi ndow));
153 exceptionState.throwIfNeeded(); 156 exceptionState.throwIfNeeded();
154 } 157 }
155 158
156 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698