Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 685247318fa25a58949852eac7ef2cae70be0d18
      
https://github.com/WebKit/WebKit/commit/685247318fa25a58949852eac7ef2cae70be0d18
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-03-12 (Thu, 12 Mar 2026)

  Changed paths:
    A JSTests/stress/array-prototype-copyWithin-primitive-this-toobject.js
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp

  Log Message:
  -----------
  [JSC] Array.prototype.copyWithin should return ToObject(this) when finalIndex 
< from
https://bugs.webkit.org/show_bug.cgi?id=309769

Reviewed by Yusuke Suzuki.

Per spec[1], Array.prototype.copyWithin always returns the result of
ToObject(this value). When |this| is a primitive and the early return
path (finalIndex < from) is taken, we were returning the original
primitive value instead of the wrapper object.

[1]: https://tc39.es/ecma262/#sec-array.prototype.copywithin

Test: JSTests/stress/array-prototype-copyWithin-primitive-this-toobject.js

* JSTests/stress/array-prototype-copyWithin-primitive-this-toobject.js: Added.
(shouldBe):
(throw.new.Error):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/309182@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to