Commit 36c3d015 authored by rossberg@chromium.org's avatar rossberg@chromium.org

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 <rafaelw@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12950 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dcb6abd4
......@@ -100,6 +100,8 @@ function ObjectObserve(object, callback) {
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))
......
......@@ -100,6 +100,7 @@ assertThrows(function() { Object.observe(obj, frozenFunction); }, TypeError);
// Object.unobserve
assertThrows(function() { Object.unobserve(4, observer.callback); }, TypeError);
assertThrows(function() { Object.unobserve(obj, nonFunction); }, TypeError);
// Object.getNotifier
var notifier = Object.getNotifier(obj);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment