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

  • Home
  • SEARCH
  • 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 6598225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:18:51+00:00 2026-05-25T18:18:51+00:00

window.onmessage = … window.postMessage(‘1’, ‘*’); window.postMessage(‘2’, ‘*’); Does postMessage ( http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task ) guarantee the

  • 0
window.onmessage = ...
window.postMessage('1', '*');
window.postMessage('2', '*');

Does postMessage (http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task) guarantee the order of events?

  • 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-05-25T18:18:52+00:00Added an answer on May 25, 2026 at 6:18 pm

    I don’t know, although the wording of the spec seems to suggest it doesn’t make such guarantees (which is surprising). It’s clear that once the MessageEvent is added to the task queue on the receiving end, then it’s order is maintained, although the MessageEvent creation and dispatch are asynchronous to the original postMessage call, so theoretically it appears that you could have the following situation:

    main thread:

    window.postMessage('1', '*'); --> thread spawned to create MessageEvent
    window.postMessage('2', '*'); --> new thread spawned for another MessageEvent
    

    If the thread management system allowed the second postMessage to execute before the first thread managed to dispatch the MessageEvent, and for whatever unlucky reason allowed that newer thread to execute (a diluted priority inversion), again before the first managed to dispatch, then you would indeed receive those messages in the reverse order.

    Although there might be some other place in the spec that provides more context for these asynchronous executions and rules out this case – I couldn’t find it.

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

Sidebar

Related Questions

window.location.href redirects the browser to stackoverflow.com when the button is clicked, but does not
Window.open javascript function is not working in Mozilla, but working in other browsers, here
The window pops up below the variable, and obscures the code I want to
the window.open() object has some funky parameter list... is there a way to do
On Window 's load, every DD element inside Quote_App should have an onCLick event
A window has a Grid with two columns. The left column contains a control
From the Immediate Window in Visual Studio: > Path.Combine(@C:\x, y) C:\\x\\y > Path.Combine(@C:\x, @\y)
I've been using Window Home Server for my backups here at home for most
I have a Window where I have put a Frame. I would like to
What is the window which is displayed when you first install Eclipse called, and

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.