My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 82797: Bad wording in instanceof check
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Closed:  Nov 2013

Sign in to add a comment
Reported by, May 16, 2011
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.
May 17, 2011
#1 megazzt
I can confirm with:

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

in the console.
Aug 11, 2011
This has been fixed in V8:
Status: ExternalDependency
Mar 10, 2013
(No comment was entered for this change.)
Labels: -Area-Undefined
Nov 8, 2013
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
Status: Assigned
Nov 8, 2013
Nevermind the previous comment. Those webkit tests have since been moved to V8 repository. I'll change them locally.

Proposed fix:
Nov 8, 2013
Fixed in V8 r17587
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting