Bug 209359

Summary: Port window.postMessage to the HTML event loop
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ews-watchlist, ggaren, hi, joepeck, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 202843    
Attachments:
Description Flags
Patch
none
Patch none

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>