[webkit-reviews] review granted: [Bug 184254] REGRESSION: MessagePort.postMessage() fails to send transferable objects : [Attachment 338017] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 17 00:42:07 PDT 2018


Ryosuke Niwa <rniwa at webkit.org> has granted Tadeu Zagallo
<tzagallo at apple.com>'s request for review:
Bug 184254: REGRESSION: MessagePort.postMessage() fails to send transferable
objects
https://bugs.webkit.org/show_bug.cgi?id=184254

Attachment 338017: Patch

https://bugs.webkit.org/attachment.cgi?id=338017&action=review




--- Comment #25 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 338017
  --> https://bugs.webkit.org/attachment.cgi?id=338017
Patch

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

> Source/WebCore/bindings/js/SerializedScriptValue.h:134
> +    auto hasArray = m_arrayBufferContentsArray &&
m_arrayBufferContentsArray->size() > 0;

Nit: should read m_arrayBufferContentsArray &&
m_arrayBufferContentsArray->size().
https://webkit.org/code-style-guidelines/#zero-comparison

> Source/WebCore/bindings/js/SerializedScriptValue.h:137
> +    if (hasArray) {

We prefer an early return over nested ifs.
This should be
if (!hasArray)
    return;
instead.

> Source/WebCore/bindings/js/SerializedScriptValue.h:158
> +    if (hasArray) {

Again, we should early return here.

> LayoutTests/workers/message-port.html:13
> +  return new Promise(function(resolve) {
> +    var channel = new MessageChannel();

Please use 4-space indentation here and in the rest of the file.
We usually put a space between function and (.
Also, use const?

> LayoutTests/workers/message-port.html:16
> +	 if (event.data == null)

These should really be !event.data

> LayoutTests/workers/message-port.html:32
> +  if (array.length === 0)

And !array.length

> LayoutTests/workers/message-port.html:40
> +var array = new Float64Array([Math.PI]);
> +var emptyArray = new Float64Array();
> +var emptyArray2 = new Float64Array();

Use const?

> LayoutTests/workers/message-port.html:46
> +    var array = new Float64Array(data.buf[0]);

Use const?


More information about the webkit-reviews mailing list