Skip to content

TEST ONLY: Combined ZoneJS changes for g3 testing#36043

Closed
AndrewKushnir wants to merge 4 commits intoangular:masterfrom
AndrewKushnir:zone-changes-combined
Closed

TEST ONLY: Combined ZoneJS changes for g3 testing#36043
AndrewKushnir wants to merge 4 commits intoangular:masterfrom
AndrewKushnir:zone-changes-combined

Conversation

@AndrewKushnir
Copy link
Copy Markdown
Contributor

!!! DO NOT MERGE !!!

This PR is a combination of 4 ZoneJS PRs that are in the merge queue (in old -> new order):

The goal of this PR is to run all affected tests in g3 with all ZoneJS changes.

Monkey patch `MessagePort.prototype.onmessage` and `MessagePort.prototype.onmessageerror` to make
these properties's value(callback function) run in the zone when these value are set.
…ght promise rejection

Close angular#27840.

By default, `zone.js` wrap uncaught promise error and wrap it to a new Error object with some
additional information includes the value of the error and the stack trace.

Consider the following example:

```
Zone.current
  .fork({
    name: 'promise-error',
    onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any): boolean => {
      console.log('caught an error', error);
      delegate.handleError(target, error);
      return false;
    }
}).run(() => {
  const originalError = new Error('testError');
  Promise.reject(originalError);
});
```

The `promise-error` zone catches a wrapped `Error` object whose `rejection` property equals
to the original error, and the message will be `Uncaught (in promise): testError....`,
You can disable this wrapping behavior by defining a global configuraiton
`__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION = true;` before importing `zone.js`.
…ion API

`zone.js` added `removeAllListeners` and `eventListeners` methods in `EventTarget.prototype`, but those methods only exists when user import `zone.js` and also enables `EventTarget` monkey patching.

If user:
1. Does not import `zone.js` and uses `noop` zone when bootstrapping Angular app. OR
2. Disable monkey patching of `EventTarget` patch by defining `__Zone_disable_EventTarget = true`.

Then `removeAllListeners` and `eventListeners`  methods will not be present.
Close angular#31687, angular#31684

Zone.js patches rxjs internal `_subscribe` and `_unsubscribe` methods, but zone.js doesn't do null check, so in some operator such as `retryWhen`, the `_unsubscribe` will be set to null, and will cause
zone patched version throw error.

In this PR, if `_subscribe` and `_unsubscribe` is null, will not do the patch.
@AndrewKushnir AndrewKushnir added the area: zones Issues related to zone.js label Mar 12, 2020
@ngbot ngbot Bot added this to the needsTriage milestone Mar 12, 2020
@googlebot
Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link
Copy Markdown

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@AndrewKushnir
Copy link
Copy Markdown
Contributor Author

AndrewKushnir commented Mar 12, 2020

@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Mar 12, 2020
@AndrewKushnir
Copy link
Copy Markdown
Contributor Author

Update: global TAP run looks good, the mentioned PRs will be merged into master on Monday.

@AndrewKushnir
Copy link
Copy Markdown
Contributor Author

Combined set of ZoneJS changes were tested in g3 (using Global TAP run), the run was successful. Corresponding PRs are now merged and I'm closing this PR.

@angular-automatic-lock-bot
Copy link
Copy Markdown

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 Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: presubmit The PR is in need of a google3 presubmit area: zones Issues related to zone.js cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants