style: Assert we never style a root element from another document.

Right now when calling getComputedStyle with an element from another document,
we return the style using the pres context of that document, not of the document
of the window getComputedStyle was called on, so this holds.

But it will stop holding if we ever change this, so assert it doesn't happen.

Bug: 1374062
Reviewed-By: Manishearth
MozReview-Commit-ID: 3g8yQWWdsen
This commit is contained in:
Emilio Cobos Álvarez 2017-06-21 13:01:44 +02:00
parent 1b2fd3fe85
commit 6fefe522a3
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
14 changed files with 52 additions and 30 deletions

View file

@ -274,6 +274,7 @@ trait PrivateMatchMethods: TElement {
if self.is_native_anonymous() || cascade_target == CascadeTarget::EagerPseudo {
cascade_flags.insert(PROHIBIT_DISPLAY_CONTENTS);
} else if self.is_root() {
debug_assert!(self.owner_doc_matches_for_testing(shared_context.stylist.device()));
cascade_flags.insert(IS_ROOT_ELEMENT);
}