Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Log.getStackTrace() doesn't work in Firefox pretending to be Android phone

    Hi,

    I am using current 12.0, but the same issues appears in showcase.
    I do not know if you consider it a bug.

    When using Firefox 105.0.1 devtools in "responsive mode" pretending to be some Samsung phone, User Agent is set to "Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Mobile Safari/537.36".
    This User Agent gives isc.Browser.isChrome === true, and in turn in Log.getStackTrace it runs code intended for V8 with Error.captureStackTrace specific for V8.

    Code:
    getStackTrace : function (args, ignoreLevels, maxLevels, skipFBugTrace, extensionTrace) {
            if (ignoreLevels == null) ignoreLevels = 0;
    
            if (isc.Log.useChromeAPIToPrepareStackTrace && isc.Browser.isChrome) {
                var e = new Error;
                var origPrepareStackTrace = Error.prepareStackTrace;
                // https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi#Customizing_stack_traces
                Error.prepareStackTrace = function (error, structuredStackTrace) {
                    // when intentionally grabbing a trace, we haven't lost any frames
                    structuredStackTrace.firstArgsIndex = 0;
                    return structuredStackTrace;
                };
                Error.captureStackTrace(e, arguments.callee);
                isc._lastErrorCallSites = e.stack;
    Could you check for 'captureStackTrace' in Error to ensure if this is really V8 instead of relying on User Agent detection?

    Best regards,
    Janusz

    #2
    in general, we strongly recommend against using these browser emulation modes, especially the Firefox ones, since Firefox isn't even based on the WebKit engine underlying all mobile browsers, but lies that it is. We don't accept bugs from these modes - bugs need to be reproduced on either real devices or true emulators.

    However this looks like a simple change that would also help if Chrome ever removes the special non-standard stack trace API, so we'll likely do it.

    Comment


      #3
      At the time of your post, this was already fixed in our mainline (SC 13.1d) branch, and a fix has now been backported to older branches back to SC 12.0p. For the older branches, the fix is in the nightly patch builds dated 2022-12-02 and beyond.

      Comment

      Working...
      X