[Extension Bindings] Don't allow arrays or functions as object params
In JavaScript (and v8), functions and arrays are both considered objects. However, for the sake of argument matching in extension APIs, we shouldn't consider them as such. This is to help in our ambiguous argument matching, where we allow optional inner parameters. For instance, given an API function that takes an int, an optional object with no required properties, and an optional callback, the system wouldn't necessarily be able to tell that, given a call of foo(1, function() {}), it was passed the callback rather than the object. This is exactly the scenario that arises with tabs.sendMessage. While we could potentially make our matching more intelligent to account for this case, it doesn't seem worth the extra complexity (and speed cost). Instead, simply don't allow functions or arrays as object parameters. Add tests for the same. BUG=653596 Review-Url: https://codereview.chromium.org/2621883002 Cr-Commit-Position: refs/heads/master@{#442671}
Showing
This diff is collapsed.
Please register or sign in to comment