Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index 7e0d304a0ace749f9382e3fa59cdf060e416894e..925e2d506e9a3d579136c6609d42c93084bedde8 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -1808,18 +1808,30 @@ bool ChromeContentBrowserClient::AllowServiceWorker( |
#endif |
ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
- bool allow = io_data->GetCookieSettings()->IsSettingCookieAllowed( |
- scope, first_party_url); |
+ // Check if javascripts are allowed |
falken
2016/10/05 01:16:50
nit: Add a period to the end of the sentence. Also
shimazu
2016/10/05 02:10:57
Done.
|
+ content_settings::SettingInfo info; |
+ std::unique_ptr<base::Value> value = |
+ io_data->GetHostContentSettingsMap()->GetWebsiteSetting( |
+ first_party_url, first_party_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
+ std::string(), &info); |
+ ContentSetting setting = content_settings::ValueToContentSetting(value.get()); |
+ bool allow_javascript = (setting == CONTENT_SETTING_ALLOW); |
+ |
+ // Check if cookies are allowed |
falken
2016/10/05 01:16:49
nit: period at end of the sentence.
shimazu
2016/10/05 02:10:57
Done.
|
+ bool allow_serviceworker = |
+ io_data->GetCookieSettings()->IsSettingCookieAllowed(scope, |
+ first_party_url); |
// Record access to database for potential display in UI. |
// Only post the task if this is for a specific frame. |
if (render_process_id != -1 && render_frame_id != -1) { |
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
base::Bind(&TabSpecificContentSettings::ServiceWorkerAccessed, |
- render_process_id, render_frame_id, scope, !allow)); |
+ render_process_id, render_frame_id, scope, |
+ !allow_javascript, !allow_serviceworker)); |
} |
- return allow; |
+ return allow_javascript && allow_serviceworker; |
} |
bool ChromeContentBrowserClient::AllowGetCookie( |