New issue
Advanced search Search tips

Issue 771064 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DCHECK WebContentsObserver::Observe(web_contents())

Project Member Reported by xhw...@chromium.org, Oct 3 2017

Issue description

Today, 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
 
Status: WontFix (was: Untriaged)
Hmm, from the code it seems Observe(nullptr) is allowed to remove the observer. So this is fine. I'll mark this as wontfix then.

Sign in to add a comment