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

Unified Diff: src/object-observe.js

Issue 47703003: Make Object.freeze/seal/preventExtensions observable (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: formatting Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/object-observe.js
diff --git a/src/object-observe.js b/src/object-observe.js
index 9c7ac3889eb573b04ae6c4612dc5d4791174fda0..a4761e488098cddda2344d91777ca7b28506c11a 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -132,7 +132,8 @@ var defaultAcceptTypes = TypeMapCreateFromList([
'updated',
'deleted',
'prototype',
- 'reconfigured'
+ 'reconfigured',
+ 'preventExtensions'
]);
// An Observer is a registration to observe an object by a callback with
@@ -443,9 +444,20 @@ function NotifyChange(type, object, name, oldValue) {
if (!ObjectInfoHasActiveObservers(objectInfo))
return;
- var changeRecord = (arguments.length < 4) ?
- { type: type, object: object, name: name } :
- { type: type, object: object, name: name, oldValue: oldValue };
+ var changeRecord;
+ if (arguments.length == 2) {
arv (Not doing code reviews) 2013/10/29 21:58:18 This is tangential but ES does not usually use the
rafaelw 2013/10/30 17:54:37 (talked with arv off-line). This is internal-only
+ changeRecord = { type: type, object: object };
+ } else if (arguments.length == 3) {
+ changeRecord = { type: type, object: object, name: name };
+ } else {
+ changeRecord = {
+ type: type,
+ object: object,
+ name: name,
+ oldValue: oldValue
+ };
+ }
+
ObjectFreeze(changeRecord);
ObjectInfoEnqueueChangeRecord(objectInfo, changeRecord);
}
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698