Skip to content

Commit

Permalink
<webview> Dialog API should get cancelled by default in stable shim c…
Browse files Browse the repository at this point in the history
…ode.

When web_view_experimental.js is not present (CHANNEL_STABLE/CHANNEL_BETA), guest
dispatches 'dialog' event but never hears back from it, hanging the guest.
This CL ensures that we do not dispatch the event in
non-experimental case and deny the request immediately.

BUG=304238
Test=An app with a <webview>, the <webview> triggers a window.confirm()
  dialog. Now if experimental shim (web_view_experimental.js) is disabled
  (which is the case for stable channel), the guest would hang without
  this change. With this change, the effect is that the dialog is
  cancelled.
Tested with manually disabling experimental code from
chrome/renderer/extensions/dispatcher.cc:~1120.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227098 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
lazyboy@chromium.org committed Oct 4, 2013
1 parent 84bbc6f commit 4b98675
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chrome/browser/guestview/webview/webview_guest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ bool WebViewGuest::RequestPermission(
break;
}
case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: {
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
if (channel > chrome::VersionInfo::CHANNEL_DEV) {
// 'dialog' API is not available in stable/beta.
callback.Run(false, std::string());
return true;
}
DispatchEvent(new GuestView::Event(webview::kEventDialog,
args.Pass()));
break;
Expand Down

0 comments on commit 4b98675

Please sign in to comment.