Bug 209359 - Port window.postMessage to the HTML event loop
Summary: Port window.postMessage to the HTML event loop
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 202843
  Show dependency treegraph
 
Reported: 2020-03-20 13:24 PDT by Chris Dumez
Modified: 2020-03-24 23:20 PDT (History)
7 users (show)

See Also:


Attachments
Patch (21.90 KB, patch)
2020-03-20 13:25 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (29.97 KB, patch)
2020-03-20 14:24 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-03-20 13:24:08 PDT
Port window.postMessage to the HTML event loop instead of using a 0-timer.
Comment 1 Chris Dumez 2020-03-20 13:25:28 PDT
Created attachment 394116 [details]
Patch
Comment 2 Chris Dumez 2020-03-20 14:24:17 PDT
Created attachment 394127 [details]
Patch
Comment 3 Alex Christensen 2020-03-20 16:12:39 PDT
Comment on attachment 394127 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394127&action=review

> Source/WebCore/inspector/agents/WebDebuggerAgent.cpp:115
> +int WebDebuggerAgent::willPostMessage()

Why don't we make m_nextPostMessageIdentifier unsigned and make this unsigned?  I don't see any need for negative values anywhere.
Comment 4 Chris Dumez 2020-03-20 16:14:12 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 394127 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=394127&action=review
> 
> > Source/WebCore/inspector/agents/WebDebuggerAgent.cpp:115
> > +int WebDebuggerAgent::willPostMessage()
> 
> Why don't we make m_nextPostMessageIdentifier unsigned and make this
> unsigned?  I don't see any need for negative values anywhere.

I don't disagree with you but this is not new. WebInspector was already using int as identifier type for those. We likely can switch to uint64_t but it will be more refactoring as it is being passed to WebInspector internals.
Comment 5 Chris Dumez 2020-03-20 16:15:09 PDT
Comment on attachment 394127 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394127&action=review

> Source/WebCore/inspector/agents/WebDebuggerAgent.cpp:155
> +    willDispatchAsyncCall(InspectorDebuggerAgent::AsyncCallType::PostMessage, postMessageIdentifier);

and here the int is being passed below.

> Source/WebCore/inspector/agents/WebDebuggerAgent.h:70
>      int m_nextPostMessageIdentifier { 1 };

See int here..
Comment 6 Chris Dumez 2020-03-20 16:19:05 PDT
Will look in a follow-up to see if I can easily switch that int into a uint64_t.
Comment 7 EWS 2020-03-23 09:51:30 PDT
Committed r258850: <https://trac.webkit.org/changeset/258850>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394127 [details].
Comment 8 Radar WebKit Bug Importer 2020-03-23 09:52:19 PDT
<rdar://problem/60778822>