Eagerly report errors when evaluating JS on a global scope. Fixes #4966.

This commit is contained in:
Josh Matthews 2015-02-20 20:33:09 -05:00
parent 172db80703
commit 880c7189b3
2 changed files with 4 additions and 1 deletions

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::InheritTypes::EventTargetCast; use dom::bindings::codegen::InheritTypes::EventTargetCast;
use dom::bindings::global::global_object_for_js_object; use dom::bindings::global::global_object_for_js_object;
use dom::bindings::error::Fallible; use dom::bindings::error::{report_pending_exception, Fallible};
use dom::bindings::error::Error::InvalidCharacter; use dom::bindings::error::Error::InvalidCharacter;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{MutNullableJS, JSRef, Temporary}; use dom::bindings::js::{MutNullableJS, JSRef, Temporary};
@ -362,6 +362,7 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
code.len() as libc::c_uint, code.len() as libc::c_uint,
filename.as_ptr(), 1, &mut rval) == 0 { filename.as_ptr(), 1, &mut rval) == 0 {
debug!("error evaluating JS string"); debug!("error evaluating JS string");
report_pending_exception(cx, global);
} }
rval rval
} }

View file

@ -1,3 +1,5 @@
[browsing-context-choose-parent.html] [browsing-context-choose-parent.html]
type: testharness type: testharness
expected: TIMEOUT expected: TIMEOUT
[The parent browsing context must be chosen if the given name is '_parent']
expected: NOTRUN