Reviewers: rossberg,
Description:
Update behavior of inspection of |acceptList| during Object.observe:
1) Allow implicit conversion of acceptList values to string
2) Disallow empty acceptList
R=rossberg
BUG=
Please review this at https://codereview.chromium.org/23464058/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+11, -14 lines):
M src/object-observe.js
M test/mjsunit/harmony/object-observe.js
Index: src/object-observe.js
diff --git a/src/object-observe.js b/src/object-observe.js
index
81385c3f9a6a11cb651241a53ec157f8051e0e53..548ed620962bfcea958f05aa4b74631c53ad5118
100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -281,14 +281,9 @@ function AcceptArgIsValid(arg) {
if (!IS_SPEC_OBJECT(arg) ||
!IS_NUMBER(arg.length) ||
- arg.length < 0)
+ arg.length <= 0)
return false;
- var length = arg.length;
- for (var i = 0; i < length; i++) {
- if (!IS_STRING(arg[i]))
- return false;
- }
return true;
}
Index: test/mjsunit/harmony/object-observe.js
diff --git a/test/mjsunit/harmony/object-observe.js
b/test/mjsunit/harmony/object-observe.js
index
830eb1b09a2159fb5d24ae8a785fc5d352383cd5..6b86a17a3eecf784e7e61b1377cfc5ec343e8e77
100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -110,15 +110,17 @@
Object.defineProperty(changeRecordWithAccessor, 'name', {
// Object.observe
-assertThrows(function() { Object.observe("non-object", observer.callback);
}, TypeError);
+assertThrows(function() { Object.observe("non-object", observer.callback);
},
+ TypeError);
assertThrows(function() { Object.observe(obj, nonFunction); }, TypeError);
assertThrows(function() { Object.observe(obj, frozenFunction); },
TypeError);
-assertThrows(function() { Object.observe(obj, function() {}, 1); },
TypeError);
-assertThrows(function() { Object.observe(obj, function() {}, [undefined]);
}, TypeError);
-assertThrows(function() { Object.observe(obj, function() {}, [1]); },
TypeError);
-assertThrows(function() { Object.observe(obj, function() {}, ['foo',
null]); }, TypeError);
-assertEquals(obj, Object.observe(obj, observer.callback,
['foo', 'bar', 'baz']));
-assertEquals(obj, Object.observe(obj, observer.callback, []));
+assertThrows(function() { Object.observe(obj, function() {}, []); },
TypeError);
+assertEquals(obj, Object.observe(obj, observer.callback, [1]));
+assertEquals(obj, Object.observe(obj, observer.callback, [true]));
+assertEquals(obj, Object.observe(obj, observer.callback, ['foo', null]));
+assertEquals(obj, Object.observe(obj, observer.callback, [undefined]));
+assertEquals(obj, Object.observe(obj, observer.callback,
+ ['foo', 'bar', 'baz']));
assertEquals(obj, Object.observe(obj, observer.callback, undefined));
assertEquals(obj, Object.observe(obj, observer.callback));
@@ -312,7 +314,7 @@ observer.assertCallbackRecords([
// Accept
reset();
-Object.observe(obj, observer.callback, []);
+Object.observe(obj, observer.callback, ['somethingElse']);
Object.getNotifier(obj).notify({
type: 'new'
});
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.