My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
for
  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
Owner:  yangguo@chromium.org
Closed:  Nov 2013
Cc:  machenb...@chromium.org


Sign in to add a comment
 
Reported by pimvande...@gmail.com, 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
#2 dub...@chromium.org
This has been fixed in V8: https://code.google.com/p/v8/issues/detail?id=1593.
Status: ExternalDependency
Mar 10, 2013
#3 bugdro...@chromium.org
(No comment was entered for this change.)
Labels: -Area-Undefined
Nov 8, 2013
#4 yangguo@chromium.org
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
Owner: yangguo@chromium.org
Cc: machenb...@chromium.org
Nov 8, 2013
#5 yangguo@chromium.org
Nevermind the previous comment. Those webkit tests have since been moved to V8 repository. I'll change them locally.

Proposed fix: https://codereview.chromium.org/66463002/
Nov 8, 2013
#6 yangguo@chromium.org
Fixed in V8 r17587
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting