[Webkit-unassigned] [Bug 183115] Web Inspector: Object.shallowCopy(obj) should always equal shallowEqual

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 27 15:36:32 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=183115

Brian Burg <bburg at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bburg at apple.com

--- Comment #1 from Brian Burg <bburg at apple.com> ---
(In reply to Nikita Vasilyev from comment #0)
> let copy = Object.shallowCopy(obj);
>     Object.shallowEqual(obj, copy); // true only if obj is a plain object,
> e.g. obj.constructor === Object
> 
> I find it's odd that a shallow copy of an object may NOT equal to the
> original object.
> 
> This can be fixed by:
> A. Using Object.setPrototypeOf for Object.shallowCopy, which is very slow
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
> Global_Objects/Object/setPrototypeOf
> B. Reverting Bug 161852: Web Inspector: Object.shallowEqual() should return
> false if object prototype chains differ
> 
> I like option B.

1. Why are you using shallowCopy on a non-plain object? This doesn't seem like something we should encourage. Most of our classes are not designed to be copied like that. If you really need a isolated copy, then write a method that creates one.

2. This doesn't seem to block any bugs or engineering work. So I'm not inclined to further argue about the hypothetical correct behavior.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180227/ab565db2/attachment.html>


More information about the webkit-unassigned mailing list