Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Non-eval'ing method #6

Closed
Closed

Description

@tmcw

The usage of the Function constructor in this module means that mapbox-gl-js upstream cannot satisfy the Content Security Policy unsafe-eval rule. For CSP-implementing sites, a non-eval'ing method would better.

Activity

  1. jfirebaugh commented on Aug 12, 2015

    @jfirebaugh
    Contributor

    It would be possible to feature detect this and fall back to an interpreted implementation:

    // Are we running under a CSP that forbids unsafe-eval?
    try {
      new Function('');
      module.exports = require('./compiled'); // No; use fast eval'ing implementation
    } catch (e) {
      module.exports = require('./interpreted); // Yes; use slower interpreted implementation
    }
    

    But it would be preferable not to introduce a performance variable and use a sufficiently well performing, eval-free implementation everywhere.

  2. jfirebaugh commented on Aug 12, 2015

    @jfirebaugh
    Contributor

    Feature detecting probably spams CSP violation reports though, huh?

  3. added 3 commits that reference this issue on Jan 29, 2016
    9ba624b
    55aecbb
    b4bc18d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions