Skip to content

Commit 308e646

Browse files
committed
Throw TypeError instead of string on use after free
1 parent 1bd5f69 commit 308e646

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use js_sys::TypeError;
12
use lol_html::html_content::ContentType as NativeContentType;
23
use std::cell::Cell;
34
use std::convert::Into;
@@ -57,7 +58,9 @@ impl<R> NativeRefWrap<R> {
5758

5859
fn assert_not_poisoned(&self) -> JsResult<()> {
5960
if self.poisoned.get() {
60-
Err("The object has been freed and can't be used anymore.".into())
61+
Err(TypeError::new(
62+
"This content token is no longer valid. Content tokens are only valid during the execution of the relevant content handler.",
63+
).into())
6164
} else {
6265
Ok(())
6366
}

0 commit comments

Comments
 (0)