Things we did:

  • Body
    • Started refactoring consume_body based on feedback and yesterday’s planning. Created body.rs and pulled out consume_body and run_package_data_algorithm into it, and created a BodyTrait. The project was oddly compiling without complaints for most of the day. I mentioned this to Jeena, who reminded me that I have to list new dom files it in dom/mod.rs……haha. :) I did, and then all my bugs were then revealed upon the next compile. :P
  • Promise in Fetch
    • net_traits had changed! So I had to modify the process_response() method to accomodate the changes. It is more secure now as it allows the fetched data to be filtered. Filter exists to protect sites from having their data stolen by other sites.
  • Package Data Algorithm
    • I implemented(though no guarantee it works :wink:) Json(), Blob(), and part of FormData().

Things we learned:

  • Moment of Realization
    • One of the reasons why I (Malisa) write code so slowly is that I feel like I need to understand every little thing about the codebase (at least, the parts I touch) prior to writing code. I’m unwilling to accept that Servo can just be MagicTM. But I think I’m starting to realize that going “down the rabbit hole” for each little detail can actually be somewhat counter-productive. Going to try to believe in magic a little more from now on.
  • If an enum has a type that is a struct/enum, the match statement will need to be comprehensive to cover the struct’s fields or enum’s types. For example, say there are two enums:
pub enum Animal {
    Cat,
    Dog,
}

pub enum HavePet {
    No,
    Yes {
        animal: Animal,
        how_many: i32,
    }
}

let me = HavePet::Yes {
            animal: Animal::Dog,
            how_many: 1,
        };

This match statement won’t work!

match me {
    HavePet::No => println!("I wish I had a pet!"),
    HavePet::Yes => println!("I have a pet!"),
}

The compiler will say that:

error: `HavePet::Yes` does not name a tuple variant or a tuple struct [--explain E0164]
  --> <anon>:22:5
   |>
22 |>     HavePet::Yes => println!("I have a pet!"),
   |>     ^^^^^^^^^^^^

The correct way to write the match statement is:

match me {
    HavePet::No => println!("I wish I had a pet!"),
    HavePet::Yes {
        animal: Animal::Dog,
        how_many: _,
        } => println!("I have dog(s)!"),
    HavePet::Yes {
        animal: Animal::Cat,
        how_many: _,
        } => println!("I have cat(s)!"),
}

Link to play-rust is here. Or even simpler:

match me {
    HavePet::No => println!("I wish I had a pet!"),
    HavePet::Yes { animal, .. } => match animal {
        Animal::Dog => println!("I have dog(s)!"),
        Animal::Cat => println!("I have cat(s)!"),
    }
}

Link to play-rust is here. There is a github issue open for rust-lang to print out more helpful hints about this matter.

TODO:

  • Body
    • debug and finish refactoring. Push to github and then merge with Jeena’s implementation of Blob() and FormData(). Then work on Body for Request.
  • Test Curation
    • Go through the new tests, and categorize them.
  • Package Data Algorithm
    • Figure out how to write FormData() when MIMEType is “multipart/form-data”.