From 154b16a25ddaef753f3fac0a70b035646b2ce201 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 26 Nov 2016 22:54:43 +0100 Subject: [PATCH] Don't return early from report_pending_exception() if the value is an unexpected object. We will now dispatch the error event in this case as well. --- components/script/dom/bindings/error.rs | 19 ++++++++++--------- .../XMLHttpRequest/send-usp.worker.js.ini | 2 +- .../AddEventListenerOptions-passive.html.ini | 1 + .../fetch/api/headers/headers-idl.html.ini | 2 +- .../fetch/api/request/request-idl.html.ini | 2 +- .../fetch/api/response/response-idl.html.ini | 2 +- .../the-history-interface/004.html.ini | 1 + .../sandboxing/sandbox-allow-scripts.html.ini | 2 +- .../wpt/mozilla/meta/css/matchMedia.html.ini | 1 + .../disconnect-called-during.html.ini | 1 + .../disconnect-called-during.html.ini | 1 + .../mozilla/htmllabel-activation.html.ini | 6 ++++++ .../tests/mozilla/htmllabel-activation.html | 10 +++++----- 13 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 tests/wpt/mozilla/meta/mozilla/htmllabel-activation.html.ini diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 3b179e85d1d7..d38a55c31be2 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -214,15 +214,16 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool) JS_ClearPendingException(cx); let error_info = if value.is_object() { rooted!(in(cx) let object = value.to_object()); - let error_info = ErrorInfo::from_native_error(cx, object.handle()) - .or_else(|| ErrorInfo::from_dom_exception(object.handle())); - match error_info { - Some(error_info) => error_info, - None => { - error!("Uncaught exception: failed to extract information"); - return; - } - } + ErrorInfo::from_native_error(cx, object.handle()) + .or_else(|| ErrorInfo::from_dom_exception(object.handle())) + .unwrap_or_else(|| { + ErrorInfo { + message: format!("uncaught exception: unknown (can't convert to string)"), + filename: String::new(), + lineno: 0, + column: 0, + } + }) } else { match USVString::from_jsval(cx, value.handle(), ()) { Ok(ConversionResult::Success(USVString(string))) => { diff --git a/tests/wpt/metadata/XMLHttpRequest/send-usp.worker.js.ini b/tests/wpt/metadata/XMLHttpRequest/send-usp.worker.js.ini index fddbbbec6e41..9e5384b5c4b4 100644 --- a/tests/wpt/metadata/XMLHttpRequest/send-usp.worker.js.ini +++ b/tests/wpt/metadata/XMLHttpRequest/send-usp.worker.js.ini @@ -1,3 +1,3 @@ [send-usp.worker.html] type: testharness - disabled: https://github.com/servo/servo/issues/12654 \ No newline at end of file + disabled: https://github.com/servo/servo/issues/12654 diff --git a/tests/wpt/metadata/dom/events/AddEventListenerOptions-passive.html.ini b/tests/wpt/metadata/dom/events/AddEventListenerOptions-passive.html.ini index 5a7b0d1a7819..552da8a11ef2 100644 --- a/tests/wpt/metadata/dom/events/AddEventListenerOptions-passive.html.ini +++ b/tests/wpt/metadata/dom/events/AddEventListenerOptions-passive.html.ini @@ -1,6 +1,7 @@ [AddEventListenerOptions-passive.html] type: testharness bug: https://github.com/servo/servo/issues/13243 + expected: ERROR [Supports passive option on addEventListener only] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/headers/headers-idl.html.ini b/tests/wpt/metadata/fetch/api/headers/headers-idl.html.ini index 5a6cbcf65051..0dcbdbf04345 100644 --- a/tests/wpt/metadata/fetch/api/headers/headers-idl.html.ini +++ b/tests/wpt/metadata/fetch/api/headers/headers-idl.html.ini @@ -1,3 +1,3 @@ [headers-idl.html] type: testharness - expected: TIMEOUT + expected: ERROR diff --git a/tests/wpt/metadata/fetch/api/request/request-idl.html.ini b/tests/wpt/metadata/fetch/api/request/request-idl.html.ini index 185322453ef1..7bb88b0081dc 100644 --- a/tests/wpt/metadata/fetch/api/request/request-idl.html.ini +++ b/tests/wpt/metadata/fetch/api/request/request-idl.html.ini @@ -1,3 +1,3 @@ [request-idl.html] type: testharness - expected: TIMEOUT + expected: ERROR diff --git a/tests/wpt/metadata/fetch/api/response/response-idl.html.ini b/tests/wpt/metadata/fetch/api/response/response-idl.html.ini index 54a3bf894ce7..6b6489d88719 100644 --- a/tests/wpt/metadata/fetch/api/response/response-idl.html.ini +++ b/tests/wpt/metadata/fetch/api/response/response-idl.html.ini @@ -1,3 +1,3 @@ [response-idl.html] type: testharness - expected: TIMEOUT + expected: ERROR diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/004.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/004.html.ini index c442d6da7e9f..278160ab559f 100644 --- a/tests/wpt/metadata/html/browsers/history/the-history-interface/004.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/004.html.ini @@ -8,3 +8,4 @@ [history position should be calculated when executing, not when calling the .go command] expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/sandboxing/sandbox-allow-scripts.html.ini b/tests/wpt/metadata/html/browsers/sandboxing/sandbox-allow-scripts.html.ini index 91e5608d4b60..9f15cc3c5d99 100644 --- a/tests/wpt/metadata/html/browsers/sandboxing/sandbox-allow-scripts.html.ini +++ b/tests/wpt/metadata/html/browsers/sandboxing/sandbox-allow-scripts.html.ini @@ -1,6 +1,6 @@ [sandbox-allow-scripts.html] type: testharness - expected: TIMEOUT + expected: ERROR [Running script from sandbox='allow-scripts' iframe is allowed] expected: NOTRUN diff --git a/tests/wpt/mozilla/meta/css/matchMedia.html.ini b/tests/wpt/mozilla/meta/css/matchMedia.html.ini index cb68916336c7..8c726be5a034 100644 --- a/tests/wpt/mozilla/meta/css/matchMedia.html.ini +++ b/tests/wpt/mozilla/meta/css/matchMedia.html.ini @@ -8,3 +8,4 @@ [Resize iframe from 200x100 to 200x50, then to 100x50] expected: FAIL + diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/startNotifications/disconnect-called-during.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/startNotifications/disconnect-called-during.html.ini index 3f7bd5bd0e38..bd5ab348ee16 100644 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/startNotifications/disconnect-called-during.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/bluetooth/startNotifications/disconnect-called-during.html.ini @@ -2,3 +2,4 @@ type: testharness [disconnect() called during startNotifications. Reject with NetworkError.] expected: FAIL + diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/stopNotifications/disconnect-called-during.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/stopNotifications/disconnect-called-during.html.ini index 63d2902e525f..6dc580dc253c 100644 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/stopNotifications/disconnect-called-during.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/bluetooth/stopNotifications/disconnect-called-during.html.ini @@ -2,3 +2,4 @@ type: testharness [disconnect() called during stopNotifications. Reject with NetworkError.] expected: FAIL + diff --git a/tests/wpt/mozilla/meta/mozilla/htmllabel-activation.html.ini b/tests/wpt/mozilla/meta/mozilla/htmllabel-activation.html.ini new file mode 100644 index 000000000000..29941630cf9c --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/htmllabel-activation.html.ini @@ -0,0 +1,6 @@ +[htmllabel-activation.html] + type: testharness + + [If label's 1st child (submit) is disabled, click should have no impact] + expected: FAIL + diff --git a/tests/wpt/mozilla/tests/mozilla/htmllabel-activation.html b/tests/wpt/mozilla/tests/mozilla/htmllabel-activation.html index ff77c80a18fd..8040612c8b96 100644 --- a/tests/wpt/mozilla/tests/mozilla/htmllabel-activation.html +++ b/tests/wpt/mozilla/tests/mozilla/htmllabel-activation.html @@ -37,7 +37,7 @@ label.click(); assert_false(disabledcb.checked, "checkbox should not be checked") assert_false(checkbox.checked, "checkbox should not be checked") - }, "If label's 1st child is disabled, click should have no impact"); + }, "If label's 1st child (checkbox) is disabled, click should have no impact"); test(function() { document.querySelector("#test").innerHTML = '