@@ -21,6 +21,7 @@ import {
2121 GlimmerComponent ,
2222 GlimmerReference ,
2323 GlimmerValidator ,
24+ getOwner ,
2425} from './utils/ember' ;
2526import { cacheFor , guidFor } from './utils/ember/object/internals' ;
2627import { _backburner , join } from './utils/ember/runloop' ;
@@ -31,6 +32,8 @@ let tagValue, tagValidate, track, tagForProperty;
3132
3233const GlimmerDebugComponent = ( ( ) => GlimmerComponent ?. default ) ( ) ;
3334
35+ const OWNER_SYMBOL = '__owner__' ; // can't use actual symbol because it can't be cloned
36+
3437// Try to use the most recent library (GlimmerValidator), else
3538// fallback on the previous implementation (GlimmerReference).
3639if ( GlimmerValidator ) {
@@ -491,6 +494,8 @@ export default class extends DebugPort {
491494
492495 if ( prop === null || prop === undefined ) {
493496 value = this . sentObjects [ objectId ] ;
497+ } else if ( prop === OWNER_SYMBOL ) {
498+ value = getOwner ( this . sentObjects [ objectId ] ) ;
494499 } else {
495500 value = calculateCP ( object , { name : prop } , { } ) ;
496501 }
@@ -615,6 +620,7 @@ export default class extends DebugPort {
615620 * - Bar
616621 * - Foo
617622 * - EmberObject
623+ * - Owner (Container)
618624 * ```
619625 *
620626 * The "mixins" returned by this function directly represent these things too.
@@ -734,6 +740,27 @@ export default class extends DebugPort {
734740 tracked ,
735741 ) ;
736742
743+ const owner = getOwner ( object ) ;
744+ const ownerId = guidFor ( owner ) ;
745+
746+ if ( owner && ! mixinDetails . find ( ( mixin ) => mixin . id === ownerId ) ) {
747+ mixinDetails . push ( {
748+ name : 'Container' ,
749+ id : ownerId ,
750+ expand : false ,
751+ properties : [
752+ {
753+ name : OWNER_SYMBOL ,
754+ value : {
755+ inspect : `<Owner:${ ownerId } >` ,
756+ type : 'type-owner' ,
757+ objectId : ownerId ,
758+ } ,
759+ } ,
760+ ] ,
761+ } ) ;
762+ }
763+
737764 this . currentObject = { object, mixinDetails, objectId } ;
738765
739766 let errors = errorsToSend ( errorsForObject ) ;
@@ -1284,6 +1311,7 @@ function calculateCP(object, item, errorsForObject) {
12841311 if ( object instanceof ArrayProxy && property == parseInt ( property ) ) {
12851312 return object . at ( property ) ;
12861313 }
1314+
12871315 return item . isGetter || property . includes ?. ( '.' )
12881316 ? object [ property ]
12891317 : object . get ?. ( property ) || object [ property ] ; // need to use `get` to be able to detect tracked props
0 commit comments