Commit graph

159 commits

Author SHA1 Message Date
James Sanders
d121958a17 Make closing related code more clear and more correct 2016-01-18 17:37:16 -07:00
James Sanders
0bffffd8f5 Make WebSocket constructor take (DOMString or sequence<DOMString>) 2016-01-17 21:33:04 -07:00
Chad Kimes
ce6075825d Add global default method for Reflectable trait 2016-01-11 20:23:47 -05:00
Chad Kimes
fbe9107614 Remove global field from WebSocket 2016-01-10 22:24:33 -05:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Brandon Fairchild
fb0304cfdb Rename fire_simple_event_params to fire_event
Fixes #9180.
2016-01-07 13:49:49 -05:00
David Raifaizen
76f689cd06 Changed blob to use DataSlice with Arc in order to limit wasteful copying of byte vector 2016-01-06 19:41:52 -05:00
Nikki
b95af756ad now panics on integer overflow 2015-12-30 10:38:53 -07:00
Nikki
773a15d28a added a check for buffer overflow 2015-12-29 17:08:46 -07:00
Nikki
20edf21352 updated websocket buffered_amount to be u64 instead of u32 2015-12-29 13:30:35 -07:00
Arthur Skobara
d38771e270 Implement EventTarget::fire_simple_event and EventTarget::fire_simple_event_params 2015-12-22 13:47:57 +06:00
bors-servo
63923bc7c9 Auto merge of #8825 - jmr0:master, r=jdm
adding initial support for websocket subprotocol negotation

Addresses #8177

I also noticed some bugs/gaps (and at least one of my TODO's can be an E-Easy)

cc @jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8825)
<!-- Reviewable:end -->
2015-12-18 05:23:15 +05:30
jmr0
7d0bede8ba adding initial support for websocket subprotocol negotation 2015-12-17 09:17:15 -05:00
Arthur Skobara
8acb21a594 Remove from Trusted::new an unnecessary argument 2015-12-12 22:31:19 +06:00
Corey Farwell
4accaf50b2 Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s
everywhere, which can cause unnecessary allocations to occur since
they'll end up as `Atom`s anyways.
2015-12-10 23:47:25 -05:00
Nova Fallen
e8c8277f34 move websocket creation to resource task 2015-12-08 02:04:40 -05:00
Keith Yeung
8d90034d29 Split fn script_chan into 5 different task channel fn 2015-12-06 12:12:14 -08:00
bors-servo
8ae008761f Auto merge of #8787 - Jayflux:hotfix/8695, r=mbrubeck
now using external ref_slice instead of the std version fixed #8695

Fixes #8695.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8787)
<!-- Reviewable:end -->
2015-12-03 16:10:24 +05:30
Jason Williams
1a8db9a07a now using external ref_slice instead of the std version 2015-12-03 07:32:07 +00:00
bors-servo
01b4deb9d1 Auto merge of #8693 - yanirs:websocket-close-unspecified-status, r=jdm
Implement unspecified websocket close code (fixes issue #8158)

Fixes #8158.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8693)
<!-- Reviewable:end -->
2015-12-03 11:56:18 +05:30
Yanir Seroussi
ad9accf8e7 Implement unspecified websocket close code (fixes issue #8158) 2015-11-30 11:20:41 +11:00
Manish Goregaokar
dc0e467945 Upgrade to rustc 1.6.0-nightly (d5fde83ae 2015-11-12)
… and libc 0.2 and many other dependencies
2015-11-27 00:15:29 -05:00
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Ms2ger
6d2ae85c1f Use the conversion traits from js. 2015-11-12 10:48:58 +01:00
Roman Klauke
4f35941b9d rename WebSocket::Send_Impl
Previos: `Send_Impl`, now: `send_impl`.

Closes: #8345
2015-11-08 14:45:59 +01:00
Ms2ger
0a158967e0 Cleanup WebSocket::Send_Impl. 2015-11-05 12:23:18 +01:00
bors-servo
021f441d24 Auto merge of #8218 - nikkisquared:master, r=eefriedman
I'm working on resolving https://github.com/servo/servo/issues/8213 as per the spec online and feedback in the servo channel. Note that currently I cannot build (and thus test) my code, so this is a bit of a rough first draft. I'd still like feedback on my progress, and I hope that there is another way for my code to be tested.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8218)
<!-- Reviewable:end -->
2015-11-05 10:24:27 +05:30
Nikki
1d280289f1 Fixes #8213: Implement Blob variant of WebSocket.send() 2015-11-04 21:42:10 -07:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
David Zbarsky
722aa86c89 Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
Eli Friedman
df7fb8fa32 Remove JSTraceable implementation from RefCell.
The implementation wasn't really right, and we would rather just use
DOMRefCell anyway.
2015-11-02 14:40:57 -08:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
rohan.prinja
bb2536cd01 move Castable into dom::bindings::inheritance 2015-10-30 20:24:42 +09:00
Anthony Ramine
68014af78e Clean up the cast calls 2015-10-21 11:40:34 +02:00
Anthony Ramine
13ea3ac413 Introduce trait Castable
This trait is used to hold onto the downcast and upcast functions of all
castable IDL interfaces. A castable IDL interface is one which either derives
from or is derived by other interfaces.

The deriving relation is represented by implementations of marker trait
DerivedFrom<T: Castable> generated in InheritTypes.

/^[ ]*use dom::bindings::codegen::InheritTypes::.*(Base|Cast|Derived)/ {
    /::[a-zA-Z]+(Base|Cast|Derived);/d
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    /\{([a-zA-Z]+(Base|Cast|Derived))?\};$/d
    s/\{([a-zA-Z_]+)\};$/\1;/
}

s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.upcast::<\1>()/g
s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.upcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::from_ref\)/\(Castable::upcast::<\1>\)/g

