| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (!frame) { | 109 if (!frame) { |
| 110 // Sandbox detached frames - they can't create cross origin objects. | 110 // Sandbox detached frames - they can't create cross origin objects. |
| 111 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); | 111 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); |
| 112 DOMWindow* targetWindow = toDOMWindow(contextForWrapper); | 112 DOMWindow* targetWindow = toDOMWindow(contextForWrapper); |
| 113 // TODO(jochen): Currently, Location is the only object for which we can
reach this code path. Should be generalized. | 113 // TODO(jochen): Currently, Location is the only object for which we can
reach this code path. Should be generalized. |
| 114 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Loca
tion", contextForWrapper->Global(), isolate); | 114 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Loca
tion", contextForWrapper->Global(), isolate); |
| 115 if (BindingSecurity::shouldAllowAccessToDetachedWindow(callingWindow, ta
rgetWindow, exceptionState)) | 115 if (BindingSecurity::shouldAllowAccessToDetachedWindow(callingWindow, ta
rgetWindow, exceptionState)) |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 CHECK_EQ(SecurityError, exceptionState.code()); | 118 CHECK_EQ(SecurityError, exceptionState.code()); |
| 119 exceptionState.throwIfNeeded(); | |
| 120 return; | 119 return; |
| 121 } | 120 } |
| 122 const DOMWrapperWorld& currentWorld = DOMWrapperWorld::world(m_context); | 121 const DOMWrapperWorld& currentWorld = DOMWrapperWorld::world(m_context); |
| 123 RELEASE_ASSERT(currentWorld.worldId() == DOMWrapperWorld::world(contextForWr
apper).worldId()); | 122 RELEASE_ASSERT(currentWorld.worldId() == DOMWrapperWorld::world(contextForWr
apper).worldId()); |
| 124 // TODO(jochen): Add the interface name here once this is generalized. | 123 // TODO(jochen): Add the interface name here once this is generalized. |
| 125 ExceptionState exceptionState(ExceptionState::ConstructionContext, nullptr,
contextForWrapper->Global(), isolate); | 124 ExceptionState exceptionState(ExceptionState::ConstructionContext, nullptr,
contextForWrapper->Global(), isolate); |
| 126 if (currentWorld.isMainWorld() && !BindingSecurity::shouldAllowAccessToFrame
(currentDOMWindow(isolate), frame, exceptionState)) { | 125 if (currentWorld.isMainWorld() && !BindingSecurity::shouldAllowAccessToFrame
(currentDOMWindow(isolate), frame, exceptionState)) { |
| 127 CHECK_EQ(SecurityError, exceptionState.code()); | 126 CHECK_EQ(SecurityError, exceptionState.code()); |
| 128 exceptionState.throwIfNeeded(); | |
| 129 return; | 127 return; |
| 130 } | 128 } |
| 131 } | 129 } |
| 132 | 130 |
| 133 void V8WrapperInstantiationScope::convertException() | 131 void V8WrapperInstantiationScope::convertException() |
| 134 { | 132 { |
| 135 v8::Isolate* isolate = m_context->GetIsolate(); | 133 v8::Isolate* isolate = m_context->GetIsolate(); |
| 136 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. | 134 // TODO(jochen): Currently, Location is the only object for which we can rea
ch this code path. Should be generalized. |
| 137 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); | 135 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location
", isolate->GetCurrentContext()->Global(), isolate); |
| 138 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); | 136 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); |
| 139 DOMWindow* targetWindow = toDOMWindow(m_context); | 137 DOMWindow* targetWindow = toDOMWindow(m_context); |
| 140 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); | 138 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWi
ndow)); |
| 141 exceptionState.throwIfNeeded(); | |
| 142 } | 139 } |
| 143 | 140 |
| 144 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |