From bdb75c2146f3519a9526d589d25ae7c2499fcc56 Mon Sep 17 00:00:00 2001 From: Matt McCoy Date: Wed, 24 Dec 2014 17:16:48 -0500 Subject: [PATCH] This fixes #4166. throw_dom_exception will take the GlobalRef by value, and all generated code will pass it by value. --- components/script/dom/bindings/codegen/CodegenRust.py | 2 +- components/script/dom/bindings/error.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 01efdd012c0..df7085e64d2 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2215,7 +2215,7 @@ class CGCallGenerator(CGThing): " Ok(result) => result,\n" " Err(e) => {\n" "%s" - " throw_dom_exception(cx, &global.root_ref(), e);\n" + " throw_dom_exception(cx, global.root_ref(), e);\n" " return%s;\n" " },\n" "};\n" % (glob, errorResult))) diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 4cfdd3a0663..f9de48935dc 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -46,10 +46,10 @@ pub type Fallible = Result; pub type ErrorResult = Fallible<()>; /// Set a pending DOM exception for the given `result` on `cx`. -pub fn throw_dom_exception(cx: *mut JSContext, global: &GlobalRef, +pub fn throw_dom_exception(cx: *mut JSContext, global: GlobalRef, result: Error) { assert!(unsafe { JS_IsExceptionPending(cx) } == 0); - let exception = DOMException::new_from_error(*global, result).root(); + let exception = DOMException::new_from_error(global, result).root(); let thrown = exception.to_jsval(cx); unsafe { JS_SetPendingException(cx, thrown);