File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -7600,6 +7600,16 @@ using namespace Js;
7600
7600
RecyclableObject* constructor = VarTo<RecyclableObject>(aClass);
7601
7601
if (scriptContext->GetConfig()->IsES6HasInstanceEnabled())
7602
7602
{
7603
+ if (VarIs<JavascriptFunction>(constructor))
7604
+ {
7605
+ JavascriptFunction* func = VarTo<JavascriptFunction>(constructor);
7606
+ if (func->IsBoundFunction())
7607
+ {
7608
+ BoundFunction* boundFunc = (BoundFunction*)func;
7609
+ constructor = boundFunc->GetTargetFunction();
7610
+ }
7611
+ }
7612
+
7603
7613
Var instOfHandler = JavascriptOperators::GetPropertyNoCache(constructor,
7604
7614
PropertyIds::_symbolHasInstance, scriptContext);
7605
7615
if (JavascriptOperators::IsUndefinedObject(instOfHandler)
Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ enum tagDEBUG_EVENT_INFO_TYPE
429
429
430
430
#include " Library/JavascriptNumber.h"
431
431
#include " Library/JavascriptFunction.h"
432
+ #include " Library/BoundFunction.h"
432
433
#include " Library/RuntimeFunction.h"
433
434
#include " Library/JavascriptExternalFunction.h"
434
435
#include " Library/CustomExternalIterator.h"
Original file line number Diff line number Diff line change
1
+ //-------------------------------------------------------------------------------------------------------
2
+ // Copyright (C) Microsoft. All rights reserved.
3
+ // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4
+ //-------------------------------------------------------------------------------------------------------
5
+
6
+ WScript . LoadScriptFile ( "..\\UnitTestFramework\\UnitTestFramework.js" ) ;
7
+
8
+ var tests = [
9
+ {
10
+ name : "#5883 - instanceof on a bound function fails to call [Symbol.hasInstance] accessor" ,
11
+ body : function ( ) {
12
+ let called = false ;
13
+ class A {
14
+ static [ Symbol . hasInstance ] ( ) {
15
+ called = true ;
16
+ }
17
+ }
18
+ const B = A . bind ( ) ;
19
+
20
+ ( { } instanceof B ) ;
21
+ assert . isTrue ( called ) ;
22
+ }
23
+ } ,
24
+ ] ;
25
+
26
+ testRunner . runTests ( tests , { verbose : WScript . Arguments [ 0 ] != "summary" } ) ;
Original file line number Diff line number Diff line change 576
576
<compile-flags >-force:deferparse</compile-flags >
577
577
</default >
578
578
</test >
579
+ <test >
580
+ <default >
581
+ <files >bug_5883.js</files >
582
+ <compile-flags >-args summary -endargs</compile-flags >
583
+ </default >
584
+ </test >
579
585
</regress-exe >
You can’t perform that action at this time.
0 commit comments