This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24077 - second-argument-null.html worker test is incorrect
Summary: second-argument-null.html worker test is incorrect
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Test suite (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-12 15:12 UTC by Boris Zbarsky
Modified: 2014-01-03 15:14 UTC (History)
4 users (show)

See Also:


Attachments

Description Boris Zbarsky 2013-12-12 15:12:08 UTC
The test has:

  try {
    postMessage(1, null);
  } catch(e) {
    postMessage(''+e);
  }

and asserts that 1 is posted.

But the spec for postMessage is:

  void postMessage(any message, optional sequence<Transferable> transfer);

and passing null to the second argument of that should throw, per webidl.

I recommend we do three things:

1)  Add a copy of this test that replaces the first postMessage line with:

     postMessage(1);

2)  Add a copy of this test that replaces the first postMessage line with:

     postMessage(1, undefined);

3)  Modify this test to check that postMessage(1, null) in fact throws.

#1 and #2 would test correct handling of the optional argument when it's not actually passed and #3 would test correct handling of null here.
Comment 1 Simon Pieters 2013-12-12 21:18:26 UTC
Test
http://w3c-test.org/web-platform-tests/master/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html

Spec
http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dedicatedworkerglobalscope

I think the spec was correct when it was written because it predates transferables, but obviously it should be fixed. I think #3 since the test is explicitly about testing null in the second argument.
Comment 2 Boris Zbarsky 2013-12-12 21:21:21 UTC
My 3 suggestions were not mutually exclusive.  I didn't say "one of three things", right?  We should do all three, with different test names for 1 and 2, obviously.
Comment 3 Simon Pieters 2013-12-13 07:53:01 UTC
Oh, OK, sure. I think #1 is probably tested already somewhere.
Comment 4 Arthur Barstow 2014-01-03 15:14:29 UTC
Moving this bug report to Github as Issue 491 https://github.com/w3c/web-platform-tests/issues/491