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

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: rebase 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return; 364 return;
365 365
366 if (m_frame->isRemoteFrame()) { 366 if (m_frame->isRemoteFrame()) {
367 return; 367 return;
368 } 368 }
369 369
370 ScriptState::Scope scope(m_scriptState.get()); 370 ScriptState::Scope scope(m_scriptState.get());
371 v8::Local<v8::Context> context = m_scriptState->context(); 371 v8::Local<v8::Context> context = m_scriptState->context();
372 LocalFrame* frame = toLocalFrame(m_frame); 372 LocalFrame* frame = toLocalFrame(m_frame);
373 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate()); 373 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate());
374 if (documentWrapper.IsEmpty())
375 return;
374 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty()); 376 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty());
375 if (m_document.isEmpty()) 377 if (m_document.isEmpty())
376 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); 378 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper));
377 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); 379 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document());
378 380
379 ASSERT(documentWrapper->IsObject()); 381 ASSERT(documentWrapper->IsObject());
380 if (!v8CallBoolean(context->Global()->ForceSet(context, v8AtomicString(m_iso late, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadO nly | v8::DontDelete)))) 382 if (!v8CallBoolean(context->Global()->ForceSet(context, v8AtomicString(m_iso late, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadO nly | v8::DontDelete))))
381 return; 383 return;
382 384
383 // We also stash a reference to the document on the inner global object so t hat 385 // 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
517 519
518 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) 520 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin)
519 { 521 {
520 ASSERT(m_world->isMainWorld()); 522 ASSERT(m_world->isMainWorld());
521 if (!isContextInitialized()) 523 if (!isContextInitialized())
522 return; 524 return;
523 setSecurityToken(origin); 525 setSecurityToken(origin);
524 } 526 }
525 527
526 } // namespace blink 528 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp ('k') | Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698