DCHECK WebContentsObserver::Observe(web_contents()) |
|
Issue descriptionToday, if someone writes code like WebContentsObserver::Observe(web_contents()), it will compile and run without any warnings. However, the code will simply NOT work. This is because web_contents() will return nullptr, and we'll do nothing in the Observe() function [1]. This means that the observer is actually NOT observing the right WebContents. Maybe we should add a DCHECK in WebContentsObserver::Observe() to make sure we are not observing a null WebContents. [1] https://cs.chromium.org/chromium/src/content/public/browser/web_contents_observer.cc?rcl=5824890b01865469b700c4494434f4f5b8007d38&l=32 |
|
►
Sign in to add a comment |
|
Comment 1 by xhw...@chromium.org
, Oct 3 2017