This is not mandatory, but spec allow to send HTTP compatible headers in opening handshake, and many web application developers want to have this.
Created attachment 189762 [details] Patch
Created attachment 189766 [details] Patch
Having layout test must be nice :) Alexey, and Kent: Can one of you take a look the second patch?
Comment on attachment 189766 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189766&action=review It's so horrible that we have to build the header twice, once for real and second time for Web Inspector. r=me > LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:1 > +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> Please use a regular HTML5 doctype: <!DOCTYPE html> > LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:4 > +<script src="../../../../js-test-resources/js-test-pre.js"></script> There is no need to build a document relative path, you can just use 'src="/js-test-resources/js-test-pre.js"'. > LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:27 > + data = messageEvent.data; > + useragent = navigator.userAgent; > + shouldBe("data", "useragent"); Why not shouldBe("messageEvent.data", "navigator.userAgent")? That would make test output a little clearer. > LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:40 > +<script src="../../../../js-test-resources/js-test-post.js"></script> Ditto.
Comment on attachment 189766 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189766&action=review >> LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:1 >> +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> > > Please use a regular HTML5 doctype: > > <!DOCTYPE html> Fixed. >> LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:4 >> +<script src="../../../../js-test-resources/js-test-pre.js"></script> > > There is no need to build a document relative path, you can just use 'src="/js-test-resources/js-test-pre.js"'. Fixed. >> LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:27 >> + shouldBe("data", "useragent"); > > Why not shouldBe("messageEvent.data", "navigator.userAgent")? That would make test output a little clearer. messageEvent can not be used directly because global variable is required to be compared correctly by shouldBe(). But your suggestion is very reasonable. I use navigator.userAgent directly, and assign messageEvent to global variable event, then use event.data to compare. >> LayoutTests/http/tests/websocket/tests/hybi/useragent-in-openinghandshake.html:40 >> +<script src="../../../../js-test-resources/js-test-post.js"></script> > > Ditto. Fixed.
Created attachment 190198 [details] Patch
Comment on attachment 190198 [details] Patch Clearing flags on attachment: 190198 Committed r144037: <http://trac.webkit.org/changeset/144037>
All reviewed patches have been landed. Closing bug.