Revision: 12950
Author: [email protected]
Date: Tue Nov 13 07:50:59 2012
Log: Object.unobserve(obj, callback) now throws a TypeError when
callback is not a function.
Review URL: https://codereview.chromium.org/11293248
Patch from Rafael Weinstein <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12950
Modified:
/branches/bleeding_edge/src/object-observe.js
/branches/bleeding_edge/test/mjsunit/harmony/object-observe.js
=======================================
--- /branches/bleeding_edge/src/object-observe.js Fri Nov 9 08:14:42 2012
+++ /branches/bleeding_edge/src/object-observe.js Tue Nov 13 07:50:59 2012
@@ -100,6 +100,8 @@
function ObjectUnobserve(object, callback) {
if (!IS_SPEC_OBJECT(object))
throw MakeTypeError("observe_non_object", ["unobserve"]);
+ if (!IS_SPEC_FUNCTION(callback))
+ throw MakeTypeError("observe_non_function", ["unobserve"]);
var objectInfo = objectInfoMap.get(object);
if (IS_UNDEFINED(objectInfo))
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/object-observe.js Fri Nov
9 08:14:42 2012
+++ /branches/bleeding_edge/test/mjsunit/harmony/object-observe.js Tue Nov
13 07:50:59 2012
@@ -100,6 +100,7 @@
// Object.unobserve
assertThrows(function() { Object.unobserve(4, observer.callback); },
TypeError);
+assertThrows(function() { Object.unobserve(obj, nonFunction); },
TypeError);
// Object.getNotifier
var notifier = Object.getNotifier(obj);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev