| 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 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
| 34 #include "bindings/core/v8/V8Location.h" | 34 #include "bindings/core/v8/V8Location.h" |
| 35 #include "bindings/core/v8/V8ObjectConstructor.h" | 35 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 36 #include "bindings/core/v8/V8PerContextData.h" | 36 #include "bindings/core/v8/V8PerContextData.h" |
| 37 #include "bindings/core/v8/V8PerIsolateData.h" | 37 #include "bindings/core/v8/V8PerIsolateData.h" |
| 38 #include "bindings/core/v8/V8ScriptRunner.h" | 38 #include "bindings/core/v8/V8ScriptRunner.h" |
| 39 #include "bindings/core/v8/V8Window.h" | 39 #include "bindings/core/v8/V8Window.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Loca
l<v8::Object> creationContext, const WrapperTypeInfo* type, ScriptWrappable* scr
iptWrappable) | 43 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Loca
l<v8::Object> creationContext, const WrapperTypeInfo* type) |
| 44 { | 44 { |
| 45 ASSERT(!type->equals(&V8Window::wrapperTypeInfo)); | 45 ASSERT(!type->equals(&V8Window::wrapperTypeInfo)); |
| 46 // According to https://html.spec.whatwg.org/multipage/browsers.html#securit
y-location, | 46 // According to https://html.spec.whatwg.org/multipage/browsers.html#securit
y-location, |
| 47 // cross-origin script access to a few properties of Location is allowed. | 47 // cross-origin script access to a few properties of Location is allowed. |
| 48 // Location already implements the necessary security checks. | 48 // Location already implements the necessary security checks. |
| 49 bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo); | 49 bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo); |
| 50 V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityChec
k); | 50 V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityChec
k); |
| 51 | 51 |
| 52 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); | 52 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); |
| 53 v8::Local<v8::Object> wrapper; | 53 v8::Local<v8::Object> wrapper; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 v8::Isolate* isolate = m_context->GetIsolate(); | 121 v8::Isolate* isolate = m_context->GetIsolate(); |
| 122 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. | 122 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. |
| 123 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); | 123 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); |
| 124 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); | 124 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); |
| 125 DOMWindow* targetWindow = toDOMWindow(m_context); | 125 DOMWindow* targetWindow = toDOMWindow(m_context); |
| 126 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); | 126 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); |
| 127 exceptionState.throwIfNeeded(); | 127 exceptionState.throwIfNeeded(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |