Open Bug 1564880 Opened 5 years ago Updated 2 years ago

Run StructuredDeserialize lazily


(Core :: DOM: postMessage, enhancement)





(Reporter: surma, Unassigned)


(Blocks 1 open bug)


User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Steps to reproduce:

  1. Send a big message from a worker to the main thread using postMessage()
  2. Measure the time it takes to access the MessageEvent’s .data property


Actual results:

It takes almost no time.

Expected results:

It should take some time (I’m seeing between 20 and 40ms on a MacBook Pro). Chrome and Safari seem to run StructuredDeserialize1 lazily, so only once .data is being accessed.

I think this is desirable as it puts the developer in control when to pay the performance hit of deserializing potentially big payloads. It also aligns Firefox with Chrome and Safari.

I tested this on Mac OS X 10.14 with FF Release 68 and Nightly 70.0a1(2019-07-14) and I have the same result like the one from the reporter. I'm not sure if this should be marked as an enhancement or a defect, for the moment I will mark it as an enhancement but please feel free to change it if you consider it necessary.

Type: defect → enhancement
Component: Untriaged → Networking
Ever confirmed: true
Product: Firefox → Core
Version: 68 Branch → Trunk
Component: Networking → JavaScript Engine
Component: JavaScript Engine → DOM: Core & HTML
Blocks: 1254240
No longer depends on: 1254240
Component: DOM: Core & HTML → DOM: postMessage
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.