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 7906839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:09:15+00:00 2026-06-03T11:09:15+00:00

I am writing a Firefox extension, which is doing two things (for the context

  • 0

I am writing a Firefox extension, which is doing two things (for the context of this question):

  1. Registering for certain DOM events, viz DOMContentLoaded and DOMFrameContentLoaded.
  2. In the call back for the events, access the DOM APIs and do certain operations.

The extension gets the first event (either DOMContentLoaded or DOMFrameContentLoaded), and the callback function invokes some DOM APIs. I am observing, before the call returning back to my extension from the DOM API call, another event firing and my call back function getting invoked (I haven’t been able to narrow down which specific DOM API, as my extension invokes bunch of DOM APIs).

Is this even possible? BTW, I am on Firefox 12 on Windows. I am printing the threadManager.isMainThread, and in both situations the event call back is being invoked on the main thread.

Any pointers will be highly appreciated.

  • 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-03T11:09:17+00:00Added an answer on June 3, 2026 at 11:09 am

    JavaScript is generally single-threaded. However, this doesn’t mean that functions cannot be reentered (a function calling itself being the most obvious example). So an event handler could still be called while another event handler is executing. AFAICT this can happen under the following conditions:

    • The event handler causes (directly or indirectly) another event to be generated and dispatched. In particular, DOM manipulations will cause mutation events – the processing of such events happens synchronously. E.g. calling element.setAttribute() will create DOMAttrModified event and that event will be processed before element.setAttribute() returns, including running event handlers.
    • The event handler is “paused”. This will typically happen if a modal dialog (like alert()) is opened – the current event handler will wait for this dialog to be closed while other event handlers can still be triggered. A less common case is the usage of the yield keyword in generators.
    • The event handler calls nsIThread.processNextEvent(). This call might execute event handlers associated with the next event in the queue. Technically, this point is the same as the one before it – alert() will call nsIThread.processNextEvent() internally to ensure that events are processed while the caller is blocked.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi: I'm writing a firefox extension (my first) that among other things, gets an
I'm writing a firefox extension which displays a statusbarpanel containing some text. I want
I am writing a Firefox extension which creates a Java applet in the page.
I'm writing a firefox extension and really need to listen on TabOpen events and
I'm writing a firefox-extension and I've got this little json file: for (;;);{__ar:1,payload:{stackable:[true,false],title:{__html:How You
I am writing a simple Firefox extension which has an icon in the toolbar.
I'm writing a Firefox extension and I need to find the ip address of
I'm writing a Firefox extension that's to be used in house. Basically, I need
I am writing a firefox extension that interacts with a JSON server interface. I
I am writing my first FireFox extension and I have some questions. Maybe someone

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.