You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-content/domInteracting with the DOM from web contentC-assignedThere is someone working on resolving the issueE-less-complexStraightforward. Recommended for a new contributor.I-panicServo encounters a panic.
We call unwrap on the argument passed to WebSocket::Send which is an Option<String>, but that brings Servo down if the argument is null in JavaScript which corresponds to None in Rust. We should use unwrap_or_else and create an empty string instead.
@jdm Why is null converted to None for an optional argument though? Isn't null not the same thing as a missing argument? Shouldn't thus the null value be converted to an empty string in codegen directly?
My reading of the WebIDL spec suggests that for methods with optional arguments with no default value, an undefined value is converted to a "missing" value, which I presume is equivalent to None for Servo's implementation.
@jimberlage Want to test what happens without your change in #7885 when passing either null or undefined to the send method? I suggest modifying an existing test in tests/wpt/web-platform-tests/websockets/ for quick experimentation, then running with ./mach test-wpt path/to/test.html.
so the argument should not be optional or nullable, which means null should be mapped to the string "null", and undefined to the string "undefined".
Fixing this should make some tests in html/dom/interfaces.html and websockets/interfaces.html, as well as websockets/interfaces/WebSocket/send/001.html, pass.
A-content/domInteracting with the DOM from web contentC-assignedThere is someone working on resolving the issueE-less-complexStraightforward. Recommended for a new contributor.I-panicServo encounters a panic.
Activity
jimberlage commentedon Oct 5, 2015
I'd like to take this on, if that's cool.
jdm commentedon Oct 5, 2015
Please do!
nox commentedon Oct 6, 2015
@jdm Why is null converted to None for an optional argument though? Isn't null not the same thing as a missing argument? Shouldn't thus the null value be converted to an empty string in codegen directly?
jdm commentedon Oct 6, 2015
My reading of the WebIDL spec suggests that for methods with optional arguments with no default value, an
undefinedvalue is converted to a "missing" value, which I presume is equivalent toNonefor Servo's implementation.jdm commentedon Oct 6, 2015
@jimberlage Want to test what happens without your change in #7885 when passing either
nullorundefinedto thesendmethod? I suggest modifying an existing test intests/wpt/web-platform-tests/websockets/for quick experimentation, then running with./mach test-wpt path/to/test.html.Ms2ger commentedon Oct 6, 2015
The spec says
so the argument should not be optional or nullable, which means
nullshould be mapped to the string"null", andundefinedto the string"undefined".Fixing this should make some tests in
html/dom/interfaces.htmlandwebsockets/interfaces.html, as well aswebsockets/interfaces/WebSocket/send/001.html, pass.jdm commentedon Oct 6, 2015
Huh, I feel a bit silly now. Want to get rid of the
optionalin WebSocket.webidl, @jimberlage ?jimberlage commentedon Oct 6, 2015
Sure thing.
Require the argument to WebSocket#send() (fixes servo#7858).
Require the argument to WebSocket#send() (fixes servo#7858).
Auto merge of #7885 - jimberlage:7858/null-message, r=Ms2ger