Bug 28460 - Need to update JS bindings and IDL files to support multiple message ports in postMessage()
Summary: Need to update JS bindings and IDL files to support multiple message ports in...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Andrew Wilson
URL:
Keywords:
Depends on: 26902
Blocks: 28839
  Show dependency treegraph
 
Reported: 2009-08-19 09:54 PDT by Andrew Wilson
Modified: 2009-09-03 11:37 PDT (History)
2 users (show)

See Also:


Attachments
proposed patch (79.91 KB, patch)
2009-08-29 09:12 PDT, Andrew Wilson
no flags Details | Formatted Diff | Diff
Patch addressing Levin's comments (79.92 KB, patch)
2009-09-01 16:35 PDT, Andrew Wilson
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Wilson 2009-08-19 09:54:08 PDT
We're updating the internal WebCore APIs to support passing multiple MessagePorts to postMessage() as part of bug 26902.

Once that's in, we need to update the JS bindings and IDL files to reflect the new APIs.
Comment 1 Andrew Wilson 2009-08-29 09:12:00 PDT
Created attachment 38775 [details]
proposed patch

This is the patch for the IDL files and JS bindings - I'm making another patch for the V8 bindings.
Comment 2 David Levin 2009-09-01 12:26:46 PDT
Comment on attachment 38775 [details]
proposed patch

r+ from me with some minor changes except for WebCore/bindings/js/*.

It would be great if you got someone to look over those changes. I tried but my naive eyes probably missed things.  If this totally clogs up, I'll be willing to give this one last on those as well as I can to finish this off.

> diff --git a/LayoutTests/fast/events/message-port-multi.html b/LayoutTests/fast/events/message-port-multi.html
> \ No newline at end of file

Please fix.

>
> diff --git a/LayoutTests/fast/workers/resources/worker-context-multi-port.js b/LayoutTests/fast/workers/resources/worker-context-multi-port.js

> +    } else if (event.data.indexOf("PASS") >= 0)

Why is this >= 0 instead of == 0?

> +        testPassed(event.data.substring(4));
> +    else
> +        testFailed(event.data.substring(4));

Why is this substring(4) when the event.data wasn't "PASS"?  
I think you are expecting FAIL.  It may be good to check that it is fail and if not print the whole message.


> diff --git a/LayoutTests/fast/workers/resources/worker-multi-port.js b/LayoutTests/fast/workers/resources/worker-multi-port.js

> +    else if (event.data.indexOf("PASS") >= 0)
> +        testPassed(event.data.substring(4));

Why is this >= 0 instead of == 0?

> +    else
> +        testFailed(event.data.substring(4));

Why is this substring(4) when the event.data wasn't "PASS"?  
I think you are expecting FAIL.  It may be good to check that it is fail and if not print the whole message.

> diff --git a/LayoutTests/fast/workers/worker-context-multi-port.html b/LayoutTests/fast/workers/worker-context-multi-port.html
> \ No newline at end of file

Please fix.


> diff --git a/LayoutTests/fast/workers/worker-multi-port.html b/LayoutTests/fast/workers/worker-multi-port.html
> \ No newline at end of file

Please fix.


> diff --git a/WebCore/bindings/js/JSMessageEventCustom.cpp b/WebCore/bindings/js/JSMessageEventCustom.cpp
> +
> +    MessageEvent* impl = static_cast<MessageEvent*>(this->impl());

Prefer whole words: "impl"  Perhaps "messageEvent" or just "event".


> diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp
> +JSC::JSValue JSMessagePort::postMessage(JSC::ExecState* exec, const JSC::ArgList& args)
> +{
> +    const UString& message = args.at(0).toString(exec);
> +    MessagePortArray portArray;
> +    fillMessagePortArray(exec, args.at(1), portArray);
> +    if (exec->hadException())
> +        return jsUndefined();
> +
> +    ExceptionCode ec = 0;
> +    impl()->postMessage(message, &portArray, ec);
> +    setDOMException(exec, ec);
> +    return jsUndefined();
> +}

I think I saw two copies of this code.  Is it possible to consolidate them?
Comment 3 Andrew Wilson 2009-09-01 16:35:37 PDT
Created attachment 38896 [details]
Patch addressing Levin's comments

Sam, can you take a look at the JS bindings changes? dave_levin already looked at the rest of the patch.
Comment 4 Andrew Wilson 2009-09-03 11:37:34 PDT
Committed as r48025.