Skip to content

Commit

Permalink
This fixes #4166. throw_dom_exception will take the GlobalRef by valu…
Browse files Browse the repository at this point in the history
…e, and all generated code will pass it by value.
  • Loading branch information
mattnenterprise committed Dec 24, 2014
1 parent 070008b commit bdb75c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -2215,7 +2215,7 @@ def __init__(self, errorResult, arguments, argsPre, returnType,
" 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)))
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/bindings/error.rs
Expand Up @@ -46,10 +46,10 @@ pub type Fallible<T> = Result<T, Error>;
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);
Expand Down

5 comments on commit bdb75c2

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at mattnenterprise@bdb75c2

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging mattnenterprise/servo/globalref-by-value = bdb75c2 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mattnenterprise/servo/globalref-by-value = bdb75c2 merged ok, testing candidate = 57b6dc9

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 57b6dc9

Please sign in to comment.