Instabug/Instabug-iOS

Instabug IOS SDK script variable/function's names collides with webview's URL script

ketan0809 opened this issue · 7 comments

Steps to Reproduce the Problem

  1. Open any URL in the webview.
  2. Instabug iOS SDK is inserted into the webview's window.
  3. This insertion collides with the webview's URL script.

Expected Behavior

The Instabug SDK should not collide with other script's variables or function's names.

Actual Behavior

It collides with the webview's URL script variables or function's names.

Possible solution

it is always recommended to wrap injected Instabug IOS scripts in IIFE.

Original script:
 
"use strict";
    let _e,
        _t,
        _n,
        _i,
...
 
Fixed script:
 
(function () {
  "use strict";
    let _e,
        _t,
        _n,
        _i,
...
})();

SDK Version

>= 12.7.0 sdk version.

iOS Version

Any version

Device Model

Any device

Same problem here. I assume this is “Adds support for WebViews loading in App Performance Monitoring” in 12.7.0 (release notes). Is there a way to turn this off?

Aha, there is. After Instabug.start(), do this:

    APM.webViewTrackingEnabled = false

Side note: the documentation for this property is wrong:

/**
Controls whether tracking is enabled for web views in the application.

If set to `YES`, the application will enable tracking for web views, allowing for monitoring and recording of web vitals. If set to `NO`, tracking will be disabled.

The default value is `NO`.

@discussion Use this property to dynamically enable or disable web view tracking based on application requirements.
*/
@property (class, atomic, assign) BOOL webViewTrackingEnabled;

The default value is apparently actually YES.

Hello @ketan0809 @krevis-figma
We are sorry about this, we're working on a fix for this and it will be released soon.

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed due to inactivity.

@husseinkishk May I know, is it fixed in the v13.0.0 release?

@ketan0809 Yes, this is fixed in 13.0.0