Bug 139614 - Web Inspector: Console should do a better job of determining real constructor
Summary: Web Inspector: Console should do a better job of determining real constructor
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-12-12 19:01 PST by Joseph Pecoraro
Modified: 2016-12-13 15:39 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2014-12-12 19:01:19 PST
* SUMMARY
For Objects it is very useful to know the constructor. If the prototype has been modified and loses constructor the Console may show misleading values. We should do a better job here.

* TEST
<script>
function BottomLevel() { this._bottom = Math.random(); }
function TopLevel() { BottomLevel.call(this); this._top = Math.random(); }
TopLevel.prototype = {} // Comment this out to get desired result
TopLevel.prototype.__proto__ = BottomLevel.prototype;
var x = new TopLevel;
console.log(x); // => BottomLevel, because x.constructor => BottomLevel.
</script>

* STEPS TO REPRODUCE
1. Inspect test above
  => Console labels "x" a "BottomLevel" object
  => Expected to see "TopLevel" object, since that was the constructor

* NOTES
- Settings constructor on TopLevel fixes the issue
- Chrome shows "TopLevel" with/without prototype.constructor being set.
Comment 1 Radar WebKit Bug Importer 2014-12-17 11:22:05 PST
<rdar://problem/19281496>
Comment 2 Radar WebKit Bug Importer 2014-12-17 11:25:47 PST
<rdar://problem/19281616>