Skip to content

Accept WebSocket protocols as string or sequence - #9360

Merged
bors-servo merged 1 commit into
servo:masterfrom
jsanders:accept-protocols-sequence
Jan 18, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
jsanders:accept-protocols-sequence

Conversation

@jsanders

Copy link
Copy Markdown
Contributor

Fixes #9053

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 18, 2016
Comment thread components/script/dom/websocket.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the type annotation is necessary here.

@KiChjang

Copy link
Copy Markdown
Contributor

With my comments addressed, please squash and we'll merge this!

@KiChjang KiChjang added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 18, 2016
@jsanders
jsanders force-pushed the accept-protocols-sequence branch from 5868ffe to 0bffffd Compare January 18, 2016 04:33
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jan 18, 2016
@jsanders

Copy link
Copy Markdown
Contributor Author

@KiChjang: Done!

@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 0bffffd has been approved by KiChjang

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 18, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0bffffd with merge 4e348d0...

bors-servo pushed a commit that referenced this pull request Jan 18, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jan 18, 2016
@KiChjang

Copy link
Copy Markdown
Contributor
Ran 3837 tests finished in 227.0 seconds.
  • 3832 ran as expected. 691 tests skipped.
  • 5 tests crashed unexpectedly

Tests with unexpected results:
  ▶ CRASH [expected OK] /websockets/Create-Secure-valid-url-array-protocols.htm

  ▶ CRASH [expected OK] /websockets/Create-protocols-repeated.htm

  ▶ CRASH [expected OK] /websockets/Create-valid-url-array-protocols.htm

  ▶ CRASH [expected OK] /websockets/constructor/021.html

  ▶ CRASH [expected OK] /websockets/constructor/022.html

@emilio

emilio commented Jan 18, 2016

Copy link
Copy Markdown
Member

Hrrm, Got them all passing locally with this patch...

@KiChjang Do you know if there's a way to see the stack trace on the builders? I can't find any in the wpt log.

@jdm

jdm commented Jan 18, 2016

Copy link
Copy Markdown
Member

Unfortunately we don't have any automation to report backtraces of actual segfaults. These would need to be run under gdb either locally or on the build machine to get that information.

@emilio

emilio commented Jan 18, 2016

Copy link
Copy Markdown
Member

Just for the record, while I dig into this, the segfault is on spidermonkey, which is a bit worrying, and just on release builds (which is even more).

At least it seems deterministic... There it goes my backtrace:

0x0000555556738f1e in js::GetLengthProperty (cx=0x7fff9c027340, obj=..., lengthp=0x7fffc7fe702c)                                                                                              
    at /home/emilio/projects/moz/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jsarray.cpp:63
63      if (obj->is<ArrayObject>()) {
(gdb) bt
#0  0x0000555556738f1e in js::GetLengthProperty (cx=0x7fff9c027340, obj=..., lengthp=0x7fffc7fe702c)
    at /home/emilio/projects/moz/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jsarray.cpp:63
#1  0x0000555555efb952 in conversions::Vec$LT$T$GT$.FromJSValConvertible::from_jsval::h11377707114978210586 ()
#2  0x0000555555efaf01 in dom::bindings::codegen::UnionTypes::StringOrStringSequence.FromJSValConvertible::from_jsval::heefa2eec5fa5708eJhx ()
#3  0x0000555555f53c0b in dom::bindings::codegen::Bindings::WebSocketBinding::_constructor::hb419dab516bee77dxSi ()

@jdm

jdm commented Jan 18, 2016

Copy link
Copy Markdown
Member

Make sure you're building with debug mozjs enabled in your .servobuild to obtain maximal helpful assertions.

@emilio

emilio commented Jan 18, 2016

Copy link
Copy Markdown
Member

Heh, you'll like this, @jdm:

in rust-mozjs/src/conversions.rs:

Segfault:

let handle_obj = Handle::from_marked_location(&value.to_object());

No segfault (nor triggered assertions):

let object = value.to_object();
assert!(!object.is_null());
let handle_obj = Handle::from_marked_location(&object);

So... Maybe optimisations are playing a big role here (I guess the assert prevents some kind of optimisation).

You can try this (in rust-mozjs) with: cargo test --release test_vec_conversion or with the executable and gdb.

EDIT:

Seems that the assert is meaningless, using:

let object = value.to_object();
let handle_obj = Handle::from_marked_location(&object);

Also results in consistent success.

@emilio

emilio commented Jan 18, 2016

Copy link
Copy Markdown
Member

BTW: A servo build with debug-mozjs enabled gives me this on startup, independently of the page loaded of course.

$ ./target/release/servo     
Assertion failure: !mEntered, at ../../dist/include/mozilla/ReentrancyGuard.h:39

@jdm

jdm commented Jan 18, 2016

Copy link
Copy Markdown
Member

There is a reason I give every use of Handle::from_marked_location extreme side-eye. As established over IRC, the handle is outliving the stack JSObject* that it contains a pointer to, so the JSAPI code receives garbage.

@jsanders

Copy link
Copy Markdown
Contributor Author

@ecoal95 / @jdm: D'oh, I guess I probably only tested a debug build locally. Seems like you guys have a better handle on this than me, but let me know if there's anything I need to do to fix it.

@emilio

emilio commented Jan 18, 2016

Copy link
Copy Markdown
Member

@jsanders Actually it was my fault. This will have to wait until a rust-mozjs update lands, but the code is fine :P

@jsanders

Copy link
Copy Markdown
Contributor Author

@ecoal95: Ok no problem!

@KiChjang

Copy link
Copy Markdown
Contributor

rust-mozjs update has landed, let's land this.

@bors-servo retry

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0bffffd with merge 03a0b73...

bors-servo pushed a commit that referenced this pull request Jan 18, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Jan 18, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 0bffffd into servo:master Jan 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants