Web Inspector: Object.shallowEqual() should return false if object prototype chains...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Sep 2016 18:35:40 +0000 (18:35 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Sep 2016 18:35:40 +0000 (18:35 +0000)
commite3249f5439df05cf255386dc056ad008c51136bb
tree254edd75c5a0d8f17f5c4fce411775899e3a5fa8
parentf5e4cd515b4e8a3d4bdcc8d13b8ae426001419f2
Web Inspector: Object.shallowEqual() should return false if object prototype chains differ
https://bugs.webkit.org/show_bug.cgi?id=161852

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Improve Object.shallowEqual so it won't produce false positives.

* UserInterface/Base/Utilities.js:
(value):
Object.shallowEqual should return false for non-array arguments.
Since typeof null === "object", use `instanceof` instead to avoid separate
null checks. Also use Array.shallowEqual fast path when both arguments are arrays.

LayoutTests:

* inspector/unit-tests/object-utilities-expected.txt: Added.
* inspector/unit-tests/object-utilities.html: Added.
Add test coverage for Object.shallowEqual.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/unit-tests/object-utilities-expected.txt [new file with mode: 0644]
LayoutTests/inspector/unit-tests/object-utilities.html [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Utilities.js