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

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

Issue 2706923002: Rework security checks to be based on Window rather than Frame. (Closed)
Patch Set: Address review comments. Created 3 years, 9 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // context has access to the creation context. 112 // context has access to the creation context.
113 Frame* frame = toFrameIfNotDetached(contextForWrapper); 113 Frame* frame = toFrameIfNotDetached(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 DOMWindow* targetWindow = toDOMWindow(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::shouldAllowAccessTo(callingWindow, targetWindow,
123 callingWindow, targetWindow, exceptionState)) 123 exceptionState)) {
124 return; 124 return;
125 }
125 126
126 CHECK_EQ(SecurityError, exceptionState.code()); 127 CHECK_EQ(SecurityError, exceptionState.code());
127 return; 128 return;
128 } 129 }
129 const DOMWrapperWorld& currentWorld = DOMWrapperWorld::world(m_context); 130 const DOMWrapperWorld& currentWorld = DOMWrapperWorld::world(m_context);
130 RELEASE_ASSERT(currentWorld.worldId() == 131 RELEASE_ASSERT(currentWorld.worldId() ==
131 DOMWrapperWorld::world(contextForWrapper).worldId()); 132 DOMWrapperWorld::world(contextForWrapper).worldId());
132 // TODO(jochen): Add the interface name here once this is generalized. 133 // TODO(jochen): Add the interface name here once this is generalized.
133 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, 134 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext,
134 nullptr); 135 nullptr);
(...skipping 12 matching lines...) Expand all
147 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, 148 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext,
148 "Location"); 149 "Location");
149 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); 150 LocalDOMWindow* callingWindow = currentDOMWindow(isolate);
150 DOMWindow* targetWindow = toDOMWindow(m_context); 151 DOMWindow* targetWindow = toDOMWindow(m_context);
151 exceptionState.throwSecurityError( 152 exceptionState.throwSecurityError(
152 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), 153 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow),
153 targetWindow->crossDomainAccessErrorMessage(callingWindow)); 154 targetWindow->crossDomainAccessErrorMessage(callingWindow));
154 } 155 }
155 156
156 } // namespace blink 157 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698