mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #18539 - emilio:dom-conversion-fixes, r=nox
script: a couple DOM conversion fixes Fixes https://github.com/servo/servo/issues/18535 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18539) <!-- Reviewable:end -->
This commit is contained in:
commit
6f97dd1c96
7 changed files with 101 additions and 12 deletions
|
@ -4938,8 +4938,6 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
|||
set += ("if RUST_JSID_IS_STRING(id) {\n" +
|
||||
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() +
|
||||
" return (*opresult).succeed();\n" +
|
||||
"} else {\n" +
|
||||
" return false;\n" +
|
||||
"}\n")
|
||||
else:
|
||||
set += ("if RUST_JSID_IS_STRING(id) {\n" +
|
||||
|
@ -4948,7 +4946,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
|||
" return (*opresult).failNoNamedSetter();\n"
|
||||
" }\n"
|
||||
"}\n")
|
||||
set += "return proxyhandler::define_property(%s);" % ", ".join(a.name for a in self.args)
|
||||
set += "return proxyhandler::define_property(%s);" % ", ".join(a.name for a in self.args)
|
||||
return set
|
||||
|
||||
def definition_body(self):
|
||||
|
|
|
@ -84,13 +84,13 @@ impl<T: Float + FromJSValConvertible<Config=()>> FromJSValConvertible for Finite
|
|||
value: HandleValue,
|
||||
option: ())
|
||||
-> Result<ConversionResult<Finite<T>>, ()> {
|
||||
let result = match FromJSValConvertible::from_jsval(cx, value, option) {
|
||||
Ok(ConversionResult::Success(v)) => v,
|
||||
Ok(ConversionResult::Failure(error)) => {
|
||||
let result = match FromJSValConvertible::from_jsval(cx, value, option)? {
|
||||
ConversionResult::Success(v) => v,
|
||||
ConversionResult::Failure(error) => {
|
||||
// FIXME(emilio): Why throwing instead of propagating the error?
|
||||
throw_type_error(cx, &error);
|
||||
return Err(());
|
||||
}
|
||||
_ => return Err(()),
|
||||
};
|
||||
match Finite::new(result) {
|
||||
Some(v) => Ok(ConversionResult::Success(v)),
|
||||
|
|
|
@ -414,18 +414,22 @@ unsafe fn generic_call(cx: *mut JSContext,
|
|||
-> bool)
|
||||
-> bool {
|
||||
let args = CallArgs::from_vp(vp, argc);
|
||||
|
||||
let info = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
|
||||
let proto_id = (*info).protoID;
|
||||
|
||||
let thisobj = args.thisv();
|
||||
if !thisobj.get().is_null_or_undefined() && !thisobj.get().is_object() {
|
||||
throw_invalid_this(cx, proto_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
let obj = if thisobj.get().is_object() {
|
||||
thisobj.get().to_object()
|
||||
} else {
|
||||
GetGlobalForObjectCrossCompartment(JS_CALLEE(cx, vp).to_object_or_null())
|
||||
};
|
||||
rooted!(in(cx) let obj = obj);
|
||||
let info = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
|
||||
let proto_id = (*info).protoID;
|
||||
let depth = (*info).depth;
|
||||
let proto_check = |class: &'static DOMClass| {
|
||||
class.interface_chain[depth as usize] as u16 == proto_id
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[storage_setitem.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[localStorage[\] = "<22>"]
|
||||
expected: FAIL
|
||||
bug: https://github.com/servo/servo/issues/6564
|
||||
|
@ -14,6 +13,72 @@
|
|||
bug: https://github.com/servo/servo/issues/6564
|
||||
|
||||
[localStorage["0"\]]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
bug: https://github.com/servo/servo/issues/10686
|
||||
|
||||
[localStorage["1"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["2"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["3"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["4"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["5"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["6"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["7"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["8"\]]
|
||||
expected: FAIL
|
||||
|
||||
[localStorage["9"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage[\] = "<22>"]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage[\] = "<22>a"]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage[\] = "a<>"]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["0"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["1"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["2"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["3"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["4"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["5"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["6"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["7"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["8"\]]
|
||||
expected: FAIL
|
||||
|
||||
[sessionStorage["9"\]]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -14739,6 +14739,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/invalid-this.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/invalid-this.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/iterable.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/iterable.html",
|
||||
|
@ -28074,6 +28080,10 @@
|
|||
"c9dcc4f24540914b3be1ef18f13b721773eb76be",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/invalid-this.html": [
|
||||
"4ed18511e6399b356fe196b92f72dd16a9019f55",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/iterable.html": [
|
||||
"66f05b1f12b8be392705f5ba4a96c70b9226721d",
|
||||
"testharness"
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
[Untitled]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
|
|
13
tests/wpt/mozilla/tests/mozilla/invalid-this.html
Normal file
13
tests/wpt/mozilla/tests/mozilla/invalid-this.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for #18535: Wrong type arguments to some JS functions abort the execution of the script.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() { window.atob.call("", localStorage); })
|
||||
assert_throws(new TypeError(), function() { window.removeEventListener.call("", ""); })
|
||||
assert_throws(new TypeError(), function() { window.alert.call(""); })
|
||||
assert_throws(new TypeError(), function() { window.moveTo.call(128); })
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue