mozilla / mozilla/source-map

`isBrowserEnvironment` is `false` in the browser

Open
#459 6 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.7k
Forks
370
PR merge metrics
No merged PRs in 30d

Description

running in a strict mode in the browser will lead isBrowserEnvironment is false

"use strict";

var isBrowserEnvironment = (function() {
    // eslint-disable-next-line no-undef
    return (typeof window !== "undefined") && (this === window);
}).call();

isBrowserEnvironment
// false

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the isBrowserEnvironment definition and reproduce the issue with the strict-mode browser example in the report. Check the surrounding tests or browser-focused entry points before changing the detection logic. Done means the value is true in a browser even when the code runs in strict mode, with a regression test covering that example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.