Chromium Code Reviews| Index: test/mjsunit/harmony/proxies-with.js |
| diff --git a/test/mjsunit/harmony/proxies-with.js b/test/mjsunit/harmony/proxies-with.js |
| index 9c18373863c02fcbec7dac32e8d64ce6bad27437..8905ee9160e35edf2ff3aa8cfd83682206dd5b71 100644 |
| --- a/test/mjsunit/harmony/proxies-with.js |
| +++ b/test/mjsunit/harmony/proxies-with.js |
| @@ -32,9 +32,10 @@ |
| function TestWithProxies(test, x, y, z) { |
| test(function(h) { return new Proxy({}, h) }, x, y, z) |
| - test(function(h) { |
| - return Proxy.createFunction(h, function() {}) |
| - }, x, y, z) |
| + // TODO(cbruni): enable once we have [[Call]] working. |
|
Jakob Kummerow
2015/12/10 15:35:03
Don't we have [[Call]] working?
|
| + // test(function(h) { |
| + // return Proxy.createFunction(h, function() {}) |
| + // }, x, y, z) |
|
neis
2015/12/10 15:13:50
This can be done now :)
|
| } |
| @@ -72,7 +73,7 @@ TestWithGet({ |
| key = k; |
| return k === "a" ? "onproxy" : undefined |
| }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? {value: "onproxy", configurable: true} : undefined |
| } |
| @@ -81,43 +82,38 @@ TestWithGet({ |
| TestWithGet({ |
| get: function(r, k) { return this.get2(r, k) }, |
| get2: function(r, k) { key = k; return k === "a" ? "onproxy" : undefined }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? {value: "onproxy", configurable: true} : undefined |
| } |
| }) |
| TestWithGet({ |
| - getPropertyDescriptor: function(k) { |
| + get: function(r, k) { |
| key = k; |
| - return k === "a" ? {value: "onproxy", configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGet({ |
| - getPropertyDescriptor: function(k) { return this.getPropertyDescriptor2(k) }, |
| - getPropertyDescriptor2: function(k) { |
| + return k === "a" ? "onproxy" : undefined |
| + }, |
| + getOwnPropertyDescriptor: function(t, k) { |
| + return this.getOwnPropertyDescriptor2(k) |
| + }, |
| + getOwnPropertyDescriptor2: function(k) { |
| key = k; |
| return k === "a" ? {value: "onproxy", configurable: true} : undefined |
| } |
| }) |
| TestWithGet({ |
| - getPropertyDescriptor: function(k) { |
| + get: function(r, k) { |
| + key = k; |
| + return k === "a" ? "onproxy" : undefined |
| + }, |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? |
| {get value() { return "onproxy" }, configurable: true} : undefined |
| } |
| }) |
| -TestWithGet({ |
| - get: undefined, |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: "onproxy", configurable: true} : undefined |
| - } |
| -}) |
| - |
| // Invoking. |
| @@ -156,7 +152,7 @@ function onproxy() { receiver = this; return "onproxy" } |
| TestWithGetCall({ |
| get: function(r, k) { key = k; return k === "a" ? onproxy : undefined }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? {value: onproxy, configurable: true} : undefined |
| } |
| @@ -165,43 +161,32 @@ TestWithGetCall({ |
| TestWithGetCall({ |
| get: function(r, k) { return this.get2(r, k) }, |
| get2: function(r, k) { key = k; return k === "a" ? onproxy : undefined }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? {value: onproxy, configurable: true} : undefined |
| } |
| }) |
| TestWithGetCall({ |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxy, configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGetCall({ |
| - getPropertyDescriptor: function(k) { return this.getPropertyDescriptor2(k) }, |
| - getPropertyDescriptor2: function(k) { |
| + get: function(r, k) { key = k; return k === "a" ? onproxy : undefined }, |
| + getOwnPropertyDescriptor: function(t, k) { |
| + return this.getOwnPropertyDescriptor2(k) |
| + }, |
| + getOwnPropertyDescriptor2: function(k) { |
| key = k; |
| return k === "a" ? {value: onproxy, configurable: true} : undefined |
| } |
| }) |
| TestWithGetCall({ |
| - getPropertyDescriptor: function(k) { |
| + get: function(r, k) { key = k; return k === "a" ? onproxy : undefined }, |
| + getOwnPropertyDescriptor: function(t, k) { |
| key = k; |
| return k === "a" ? |
| {get value() { return onproxy }, configurable: true} : undefined |
| } |
| }) |
| -TestWithGetCall({ |
| - get: undefined, |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxy, configurable: true} : undefined |
| - } |
| -}) |
| - |
| function TestWithGetCallThrow(handler) { |
| TestWithProxies(TestWithGetCallThrow2, handler) |
| @@ -230,50 +215,11 @@ function onproxythrow() { throw "myexn" } |
| TestWithGetCallThrow({ |
| get: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined }, |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxythrow, configurable: true} : undefined |
| - } |
| }) |
| TestWithGetCallThrow({ |
| get: function(r, k) { return this.get2(r, k) }, |
| get2: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined }, |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxythrow, configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGetCallThrow({ |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxythrow, configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGetCallThrow({ |
| - getPropertyDescriptor: function(k) { return this.getPropertyDescriptor2(k) }, |
| - getPropertyDescriptor2: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxythrow, configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGetCallThrow({ |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? |
| - {get value() { return onproxythrow }, configurable: true} : undefined |
| - } |
| -}) |
| - |
| -TestWithGetCallThrow({ |
| - get: undefined, |
| - getPropertyDescriptor: function(k) { |
| - key = k; |
| - return k === "a" ? {value: onproxythrow, configurable: true} : undefined |
| - } |
| }) |
| @@ -327,7 +273,7 @@ function TestWithSet2(create, handler, hasSetter) { |
| TestWithSet({ |
| set: function(r, k, v) { key = k; val = v; return true }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| } |
| }) |
| @@ -335,71 +281,52 @@ TestWithSet({ |
| TestWithSet({ |
| set: function(r, k, v) { return this.set2(r, k, v) }, |
| set2: function(r, k, v) { key = k; val = v; return true }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| } |
| }) |
| TestWithSet({ |
| - getPropertyDescriptor: function(k) { |
| - return this.getOwnPropertyDescriptor(k) |
| - }, |
| - getOwnPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| }, |
| - defineProperty: function(k, desc) { key = k; val = desc.value } |
| + defineProperty: function(t, k, desc) { key = k; val = desc.value } |
| }) |
| TestWithSet({ |
| - getOwnPropertyDescriptor: function(k) { |
| - return this.getPropertyDescriptor2(k) |
| + getOwnPropertyDescriptor: function(t, k) { |
| + return this.getOwnPropertyDescriptor2(k) |
| }, |
| - getPropertyDescriptor: function(k) { return this.getPropertyDescriptor2(k) }, |
| - getPropertyDescriptor2: function(k) { |
| + getOwnPropertyDescriptor2: function(k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| }, |
| - defineProperty: function(k, desc) { this.defineProperty2(k, desc) }, |
| + defineProperty: function(t, k, desc) { this.defineProperty2(k, desc) }, |
| defineProperty2: function(k, desc) { key = k; val = desc.value } |
| }) |
| TestWithSet({ |
| - getOwnPropertyDescriptor: function(k) { |
| - return this.getPropertyDescriptor(k) |
| - }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? |
| {get writable() { return true }, configurable: true} : undefined |
| }, |
| - defineProperty: function(k, desc) { key = k; val = desc.value } |
| + defineProperty: function(t, k, desc) { key = k; val = desc.value } |
| }) |
| TestWithSet({ |
| - getOwnPropertyDescriptor: function(k) { |
| - return this.getPropertyDescriptor(k) |
| - }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| + return this.getOwnPropertyDescriptor2(k) }, |
| + getOwnPropertyDescriptor2: function(k) { |
| return k === "a" ? |
| {set: function(v) { key = k; val = v }, configurable: true} : undefined |
| - } |
| -}, true) |
| - |
| -TestWithSet({ |
| - getOwnPropertyDescriptor: function(k) { |
| - return this.getPropertyDescriptor(k) |
| }, |
| - getPropertyDescriptor: function(k) { return this.getPropertyDescriptor2(k) }, |
| - getPropertyDescriptor2: function(k) { |
| - return k === "a" ? |
| - {set: function(v) { key = k; val = v }, configurable: true} : undefined |
| - } |
| + set: function(t, k, v) { key = k; val = v; return true } |
| }, true) |
| TestWithSet({ |
| - getOwnPropertyDescriptor: function(k) { return null }, |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| }, |
| - defineProperty: function(k, desc) { key = k; val = desc.value } |
| + defineProperty: function(t, k, desc) { key = k; val = desc.value } |
| }) |
| @@ -426,26 +353,31 @@ function TestWithSetThrow2(create, handler, hasSetter) { |
| } |
| TestWithSetThrow({ |
| - set: function(r, k, v) { throw "myexn" }, |
| - getPropertyDescriptor: function(k) { |
| + set: function() { throw "myexn" }, |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| } |
| }) |
| TestWithSetThrow({ |
| - getPropertyDescriptor: function(k) { throw "myexn" }, |
| + getOwnPropertyDescriptor: function() { throw "myexn" }, |
| }) |
| TestWithSetThrow({ |
| - getPropertyDescriptor: function(k) { |
| + has: function() { throw "myexn" }, |
| +}) |
| + |
| +TestWithSetThrow({ |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? {writable: true, configurable: true} : undefined |
| }, |
| - defineProperty: function(k, desc) { throw "myexn" } |
| + defineProperty: function() { throw "myexn" } |
| }) |
| TestWithSetThrow({ |
| - getPropertyDescriptor: function(k) { |
| + getOwnPropertyDescriptor: function(t, k) { |
| return k === "a" ? |
| {set: function() { throw "myexn" }, configurable: true} : undefined |
| - } |
| + }, |
| + defineProperty: function() { throw "myexn" } |
| }, true) |