Expand description
A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes escape, and from generally doing anything that it isn’t supposed to. This is accomplished via a simple whitelist of allowed operations, along with some lifetime magic to prevent nodes from escaping.
As a security wrapper is only as good as its whitelist, be careful when adding operations to this list. The cardinal rules are:
-
Layout is not allowed to mutate the DOM.
-
Layout is not allowed to see anything with
LayoutDomin the name, because it could hang onto these objects and cause use-after-free.
When implementing wrapper functions, be careful that you do not touch the borrow flags, or you will race and cause spurious thread failure. (Note that I do not believe these races are exploitable, but they’ll result in brokenness nonetheless.)
Modules§
- iterators 🔒
- servo_
dangerous_ 🔒style_ document - servo_
dangerous_ 🔒style_ element - servo_
dangerous_ 🔒style_ node - servo_
dangerous_ 🔒style_ shadow_ root - servo_
layout_ 🔒element - servo_
layout_ 🔒node
Structs§
- Reverse
Children Iterator - Servo
Dangerous Style Document - A wrapper around documents that ensures layout can only ever access safe properties.
- Servo
Dangerous Style Element - A wrapper around
LayoutDom<_, Element>to be used withstyloandselectors. - Servo
Dangerous Style Node - A wrapper around
LayoutDom<_, Node>to be used withstyloandselectors. - Servo
Dangerous Style Shadow Root - A wrapper around
LayoutDom<_, ShadowRoot>to be used withstyloandselectors. - Servo
Layout Element - An implementation of
LayoutElementfor Servo’sscriptcrate. - Servo
Layout Node - A wrapper around a
LayoutDom<Node>which provides a safe interface that can be used during layout. This implements theLayoutNodetrait.