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

Issue 3404024: Add NULL-checks to plugin delegate message handlers (Closed)

Created:
10 years, 2 months ago by stuartmorgan
Modified:
9 years, 7 months ago
Reviewers:
brettw
CC:
chromium-reviews, jam, darin-cc_chromium.org, stuartmorgan+watch_chromium.org
Visibility:
Public.

Description

Add NULL-checks to plugin delegate message handlers The handlers for messages that originate from render_view, rather than being results of actions started by the plugin itself, can't assume that plugin initialization succeeded. BUG=57085 TEST=Plugins that don't load shouldn't crash. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60712

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -7 lines) Patch
M chrome/plugin/webplugin_delegate_stub.cc View 1 chunk +13 lines, -7 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
stuartmorgan
10 years, 2 months ago (2010-09-27 21:45:35 UTC) #1
brettw
10 years, 2 months ago (2010-09-27 21:47:17 UTC) #2
LGTM

On Mon, Sep 27, 2010 at 2:45 PM,  <stuartmorgan@chromium.org> wrote:
> Reviewers: brettw,
>
> Description:
> Add NULL-checks to plugin delegate message handlers
>
> The handlers for messages that originate from render_view, rather than being
> results of actions started by the plugin itself, can't assume that plugin
> initialization succeeded.
>
> BUG=57085
> TEST=Plugins that don't load shouldn't crash.
>
> Please review this at http://codereview.chromium.org/3404024/show
>
> Affected files:
>  M chrome/plugin/webplugin_delegate_stub.cc
>
>
> Index: chrome/plugin/webplugin_delegate_stub.cc
> diff --git a/chrome/plugin/webplugin_delegate_stub.cc
> b/chrome/plugin/webplugin_delegate_stub.cc
> index
>
8e74aa7df290a6a4e4cb82cf67ed748a6d12837e..17f02222b28887e3e0f17ab1d65f5d94244334ba
> 100644
> --- a/chrome/plugin/webplugin_delegate_stub.cc
> +++ b/chrome/plugin/webplugin_delegate_stub.cc
> @@ -337,29 +337,35 @@ void
> WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url,
>  }
>
>  void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) {
> -  delegate_->SetContentAreaHasFocus(has_focus);
> +  if (delegate_)
> +    delegate_->SetContentAreaHasFocus(has_focus);
>  }
>
>  #if defined(OS_MACOSX)
>  void WebPluginDelegateStub::OnSetWindowFocus(bool has_focus) {
> -  delegate_->SetWindowHasFocus(has_focus);
> +  if (delegate_)
> +    delegate_->SetWindowHasFocus(has_focus);
>  }
>
>  void WebPluginDelegateStub::OnContainerHidden() {
> -  delegate_->SetContainerVisibility(false);
> +  if (delegate_)
> +    delegate_->SetContainerVisibility(false);
>  }
>
>  void WebPluginDelegateStub::OnContainerShown(gfx::Rect window_frame,
>                                              gfx::Rect view_frame,
>                                              bool has_focus) {
> -  delegate_->WindowFrameChanged(window_frame, view_frame);
> -  delegate_->SetContainerVisibility(true);
> -  delegate_->SetWindowHasFocus(has_focus);
> +  if (delegate_) {
> +    delegate_->WindowFrameChanged(window_frame, view_frame);
> +    delegate_->SetContainerVisibility(true);
> +    delegate_->SetWindowHasFocus(has_focus);
> +  }
>  }
>
>  void WebPluginDelegateStub::OnWindowFrameChanged(const gfx::Rect&
> window_frame,
>                                                  const gfx::Rect&
> view_frame) {
> -  delegate_->WindowFrameChanged(window_frame, view_frame);
> +  if (delegate_)
> +    delegate_->WindowFrameChanged(window_frame, view_frame);
>  }
>  #endif  // OS_MACOSX
>
>
>
>

Powered by Google App Engine
This is Rietveld 408576698