Oxidation

How we got rust code into Firefox

Firefox Quantum

Brief history of Rust

2006: Rust language started by Graydon Hoare

2009: Mozilla begins sponsoring Rust project

2012: rustc self-hosting compiler

2015: rust 1.0 is released

2017: rust 1.21 is released

Fearless concurrency

“… a folk definition of insanity is to do the same thing over and over again and to expect the results to be different. By this definition, we in fact require that programmers of multithreaded systems be insane. Were they sane, they could not understand their programs.”

                        Edward A. Lee

Brief history of Servo

2012: Research Team starts work on Servo

2016: 0.0.1 alpha version released

2017: Servo code lives in the Gecko tree

2017: Firefox Quantum!!!

Oxidation

  • mp4parse-rust
  • rust-url
  • encoding-rs
  • requiring Rust
  • importing Servo

 

Oxidation

  • mp4parse-rust
  • rust-url
  • encoding-rs
  • requiring Rust
  • importing Servo

 

Oxidation

  • mp4parse-rust
  • rust-url
  • encoding-rs
  • requiring Rust
  • importing Servo

 

Oxidation

  • mp4parse-rust
  • rust-url
  • encoding-rs
  • requiring Rust
  • importing Servo

 

Oxidation

  • mp4parse-rust
  • rust-url
  • encoding-rs
  • requiring Rust
  • importing Servo

 

Quantum CSS (Stylo)

WebRenderer

What's next?

#moreRust

Spot the bug

int64_t GetChunkIdx() const
{ 
  return mChunk ? mChunk->Index() : -1;
};

Spot the bug

4294967295


WTF!?
int64_t GetChunkIdx() const
{ 
  return mChunk ? static_cast<int64_t>(mChunk->Index()) : -1;
};
class CacheFileChunk {
  [...]
  uint32_t  Index() const;
};

Spot the bug

fn GetChunkIdx(&self) -> Option<i64>
{
  if let Some(chunk) = self.mChunk {
    Some(chunk.index() as i64)
  } else {
    None
  }
};

The rust way

How can I help?

Contribute to our projects:

Firefox - mentored bugs

Servo - E-Easy

Rust - E-Easy

Use and report bugs - bugzilla.mozilla.org

Oxidation - Rust in Firefox

By Valentin Gosu

Oxidation - Rust in Firefox

  • 3,135