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

Side by Side Diff: Source/bindings/core/v8/WindowProxy.cpp

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return; 357 return;
358 358
359 if (m_frame->isRemoteFrame()) { 359 if (m_frame->isRemoteFrame()) {
360 return; 360 return;
361 } 361 }
362 362
363 ScriptState::Scope scope(m_scriptState.get()); 363 ScriptState::Scope scope(m_scriptState.get());
364 v8::Local<v8::Context> context = m_scriptState->context(); 364 v8::Local<v8::Context> context = m_scriptState->context();
365 LocalFrame* frame = toLocalFrame(m_frame); 365 LocalFrame* frame = toLocalFrame(m_frame);
366 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate()); 366 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate());
367 if (documentWrapper.IsEmpty())
368 return;
367 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty()); 369 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty());
368 if (m_document.isEmpty()) 370 if (m_document.isEmpty())
369 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); 371 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper));
370 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); 372 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document());
371 373
372 ASSERT(documentWrapper->IsObject()); 374 ASSERT(documentWrapper->IsObject());
373 if (!v8CallBoolean(context->Global()->ForceSet(context, v8AtomicString(m_iso late, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadO nly | v8::DontDelete)))) 375 if (!v8CallBoolean(context->Global()->ForceSet(context, v8AtomicString(m_iso late, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadO nly | v8::DontDelete))))
374 return; 376 return;
375 377
376 // We also stash a reference to the document on the inner global object so t hat 378 // We also stash a reference to the document on the inner global object so t hat
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 512
511 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) 513 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin)
512 { 514 {
513 ASSERT(m_world->isMainWorld()); 515 ASSERT(m_world->isMainWorld());
514 if (!isContextInitialized()) 516 if (!isContextInitialized())
515 return; 517 return;
516 setSecurityToken(origin); 518 setSecurityToken(origin);
517 } 519 }
518 520
519 } // namespace blink 521 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698