Make sure all methods have a correct name.
Adds an assertion to idlharness to check the name attribute of methods, and fixes the bindings code to make sure we actually set the name correctly. Bug: 1106097, 1097814 Change-Id: I73dea7b96a94a9b2925c23156e6ef8146291cbc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300824 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Marijn Kruisselbrink <mek@chromium.org> Cr-Commit-Position: refs/heads/master@{#789135}
This commit is contained in:

committed by
Commit Bot

parent
6fb4c5c353
commit
6afc7d8ccd
third_party/blink
renderer
bindings
web_tests
external
wpt
@@ -534,7 +534,7 @@ void InstallMethodInternal(
|
||||
if (!WorldConfigurationApplies(config, world))
|
||||
return;
|
||||
|
||||
v8::Local<v8::Name> name = config.MethodName(isolate);
|
||||
v8::Local<v8::String> name = config.MethodName(isolate);
|
||||
v8::FunctionCallback callback = config.callback;
|
||||
// Promise-returning functions need to return a reject promise when
|
||||
// an exception occurs. This includes a case that the receiver object is not
|
||||
@@ -565,6 +565,7 @@ void InstallMethodInternal(
|
||||
v8::Local<v8::Function> function =
|
||||
function_template->GetFunction(isolate->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
function->SetName(name);
|
||||
if (location & V8DOMConfiguration::kOnInstance && !instance.IsEmpty()) {
|
||||
instance
|
||||
->DefineOwnProperty(
|
||||
@@ -594,6 +595,7 @@ void InstallMethodInternal(
|
||||
v8::Local<v8::Function> function =
|
||||
function_template->GetFunction(isolate->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
function->SetName(name);
|
||||
interface->DefineOwnProperty(isolate->GetCurrentContext(), name, function, static_cast<v8::PropertyAttribute>(config.attribute)).ToChecked();
|
||||
}
|
||||
}
|
||||
|
@@ -298,7 +298,7 @@ class CORE_EXPORT V8DOMConfiguration final {
|
||||
struct MethodConfiguration {
|
||||
MethodConfiguration& operator=(const MethodConfiguration&) = delete;
|
||||
DISALLOW_NEW();
|
||||
v8::Local<v8::Name> MethodName(v8::Isolate* isolate) const {
|
||||
v8::Local<v8::String> MethodName(v8::Isolate* isolate) const {
|
||||
return V8AtomicString(isolate, name);
|
||||
}
|
||||
|
||||
|
@@ -1,95 +0,0 @@
|
||||
This is a testharness.js-based test.
|
||||
Found 91 tests; 90 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
|
||||
PASS idl_test setup
|
||||
PASS idl_test validation
|
||||
PASS Partial interface Navigator: original interface defined
|
||||
PASS Partial interface Navigator: valid exposure set
|
||||
PASS Partial interface Navigator: member names are unique
|
||||
PASS Partial interface HTMLMediaElement: original interface defined
|
||||
PASS Partial interface HTMLMediaElement: valid exposure set
|
||||
PASS Partial interface HTMLMediaElement: member names are unique
|
||||
PASS Partial interface mixin NavigatorID: member names are unique
|
||||
PASS HTMLElement includes GlobalEventHandlers: member names are unique
|
||||
PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique
|
||||
PASS HTMLElement includes ElementContentEditable: member names are unique
|
||||
PASS HTMLElement includes HTMLOrSVGElement: member names are unique
|
||||
PASS Navigator includes NavigatorID: member names are unique
|
||||
PASS Navigator includes NavigatorLanguage: member names are unique
|
||||
PASS Navigator includes NavigatorOnLine: member names are unique
|
||||
PASS Navigator includes NavigatorContentUtils: member names are unique
|
||||
PASS Navigator includes NavigatorCookies: member names are unique
|
||||
PASS Navigator includes NavigatorPlugins: member names are unique
|
||||
PASS Navigator includes NavigatorConcurrentHardware: member names are unique
|
||||
PASS Element includes ParentNode: member names are unique
|
||||
PASS Element includes NonDocumentTypeChildNode: member names are unique
|
||||
PASS Element includes ChildNode: member names are unique
|
||||
PASS Element includes Slottable: member names are unique
|
||||
PASS MediaKeySystemAccess interface: existence and properties of interface object
|
||||
PASS MediaKeySystemAccess interface object length
|
||||
PASS MediaKeySystemAccess interface object name
|
||||
PASS MediaKeySystemAccess interface: existence and properties of interface prototype object
|
||||
PASS MediaKeySystemAccess interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaKeySystemAccess interface: existence and properties of interface prototype object's @@unscopables property
|
||||
PASS MediaKeySystemAccess interface: attribute keySystem
|
||||
PASS MediaKeySystemAccess interface: operation getConfiguration()
|
||||
PASS MediaKeySystemAccess interface: operation createMediaKeys()
|
||||
PASS MediaKeys interface: existence and properties of interface object
|
||||
PASS MediaKeys interface object length
|
||||
PASS MediaKeys interface object name
|
||||
PASS MediaKeys interface: existence and properties of interface prototype object
|
||||
PASS MediaKeys interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaKeys interface: existence and properties of interface prototype object's @@unscopables property
|
||||
PASS MediaKeys interface: operation createSession(optional MediaKeySessionType)
|
||||
PASS MediaKeys interface: operation setServerCertificate(BufferSource)
|
||||
PASS MediaKeySession interface: existence and properties of interface object
|
||||
PASS MediaKeySession interface object length
|
||||
PASS MediaKeySession interface object name
|
||||
PASS MediaKeySession interface: existence and properties of interface prototype object
|
||||
PASS MediaKeySession interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaKeySession interface: existence and properties of interface prototype object's @@unscopables property
|
||||
PASS MediaKeySession interface: attribute sessionId
|
||||
PASS MediaKeySession interface: attribute expiration
|
||||
PASS MediaKeySession interface: attribute closed
|
||||
PASS MediaKeySession interface: attribute keyStatuses
|
||||
PASS MediaKeySession interface: attribute onkeystatuseschange
|
||||
PASS MediaKeySession interface: attribute onmessage
|
||||
PASS MediaKeySession interface: operation generateRequest(DOMString, BufferSource)
|
||||
PASS MediaKeySession interface: operation load(DOMString)
|
||||
PASS MediaKeySession interface: operation update(BufferSource)
|
||||
PASS MediaKeySession interface: operation close()
|
||||
PASS MediaKeySession interface: operation remove()
|
||||
PASS MediaKeyStatusMap interface: existence and properties of interface object
|
||||
PASS MediaKeyStatusMap interface object length
|
||||
PASS MediaKeyStatusMap interface object name
|
||||
PASS MediaKeyStatusMap interface: existence and properties of interface prototype object
|
||||
PASS MediaKeyStatusMap interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaKeyStatusMap interface: existence and properties of interface prototype object's @@unscopables property
|
||||
FAIL MediaKeyStatusMap interface: iterable<BufferSource, MediaKeyStatus> assert_equals: keys function object should have the right name expected "keys" but got ""
|
||||
PASS MediaKeyStatusMap interface: attribute size
|
||||
PASS MediaKeyStatusMap interface: operation has(BufferSource)
|
||||
PASS MediaKeyStatusMap interface: operation get(BufferSource)
|
||||
PASS MediaKeyMessageEvent interface: existence and properties of interface object
|
||||
PASS MediaKeyMessageEvent interface object length
|
||||
PASS MediaKeyMessageEvent interface object name
|
||||
PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object
|
||||
PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object's @@unscopables property
|
||||
PASS MediaKeyMessageEvent interface: attribute messageType
|
||||
PASS MediaKeyMessageEvent interface: attribute message
|
||||
PASS MediaEncryptedEvent interface: existence and properties of interface object
|
||||
PASS MediaEncryptedEvent interface object length
|
||||
PASS MediaEncryptedEvent interface object name
|
||||
PASS MediaEncryptedEvent interface: existence and properties of interface prototype object
|
||||
PASS MediaEncryptedEvent interface: existence and properties of interface prototype object's "constructor" property
|
||||
PASS MediaEncryptedEvent interface: existence and properties of interface prototype object's @@unscopables property
|
||||
PASS MediaEncryptedEvent interface: attribute initDataType
|
||||
PASS MediaEncryptedEvent interface: attribute initData
|
||||
PASS HTMLMediaElement interface: attribute mediaKeys
|
||||
PASS HTMLMediaElement interface: attribute onencrypted
|
||||
PASS HTMLMediaElement interface: attribute onwaitingforkey
|
||||
PASS HTMLMediaElement interface: operation setMediaKeys(MediaKeys?)
|
||||
PASS Navigator interface: operation requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>)
|
||||
PASS Navigator interface: navigator must inherit property "requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>)" with the proper type
|
||||
PASS Navigator interface: calling requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>) on navigator with too few arguments must throw TypeError
|
||||
Harness: the test ran to completion.
|
||||
|
@@ -2534,6 +2534,10 @@ IdlInterface.prototype.do_member_operation_asserts = function(memberHolderObject
|
||||
memberHolderObject[member.name].length,
|
||||
minOverloadLength(ctors),
|
||||
"property has wrong .length");
|
||||
assert_equals(
|
||||
memberHolderObject[member.name].name,
|
||||
member.name,
|
||||
"property has wrong .name");
|
||||
|
||||
// Make some suitable arguments
|
||||
var args = member.arguments.map(function(arg) {
|
||||
|
Reference in New Issue
Block a user