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

Issue 9584021: Improve implementation of isInstanceOf in JSONSchemaValidator. (Closed)

Created:
8 years, 9 months ago by Aaron Boodman
Modified:
8 years, 9 months ago
CC:
chromium-reviews, Aaron Boodman, darin-cc_chromium.org, mihaip+watch_chromium.org, brettw-cc_chromium.org, Matt Perry
Visibility:
Public.

Description

Improve implementation of isInstanceOf in JSONSchemaValidator. This does not update the docs because they have gotten badly out of date. I will update them separately. BUG=116490 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=124835

Patch Set 1 #

Total comments: 2

Patch Set 2 : Remove a test that cannot work anymore, update docs #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -59 lines) Patch
M chrome/common/extensions/api/extension.json View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/common/extensions/docs/extension.html View 1 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/renderer/resources/extensions/json_schema.js View 1 chunk +3 lines, -20 lines 2 comments Download
M chrome/test/data/extensions/json_schema_test.js View 1 2 chunks +0 lines, -32 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Aaron Boodman
8 years, 9 months ago (2012-03-02 19:46:08 UTC) #1
Aaron Boodman
+mpcomplete fyi
8 years, 9 months ago (2012-03-02 19:46:27 UTC) #2
arv (Not doing code reviews)
https://chromiumcodereview.appspot.com/9584021/diff/1/chrome/renderer/resources/extensions/json_schema.js File chrome/renderer/resources/extensions/json_schema.js (right): https://chromiumcodereview.appspot.com/9584021/diff/1/chrome/renderer/resources/extensions/json_schema.js#newcode283 chrome/renderer/resources/extensions/json_schema.js:283: if (Object.prototype.toString.call(instance) != It seems a bit cleaner to ...
8 years, 9 months ago (2012-03-02 19:58:28 UTC) #3
Aaron Boodman
Also removed a test that no longer can be implemented. I'm looking into an alternate ...
8 years, 9 months ago (2012-03-02 22:54:26 UTC) #4
arv (Not doing code reviews)
lgtm
8 years, 9 months ago (2012-03-02 23:07:35 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/aa@chromium.org/9584021/3003
8 years, 9 months ago (2012-03-03 00:50:32 UTC) #6
commit-bot: I haz the power
Change committed as 124835
8 years, 9 months ago (2012-03-03 08:30:00 UTC) #7
arv (Not doing code reviews)
Sorry for adding more feedback to this. I thought a bit more about this over ...
8 years, 9 months ago (2012-03-05 19:13:07 UTC) #8
Aaron Boodman
8 years, 9 months ago (2012-03-05 21:06:07 UTC) #9
http://codereview.chromium.org/9584021/diff/3003/chrome/renderer/resources/ex...
File chrome/renderer/resources/extensions/json_schema.js (right):

http://codereview.chromium.org/9584021/diff/3003/chrome/renderer/resources/ex...
chrome/renderer/resources/extensions/json_schema.js:283: if
(Object.prototype.toString.call(instance) !=
On 2012/03/05 19:13:07, arv wrote:
> Maybe we should have walked the prototype chain so that we could have used
> Window in the API. Using "global" seems ugly.
> 
> function isInstanceOfClass(object , className) {
>   if (!object)
>     return false;
>   if (Object.prototype.toString.call(instance) === "[object " + className +
"]")
>     return true;
>   return isInstanceOfClass(Object.getPrototypeOf(object), className);
> }

I agree the recursive search is cooler, but in this case, I actually think that
documenting the return type is "global" is more correct than "Window".

I'll send a review for the recursive search, but will leave the docs the same.

Powered by Google App Engine
This is Rietveld 408576698