Open Bug 1737188 Opened 4 years ago Updated 1 month ago

Data URL SourceMap in Data URL JavaScript Does Not Resolve.

Categories

(DevTools :: Source Editor, defect)

Firefox 93
x86_64
macOS
defect

Tracking

(firefox-esr78 affected, firefox-esr91 affected, firefox93 affected, firefox94 affected, firefox95 affected)

Tracking Status
firefox-esr78 --- affected
firefox-esr91 --- affected
firefox93 --- affected
firefox94 --- affected
firefox95 --- affected

People

(Reporter: snake_case, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:93.0) Gecko/20100101 Firefox/93.0

Steps to reproduce:

Main Scenario:

  1. Generate a JavaScript file with an inline SourceMap.
  2. Base64 encode the JavaScript file and embed it into a HTML page using a script tag and a Data URL
  3. Print hello world with the js file, and expect to see the line where the console.log is generated.

I've also performed these additional tests with the same script:

  1. Base64 decode the data url, then paste it directly between the script tags. (Does not resolve, the error below was not emitted)
  2. Base64 decode the data url, put it in a separate file, and link it in the script tag. (It works as expected.)

Actual results:

SourceMap does not resolve, and just prints the location within the obfuscated script.

The following warning was emitted to console:

Source map error: Error: Invalid URL: .
Resource URL: [Data URL of the JS]
Source Map URL: [Data URL of the SourceMap, it decodes properly]

Expected results:

To see the real source location pre-transpilation. (eg. "Hello World! index.tsx:3")

(Chrome Version 95.0.4638.54 on my system resolves the source correctly, see attached demo file.)

OS: Unspecified → macOS
Hardware: Unspecified → x86_64
Component: Untriaged → Source Editor
Product: Firefox → DevTools

Setting this issue to NEW as I could reproduce it with the attached file. Reproduced it on macOS Big Sur 11.6 using the latest Nightly 95.0a1, Firefox 94, Firefox 93, Firefox 91.2.0 esr, and Firefox 78.15.0 esr.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: