mirror of
https://github.com/servo/servo.git
synced 2025-11-13 21:27:48 +00:00
DomObject::global is a tricky API because it's used pervasively but has subtle requirements that are not documented and not yet enforced by the type system (#36116). The method returns the relevant global object for a given DOM object, but that operation is only meaningful if there is an active realm. We usually, but not always, have an active realm. This change avoids a footgun by following the principle of least surprise. Rather than making every single caller of `something.global()` both prove that there is an active realm and think about which realm they want active, we implement the obvious behaviour: always activate the realm of the callee before obtaining the relevant global. Testing: Existing WPT coverage is sufficient; this method is called all over the codebase. Fixes: #37070 #27037 Signed-off-by: Josh Matthews <josh@joshmatthews.net> |
||
|---|---|---|
| .. | ||
| buffer_source.rs | ||
| cell.rs | ||
| constructor.rs | ||
| conversions.rs | ||
| error.rs | ||
| frozenarray.rs | ||
| function.rs | ||
| import.rs | ||
| inheritance.rs | ||
| like.rs | ||
| mod.rs | ||
| principals.rs | ||
| proxyhandler.rs | ||
| refcounted.rs | ||
| reflector.rs | ||
| root.rs | ||
| serializable.rs | ||
| settings_stack.rs | ||
| str.rs | ||
| structuredclone.rs | ||
| trace.rs | ||
| transferable.rs | ||
| utils.rs | ||
| weakref.rs | ||
| xmlname.rs | ||