diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 19:54:39 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 19:54:39 +0000 |
commit | 33641f351d451bf84d4d0a937bc9ed7e75ee3121 (patch) | |
tree | c9a4dd0f22f678ca76cf6afe6b18969b72e8f77c /chrome/renderer | |
parent | e00f24bd10ea6b08ad38c7cfb5dd56028e6f76ba (diff) | |
download | chromium_src-33641f351d451bf84d4d0a937bc9ed7e75ee3121.zip chromium_src-33641f351d451bf84d4d0a937bc9ed7e75ee3121.tar.gz chromium_src-33641f351d451bf84d4d0a937bc9ed7e75ee3121.tar.bz2 |
Fix a bug that causes NaCl tests to fail. The CWS and dev interface
restriction code doesn't work for external NaCl plugins.
BUG=100830
TEST=manual
Review URL: http://codereview.chromium.org/8344034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 30 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.h | 1 |
2 files changed, 19 insertions, 12 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index eee82c2..de72527 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -403,8 +403,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( } // Treat Native Client invocations like Javascript. - bool is_nacl_plugin = plugin.name == - ASCIIToUTF16(ChromeContentClient::kNaClPluginName); + bool is_nacl_plugin = + plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName); if (is_nacl_plugin) { content_type = CONTENT_SETTINGS_TYPE_JAVASCRIPT; plugin_setting = @@ -421,15 +421,22 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( IDR_CLICK_TO_PLAY_PLUGIN_HTML, IDS_PLUGIN_LOAD, true, true); } - if (is_nacl_plugin && - !IsNaClAllowed(plugin, - url, - actual_mime_type, - cmd->HasSwitch(switches::kEnableNaCl), - params)) { + // Determine if NaCl is allowed for both the internal plugin and + // any external plugin that handles our MIME type. This is so NaCl + // tests will still pass. + const char* kNaClMimeType = "application/x-nacl"; + bool is_nacl_mime_type = actual_mime_type == kNaClMimeType; + if (is_nacl_plugin || is_nacl_mime_type) { + if (!IsNaClAllowed(plugin, + url, + actual_mime_type, + is_nacl_mime_type, + cmd->HasSwitch(switches::kEnableNaCl), + params)) { return CreatePluginPlaceholder( render_view, frame, plugin, params, group.get(), IDR_BLOCKED_PLUGIN_HTML, IDS_PLUGIN_BLOCKED, false, false); + } } return render_view->CreatePlugin(frame, plugin, params); @@ -453,17 +460,16 @@ bool ChromeContentRendererClient::IsNaClAllowed( const webkit::WebPluginInfo& plugin, const GURL& url, const std::string& actual_mime_type, + bool is_nacl_mime_type, bool enable_nacl, WebKit::WebPluginParams& params) { - const char* kNaClPluginMimeType = "application/x-nacl"; - const char* kNaClPluginManifestAttribute = "nacl"; - GURL manifest_url; - if (actual_mime_type == kNaClPluginMimeType) { + if (is_nacl_mime_type) { manifest_url = url; // Normal embedded NaCl plugin. } else { // This is a content type handling NaCl plugin; look for the .nexe URL // among the MIME type's additonal parameters. + const char* kNaClPluginManifestAttribute = "nacl"; string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); for (size_t i = 0; i < plugin.mime_types.size(); ++i) { if (plugin.mime_types[i].mime_type == actual_mime_type) { diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index 990fb20..f70d4e1 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -132,6 +132,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient { bool IsNaClAllowed(const webkit::WebPluginInfo& plugin, const GURL& url, const std::string& actual_mime_type, + bool is_nacl_mime_type, bool enable_nacl, WebKit::WebPluginParams& params); |