| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; | 103 untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void V8WrapperInstantiationScope::securityCheck( | 106 void V8WrapperInstantiationScope::securityCheck( |
| 107 v8::Isolate* isolate, | 107 v8::Isolate* isolate, |
| 108 v8::Local<v8::Context> contextForWrapper) { | 108 v8::Local<v8::Context> contextForWrapper) { |
| 109 if (m_context.IsEmpty()) | 109 if (m_context.IsEmpty()) |
| 110 return; | 110 return; |
| 111 // If the context is different, we need to make sure that the current | 111 // If the context is different, we need to make sure that the current |
| 112 // context has access to the creation context. | 112 // context has access to the creation context. |
| 113 Frame* frame = toFrameIfNotDetached(contextForWrapper); | 113 LocalFrame* frame = toLocalFrameIfNotDetached(contextForWrapper); |
| 114 if (!frame) { | 114 if (!frame) { |
| 115 // Sandbox detached frames - they can't create cross origin objects. | 115 // Sandbox detached frames - they can't create cross origin objects. |
| 116 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); | 116 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); |
| 117 DOMWindow* targetWindow = toDOMWindow(contextForWrapper); | 117 LocalDOMWindow* targetWindow = toLocalDOMWindow(contextForWrapper); |
| 118 // TODO(jochen): Currently, Location is the only object for which we can | 118 // TODO(jochen): Currently, Location is the only object for which we can |
| 119 // reach this code path. Should be generalized. | 119 // reach this code path. Should be generalized. |
| 120 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, | 120 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, |
| 121 "Location"); | 121 "Location"); |
| 122 if (BindingSecurity::shouldAllowAccessToDetachedWindow( | 122 if (BindingSecurity::shouldAllowAccessToDetachedWindow( |
| 123 callingWindow, targetWindow, exceptionState)) | 123 callingWindow, targetWindow, exceptionState)) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 CHECK_EQ(SecurityError, exceptionState.code()); | 126 CHECK_EQ(SecurityError, exceptionState.code()); |
| 127 return; | 127 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 void V8WrapperInstantiationScope::convertException() { | 143 void V8WrapperInstantiationScope::convertException() { |
| 144 v8::Isolate* isolate = m_context->GetIsolate(); | 144 v8::Isolate* isolate = m_context->GetIsolate(); |
| 145 // TODO(jochen): Currently, Location is the only object for which we can reach | 145 // TODO(jochen): Currently, Location is the only object for which we can reach |
| 146 // this code path. Should be generalized. | 146 // this code path. Should be generalized. |
| 147 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, | 147 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, |
| 148 "Location"); | 148 "Location"); |
| 149 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); | 149 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); |
| 150 DOMWindow* targetWindow = toDOMWindow(m_context); | 150 LocalDOMWindow* targetWindow = toLocalDOMWindow(m_context); |
| 151 exceptionState.throwSecurityError( | 151 exceptionState.throwSecurityError( |
| 152 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), | 152 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), |
| 153 targetWindow->crossDomainAccessErrorMessage(callingWindow)); | 153 targetWindow->crossDomainAccessErrorMessage(callingWindow)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |