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

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

Issue 2272613003: binding: Retires ExceptionState::throwIfNeeded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 4 years, 3 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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698