Skip to content

Firefox throws a TypeError if user code tries to walk up the call stack of a wrapped function #979

@mhenr18

Description

@mhenr18

Do you want to request a feature or report a bug?

A bug.

What is the current behavior?

I'm using Firefox 51 (UA: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0) and working on adding Sentry into the JavaScript code for an old ASP.NET WebForms codebase, with Raven version 3.15.0 from https://cdn.ravenjs.com/3.15.0/raven.min.js.

Under certain circumstances when simulating an event on a button, some WebForms JS code (which we can't easily change - it's baked into the framework in the Sys$WebForms$PageRequestManager$_doPostBack function) tries to walk up the call stack using arguments.callee/caller.

If that call stack involves a function wrapped by Raven (which as far as I can tell involves many event handlers due to Raven wrapping addEventListener), Firefox throws a TypeError: access to strict mode caller function is censored because Raven itself has a 'use strict'; statement.

(Note that no other code is running in strict mode, and disabling Raven stops the issue from happening)

You can see this happening in Firefox here: https://jsfiddle.net/yuuoq9qq/

What is the expected behavior?

The exception shouldn't be thrown.

This is perhaps Firefox doing something overly zealous (as no other browsers have this issue). However, I wouldn't expect Raven itself to run in strict mode, as user code may not be running in strict mode and may try to do things that are totally fine in sloppy mode but are banned in strict mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions