Title: [225444] trunk/JSTests
- Revision
- 225444
- Author
- [email protected]
- Date
- 2017-12-01 22:48:27 -0800 (Fri, 01 Dec 2017)
Log Message
Try proxying all function arguments
https://bugs.webkit.org/show_bug.cgi?id=180306
Reviewed by Saam Barati.
* stress/proxy-all-the-parameters.js: Added.
(isPropertyOfType):
(getProperties):
(generateObjects):
(getObjects):
(getFunctions):
(get throw):
(let.o.of.getObjects.let.f.of.getFunctions.catch):
Modified Paths
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (225443 => 225444)
--- trunk/JSTests/ChangeLog 2017-12-02 05:44:04 UTC (rev 225443)
+++ trunk/JSTests/ChangeLog 2017-12-02 06:48:27 UTC (rev 225444)
@@ -1,5 +1,21 @@
2017-12-01 JF Bastien <[email protected]>
+ Try proxying all function arguments
+ https://bugs.webkit.org/show_bug.cgi?id=180306
+
+ Reviewed by Saam Barati.
+
+ * stress/proxy-all-the-parameters.js: Added.
+ (isPropertyOfType):
+ (getProperties):
+ (generateObjects):
+ (getObjects):
+ (getFunctions):
+ (get throw):
+ (let.o.of.getObjects.let.f.of.getFunctions.catch):
+
+2017-12-01 JF Bastien <[email protected]>
+
_javascript_Core: missing exception checks in Math functions that take more than one argument
https://bugs.webkit.org/show_bug.cgi?id=180297
<rdar://problem/35745556>
Added: trunk/JSTests/stress/proxy-all-the-parameters.js (0 => 225444)
--- trunk/JSTests/stress/proxy-all-the-parameters.js (rev 0)
+++ trunk/JSTests/stress/proxy-all-the-parameters.js 2017-12-02 06:48:27 UTC (rev 225444)
@@ -0,0 +1,70 @@
+const verbose = false;
+
+const ignore = ['quit', 'readline', 'waitForReport', 'flashHeapAccess', 'leaving', 'getReport'];
+
+function isPropertyOfType(obj, name, type) {
+ let desc;
+ desc = Object.getOwnPropertyDescriptor(obj, name)
+ return typeof type === 'undefined' || typeof desc.value === type;
+}
+
+function getProperties(obj, type) {
+ let properties = [];
+ for (let name of Object.getOwnPropertyNames(obj)) {
+ if (isPropertyOfType(obj, name, type))
+ properties.push(name);
+ }
+ return properties;
+}
+
+function* generateObjects(root = this, level = 0) {
+ if (level > 4)
+ return;
+ let obj_names = getProperties(root, 'object');
+ for (let obj_name of obj_names) {
+ let obj = root[obj_name];
+ yield obj;
+ yield* generateObjects(obj, level + 1);
+ }
+}
+
+function getObjects() {
+ let objects = [];
+ for (let obj of generateObjects())
+ if (!objects.includes(obj))
+ objects.push(obj);
+ return objects;
+}
+
+function getFunctions(obj) {
+ return getProperties(obj, 'function');
+}
+
+const thrower = new Proxy({}, { get() { throw 0xc0defefe; } });
+
+for (let o of getObjects()) {
+ for (let f of getFunctions(o)) {
+ if (ignore.includes(f))
+ continue;
+ const arityPlusOne = o[f].length + 1;
+ if (verbose)
+ print(`Calling ${o}['${f}'](${Array(arityPlusOne).fill("thrower")})`);
+ try {
+ o[f](Array(arityPlusOne).fill(thrower));
+ } catch (e) {
+ if (`${e}`.includes('constructor without new is invalid')) {
+ try {
+ if (verbose)
+ print(` Constructing instead`);
+ new o[f](Array(arityPlusOne).fill(thrower));
+ } catch (e) {
+ if (verbose)
+ print(` threw ${e}`);
+ }
+ } else {
+ if (verbose)
+ print(` threw ${e}`);
+ }
+ }
+ }
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes