Auto merge of #26154 - Manishearth:platform-object-overload, r=jdm

Do not filter out platform objects when doing dictionary conversions in overload resolution

https://heycam.github.io/webidl/#es-overloads

In step 12, the platform object check is for substep 4, but importantly it only matters if `V` implements the matching interface. If not, it should be able to fall back to substep 10 and attempt conversion to a dictionary.
This commit is contained in:
bors-servo 2020-04-09 17:39:10 -04:00 committed by GitHub
commit 455a99ca8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 3 deletions

View file

@ -0,0 +1,3 @@
[overload_dict.html]
type: testharness
prefs: [dom.testbinding.enabled:true]

View file

@ -14088,6 +14088,13 @@
{}
]
],
"overload_dict.html": [
"cd42fd97331753fc0580a47a39814cff57911638",
[
null,
{}
]
],
"paint_timing.html": [
"0c1798ec565a77d20d9550b5cec352a0b286c415",
[

View file

@ -0,0 +1,3 @@
[overload_dict.html]
type: testharness
prefs: [dom.testbinding.enabled:true]

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<title>Test for overload with dictionary object</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var t = new TestBinding();
assert_equals(t.passOverloadedDict({href: "a"}), "a");
assert_equals(t.passOverloadedDict(document.documentElement), "node");
// interface objects should be converted to the dictionary if
// they're incompatible with the interface
// See https://github.com/servo/servo/pull/26154
assert_equals(t.passOverloadedDict(new URL("https://example.org/foo")), "https://example.org/foo");
}, "Overload of dictionary and interface item works")
</script>