Skip to content

Commit

Permalink
Don't return early from report_pending_exception() if the value is an…
Browse files Browse the repository at this point in the history
… unexpected object.

We will now dispatch the error event in this case as well.
  • Loading branch information
Ms2ger committed Nov 27, 2016
1 parent c4f87f4 commit 154b16a
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 19 deletions.
19 changes: 10 additions & 9 deletions components/script/dom/bindings/error.rs
Expand Up @@ -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))) => {
Expand Down
2 changes: 1 addition & 1 deletion 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
disabled: https://github.com/servo/servo/issues/12654
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/wpt/metadata/fetch/api/headers/headers-idl.html.ini
@@ -1,3 +1,3 @@
[headers-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR
2 changes: 1 addition & 1 deletion tests/wpt/metadata/fetch/api/request/request-idl.html.ini
@@ -1,3 +1,3 @@
[request-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR
@@ -1,3 +1,3 @@
[response-idl.html]
type: testharness
expected: TIMEOUT
expected: ERROR
Expand Up @@ -8,3 +8,4 @@

[history position should be calculated when executing, not when calling the .go command]
expected: FAIL

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

1 change: 1 addition & 0 deletions tests/wpt/mozilla/meta/css/matchMedia.html.ini
Expand Up @@ -8,3 +8,4 @@

[Resize iframe from 200x100 to 200x50, then to 100x50]
expected: FAIL

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

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

6 changes: 6 additions & 0 deletions 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
10 changes: 5 additions & 5 deletions tests/wpt/mozilla/tests/mozilla/htmllabel-activation.html
Expand Up @@ -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 \
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit 154b16a

Please sign in to comment.