Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8412145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:36:09+00:00 2026-06-10T00:36:09+00:00

This isn’t directly a coding question, but answers to this will help in coding

  • 0

This isn’t directly a coding question, but answers to this will help in coding a Firefox addon.

  1. Is all JS addon code executed on main thread?
  2. Assuming question to above is ‘yes’, could the addon code be executed by different JS runtimes on the main thread?
  3. Assuming answer to #2 is ‘no’, are there multiple JS ‘execution contexts’ within the same JS runtime? If ‘yes’, could the addon code be executed by different execution contexts within the same JS runtime?

I could be way off in my above questions, but I am seeing a strange behavior in my addon that is causing parts of my addon code to hang (when a modal dialog is up, am not able to receive data on socket #1), but other parts continue working (am able to read data from socket #2). I am not able to explain the behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:36:10+00:00Added an answer on June 10, 2026 at 12:36 am

    Is all JS addon code executed on main thread?

    Yes. AFAIK the only exception to this rule is code you run via web workers or ChromeWorker. There were plans to run extensions based on the Add-on SDK in a different process, I’m not sure whether this is still the goal.

    could the addon code be executed by different JS runtimes on the main thread?

    Theoretically – yes. E.g. an extension could come with a binary XPCOM component containing a different JavaScript engine. Or there is the Zaphod extension coming with a JavaScript-based JavaScript engine. But that doesn’t really matter to your code running in the regular SpiderMonkey engine.

    I am seeing a strange behavior in my addon that is causing parts of my addon code to hang (when a modal dialog is up, am not able to receive data on socket #1)

    JavaScript execution is based on event queues – the browser will take an event from the queue (could be for example a DOM event, a timeout, a network event) and process it which will run corresponding JavaScript code. No other events can be processed until this JavaScript code finishes.

    However, JavaScript code doesn’t continue to run when a modal dialog is open or a synchronous XMLHttpRequest is performed – yet events still need to be processed. This is solved by modal dialogs and XMLHttpRequest doing event processing while they are active (they spin their own event loop).

    So far the basics. Data coming in on a socket is a regular event – and it should work regardless of whether it is being processed by the main event loop or by the modal dialog’s loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't a code question for once, but it definitely has me confused. Basically,
This isn't much of a coding question as opposed to seeking help on going
This isn't the best question ever, but since search engines feel the need to
This isn't strictly a programming question, but I'm asking it here because it's certainly
This isn't the best programming question but lets face it, the server fault guys
This isn't a very simple question, but hopefully someone has run across it. I
This isn't a question on proper coding practice, I'm just working through the semantics.
Hopefully this isn't a dupe of another question, but I couldn't see it anywhere
This isn't a classic programming language question, but it's keeping me busy so I
This isn't exactly a development question, but it does affect my productivity! Recently, installing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.