Source map is ignored when debugging popup script
Categories
(DevTools :: Debugger, defect)
Tracking
(Not tracked)
People
(Reporter: kirill.rakhman, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: needs-review)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171115114231 Steps to reproduce: I'm trying to port the extension tutorial from https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_second_WebExtension to Kotlin JS. You can try out the extension using https://github.com/cypressious/second-firefox-extension-kotlin/. The Kotlin code is compiled to Javascript and it contains a comment at the end of the file pointing to the sourcemap in the same directory, e.g. //# sourceMappingURL=popup.js.map Actual results: When debugging the popup script using about:debugging (according to https://developer.mozilla.org/de/Add-ons/WebExtensions/Debugging#Debugging_popups), the source map seems to be ignored and the generated JS code is displayed instead. When debugging a content script, the source map is however taken into account and displayed correctly. Expected results: I expected to see the Kotlin code (using the source map) for the popup script in the addon debugger.
Updated•7 years ago
|
Updated•7 years ago
|
Updated•6 years ago
|
Comment 1•5 years ago
|
||
Hmm, i'm curious what you think Julian. I'm not too familiar with remote debugging.
Comment 2•5 years ago
|
||
(In reply to Jason Laster [:jlast] from comment #1)
Hmm, i'm curious what you think Julian. I'm not too familiar with remote debugging.
I think it is not remote debugging, but rather local addon debugging. But I can help you with the STRs :)
1/ Build the extension
- run
git clone https://github.com/cypressious/second-firefox-extension-kotlin/
cd second-firefox-extension-kotlin
./gradlew runDceKotlinJs
2/ Load the extension
- start Firefox
- open about:debugging
- select "This Firefox" (or This Nightly)
- click on "Load Temporary Add-on..."
- open
second-firefox-extension-kotlin/manifest.json
3/ Enable "Disable popup auto hide"
- open the Browser Toolbox
- turn on "Disable popup auto hide" in the Browser Toolbox hamburger menu
- (you can close the Browser Toolbox now)
4/ Trigger the extension's popup
- open any website with images (eg https://www.mozilla.org/en-US/)
- click on the Beastify extension icon in the toolbar
- this should show the extension's popup with 4 items "Frog, Turtle, Snake, Reset"
- (and thanks to step 3 the popup should still be displayed)
5/ Debug the extension
- go back to about:debugging#/runtime/this-firefox
- in the Temporary Extensions category, click on Inspect next to Beastify
- open the debugger
- check if sourcemapped sources are working
Note that it seems to work a bit better than what the initial report mentioned. I can see *.kt files in the source tree. Some can be opened (eg moz-extension://8d66093c-c373-954f-91d5-1fcdde232a5a/popup/src/main/kotlin/popup.kt) some can't (moz-extension://8d66093c-c373-954f-91d5-1fcdde232a5a/src/main/kotlin/extensionTypes/extensionTypes.kt). When they fail to open, the logged error is:
Error while fetching an original source: TypeError: NetworkError when attempting to fetch resource.
Source URL: moz-extension://8d66093c-c373-954f-91d5-1fcdde232a5a/src/main/kotlin/extensionTypes/extensionTypes.kt
But looking at my sources locally I can't find any extensionTypes.kt file, so maybe the sourcemap is faulty?
Comment 3•5 years ago
|
||
I just tested the extension recently and sourcemaps seem to work for me. I know this is a very old bug and sorry for not having a look earlier, but could you have a look and confirm? Thanks!
Comment 4•5 years ago
|
||
Happy to re-open if you see an issue.
Reporter | ||
Updated•3 months ago
|
Description
•