fix(zone.js): browser-legacy should not reference Zone (#32016)

PR Close #32016
This commit is contained in:
JiaLiPassion
2019-08-06 09:54:54 +09:00
committed by Kara Erickson
parent 48487cb70e
commit a91a55a6d2
4 changed files with 25 additions and 11 deletions

View File

@ -11,14 +11,19 @@
* things like redefining `createdCallback` on an element.
*/
const zoneSymbol = Zone.__symbol__;
const _defineProperty = (Object as any)[zoneSymbol('defineProperty')] = Object.defineProperty;
const _getOwnPropertyDescriptor = (Object as any)[zoneSymbol('getOwnPropertyDescriptor')] =
Object.getOwnPropertyDescriptor;
const _create = Object.create;
const unconfigurablesKey = zoneSymbol('unconfigurables');
let zoneSymbol: any;
let _defineProperty: any;
let _getOwnPropertyDescriptor: any;
let _create: any;
let unconfigurablesKey: any;
export function propertyPatch() {
zoneSymbol = Zone.__symbol__;
_defineProperty = (Object as any)[zoneSymbol('defineProperty')] = Object.defineProperty;
_getOwnPropertyDescriptor = (Object as any)[zoneSymbol('getOwnPropertyDescriptor')] =
Object.getOwnPropertyDescriptor;
_create = Object.create;
unconfigurablesKey = zoneSymbol('unconfigurables');
Object.defineProperty = function(obj: any, prop: string, desc: any) {
if (isUnconfigurable(obj, prop)) {
throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);