angular-cn/packages/core/test
crisbeto ab3f4c9fe1 fix(core): infinite loop if injectable using inheritance has a custom decorator (#37022)
If we detect that an injectable class is inheriting from another injectable, we generate code that looks something like this:

```
const baseFactory = ɵɵgetInheritedFactory(Child);

@Injectable()
class Parent {}

@Injectable()
class Child extends Parent {
  static ɵfac = (t) => baseFactory(t || Child)
}
```

This usually works fine, because the `ɵɵgetInheritedFactory` resolves to the factory of `Parent`, but the logic can break down if the `Child` class has a custom decorator. Custom decorators can return a new class that extends the original once, which means that the `ɵɵgetInheritedFactory` call will now resolve to the factory of the `Child`, causing an infinite loop.

These changes fix the issue by changing the inherited factory resolution logic so that it walks up the prototype chain class-by-class, while skipping classes that have the same factory as the class that was passed in.

Fixes #35733.

PR Close #37022
2020-06-03 13:16:25 -07:00
..
acceptance docs(core): remove v10 mention from @Injectable warning (#37383) 2020-06-02 17:30:58 -04:00
animation build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bundling refactor(core): remove `looseIdentical` in favor of built-in `Object.is` (#37191) 2020-06-01 17:19:17 -04:00
change_detection refactor(core): remove `looseIdentical` in favor of built-in `Object.is` (#37191) 2020-06-01 17:19:17 -04:00
debug build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
di build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
dom build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
i18n build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
linker build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflection build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
render3 fix(core): infinite loop if injectable using inheritance has a custom decorator (#37022) 2020-06-03 13:16:25 -07:00
sanitization build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
strict_types build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testability build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
util build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
zone build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel test(core): re-enable IE 10/11 test on SauceLabs (#35962) 2020-03-24 10:14:47 -07:00
application_init_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
application_module_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
application_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
application_ref_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_fixture_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
dev_mode_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_lifecycle_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
error_handler_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
event_emitter_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
fake_async_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
forward_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
spies.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test_bed_async_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test_bed_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing_internal_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00