Index: chrome/renderer/resources/extensions/content_setting.js |
diff --git a/chrome/renderer/resources/extensions/content_setting.js b/chrome/renderer/resources/extensions/content_setting.js |
index 81f28b3f14571cdf5cb1e57273885c03ce885579..745008ce6d64e8e5bb2cd69db7598c4a32fedaf0 100644 |
--- a/chrome/renderer/resources/extensions/content_setting.js |
+++ b/chrome/renderer/resources/extensions/content_setting.js |
@@ -47,6 +47,15 @@ function ContentSetting(contentType, settingSchema, schema) { |
}; |
this.set = function(details, callback) { |
+ // We check if the setting is deprecated first, since the validation will |
+ // fail for deprecated types. |
+ if ($Object.hasOwnProperty(DEPRECATED_CONTENT_TYPES, contentType)) { |
+ console.warn('contentSettings.' + contentType + ' is deprecated; setting ' |
+ + 'it has no effect.'); |
+ $Function.apply(callback, undefined, []); |
+ return; |
+ } |
+ |
// The set schema included in the Schema object is generic, since it varies |
// per-setting. However, this is only ever for a single setting, so we can |
// enforce the types more thoroughly. |
@@ -61,14 +70,7 @@ function ContentSetting(contentType, settingSchema, schema) { |
}; |
var modSetSchema = $Array.slice(rawSetSchema); |
modSetSchema[0] = modSettingParam; |
- validate([details, callback], rawSetSchema); |
Devlin
2017/05/26 01:36:01
This was validating only against the raw schema, w
|
- |
- if ($Object.hasOwnProperty(DEPRECATED_CONTENT_TYPES, contentType)) { |
- console.warn('contentSettings.' + contentType + ' is deprecated; setting ' |
- + 'it has no effect.'); |
- $Function.apply(callback, undefined, []); |
- return; |
- } |
+ validate([details, callback], modSetSchema); |
return sendRequest('contentSettings.set', |
[contentType, details, callback], |