Index: test/mjsunit/es7/object-observe.js |
diff --git a/test/mjsunit/es7/object-observe.js b/test/mjsunit/es7/object-observe.js |
index 0aa3601d73bddd93769d38f256a7798363265c5d..8ec22bceba701c6841ff7657de9dacee2168201f 100644 |
--- a/test/mjsunit/es7/object-observe.js |
+++ b/test/mjsunit/es7/object-observe.js |
@@ -113,6 +113,8 @@ Object.defineProperty(changeRecordWithAccessor, 'name', { |
// Object.observe |
assertThrows(function() { Object.observe("non-object", observer.callback); }, |
TypeError); |
+assertThrows(function() { Object.observe(this, observer.callback); }, |
+ TypeError); |
assertThrows(function() { Object.observe(obj, nonFunction); }, TypeError); |
assertThrows(function() { Object.observe(obj, frozenFunction); }, TypeError); |
assertEquals(obj, Object.observe(obj, observer.callback, [1])); |
@@ -127,6 +129,8 @@ assertEquals(obj, Object.observe(obj, observer.callback)); |
// Object.unobserve |
assertThrows(function() { Object.unobserve(4, observer.callback); }, TypeError); |
+assertThrows(function() { Object.unobserve(this, observer.callback); }, |
+ TypeError); |
assertThrows(function() { Object.unobserve(obj, nonFunction); }, TypeError); |
assertEquals(obj, Object.unobserve(obj, observer.callback)); |
@@ -135,6 +139,7 @@ assertEquals(obj, Object.unobserve(obj, observer.callback)); |
var notifier = Object.getNotifier(obj); |
assertSame(notifier, Object.getNotifier(obj)); |
assertEquals(null, Object.getNotifier(Object.freeze({}))); |
+assertThrows(function() { Object.getNotifier(this) }, TypeError); |
assertFalse(notifier.hasOwnProperty('notify')); |
assertEquals([], Object.keys(notifier)); |
var notifyDesc = Object.getOwnPropertyDescriptor(notifier.__proto__, 'notify'); |
@@ -1074,6 +1079,8 @@ function TestObserveNonConfigurable(obj, prop, desc) { |
Object.unobserve(obj, observer.callback); |
} |
+// TODO(rafaelw) Enable when ES6 Proxies are implemented |
+/* |
function createProxy(create, x) { |
var handler = { |
getPropertyDescriptor: function(k) { |
@@ -1113,11 +1120,11 @@ function createProxy(create, x) { |
Object.observe(handler.target, handler.callback); |
return handler.proxy = create(handler, x); |
} |
+*/ |
var objects = [ |
{}, |
[], |
- this, // global object |
function(){}, |
(function(){ return arguments })(), |
(function(){ "use strict"; return arguments })(), |
@@ -1125,9 +1132,10 @@ var objects = [ |
new Date(), |
Object, Function, Date, RegExp, |
new Set, new Map, new WeakMap, |
- new ArrayBuffer(10), new Int32Array(5), |
- createProxy(Proxy.create, null), |
- createProxy(Proxy.createFunction, function(){}), |
+ new ArrayBuffer(10), new Int32Array(5) |
+// TODO(rafaelw) Enable when ES6 Proxies are implemented. |
+// createProxy(Proxy.create, null), |
+// createProxy(Proxy.createFunction, function(){}), |
]; |
var properties = ["a", "1", 1, "length", "setPrototype", "name", "caller"]; |