From dc6f72e963a499c6b06e497b0da45990fd61ee90 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 25 Aug 2016 11:12:06 -0700 Subject: [PATCH] fix(closure): replace property accesses (#11078) Accessing a property on the window object must be done with square brackets. Otherwise closure compiler may collide the symbol's alias between the property and variable mappings. Also, accessing the 'provide' property must be done with dot syntax, so that it can be renamed along with the code that declares such a property. --- modules/@angular/core/src/di/reflective_provider.ts | 2 +- .../@angular/platform-browser/src/browser/testability.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/@angular/core/src/di/reflective_provider.ts b/modules/@angular/core/src/di/reflective_provider.ts index bd55c6294f..42e97163e5 100644 --- a/modules/@angular/core/src/di/reflective_provider.ts +++ b/modules/@angular/core/src/di/reflective_provider.ts @@ -185,7 +185,7 @@ function _normalizeProviders(providers: Provider[], res: Provider[]): Provider[] if (b instanceof Type) { res.push({provide: b, useClass: b}); - } else if (b && typeof b == 'object' && b.hasOwnProperty('provide')) { + } else if (b && typeof b == 'object' && (b as any).provide !== undefined) { res.push(b as NormalizedProvider); } else if (b instanceof Array) { diff --git a/modules/@angular/platform-browser/src/browser/testability.ts b/modules/@angular/platform-browser/src/browser/testability.ts index 430e1c2723..80e928f372 100644 --- a/modules/@angular/platform-browser/src/browser/testability.ts +++ b/modules/@angular/platform-browser/src/browser/testability.ts @@ -68,10 +68,10 @@ export class BrowserGetTestability implements GetTestability { }); }; - if (!global.frameworkStabilizers) { - global.frameworkStabilizers = ListWrapper.createGrowableSize(0); + if (!global['frameworkStabilizers']) { + global['frameworkStabilizers'] = ListWrapper.createGrowableSize(0); } - global.frameworkStabilizers.push(whenAllStable); + global['frameworkStabilizers'].push(whenAllStable); } findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):