ngx-image-compress icon indicating copy to clipboard operation
ngx-image-compress copied to clipboard

Slowdown on compress image with modified RegExp prototype

Open filipevserra opened this issue 1 year ago • 1 comments

Uploading a huge image to the demo site (https://image-library.app/) in the "Upload and Compress Image", it'll take a long time to finish if some extensions or libs change the prototype of RegExp. Reducing the steps to the minimum to reproduce the problem, I have:

  • Open https://image-library.app/
  • In browser console run the line: globalThis.Object["defineProperty"](globalThis.RegExp.prototype, 'mynewproperty', {});
  • Click on Upload and Compress Image and chose a huge image (7MB or more) It'll take almost 30 seconds to conclude. Without the change on RegExp prototype, it takes only 2 or 3 seconds.

Thirdy party products to protect JS code can causes this changes on RegExp.

The problem occurs only on Chrome and Edge. Firefox works fine.

filipevserra avatar Nov 29 '23 20:11 filipevserra