Commit e059e64c authored by rossberg@chromium.org's avatar rossberg@chromium.org

Object.observe: include oldValue in change records,

plus more accurate distinction of different change types.

Required handlifying more code.

Also fixed a handlification bug in JSProxy::GetElementAttributeWithHandler.

R=verwaest@chromium.org
BUG=

Review URL: https://codereview.chromium.org/11362115

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12888 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 101d64c1
...@@ -5088,6 +5088,7 @@ PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { ...@@ -5088,6 +5088,7 @@ PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) {
return GetPropertyAttributeWithReceiver(this, key); return GetPropertyAttributeWithReceiver(this, key);
} }
// TODO(504): this may be useful in other places too where JSGlobalProxy // TODO(504): this may be useful in other places too where JSGlobalProxy
// is used. // is used.
Object* JSObject::BypassGlobalProxy() { Object* JSObject::BypassGlobalProxy() {
......
This diff is collapsed.
...@@ -1499,10 +1499,10 @@ class JSReceiver: public HeapObject { ...@@ -1499,10 +1499,10 @@ class JSReceiver: public HeapObject {
Smi* GenerateIdentityHash(); Smi* GenerateIdentityHash();
private: private:
PropertyAttributes GetPropertyAttribute(JSReceiver* receiver, PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver,
LookupResult* result, LookupResult* result,
String* name, String* name,
bool continue_search); bool continue_search);
DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
}; };
......
...@@ -290,7 +290,7 @@ class LookupResult BASE_EMBEDDED { ...@@ -290,7 +290,7 @@ class LookupResult BASE_EMBEDDED {
case CONSTANT_FUNCTION: case CONSTANT_FUNCTION:
return GetConstantFunction(); return GetConstantFunction();
default: default:
return Smi::FromInt(0); return Isolate::Current()->heap()->the_hole_value();
} }
} }
......
...@@ -250,26 +250,39 @@ obj.a = 2; ...@@ -250,26 +250,39 @@ obj.a = 2;
obj["a"] = 3; obj["a"] = 3;
delete obj.a; delete obj.a;
obj.a = 4; obj.a = 4;
obj.a = 4; // ignored
obj.a = 5; obj.a = 5;
Object.defineProperty(obj, "a", {value: 6}); Object.defineProperty(obj, "a", {value: 6});
Object.defineProperty(obj, "a", {writable: false}); Object.defineProperty(obj, "a", {writable: false});
obj.a = 7; // ignored obj.a = 7; // ignored
Object.defineProperty(obj, "a", {value: 8}); Object.defineProperty(obj, "a", {value: 8});
Object.defineProperty(obj, "a", {value: 7, writable: true});
Object.defineProperty(obj, "a", {get: function() {}}); Object.defineProperty(obj, "a", {get: function() {}});
delete obj.a;
Object.defineProperty(obj, "a", {get: function() {}}); Object.defineProperty(obj, "a", {get: function() {}});
delete obj.a;
delete obj.a;
Object.defineProperty(obj, "a", {get: function() {}, configurable: true});
Object.defineProperty(obj, "a", {value: 9, writable: true});
obj.a = 10;
delete obj.a;
Object.defineProperty(obj, "a", {value: 11, configurable: true});
Object.deliverChangeRecords(observer.callback); Object.deliverChangeRecords(observer.callback);
// TODO(observe): oldValue not included yet.
observer.assertCallbackRecords([ observer.assertCallbackRecords([
{ object: obj, name: "a", type: "updated" }, { object: obj, name: "a", type: "updated", oldValue: 1 },
{ object: obj, name: "a", type: "updated" }, { object: obj, name: "a", type: "updated", oldValue: 2 },
{ object: obj, name: "a", type: "deleted" }, { object: obj, name: "a", type: "deleted", oldValue: 3 },
{ object: obj, name: "a", type: "new" }, { object: obj, name: "a", type: "new" },
{ object: obj, name: "a", type: "updated" }, { object: obj, name: "a", type: "updated", oldValue: 4 },
{ object: obj, name: "a", type: "updated" }, { object: obj, name: "a", type: "updated", oldValue: 5 },
{ object: obj, name: "a", type: "reconfigured" }, { object: obj, name: "a", type: "reconfigured", oldValue: 6 },
{ object: obj, name: "a", type: "updated" }, { object: obj, name: "a", type: "updated", oldValue: 6 },
{ object: obj, name: "a", type: "reconfigured", oldValue: 8 },
{ object: obj, name: "a", type: "reconfigured", oldValue: 7 },
{ object: obj, name: "a", type: "reconfigured" }, { object: obj, name: "a", type: "reconfigured" },
{ object: obj, name: "a", type: "deleted" }, { object: obj, name: "a", type: "deleted" },
{ object: obj, name: "a", type: "new" }, { object: obj, name: "a", type: "new" },
{ object: obj, name: "a", type: "reconfigured" },
{ object: obj, name: "a", type: "updated", oldValue: 9 },
{ object: obj, name: "a", type: "deleted", oldValue: 10 },
{ object: obj, name: "a", type: "new" },
]); ]);
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