bugsnag / bugsnag-js

JavaScript error handling tool for BugSnag. Monitor and report JavaScript bugs & errors.
https://docs.bugsnag.com/platforms/javascript
MIT License
852 stars 251 forks source link

Bugsnag causing events to be duplicated in iOS UIWebView #992

Open dpolivy opened 4 years ago

dpolivy commented 4 years ago

We have a Cordova-based mobile app using UIWebView on iOS. We use the bugsnag-js library to monitor for errors in this app, and I've recently upgraded to the v7 module. Since then, I've been noticing some odd app behaviors regarding events -- both events not being fired correctly, and also being duplicated in certain circumstances. The net result is that our app isn't working properly.

I've found that if I comment out loading the Bugsnag JS, then the issues go away. Beyond that, I'm not certain what's triggering this behavior, or how to dig more deeply to figure out why this is happening. For two specific examples of troubles:

  1. We have a <input type="file"> to allow image uploads. After selecting an image, I'm finding that the change event is not consistently fired when Bugsnag is loaded. When Bugsnag is not loaded, it fires 100% of the time.
  2. We have a jQuery Mobile multi select element on screen. Tapping on an item to select it is triggering duplicate click events to be fired, causing it to be selected and unselected immediately. When Bugsnag is not loaded, only a single click event is fired per tap and everything works perfectly.

In the debugger, I can see that the events are all coming via inline-script-content.js, so I tried to adjust the configuration to disable this module with the following:

Bugsnag.start({ trackInlineScripts: false })

With the above config, the events are working properly. So, clearly, there seems to be some type of issue with this module and UIWebView on iOS. Any suggestions on how to further debug and fix this issue? We are using jQuery and jQuery Mobile in the app to wire up the event handlers.

johnkiely1 commented 4 years ago

Hi @dpolivy

We don't officially support the use of Cordova yet, it is something that is on our roadmap but have no timeline for this yet. Thanks for reporting this so we will be sure to look into when we come to adding support for Cordova. For now I would suggest sticking with the workaround as you have found.