mozilla / self-repair-server

This project is now EOL, replaced by Normandy Recipe Server.
6 stars 11 forks source link

Make LStore robust to accessor issues by using a proxy. #200

Closed gregglind closed 8 years ago

gregglind commented 8 years ago

In a previous code this is this TODO:

proxy so that Lstore saves on changes to Data. I wonder about that and how far down the rabbit hole to go.

it.todo('proxy s.t. set saves', function () {
gregglind commented 8 years ago

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy


// throws in strict mode
var A = Object.preventExtensions({data: 1});  

var handler = { get:  function (target, name) { if (name in target) { return target[name] } else { throw new Error("oh no")}}};
var p = new Proxy(A, handler)

p.wut   // throws
gregglind commented 8 years ago

For now at least, not going to make the 'data' into a smart object. Too 'weird'.

ghost commented 8 years ago

r+, everything looks good to me, tested locally