if (!AcceptArgIsValid(acceptList))
throw MakeTypeError("observe_accept_invalid");
- return %NativeObjectObserve(object, callback, acceptList);
+ return %ObjectObserveInObjectContext(object, callback, acceptList);
}
function NativeObjectObserve(object, callback, acceptList) {
if (!IS_SPEC_FUNCTION(changeFn))
throw MakeTypeError("observe_perform_non_function");
- return %NativeObjectNotifierPerformChange(objectInfo, changeType, changeFn)
+ return %ObjectNotifierPerformChangeInObjectContext(
+ objectInfo, changeType, changeFn);
}
function NativeObjectNotifierPerformChange(objectInfo, changeType, changeFn) {
if (!%ObjectWasCreatedInCurrentOrigin(object)) return null;
- return %NativeObjectGetNotifier(object);
+ return %ObjectGetNotifierInObjectContext(object);
}
function NativeObjectGetNotifier(object) {
}
-RUNTIME_FUNCTION(Runtime_NativeObjectObserve) {
+RUNTIME_FUNCTION(Runtime_ObjectObserveInObjectContext) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, callback, 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, accept, 2);
+ RUNTIME_ASSERT(accept->IsUndefined() || accept->IsJSObject());
Handle<Context> context(object->GetCreationContext(), isolate);
Handle<JSFunction> function(context->native_object_observe(), isolate);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, function,
- handle(context->object_function(), isolate), 3, call_args, true));
+ handle(context->object_function(), isolate),
+ ARRAY_SIZE(call_args), call_args, true));
return *result;
}
-RUNTIME_FUNCTION(Runtime_NativeObjectGetNotifier) {
+RUNTIME_FUNCTION(Runtime_ObjectGetNotifierInObjectContext) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, function,
- handle(context->object_function(), isolate), 1, call_args, true));
+ handle(context->object_function(), isolate),
+ ARRAY_SIZE(call_args), call_args, true));
return *result;
}
-RUNTIME_FUNCTION(Runtime_NativeObjectNotifierPerformChange) {
+RUNTIME_FUNCTION(Runtime_ObjectNotifierPerformChangeInObjectContext) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, change_type, 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, change_fn, 2);
+ CONVERT_ARG_HANDLE_CHECKED(String, change_type, 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, change_fn, 2);
Handle<Context> context(object_info->GetCreationContext(), isolate);
Handle<JSFunction> function(context->native_object_notifier_perform_change(),
isolate);
- Handle<Object> call_args[] = { change_type, change_fn };
+ Handle<Object> call_args[] = { object_info, change_type, change_fn };
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, function, isolate->factory()->undefined_value(),
- 2, call_args, true));
+ ARRAY_SIZE(call_args), call_args, true));
return *result;
}
F(ObservationWeakMapCreate, 0, 1) \
F(ObserverObjectAndRecordHaveSameOrigin, 3, 1) \
F(ObjectWasCreatedInCurrentOrigin, 1, 1) \
- F(NativeObjectObserve, 3, 1) \
- F(NativeObjectGetNotifier, 1, 1) \
+ F(ObjectObserveInObjectContext, 3, 1) \
+ F(ObjectGetNotifierInObjectContext, 1, 1) \
+ F(ObjectNotifierPerformChangeInObjectContext, 3, 1) \
\
/* Harmony typed arrays */ \
F(ArrayBufferInitialize, 2, 1)\
context->SetSecurityToken(foo);
CompileRun("var obj = {};");
Handle<Value> object = CompileRun("obj");
+ Handle<Value> notifier = CompileRun("Object.getNotifier(obj)");
{
HandleScope scope(CcTest::isolate());
LocalContext context2(CcTest::isolate());
context2->SetSecurityToken(foo);
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
object);
- CompileRun("var n = Object.getNotifier(obj);"
- "n.performChange('foo', function() {});");
+ context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "notifier"),
+ notifier);
+ CompileRun("var obj2 = {};"
+ "var notifier2 = Object.getNotifier(obj2);"
+ "notifier2.performChange.call("
+ "notifier, 'foo', function(){})");
}
v8::V8::ContextDisposedNotification();