0

I am writing a web extension for Mozilla Firefox and would like to execute a javascript in my popup.

This is my code

manifest.json

{
  "manifest_version": 2,
  "name": "Test",
  "version": "0.0.1",
  "description": "Test",
  "icons": {
    "48": "icon.svg"
  },
  "browser_action" : {
    "default_popup": "popup.html"
  }
}

popup.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test</title>
  </head>
  <body>
    this message is correctly shown in my popup
    <script src="popup.js"></script>
  </body>
</html>

popup.js

console.log('this line is never executed');

I open the browser console (CTRL+SHIFT+J) which should theoretically log my web extension console output, but I get nothing.

Edit: I'm using Mozilla Firefox Developer Edition 72.0b3 (64-bit) on Arch Linux
Edit: I also tried launching my extension using web-ext (which launches a browser instance with a new profile) with the same result

leonixyz
  • 1,130
  • 15
  • 28
  • I think the console output will be logged in console of extension itself instead of console of webpage. Just open the extension popup and within that popup go into dev tools, you'll see this `console.log` message there. – Akash Shrivastava Dec 10 '19 at 17:26
  • 1
    You are right that the browser console does not log the extension code. But the way you suggest is wrong. The correct way to debug the extension, instead, is to open about:debugging and then "inspect" the extension. – leonixyz Dec 10 '19 at 17:52
  • ok, glad I could help, yeah you're right, I might've suggested you the chrome way, my bad. – Akash Shrivastava Dec 10 '19 at 17:53

0 Answers0