| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 v8::Local<v8::Function> function; | 87 if (!type->domTemplate(isolate)->InstanceTemplate()->NewInstance(scope.c
ontext()).ToLocal(&wrapper)) |
| 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)) | |
| 91 return v8::Local<v8::Object>(); | 88 return v8::Local<v8::Object>(); |
| 92 } | 89 } |
| 93 | 90 |
| 94 if (type == &V8HTMLDocument::wrapperTypeInfo && !wrapper.IsEmpty()) | 91 if (type == &V8HTMLDocument::wrapperTypeInfo && !wrapper.IsEmpty()) |
| 95 wrapper = wrapInShadowTemplate(wrapper, scriptWrappable, isolate); | 92 wrapper = wrapInShadowTemplate(wrapper, scriptWrappable, isolate); |
| 96 | 93 |
| 97 return wrapper; | 94 return wrapper; |
| 98 } | 95 } |
| 99 | 96 |
| 100 bool V8DOMWrapper::isWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value) | 97 bool V8DOMWrapper::isWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 v8::Isolate* isolate = m_context->GetIsolate(); | 147 v8::Isolate* isolate = m_context->GetIsolate(); |
| 151 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. | 148 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. |
| 152 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); | 149 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); |
| 153 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); | 150 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); |
| 154 DOMWindow* targetWindow = toDOMWindow(m_context); | 151 DOMWindow* targetWindow = toDOMWindow(m_context); |
| 155 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); | 152 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); |
| 156 exceptionState.throwIfNeeded(); | 153 exceptionState.throwIfNeeded(); |
| 157 } | 154 } |
| 158 | 155 |
| 159 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |