Skip to content

Random web content project

Josh Matthews edited this page Feb 20, 2018 · 4 revisions

Random web content generator

Background information: Servo is implementing a rendering engine for web content from scratch. We often rely on existing web browsers like Firefox and Chrome to help us determine if Servo is rendering web content correctly. This goal of this project is to create a tool that can randomly generate valid HTML pages, then automatically load them in both Firefox and Servo using the WebDriver protocol and report if both engines render the content identically.

Tracking issue: https://github.com/servo/servo/issues/20052 (please ask questions in that issue)

Initial steps:

  • email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions
  • in a new repository, create a program that can generate a skeleton HTML file with a doctype, head element, and body element, print the result to stdout
  • add a module to the program that enable generating random content specific to the <head> element (such as inline CSS content inside of a <style> element) and add it to the generated output
  • add a module to the program that enables generating random content specific to the <body> element (such as a <p> block that contains randomly generated text) and add it to the generated output
  • generate simple random CSS that affects randomly generated content (ie. if there is an element with an id foo, generate a CSS selector like #foo that applies a style like color to it)
  • create a program under Servo's etc/ that launches Servo and causes it to take a screenshot of a particular URL - use this to take screenshots of pages randomly generated by the previous program

Subsequent steps:

  • extend the program that controls Servo to also control Firefox using geckodriver
  • compare the resulting screenshots and report the contents of the generated page if the screenshots differ
  • extend the page generation tool with a bunch of additional strategies, such as:
    • generating elements trees of arbitrary depth
    • generating sibling elements
    • extending the set of CSS properties that can be generated (display, background, float, padding, margin, border, etc.)
    • extending the set of elements that can be generated (span, div, header elements, table (and associated table contents), etc.)
    • randomly choose whether to generate a document in quirks mode or not
Clone this wiki locally