JavaScriptで次のようなものがあるとします。
var obj = { name: "Luis" };
Object.seal( obj );
obj.address = "Fx"; //what should happen here?
それで、正しい振る舞いは何ですか?strictモードではないので、obj.address行は単に無視されると思いました。ただし、Chromeをスローするため、そうではありません。私はV8のテストを見ていますが、厳密モードでのみスローする必要があるようです。
object.sealテストコード: http ://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/object-seal.js?spec = svn7379&r = 7379
そのファイルのコードは次のとおりです。
Object.seal(obj);
// Make sure we are no longer extensible.
assertFalse(Object.isExtensible(obj));
assertTrue(Object.isSealed(obj));
// We should not be frozen, since we are still able to
// update values.
assertFalse(Object.isFrozen(obj));
// We should not allow new properties to be added.
obj.foo = 42;
assertEquals(obj.foo, undefined);
ところで、厳密モードからのテストがあり、私の例では明らかにスローされます:http ://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/strict-mode.js?spec = svn7250&r = 7250
何か案は?