Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade): fix registerForNg1Tests #13522

Merged

Conversation

jpvanhal
Copy link
Contributor

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

When trying the example in for UpgradeAdapter#registerForNg1Tests, it crashes with the following exception:

Unhandled Promise rejection: Cannot read property 'get' of null ; Zone: ProxyZone ; Task: Promise.then ; Value: TypeError: Cannot read property 'get' of null
    at UpgradeAdapterRef._bootstrapDone (base/dist/all/@angular/upgrade/src/upgrade_adapter.js:697)
    at base/dist/all/@angular/upgrade/src/upgrade_adapter.js:315
    at ZoneDelegate.invoke (zone.js:229)
    at ProxyZoneSpec.onInvoke (proxy.js:79)
    at ZoneDelegate.invoke (zone.js:228)
    at Zone.run (zone.js:113)
    at zone.js:509
    at ZoneDelegate.invokeTask (zone.js:262)
    at ProxyZoneSpec.onInvokeTask (proxy.js:103)
    at ZoneDelegate.invokeTask (zone.js:261)
    at Zone.runTask (zone.js:151)
    at drainMicroTaskQueue (zone.js:405)
    at XMLHttpRequest.ZoneTask.invoke (zone.js:336) TypeError: Cannot read property 'get' of null
    at UpgradeAdapterRef._bootstrapDone (http://localhost:9878/base/dist/all/@angular/upgrade/src/upgrade_adapter.js:697:40)
    at http://localhost:9878/base/dist/all/@angular/upgrade/src/upgrade_adapter.js:315:70
    at ZoneDelegate.invoke (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:229:26)
    at ProxyZoneSpec.onInvoke (http://localhost:9878/base/node_modules/zone.js/dist/proxy.js:79:39)
    at ZoneDelegate.invoke (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:228:32)
    at Zone.run (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:113:43)
    at http://localhost:9878/base/node_modules/zone.js/dist/zone.js:509:57
    at ZoneDelegate.invokeTask (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:262:35)
    at ProxyZoneSpec.onInvokeTask (http://localhost:9878/base/node_modules/zone.js/dist/proxy.js:103:39)
    at ZoneDelegate.invokeTask (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:261:40)
    at Zone.runTask (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:151:47)
    at drainMicroTaskQueue (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:405:35)
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:9878/base/node_modules/zone.js/dist/zone.js:336:25)

This is because upgrade.ng1Injector passed to _bootstrapDone in registerForNg1Tests is null.

What is the new behavior?

UpgradeAdapter#registerForNg1Tests doesn't throw the above exception anymore.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

Fix an issue in registerForNg1Tests, where it passes a null as
ng1Injector to _bootstrapDone. This causes a "TypeError: Cannot
read property 'get' of null" to be thrown from _bootstrapDone.

Fix an issue in `registerForNg1Tests`, where it passes a `null` as
`ng1Injector` to `_bootstrapDone`. This causes a "TypeError: Cannot
read property 'get' of null" to be thrown from `_bootstrapDone`.
@jpvanhal jpvanhal force-pushed the fix-error-in-register-for-ng1-tests branch from 249e6b4 to e44b98a Compare December 16, 2016 16:15
@petebacondarwin
Copy link
Member

Good stuff @jpvanhal - thanks for this fix.

@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker pr_state: LGTM labels Dec 16, 2016
@chuckjaz chuckjaz merged commit c6e8939 into angular:master Dec 16, 2016
@jpvanhal jpvanhal deleted the fix-error-in-register-for-ng1-tests branch December 17, 2016 01:06
chuckjaz pushed a commit that referenced this pull request Dec 20, 2016
Fix an issue in `registerForNg1Tests`, where it passes a `null` as
`ng1Injector` to `_bootstrapDone`. This causes a "TypeError: Cannot
read property 'get' of null" to be thrown from `_bootstrapDone`.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants