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.
This commit is contained in:
Ms2ger 2016-11-26 22:54:43 +01:00
parent c4f87f451f
commit 154b16a25d
13 changed files with 31 additions and 19 deletions

View file

@ -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))) => {

View file

@ -1,3 +1,3 @@
[send-usp.worker.html]
type: testharness
disabled: https://github.com/servo/servo/issues/12654
disabled: https://github.com/servo/servo/issues/12654

View file

@ -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

View file

@ -1,3 +1,3 @@
[headers-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR

View file

@ -1,3 +1,3 @@
[request-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR

View file

@ -1,3 +1,3 @@
[response-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR

View file

@ -8,3 +8,4 @@
[history position should be calculated when executing, not when calling the .go command]
expected: FAIL

View file

@ -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

View file

@ -8,3 +8,4 @@
[Resize iframe from 200x100 to 200x50, then to 100x50]
expected: FAIL

View file

@ -2,3 +2,4 @@
type: testharness
[disconnect() called during startNotifications. Reject with NetworkError.]
expected: FAIL

View file

@ -2,3 +2,4 @@
type: testharness
[disconnect() called during stopNotifications. Reject with NetworkError.]
expected: FAIL

View file

@ -0,0 +1,6 @@
[htmllabel-activation.html]
type: testharness
[If label's 1st child (submit) is disabled, click should have no impact]
expected: FAIL

View file

@ -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 = '<label id="label">hi \
@ -81,7 +81,7 @@
label.click();
assert_false(disabledRadio.checked, "disabled radio 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 (radio) is disabled, click should have no impact");
test(function() {
@ -110,13 +110,13 @@
disabledSubmit = document.getElementById('disabledSubmit'),
checkbox = document.getElementById('checkbox');
disabledSubmit.onclick = function() {
disabledSubmit.onclick = this.step_func(function() {
assert_unreached("disabled submit should not have been activated")
};
});
label.click();
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 (submit) is disabled, click should have no impact");
test(function() {
document.querySelector("#test").innerHTML = '<label id="label" for="checkbox2">hi \