angular / zone.js

Implements Zones for JavaScript
https://github.com/angular/angular/tree/master/packages/zone.js/
MIT License
3.25k stars 408 forks source link

HTMLCanvasElement.toBlob() is no longer patched in 0.9.1 #1240

Closed zbream closed 5 years ago

zbream commented 5 years ago

I noticed the following issue in bumping one of my projects to Angular@8.0.0 and Zone.js@0.9.1.

It seems that when using HTMLCanvasElement.toBlob(), the callback function no longer runs in the original zone. This caused problems when using toBlob within an Observable stream.


Minimal reproduction

Broken in ng8 (0.9.1): https://stackblitz.com/edit/angular-toblob-8

Working in ng7 (0.8.29) https://stackblitz.com/edit/angular-toblob-7


Is this a known regression that this is no longer patched when importing zone.js/dist/zone ?

JiaLiPassion commented 5 years ago

@zbream, this is a bug, I will push the canva back the default bundle of zone.js in the next version, for now, please add the following line in src/polyfills.ts.

import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js/dist/zone-patch-canvas';
JiaLiPassion commented 5 years ago

@zbream, this is a breaking changes from 0.9.1, you can

import 'zone.js/dist/zone-patch-canvas';

to resolve this issue, sorry for the lack of documentation. I will close this one for now.