mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Deny unsafe blocks in script.
As a first start, this allows them indiscriminately where used.
This commit is contained in:
parent
d9751c0fbb
commit
edc1d89251
14 changed files with 27 additions and 0 deletions
|
@ -1283,12 +1283,14 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
|
||||
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
unsafe { mem::transmute(attr.r().value().as_slice()) }
|
||||
})
|
||||
}
|
||||
#[allow(unsafe_blocks)]
|
||||
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
|
||||
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue