Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/object-observe.js

Issue 1346813002: Disallow Object.observe calls on access-checked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add new error message and tests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/messages.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var $observeEnqueueSpliceRecord; 5 var $observeEnqueueSpliceRecord;
6 var $observeBeginPerformSplice; 6 var $observeBeginPerformSplice;
7 var $observeEndPerformSplice; 7 var $observeEndPerformSplice;
8 8
9 var $observeObjectMethods; 9 var $observeObjectMethods;
10 var $observeArrayMethods; 10 var $observeArrayMethods;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 return callbackInfo; 382 return callbackInfo;
383 } 383 }
384 384
385 385
386 function ObjectObserve(object, callback, acceptList) { 386 function ObjectObserve(object, callback, acceptList) {
387 if (!IS_SPEC_OBJECT(object)) 387 if (!IS_SPEC_OBJECT(object))
388 throw MakeTypeError(kObserveNonObject, "observe", "observe"); 388 throw MakeTypeError(kObserveNonObject, "observe", "observe");
389 if (%IsJSGlobalProxy(object)) 389 if (%IsJSGlobalProxy(object))
390 throw MakeTypeError(kObserveGlobalProxy, "observe"); 390 throw MakeTypeError(kObserveGlobalProxy, "observe");
391 if (%IsAccessCheckNeeded(object))
392 throw MakeTypeError(kObserveAccessChecked, "observe");
391 if (!IS_CALLABLE(callback)) 393 if (!IS_CALLABLE(callback))
392 throw MakeTypeError(kObserveNonFunction, "observe"); 394 throw MakeTypeError(kObserveNonFunction, "observe");
393 if (ObjectIsFrozen(callback)) 395 if (ObjectIsFrozen(callback))
394 throw MakeTypeError(kObserveCallbackFrozen); 396 throw MakeTypeError(kObserveCallbackFrozen);
395 397
396 var objectObserveFn = %GetObjectContextObjectObserve(object); 398 var objectObserveFn = %GetObjectContextObjectObserve(object);
397 return objectObserveFn(object, callback, acceptList); 399 return objectObserveFn(object, callback, acceptList);
398 } 400 }
399 401
400 402
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (IS_SPEC_OBJECT(changeRecord)) 611 if (IS_SPEC_OBJECT(changeRecord))
610 ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, changeType); 612 ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, changeType);
611 } 613 }
612 614
613 615
614 function ObjectGetNotifier(object) { 616 function ObjectGetNotifier(object) {
615 if (!IS_SPEC_OBJECT(object)) 617 if (!IS_SPEC_OBJECT(object))
616 throw MakeTypeError(kObserveNonObject, "getNotifier", "getNotifier"); 618 throw MakeTypeError(kObserveNonObject, "getNotifier", "getNotifier");
617 if (%IsJSGlobalProxy(object)) 619 if (%IsJSGlobalProxy(object))
618 throw MakeTypeError(kObserveGlobalProxy, "getNotifier"); 620 throw MakeTypeError(kObserveGlobalProxy, "getNotifier");
621 if (%IsAccessCheckNeeded(object))
622 throw MakeTypeError(kObserveAccessChecked, "getNotifier");
619 623
620 if (ObjectIsFrozen(object)) return null; 624 if (ObjectIsFrozen(object)) return null;
621 625
622 if (!%ObjectWasCreatedInCurrentOrigin(object)) return null; 626 if (!%ObjectWasCreatedInCurrentOrigin(object)) return null;
623 627
624 var getNotifierFn = %GetObjectContextObjectGetNotifier(object); 628 var getNotifierFn = %GetObjectContextObjectGetNotifier(object);
625 return getNotifierFn(object); 629 return getNotifierFn(object);
626 } 630 }
627 631
628 632
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 "native_object_get_notifier", NativeObjectGetNotifier, 711 "native_object_get_notifier", NativeObjectGetNotifier,
708 "native_object_notifier_perform_change", NativeObjectNotifierPerformChange, 712 "native_object_notifier_perform_change", NativeObjectNotifierPerformChange,
709 "native_object_observe", NativeObjectObserve, 713 "native_object_observe", NativeObjectObserve,
710 "observers_begin_perform_splice", BeginPerformSplice, 714 "observers_begin_perform_splice", BeginPerformSplice,
711 "observers_end_perform_splice", EndPerformSplice, 715 "observers_end_perform_splice", EndPerformSplice,
712 "observers_enqueue_splice", EnqueueSpliceRecord, 716 "observers_enqueue_splice", EnqueueSpliceRecord,
713 "observers_notify_change", NotifyChange, 717 "observers_notify_change", NotifyChange,
714 ]); 718 ]);
715 719
716 }) 720 })
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698