From 880c7189b34e0d4504da36eb406d14fbc58580b6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 20 Feb 2015 20:33:09 -0500 Subject: [PATCH] Eagerly report errors when evaluating JS on a global scope. Fixes #4966. --- components/script/dom/window.rs | 3 ++- .../browsing-context-choose-parent.html.ini | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index fcc56776c8d..d26ef42babb 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::InheritTypes::EventTargetCast; 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::global::GlobalRef; 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, filename.as_ptr(), 1, &mut rval) == 0 { debug!("error evaluating JS string"); + report_pending_exception(cx, global); } rval } diff --git a/tests/wpt/metadata/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html.ini b/tests/wpt/metadata/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html.ini index feea11f6ac3..a78fac723d4 100644 --- a/tests/wpt/metadata/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html.ini +++ b/tests/wpt/metadata/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html.ini @@ -1,3 +1,5 @@ [browsing-context-choose-parent.html] type: testharness expected: TIMEOUT + [The parent browsing context must be chosen if the given name is '_parent'] + expected: NOTRUN