Skip to content

Commit

Permalink
Small changes to Headers.webidl and headers.rs
Browse files Browse the repository at this point in the history
Expose the Headers interface to the Window scope and to Workers
Move Append function inside HeadersMethods trait
  • Loading branch information
malisas committed Jul 20, 2016
1 parent cec3697 commit 272d12d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion components/script/dom/headers.rs
Expand Up @@ -4,6 +4,7 @@

use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HeadersBinding;
use dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
use dom::bindings::error::Error;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root;
Expand Down Expand Up @@ -42,9 +43,11 @@ impl Headers {
pub fn new(global: GlobalRef) -> Root<Headers> {
reflect_dom_object(box Headers::new_inherited(), global, HeadersBinding::Wrap)
}
}

impl HeadersMethods for Headers {
// https://fetch.spec.whatwg.org/#concept-headers-append
pub fn Append(&self, name: ByteString, value: ByteString) -> Result<(), Error> {
fn Append(&self, name: ByteString, value: ByteString) -> Result<(), Error> {
// Step 1
let value = normalize_value(value);

Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/webidls/Headers.webidl
Expand Up @@ -6,8 +6,8 @@

/* typedef (Headers or sequence<sequence<ByteString>>) HeadersInit; */

/* [Constructor(optional HeadersInit init),
* Exposed=(Window,Worker)] */
/* [Constructor(optional HeadersInit init),*/
[Exposed=(Window,Worker)]

interface Headers {
[Throws]
Expand Down

0 comments on commit 272d12d

Please sign in to comment.