@@ -518,12 +518,14 @@ Zone.patchMutationObserverClass = function (className) {
518518Zone . patchDefineProperty = function ( ) {
519519 var _defineProperty = Object . defineProperty ;
520520 var _getOwnPropertyDescriptor = Object . getOwnPropertyDescriptor ;
521+ var _create = Object . create ;
521522
522523 Object . defineProperty = function ( obj , prop , desc ) {
523524 if ( isUnconfigurable ( obj , prop ) ) {
524525 throw new TypeError ( 'Cannot assign to read only property \'' + prop + '\' of ' + obj ) ;
525526 }
526- return rewriteDescriptor ( obj , prop , desc ) ;
527+ desc = rewriteDescriptor ( obj , prop , desc ) ;
528+ return _defineProperty ( obj , prop , desc ) ;
527529 } ;
528530
529531 Object . defineProperties = function ( obj , props ) {
@@ -533,6 +535,15 @@ Zone.patchDefineProperty = function () {
533535 return obj ;
534536 } ;
535537
538+ Object . create = function ( obj , proto ) {
539+ if ( typeof proto === 'object' ) {
540+ Object . keys ( proto ) . forEach ( function ( prop ) {
541+ proto [ prop ] = rewriteDescriptor ( obj , prop , proto [ prop ] ) ;
542+ } ) ;
543+ }
544+ return _create ( obj , proto ) ;
545+ } ;
546+
536547 Object . getOwnPropertyDescriptor = function ( obj , prop ) {
537548 var desc = _getOwnPropertyDescriptor ( obj , prop ) ;
538549 if ( isUnconfigurable ( obj , prop ) ) {
@@ -542,24 +553,23 @@ Zone.patchDefineProperty = function () {
542553 } ;
543554
544555 Zone . _redefineProperty = function ( obj , prop , desc ) {
545- return rewriteDescriptor ( obj , prop , desc ) ;
556+ desc = rewriteDescriptor ( obj , prop , desc ) ;
557+ return _defineProperty ( obj , prop , desc ) ;
546558 } ;
547559
548560 function isUnconfigurable ( obj , prop ) {
549561 return obj && obj . __unconfigurables && obj . __unconfigurables [ prop ] ;
550562 }
551563
552564 function rewriteDescriptor ( obj , prop , desc ) {
565+ desc . configurable = true ;
553566 if ( ! desc . configurable ) {
554- desc . configurable = true ;
555567 if ( ! obj . __unconfigurables ) {
556- _defineProperty ( obj , '__unconfigurables' , {
557- value : { }
558- } ) ;
568+ _defineProperty ( obj , '__unconfigurables' , { writable : true , value : { } } ) ;
559569 }
560570 obj . __unconfigurables [ prop ] = true ;
561571 }
562- return _defineProperty ( obj , prop , desc ) ;
572+ return desc ;
563573 }
564574} ;
565575
0 commit comments