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

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

Issue 1194563003: Don't crash in V8Window::openMethodCustom when called on RemoteDOMWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | no next file » | 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 { 227 {
228 v8::Local<v8::Object> domWrapper = V8Window::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate()); 228 v8::Local<v8::Object> domWrapper = V8Window::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate());
229 v8::Local<v8::Object> target = domWrapper.IsEmpty() ? info.This() : domWrapp er; 229 v8::Local<v8::Object> target = domWrapper.IsEmpty() ? info.This() : domWrapp er;
230 v8::Local<v8::String> value; 230 v8::Local<v8::String> value;
231 if (target->ObjectProtoToString(info.GetIsolate()->GetCurrentContext()).ToLo cal(&value)) 231 if (target->ObjectProtoToString(info.GetIsolate()->GetCurrentContext()).ToLo cal(&value))
232 v8SetReturnValue(info, value); 232 v8SetReturnValue(info, value);
233 } 233 }
234 234
235 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 235 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
236 { 236 {
237 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); 237 DOMWindow* impl = V8Window::toImpl(info.Holder());
238 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win dow", info.Holder(), info.GetIsolate()); 238 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win dow", info.Holder(), info.GetIsolate());
239 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { 239 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
240 exceptionState.throwIfNeeded(); 240 exceptionState.throwIfNeeded();
241 return; 241 return;
242 } 242 }
243 243
244 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]); 244 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]);
245 AtomicString frameName; 245 AtomicString frameName;
246 if (info[1]->IsUndefined() || info[1]->IsNull()) { 246 if (info[1]->IsUndefined() || info[1]->IsNull()) {
247 frameName = "_blank"; 247 frameName = "_blank";
248 } else { 248 } else {
249 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]); 249 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]);
250 frameName = frameNameResource; 250 frameName = frameNameResource;
251 } 251 }
252 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, windowFea turesString, info[2]); 252 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, windowFea turesString, info[2]);
253 253
254 RefPtrWillBeRawPtr<DOMWindow> openedWindow = impl->open(urlString, frameName , windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(in fo.GetIsolate())); 254 // |impl| has to be a LocalDOMWindow, since RemoteDOMWindows wouldn't have
255 // passed the BindingSecurity check above.
256 RefPtrWillBeRawPtr<DOMWindow> openedWindow = toLocalDOMWindow(impl)->open(ur lString, frameName, windowFeaturesString, callingDOMWindow(info.GetIsolate()), e nteredDOMWindow(info.GetIsolate()));
255 if (!openedWindow) 257 if (!openedWindow)
256 return; 258 return;
257 259
258 v8SetReturnValueFast(info, openedWindow.release(), impl); 260 v8SetReturnValueFast(info, openedWindow.release(), impl);
259 } 261 }
260 262
261 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro pertyCallbackInfo<v8::Value>& info) 263 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro pertyCallbackInfo<v8::Value>& info)
262 { 264 {
263 if (!name->IsString()) 265 if (!name->IsString())
264 return; 266 return;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 { 348 {
347 return securityCheck(host); 349 return securityCheck(host);
348 } 350 }
349 351
350 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>) 352 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>)
351 { 353 {
352 return securityCheck(host); 354 return securityCheck(host);
353 } 355 }
354 356
355 } // namespace blink 357 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698