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

Unified Diff: src/object-observe.js

Issue 11377171: Object.observe: Use [[DefineOwnProperty]] to create properties of changeRecord (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: formatting Created 8 years, 1 month 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 | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »
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 1b0a491a03215765b07ea6a9efa3a0988871daa0..ea5de1f6e5b2b5e538a95890e392cbcbd10ac2a7 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -27,9 +27,6 @@
"use strict";
-var InternalObjectIsFrozen = $Object.isFrozen;
-var InternalObjectFreeze = $Object.freeze;
-
var observationState = %GetObservationState();
if (IS_UNDEFINED(observationState.observerInfoMap)) {
observationState.observerInfoMap = %CreateObjectHashTable();
@@ -74,7 +71,7 @@ function ObjectObserve(object, callback) {
throw MakeTypeError("observe_non_object", ["observe"]);
if (!IS_SPEC_FUNCTION(callback))
throw MakeTypeError("observe_non_function", ["observe"]);
- if (InternalObjectIsFrozen(callback))
+ if (ObjectIsFrozen(callback))
throw MakeTypeError("observe_callback_frozen");
if (!observerInfoMap.has(callback)) {
@@ -134,7 +131,7 @@ function NotifyChange(type, object, name, oldValue) {
var changeRecord = (arguments.length < 4) ?
{ type: type, object: object, name: name } :
{ type: type, object: object, name: name, oldValue: oldValue };
- InternalObjectFreeze(changeRecord);
+ ObjectFreeze(changeRecord);
EnqueueChangeRecord(changeRecord, objectInfo.changeObservers);
}
@@ -164,9 +161,11 @@ function ObjectNotifierNotify(changeRecord) {
for (var prop in changeRecord) {
if (prop === 'object')
continue;
- newRecord[prop] = changeRecord[prop];
+
+ %DefineOrRedefineDataProperty(newRecord, prop, changeRecord[prop],
+ READ_ONLY + DONT_DELETE);
}
- InternalObjectFreeze(newRecord);
+ ObjectFreeze(newRecord);
EnqueueChangeRecord(newRecord, objectInfo.changeObservers);
}
@@ -175,7 +174,7 @@ function ObjectGetNotifier(object) {
if (!IS_SPEC_OBJECT(object))
throw MakeTypeError("observe_non_object", ["getNotifier"]);
- if (InternalObjectIsFrozen(object))
+ if (ObjectIsFrozen(object))
return null;
var objectInfo = objectInfoMap.get(object);
« no previous file with comments | « no previous file | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698