Bug 161852 - Web Inspector: Object.shallowEqual() should return false if object prototype chains differ
Summary: Web Inspector: Object.shallowEqual() should return false if object prototype ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-09-11 16:53 PDT by Matt Baker
Modified: 2016-09-12 11:37 PDT (History)
7 users (show)

See Also:


Attachments
[Patch] Proposed Fix (7.26 KB, patch)
2016-09-12 10:58 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2016-09-11 16:53:10 PDT
A simple solution would be to just compare constructor names. This will at least catch cases like:

Object.shallowEqual([], {});

class A {};
class B extends A {};
Object.shallowEqual(new A, new B);
Comment 1 Matt Baker 2016-09-12 10:58:14 PDT
Created attachment 288585 [details]
[Patch] Proposed Fix
Comment 2 Radar WebKit Bug Importer 2016-09-12 10:58:33 PDT
<rdar://problem/28262106>
Comment 3 Joseph Pecoraro 2016-09-12 11:15:39 PDT
Comment on attachment 288585 [details]
[Patch] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=288585&action=review

r=me

> Source/WebInspectorUI/UserInterface/Base/Utilities.js:63
> +        if (a.constructor !== b.constructor)
>              return false;

We discussed an alternative checking (__proto__ / Object.getPrototypeOf). I'm fine with either because we shouldn't be modifying object instance __proto__ properties anywhere.
Comment 4 WebKit Commit Bot 2016-09-12 11:37:45 PDT
Comment on attachment 288585 [details]
[Patch] Proposed Fix

Clearing flags on attachment: 288585

Committed r205815: <http://trac.webkit.org/changeset/205815>
Comment 5 WebKit Commit Bot 2016-09-12 11:37:49 PDT
All reviewed patches have been landed.  Closing bug.