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

Side by Side Diff: Source/web/WebPluginContainerImpl.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, 8 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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return v8::Local<v8::Object>(); 456 return v8::Local<v8::Object>();
457 457
458 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 458 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
459 return v8::Local<v8::Object>(); 459 return v8::Local<v8::Object>();
460 460
461 ScriptState* scriptState = ScriptState::forMainWorld(frame); 461 ScriptState* scriptState = ScriptState::forMainWorld(frame);
462 if (!scriptState->contextIsValid()) 462 if (!scriptState->contextIsValid())
463 return v8::Local<v8::Object>(); 463 return v8::Local<v8::Object>();
464 464
465 v8::Handle<v8::Value> v8value = toV8(m_element.get(), scriptState->context() ->Global(), scriptState->isolate()); 465 v8::Handle<v8::Value> v8value = toV8(m_element.get(), scriptState->context() ->Global(), scriptState->isolate());
466 ASSERT(v8value->IsObject()); 466 ASSERT(!v8value.IsEmpty() && v8value->IsObject());
haraken 2015/04/28 04:24:59 Who guarantees it is not empty? Also we can remov
bashi 2015/04/28 05:41:53 The existing ASSERT() implies this should not be e
haraken 2015/04/28 05:50:34 I think that is exactly what we're fixing with int
bashi 2015/04/28 06:41:14 Yeah, let's use !IsEmpty() assertion to see this a
Yuki 2015/04/28 06:43:46 The problem is, ASSERT will be noop in release bui
haraken 2015/04/28 06:46:08 If you argue that we can go with ASSERT here, that
bashi 2015/04/28 06:55:49 Ok, changed to return empty handle. That's said,
467 467
468 return v8::Handle<v8::Object>::Cast(v8value); 468 return v8::Handle<v8::Object>::Cast(v8value);
469 } 469 }
470 470
471 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup sAllowed) 471 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup sAllowed)
472 { 472 {
473 LocalFrame* frame = m_element->document().frame(); 473 LocalFrame* frame = m_element->document().frame();
474 if (!frame) 474 if (!frame)
475 return WebString(); 475 return WebString();
476 476
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 for (size_t i = 0; i < cutOutRects.size(); i++) 1011 for (size_t i = 0; i < cutOutRects.size(); i++)
1012 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 1012 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
1013 } 1013 }
1014 1014
1015 bool WebPluginContainerImpl::pluginShouldPersist() const 1015 bool WebPluginContainerImpl::pluginShouldPersist() const
1016 { 1016 {
1017 return m_webPlugin->shouldPersist(); 1017 return m_webPlugin->shouldPersist();
1018 } 1018 }
1019 1019
1020 } // namespace blink 1020 } // namespace blink
OLDNEW
« Source/web/WebDevToolsFrontendImpl.cpp ('K') | « Source/web/WebDevToolsFrontendImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698