Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 1 user
Status: Fixed
Closed: Nov 2013
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Sign in to add a comment
Bad wording in instanceof check
Reported by, May 16 2011 Back to list
Chrome Version       : 11.0.696.65
URLs (if applicable) :

What steps will reproduce the problem?
1. Execute: [1,2,3] instanceof []
2. Error, because [] is not a function (which is logical and not the point)

What is the expected result?

It says something like:

TypeError: Expecting a function in instanceof check, but got []

What happens instead?

It says:

TypeError: Expecting a function in instanceof check, but got 1,2,3

Please provide any additional information below. Attach a screenshot if possible.

This is not really worded well, since it not looks like it is expecting a function on the left instead of [1,2,3]. I would replace V with F in V8's runtime.js:

    throw %MakeTypeError('instanceof_function_expected', [F]);

It passes the thing on the left which causes the wording to be not completely accurate.
Comment 1 by, May 17 2011
I can confirm with:

try { ("OBJECT" instanceof "CLASSNAME") } catch (e) { console.log(e.toString()) }

in the console.
Comment 2 by, Aug 11 2011
Status: ExternalDependency
This has been fixed in V8:
Project Member Comment 3 by, Mar 10 2013
Labels: -Area-Undefined
Status: Assigned
There is a webkit layout test expecting the current V8 behavior. It needs to be rebaselined:

1. skip test in webkit layout test
2. land fix in v8
3. rebaseline and unskip test
Nevermind the previous comment. Those webkit tests have since been moved to V8 repository. I'll change them locally.

Proposed fix:
Status: Fixed
Fixed in V8 r17587
Sign in to add a comment