mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
Script: Lazily transform the DOMString into Rust String instead of immediately. (#39509)
This implements LazyDOMString (from now on DOMString) as outlined in https://github.com/servo/servo/issues/39479. Constructing from a *mut JSString we keep the in a RootedTraceableBox<Heap<*mut JSString>> and transform the string into a rust string if necessary via the `make_rust_string` method. Methods used in script are implemented on this string. Currently we transform the string at all times. But in the future more efficient implementations are possible. We implement the safety critical sections in a separate module DOMStringInner which allows simple constructors, `make_rust_string` and the `bytes` method. This method returns the new type `EncodedBytes` which contains the reference to the underlying string in either format. Testing: WPT tests still seem to work, so this should test this functionality. --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
@@ -312,7 +312,7 @@ impl HTMLIFrameElement {
|
||||
// Note: despite not being explicitly stated in the spec steps, this falls back to
|
||||
// document's referrer policy here because it satisfies the expectations that when unset,
|
||||
// the iframe should inherit the referrer policy of its parent
|
||||
let referrer_policy = match ReferrerPolicy::from(referrer_policy_token.str()) {
|
||||
let referrer_policy = match ReferrerPolicy::from(&*referrer_policy_token.str()) {
|
||||
ReferrerPolicy::EmptyString => document.get_referrer_policy(),
|
||||
policy => policy,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user