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

Unified Diff: extensions/renderer/argument_spec.cc

Issue 2847853002: [Extensions Bindings] Add errors to signature parsing (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/argument_spec.cc
diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc
index 08768595b80ddb9dbb27efc8bf4eaa1b42138af0..9bdefdb4c7ef79208f0cdc36a3fc8c4c29f84c07 100644
--- a/extensions/renderer/argument_spec.cc
+++ b/extensions/renderer/argument_spec.cc
@@ -420,8 +420,16 @@ bool ArgumentSpec::ParseArgumentToObject(
// HasOwnProperty() check here in the future, if we desire.
// See also comment in ParseArgumentToArray() about passing in custom
// crazy values here.
- if (!object->Get(context, key).ToLocal(&prop_value))
+ if (!object->Get(context, key).ToLocal(&prop_value)) {
+ // Technically, in the case of the property being removed before access,
jbroman 2017/04/27 19:37:20 Hmm? Getting a nonexistent property will successfu
Devlin 2017/05/01 22:22:09 Ah, good point. Comment removed.
+ // this error message will be wrong. But since that can only happen if
+ // someone removes a property after the initial GetOwnPropertyNames()
+ // check, this seems reasonable enough - these error messages are meant
+ // to be helpful, but don't need 100% accuracy in deliberately-crazy
+ // cases.
+ *error = api_errors::ScriptThrewError();
return false;
+ }
// Note: We don't serialize undefined or null values.
// TODO(devlin): This matches current behavior, but it is correct?
« extensions/renderer/api_signature.cc ('K') | « extensions/renderer/api_signature_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698