MainFrameObserver is inline owned, so it shouldn't be freed by OnDestruct

MainFrameObserver is a RenderFrameObserver and as such is destroyed when
RenderFrame goes away. This happens as part of
RenderFrameObserver::OnDestruct. MainFrameObserver though is inline owned
by WebUIMojo and can be deleted before WebUIMojo is deleted. It results in
use-after-free when WebUIMojo is destructed and tries to free the already
freed MainFrameObserver.

This CL overrides OnDestruct, which allows the MainFrameObserver to stay
alive and be cleaned up by WebUIMojo.

BUG=357747

Review URL: https://codereview.chromium.org/1137533002

Cr-Commit-Position: refs/heads/master@{#328990}
2 files changed