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

Side by Side Diff: Source/bindings/core/v8/custom/V8WindowCustom.cpp

Issue 1112843007: Fix frameElement for frames with a remote parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add comment about doing the access check on the frame vs node. Created 5 years, 7 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
« no previous file with comments | « no previous file | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2011 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (context.IsEmpty()) 100 if (context.IsEmpty())
101 return; 101 return;
102 102
103 V8HiddenValue::setHiddenValue(info.GetIsolate(), context->Global(), V8Hidden Value::event(info.GetIsolate()), value); 103 V8HiddenValue::setHiddenValue(info.GetIsolate(), context->Global(), V8Hidden Value::event(info.GetIsolate()), value);
104 } 104 }
105 105
106 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info) 106 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info)
107 { 107 {
108 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); 108 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder()));
109 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate()); 109 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate());
110 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) { 110
111 // Do the security check against the parent frame rather than
112 // frameElement() itself, so that a remote parent frame can be handled
113 // properly. In that case, there's no frameElement(), yet we should still
114 // throw a proper exception and deny access.
115 Frame* target = impl->frame() ? impl->frame()->tree().parent() : nullptr;
116 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), target, ex ceptionState)) {
111 v8SetReturnValueNull(info); 117 v8SetReturnValueNull(info);
112 exceptionState.throwIfNeeded(); 118 exceptionState.throwIfNeeded();
113 return; 119 return;
114 } 120 }
115 121
116 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame. 122 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame.
117 // So, use its containing document as the creation context when wrapping. 123 // So, use its containing document as the creation context when wrapping.
118 v8::Local<v8::Value> creationContext = toV8(&impl->frameElement()->document( ), info.Holder(), info.GetIsolate()); 124 v8::Local<v8::Value> creationContext = toV8(&impl->frameElement()->document( ), info.Holder(), info.GetIsolate());
119 RELEASE_ASSERT(!creationContext.IsEmpty()); 125 RELEASE_ASSERT(!creationContext.IsEmpty());
120 v8::Local<v8::Value> wrapper = toV8(impl->frameElement(), v8::Local<v8::Obje ct>::Cast(creationContext), info.GetIsolate()); 126 v8::Local<v8::Value> wrapper = toV8(impl->frameElement(), v8::Local<v8::Obje ct>::Cast(creationContext), info.GetIsolate());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 { 345 {
340 return securityCheck(host); 346 return securityCheck(host);
341 } 347 }
342 348
343 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>) 349 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>)
344 { 350 {
345 return securityCheck(host); 351 return securityCheck(host);
346 } 352 }
347 353
348 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698