Commit 5e52fddf authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

v8binding: Improve global listing tests

Improves global listing tests to show IDL namespaces.

Change-Id: Idaf760eba8dc40728427e7865c7d075cadc87fbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494449Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820681}
parent e9e022ce
......@@ -3921,6 +3921,7 @@ interface WritableStreamDefaultWriter
method constructor
method releaseLock
method write
[NAMESPACES]
[GLOBAL OBJECT]
attribute console
attribute globalThis
......
......@@ -6,6 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
interface Navigator
interface Notification : EventTarget
getter image
[NAMESPACES]
[GLOBAL OBJECT]
PASS successfullyParsed is true
......
......@@ -80,6 +80,7 @@ interface BluetoothUUID
interface Navigator
getter bluetooth
interface Notification : EventTarget
[NAMESPACES]
[GLOBAL OBJECT]
PASS successfullyParsed is true
......
......@@ -81,6 +81,7 @@ interface Navigator
getter bluetooth
interface Notification : EventTarget
getter image
[NAMESPACES]
[GLOBAL OBJECT]
PASS successfullyParsed is true
......
......@@ -6,6 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
interface Navigator
interface Notification : EventTarget
getter image
[NAMESPACES]
[GLOBAL OBJECT]
PASS successfullyParsed is true
......
......@@ -77,7 +77,7 @@ var jsBuiltins = new Set([
'unescape',
]);
function isWebIDLConstructor(propertyKey) {
function isWebIDLInterface(propertyKey) {
if (jsBuiltins.has(propertyKey))
return false;
var descriptor = Object.getOwnPropertyDescriptor(this, propertyKey);
......@@ -86,6 +86,18 @@ function isWebIDLConstructor(propertyKey) {
return descriptor.writable && !descriptor.enumerable && descriptor.configurable;
}
function isWebIDLNamespace(propertyKey) {
if (jsBuiltins.has(propertyKey))
return false;
let object = Object.getOwnPropertyDescriptor(this, propertyKey).value;
if (object == undefined || typeof(object) != 'object' ||
object.prototype != undefined) {
return false;
}
let classString = Object.getOwnPropertyDescriptor(object, Symbol.toStringTag);
return classString && classString.value == propertyKey;
}
var wellKnownSymbols = new Map([
[Symbol.asyncIterator, "@@asyncIterator"],
[Symbol.hasInstance, "@@hasInstance"],
......@@ -192,13 +204,7 @@ function outputProperty(property) {
outputFunc(' ' + property);
}
// FIXME: List interfaces with LegacyNoInterfaceObject specified in their IDL file.
outputFunc('[INTERFACES]');
var interfaceNames = Object.getOwnPropertyNames(this)
.filter(isWebIDLConstructor)
.filter(filterPlatformSpecificInterface);
interfaceNames.sort();
interfaceNames.forEach(function(interfaceName) {
function outputWebIDLInterface(interfaceName) {
var inheritsFrom = this[interfaceName].__proto__.name;
if (inheritsFrom)
outputFunc('interface ' + interfaceName + ' : ' + inheritsFrom);
......@@ -215,12 +221,40 @@ interfaceNames.forEach(function(interfaceName) {
propertyStrings.filter((property) => filterPlatformSpecificProperty(interfaceName, property))
.sort().forEach(outputProperty);
});
});
}
function outputWebIDLNamespace(namespaceName) {
outputFunc('namespace ' + namespaceName);
let object = this[namespaceName];
let propertyKeys = collectPropertyKeys(object);
let propertyStrings = [];
propertyKeys.forEach((propertyKey) => {
collectPropertyInfo(object, propertyKey, propertyStrings);
});
propertyStrings.sort().forEach(outputProperty);
}
outputFunc('[INTERFACES]');
var interfaceNames = Object.getOwnPropertyNames(this)
.filter(isWebIDLInterface)
.filter(filterPlatformSpecificInterface);
interfaceNames.sort();
interfaceNames.forEach(outputWebIDLInterface);
outputFunc('[NAMESPACES]');
let namespaceNames = Object.getOwnPropertyNames(this)
.filter(isWebIDLNamespace)
.filter(filterPlatformSpecificInterface);
namespaceNames.sort();
namespaceNames.forEach(outputWebIDLNamespace);
outputFunc('[GLOBAL OBJECT]');
var propertyStrings = [];
var memberNames = propertyNamesInGlobal.filter(function(propertyKey) {
return !jsBuiltins.has(propertyKey) && !isWebIDLConstructor(propertyKey);
return !jsBuiltins.has(propertyKey)
&& !isWebIDLInterface(propertyKey)
&& !isWebIDLNamespace(propertyKey);
});
memberNames.forEach(function(propertyKey) {
collectPropertyInfo(globalObject, propertyKey, propertyStrings);
......
......@@ -2749,6 +2749,7 @@ interface WritableStreamDefaultWriter
method constructor
method releaseLock
method write
[NAMESPACES]
[GLOBAL OBJECT]
attribute console
attribute globalThis
......
......@@ -2794,6 +2794,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface XMLHttpRequestUpload : XMLHttpRequestEventTarget
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] [NAMESPACES]
[Worker] [GLOBAL OBJECT]
[Worker] attribute console
[Worker] attribute globalThis
......
......@@ -9558,6 +9558,7 @@ interface webkitURL
setter protocol
setter search
setter username
[NAMESPACES]
[GLOBAL OBJECT]
attribute GCController
attribute accessibilityController
......
......@@ -2681,6 +2681,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface XMLHttpRequestUpload : XMLHttpRequestEventTarget
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] [NAMESPACES]
[Worker] [GLOBAL OBJECT]
[Worker] attribute console
[Worker] attribute globalThis
......
......@@ -4071,6 +4071,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface XMLHttpRequestUpload : XMLHttpRequestEventTarget
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] [NAMESPACES]
[Worker] [GLOBAL OBJECT]
[Worker] attribute console
[Worker] attribute globalThis
......
......@@ -11752,6 +11752,7 @@ interface webkitURL
setter protocol
setter search
setter username
[NAMESPACES]
[GLOBAL OBJECT]
attribute GCController
attribute accessibilityController
......
......@@ -89,6 +89,7 @@ interface Navigator
getter bluetooth
interface Notification : EventTarget
getter image
[NAMESPACES]
[GLOBAL OBJECT]
PASS successfullyParsed is true
......
......@@ -3842,6 +3842,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface XMLHttpRequestUpload : XMLHttpRequestEventTarget
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] [NAMESPACES]
[Worker] [GLOBAL OBJECT]
[Worker] attribute console
[Worker] attribute globalThis
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment