mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
Implement trusted types for setAttribute (#38700)
Callers now call `set_attribute` directly, to avoid the trusted types machinery, as well as skip validation. That's not required by spec as well. This implements part of the DOM integration from https://github.com/whatwg/dom/pull/1268 Part of #36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
8290761066
commit
18e05d3aab
18 changed files with 217 additions and 240 deletions
|
@ -11,11 +11,13 @@ use devtools_traits::{
|
|||
AttrModification, AutoMargins, ComputedNodeLayout, CssDatabaseProperty, EvaluateJSReply,
|
||||
NodeInfo, NodeStyle, RuleModification, TimelineMarker, TimelineMarkerType,
|
||||
};
|
||||
use html5ever::LocalName;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::conversions::jsstr_to_string;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::ToString;
|
||||
use servo_config::pref;
|
||||
use style::attr::AttrValue;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::document_collection::DocumentCollection;
|
||||
|
@ -435,9 +437,9 @@ pub(crate) fn handle_modify_attribute(
|
|||
for modification in modifications {
|
||||
match modification.new_value {
|
||||
Some(string) => {
|
||||
let _ = elem.SetAttribute(
|
||||
DOMString::from(modification.attribute_name),
|
||||
DOMString::from(string),
|
||||
elem.set_attribute(
|
||||
&LocalName::from(modification.attribute_name),
|
||||
AttrValue::String(string),
|
||||
can_gc,
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue