Skip to content

Commit

Permalink
Merge pull request #79 from gjtorikian/dependabot/cargo/lol_html-2.0.0
Browse files Browse the repository at this point in the history
Bump lol_html from 1.2.1 to 2.0.0
  • Loading branch information
gjtorikian authored Oct 9, 2024
2 parents 769fbf4 + c75acd0 commit 2309bd8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/selma/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ magnus = { version = "0.7", features = ["rb-sys"] }
rb-sys = { version = "*", default-features = false, features = [
"stable-api-compiled-fallback",
] }
lol_html = "1.2"
lol_html = "2.0"

[lib]
name = "selma"
Expand Down
24 changes: 13 additions & 11 deletions ext/selma/src/rewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ impl SelmaRewriter {
}
}

pub fn perform_handler_rewrite(
pub fn perform_handler_rewrite<'a>(
&self,
sanitizer_document_content_handlers: Vec<DocumentContentHandlers>,
sanitizer_element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers)>,
handlers: &[Handler],
sanitizer_document_content_handlers: Vec<DocumentContentHandlers<'a>>,
sanitizer_element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers<'a>)>,
handlers: &'a [Handler],
html: String,
) -> Result<Vec<u8>, magnus::Error> {
// TODO: this should ideally be done ahead of time on `initialize`, not on every `#rewrite` call
Expand Down Expand Up @@ -431,10 +431,12 @@ impl SelmaRewriter {
let closure_element_stack = element_stack.clone();

if let Some(end_tag_handlers) = el.end_tag_handlers() {
end_tag_handlers.push(Box::new(move |_end_tag| {
closure_element_stack.as_ref().borrow_mut().pop();
Ok(())
}));
end_tag_handlers.push(lol_html::EndTagHandler::into(Box::new(
move |_end_tag| {
closure_element_stack.as_ref().borrow_mut().pop();
Ok(())
},
)));
}

Ok(())
Expand All @@ -449,10 +451,10 @@ impl SelmaRewriter {
)
}

fn run_rewrite(
fn run_rewrite<'a>(
&self,
document_content_handlers: Vec<DocumentContentHandlers>,
element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers)>,
document_content_handlers: Vec<DocumentContentHandlers<'a>>,
element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers<'a>)>,
html: &[u8],
) -> Result<Vec<u8>, magnus::Error> {
let binding = &self.0.borrow();
Expand Down
2 changes: 1 addition & 1 deletion lib/selma/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Selma
VERSION = "0.4.8"
VERSION = "0.4.9"
end

0 comments on commit 2309bd8

Please sign in to comment.