Skip to content

Commit

Permalink
fix(closure): replace property accesses (angular#11078)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexeagle authored and vicb committed Aug 25, 2016
1 parent 2b313e4 commit dc6f72e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/@angular/core/src/di/reflective_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions modules/@angular/platform-browser/src/browser/testability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit dc6f72e

Please sign in to comment.