s/([a-zA-Z]+)Cast::from_root/Root::upcast::<\1>/g

s/([a-zA-Z]+)Cast::from_layout_js\(\&([a-zA-Z_.]+)\)/\2.upcast::<\1>()/g

s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.downcast::<\1>()/g
s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.downcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::to_ref\)/\(Castable::downcast::<\1>\)/g

s/([a-zA-Z]+)Cast::to_root/Root::downcast::<\1>/g

s/([a-zA-Z]+)Cast::to_layout_js\(&?([a-zA-Z_.]+(\(\))?)\)/\2.downcast::<\1>()/g

s/\.is_document\(\)/.is::<Document>()/g
s/\.is_htmlanchorelement\(\)/.is::<HTMLAnchorElement>()/g
s/\.is_htmlappletelement\(\)/.is::<HTMLAppletElement>()/g
s/\.is_htmlareaelement\(\)/.is::<HTMLAreaElement>()/g
s/\.is_htmlbodyelement\(\)/.is::<HTMLBodyElement>()/g
s/\.is_htmlembedelement\(\)/.is::<HTMLEmbedElement>()/g
s/\.is_htmlfieldsetelement\(\)/.is::<HTMLFieldSetElement>()/g
s/\.is_htmlformelement\(\)/.is::<HTMLFormElement>()/g
s/\.is_htmlframesetelement\(\)/.is::<HTMLFrameSetElement>()/g
s/\.is_htmlhtmlelement\(\)/.is::<HTMLHtmlElement>()/g
s/\.is_htmlimageelement\(\)/.is::<HTMLImageElement>()/g
s/\.is_htmllegendelement\(\)/.is::<HTMLLegendElement>()/g
s/\.is_htmloptgroupelement\(\)/.is::<HTMLOptGroupElement>()/g
s/\.is_htmloptionelement\(\)/.is::<HTMLOptionElement>()/g
s/\.is_htmlscriptelement\(\)/.is::<HTMLScriptElement>()/g
s/\.is_htmltabledatacellelement\(\)/.is::<HTMLTableDataCellElement>()/g
s/\.is_htmltableheadercellelement\(\)/.is::<HTMLTableHeaderCellElement>()/g
s/\.is_htmltablerowelement\(\)/.is::<HTMLTableRowElement>()/g
s/\.is_htmltablesectionelement\(\)/.is::<HTMLTableSectionElement>()/g
s/\.is_htmltitleelement\(\)/.is::<HTMLTitleElement>()/g
2015-10-21 11:37:16 +02:00
Jim Berlage
380a9ce22b Adds bufferedAmount to Websocket (fixes #7856). 2015-10-15 17:06:24 -05:00
bors-servo
26902a9a9b Auto merge of #7871 - psdh:sendReason, r=jdm
Send reason in the Websocket close handshake

Fixes #7862

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7871)
<!-- Reviewable:end -->
2015-10-13 17:25:27 -06:00
bors-servo
8c81d9ab28 Auto merge of #7885 - jimberlage:7858/null-message, r=Ms2ger
Creates empty string when passed null

This should fix #7858.  An empty `USVString` is now used when `data` is `None`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7885)
<!-- Reviewable:end -->
2015-10-09 09:02:45 -06:00
Jim Berlage
0ffd2f636f Require the argument to WebSocket#send() (fixes #7858). 2015-10-08 12:08:26 -05:00
vectorijk
0fb5e745e5 make blacklist as const array 2015-10-06 09:03:51 -07:00
vectorijk
4e21b9fa83 Fix #7855 Implement port blocking
For WebSocket connection algorithm
2015-10-06 07:31:33 -07:00
Anthony Urena
ba86131cd5 Refactor Error enum usage to consistently be qualified 2015-10-06 05:43:52 -04:00
Roman Klauke
1f82e5121c remove data field from websockets
The data field is currently not used (no reads/ writes). This commit
removes this field.

Ref.-Issue: #7859
2015-10-05 21:23:42 +02:00
Prabhjyot Singh Sodhi
61fa1e4440 Send reason in the Websocket close handshake 2015-10-05 17:59:39 +05:30
Ravi Shankar
35d7ced89e fixed the 'as_slice' deprecated warning 2015-09-26 00:51:04 +05:30
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Michael Wu
941f7dc04b Move EventTargetTypeId/NodeTypeId to DOMClass 2015-09-12 01:09:46 +02:00