Lines Matching refs:obj

96 var obj = {};  variable
117 assertThrows(function() { Object.observe(obj, nonFunction); }, TypeError);
118 assertThrows(function() { Object.observe(obj, frozenFunction); }, TypeError);
119 assertEquals(obj, Object.observe(obj, observer.callback, [1]));
120 assertEquals(obj, Object.observe(obj, observer.callback, [true]));
121 assertEquals(obj, Object.observe(obj, observer.callback, ['foo', null]));
122 assertEquals(obj, Object.observe(obj, observer.callback, [undefined]));
123 assertEquals(obj, Object.observe(obj, observer.callback,
125 assertEquals(obj, Object.observe(obj, observer.callback, []));
126 assertEquals(obj, Object.observe(obj, observer.callback, undefined));
127 assertEquals(obj, Object.observe(obj, observer.callback));
133 assertThrows(function() { Object.unobserve(obj, nonFunction); }, TypeError);
134 assertEquals(obj, Object.unobserve(obj, observer.callback));
138 var notifier = Object.getNotifier(obj);
139 assertSame(notifier, Object.getNotifier(obj));
175 Object.observe(obj, observer.callback);
209 { object: obj, name: 'foo', type: 'update', expando: 1 },
210 { object: obj, name: 'bar', type: 'delete', expando2: 'str' }
215 Object.observe(obj, observer.callback, [true, 1, null, undefined]);
216 notifier = Object.getNotifier(obj);
227 { object: obj, type: 'true' },
228 { object: obj, type: '1' },
229 { object: obj, type: 'null' },
230 { object: obj, type: 'undefined' }
241 Object.observe(obj, observer.callback);
242 Object.observe(obj, observer.callback);
243 Object.getNotifier(obj).notify({
252 Object.unobserve(obj, observer.callback);
253 Object.getNotifier(obj).notify({
262 Object.unobserve(obj, observer.callback);
263 Object.unobserve(obj, observer.callback);
264 Object.getNotifier(obj).notify({
273 Object.getNotifier(obj).notify({
276 Object.observe(obj, observer.callback);
277 Object.getNotifier(obj).notify({
286 var obj = {};
287 Object.getNotifier(obj);
288 Object.observe(obj, observer.callback);
289 obj.id = 1;
292 { object: obj, type: 'add', name: 'id' },
297 var obj = {};
298 Object.observe(obj, observer.callback);
299 obj[''] = '';
300 obj[''] = ' ';
301 delete obj[''];
304 { object: obj, type: 'add', name: '' },
305 { object: obj, type: 'update', name: '', oldValue: '' },
306 { object: obj, type: 'delete', name: '', oldValue: ' ' },
311 var obj = { foo: 'bar'}; variable
312 Object.observe(obj, observer.callback);
313 obj.baz = 'bat';
314 Object.preventExtensions(obj);
318 { object: obj, type: 'add', name: 'baz' },
319 { object: obj, type: 'preventExtensions' },
323 var obj = { foo: 'bar'}; variable
324 Object.preventExtensions(obj);
325 Object.observe(obj, observer.callback);
326 Object.preventExtensions(obj);
332 var obj = { a: 'a' }; variable
333 Object.defineProperty(obj, 'b', {
338 Object.defineProperty(obj, 'c', {
343 Object.defineProperty(obj, 'd', {
348 Object.observe(obj, observer.callback);
349 Object.freeze(obj);
353 { object: obj, type: 'preventExtensions' },
354 { object: obj, type: 'reconfigure', name: 'a' },
355 { object: obj, type: 'reconfigure', name: 'b' },
356 { object: obj, type: 'reconfigure', name: 'c' },
360 var obj = { foo: 'bar'}; variable
361 Object.freeze(obj);
362 Object.observe(obj, observer.callback);
363 Object.freeze(obj);
369 var obj = { a: 'a' }; variable
370 Object.defineProperty(obj, 'b', {
375 Object.defineProperty(obj, 'c', {
380 Object.defineProperty(obj, 'd', {
385 Object.observe(obj, observer.callback);
386 Object.seal(obj);
390 { object: obj, type: 'preventExtensions' },
391 { object: obj, type: 'reconfigure', name: 'a' },
392 { object: obj, type: 'reconfigure', name: 'b' },
396 var obj = { foo: 'bar'}; variable
397 Object.seal(obj);
398 Object.observe(obj, observer.callback);
399 Object.seal(obj);
405 var obj = {};
406 Object.observe(obj, observer.callback);
407 Object.getNotifier(obj).notify({
412 Object.unobserve(obj, observer.callback);
413 Object.getNotifier(obj).notify({
418 Object.observe(obj, observer.callback);
419 Object.getNotifier(obj).notify({
424 Object.unobserve(obj, observer.callback);
425 Object.getNotifier(obj).notify({
430 Object.observe(obj, observer.callback);
431 Object.getNotifier(obj).notify({
436 Object.unobserve(obj, observer.callback);
439 { object: obj, type: 'update', val: 1 },
440 { object: obj, type: 'update', val: 3 },
441 { object: obj, type: 'update', val: 5 }
446 Object.observe(obj, observer.callback, ['somethingElse']);
447 Object.getNotifier(obj).notify({
450 Object.getNotifier(obj).notify({
453 Object.getNotifier(obj).notify({
456 Object.getNotifier(obj).notify({
459 Object.getNotifier(obj).notify({
466 Object.observe(obj, observer.callback, ['add', 'delete', 'setPrototype']);
467 Object.getNotifier(obj).notify({
470 Object.getNotifier(obj).notify({
473 Object.getNotifier(obj).notify({
476 Object.getNotifier(obj).notify({
479 Object.getNotifier(obj).notify({
482 Object.getNotifier(obj).notify({
487 { object: obj, type: 'add' },
488 { object: obj, type: 'delete' },
489 { object: obj, type: 'delete' },
490 { object: obj, type: 'setPrototype' }
494 Object.observe(obj, observer.callback, ['update', 'foo']);
495 Object.getNotifier(obj).notify({
498 Object.getNotifier(obj).notify({
501 Object.getNotifier(obj).notify({
504 Object.getNotifier(obj).notify({
507 Object.getNotifier(obj).notify({
510 Object.getNotifier(obj).notify({
515 { object: obj, type: 'update' },
516 { object: obj, type: 'foo' },
517 { object: obj, type: 'foo' }
793 Object.observe(obj, observer.callback);
796 Object.getNotifier(obj).notify({
808 { object: obj, type: 'add' },
815 var obj = {a: 1}; variable
820 if (r[0].oldValue < 100) ++obj[r[0].name];
822 Object.observe(obj, recursiveObserver);
823 ++obj.a;
846 var obj = {a: 1} variable
847 Object.observe(obj, observer.callback);
848 obj.a = 2;
849 obj["a"] = 3;
850 delete obj.a;
851 obj.a = 4;
852 obj.a = 4; // ignored
853 obj.a = 5;
854 Object.defineProperty(obj, "a", {value: 6});
855 Object.defineProperty(obj, "a", {writable: false});
856 obj.a = 7; // ignored
857 Object.defineProperty(obj, "a", {value: 8});
858 Object.defineProperty(obj, "a", {value: 7, writable: true});
859 Object.defineProperty(obj, "a", {get: function() {}});
860 Object.defineProperty(obj, "a", {get: frozenFunction});
861 Object.defineProperty(obj, "a", {get: frozenFunction}); // ignored
862 Object.defineProperty(obj, "a", {get: frozenFunction, set: frozenFunction});
863 Object.defineProperty(obj, "a", {set: frozenFunction}); // ignored
864 Object.defineProperty(obj, "a", {get: undefined, set: frozenFunction});
865 delete obj.a;
866 delete obj.a;
867 Object.defineProperty(obj, "a", {get: function() {}, configurable: true});
868 Object.defineProperty(obj, "a", {value: 9, writable: true});
869 obj.a = 10;
870 ++obj.a;
871 obj.a++;
872 obj.a *= 3;
873 delete obj.a;
874 Object.defineProperty(obj, "a", {value: 11, configurable: true});
877 { object: obj, name: "a", type: "update", oldValue: 1 },
878 { object: obj, name: "a", type: "update", oldValue: 2 },
879 { object: obj, name: "a", type: "delete", oldValue: 3 },
880 { object: obj, name: "a", type: "add" },
881 { object: obj, name: "a", type: "update", oldValue: 4 },
882 { object: obj, name: "a", type: "update", oldValue: 5 },
883 { object: obj, name: "a", type: "reconfigure" },
884 { object: obj, name: "a", type: "update", oldValue: 6 },
885 { object: obj, name: "a", type: "reconfigure", oldValue: 8 },
886 { object: obj, name: "a", type: "reconfigure", oldValue: 7 },
887 { object: obj, name: "a", type: "reconfigure" },
888 { object: obj, name: "a", type: "reconfigure" },
889 { object: obj, name: "a", type: "reconfigure" },
890 { object: obj, name: "a", type: "delete" },
891 { object: obj, name: "a", type: "add" },
892 { object: obj, name: "a", type: "reconfigure" },
893 { object: obj, name: "a", type: "update", oldValue: 9 },
894 { object: obj, name: "a", type: "update", oldValue: 10 },
895 { object: obj, name: "a", type: "update", oldValue: 11 },
896 { object: obj, name: "a", type: "update", oldValue: 12 },
897 { object: obj, name: "a", type: "delete", oldValue: 36 },
898 { object: obj, name: "a", type: "add" },
904 var obj = {'1': 1} variable
905 Object.observe(obj, observer.callback);
906 obj[1] = 2;
907 obj[1] = 3;
908 delete obj[1];
909 obj[1] = 4;
910 obj[1] = 4; // ignored
911 obj[1] = 5;
912 Object.defineProperty(obj, "1", {value: 6});
913 Object.defineProperty(obj, "1", {writable: false});
914 obj[1] = 7; // ignored
915 Object.defineProperty(obj, "1", {value: 8});
916 Object.defineProperty(obj, "1", {value: 7, writable: true});
917 Object.defineProperty(obj, "1", {get: function() {}});
918 Object.defineProperty(obj, "1", {get: frozenFunction});
919 Object.defineProperty(obj, "1", {get: frozenFunction}); // ignored
920 Object.defineProperty(obj, "1", {get: frozenFunction, set: frozenFunction});
921 Object.defineProperty(obj, "1", {set: frozenFunction}); // ignored
922 Object.defineProperty(obj, "1", {get: undefined, set: frozenFunction});
923 delete obj[1];
924 delete obj[1];
925 Object.defineProperty(obj, "1", {get: function() {}, configurable: true});
926 Object.defineProperty(obj, "1", {value: 9, writable: true});
927 obj[1] = 10;
928 ++obj[1];
929 obj[1]++;
930 obj[1] *= 3;
931 delete obj[1];
932 Object.defineProperty(obj, "1", {value: 11, configurable: true});
935 { object: obj, name: "1", type: "update", oldValue: 1 },
936 { object: obj, name: "1", type: "update", oldValue: 2 },
937 { object: obj, name: "1", type: "delete", oldValue: 3 },
938 { object: obj, name: "1", type: "add" },
939 { object: obj, name: "1", type: "update", oldValue: 4 },
940 { object: obj, name: "1", type: "update", oldValue: 5 },
941 { object: obj, name: "1", type: "reconfigure" },
942 { object: obj, name: "1", type: "update", oldValue: 6 },
943 { object: obj, name: "1", type: "reconfigure", oldValue: 8 },
944 { object: obj, name: "1", type: "reconfigure", oldValue: 7 },
945 { object: obj, name: "1", type: "reconfigure" },
946 { object: obj, name: "1", type: "reconfigure" },
947 { object: obj, name: "1", type: "reconfigure" },
948 { object: obj, name: "1", type: "delete" },
949 { object: obj, name: "1", type: "add" },
950 { object: obj, name: "1", type: "reconfigure" },
951 { object: obj, name: "1", type: "update", oldValue: 9 },
952 { object: obj, name: "1", type: "update", oldValue: 10 },
953 { object: obj, name: "1", type: "update", oldValue: 11 },
954 { object: obj, name: "1", type: "update", oldValue: 12 },
955 { object: obj, name: "1", type: "delete", oldValue: 36 },
956 { object: obj, name: "1", type: "add" },
963 var obj = {}
965 Object.observe(obj, observer.callback);
966 obj[symbol] = 3;
967 delete obj[symbol];
968 Object.defineProperty(obj, symbol, {get: function() {}, configurable: true});
969 Object.defineProperty(obj, symbol, {value: 6});
970 Object.defineProperty(obj, symbol, {writable: false});
971 delete obj[symbol];
972 Object.defineProperty(obj, symbol, {value: 7});
973 ++obj[symbol];
974 obj[symbol]++;
975 obj[symbol] *= 3;
976 delete obj[symbol];
977 obj.__defineSetter__(symbol, function() {});
978 obj.__defineGetter__(symbol, function() {});
984 function TestObserveConfigurable(obj, prop) { argument
986 Object.observe(obj, observer.callback);
987 Object.unobserve(obj, observer.callback);
988 obj[prop] = 1;
989 Object.observe(obj, observer.callback);
990 obj[prop] = 2;
991 obj[prop] = 3;
992 delete obj[prop];
993 obj[prop] = 4;
994 obj[prop] = 4; // ignored
995 obj[prop] = 5;
996 Object.defineProperty(obj, prop, {value: 6});
997 Object.defineProperty(obj, prop, {writable: false});
998 obj[prop] = 7; // ignored
999 Object.defineProperty(obj, prop, {value: 8});
1000 Object.defineProperty(obj, prop, {value: 7, writable: true});
1001 Object.defineProperty(obj, prop, {get: function() {}});
1002 Object.defineProperty(obj, prop, {get: frozenFunction});
1003 Object.defineProperty(obj, prop, {get: frozenFunction}); // ignored
1004 Object.defineProperty(obj, prop, {get: frozenFunction, set: frozenFunction});
1005 Object.defineProperty(obj, prop, {set: frozenFunction}); // ignored
1006 Object.defineProperty(obj, prop, {get: undefined, set: frozenFunction});
1007 obj.__defineSetter__(prop, frozenFunction); // ignored
1008 obj.__defineSetter__(prop, function() {});
1009 obj.__defineGetter__(prop, function() {});
1010 delete obj[prop];
1011 delete obj[prop]; // ignored
1012 obj.__defineGetter__(prop, function() {});
1013 delete obj[prop];
1014 Object.defineProperty(obj, prop, {get: function() {}, configurable: true});
1015 Object.defineProperty(obj, prop, {value: 9, writable: true});
1016 obj[prop] = 10;
1017 ++obj[prop];
1018 obj[prop]++;
1019 obj[prop] *= 3;
1020 delete obj[prop];
1021 Object.defineProperty(obj, prop, {value: 11, configurable: true});
1024 { object: obj, name: prop, type: "update", oldValue: 1 },
1025 { object: obj, name: prop, type: "update", oldValue: 2 },
1026 { object: obj, name: prop, type: "delete", oldValue: 3 },
1027 { object: obj, name: prop, type: "add" },
1028 { object: obj, name: prop, type: "update", oldValue: 4 },
1029 { object: obj, name: prop, type: "update", oldValue: 5 },
1030 { object: obj, name: prop, type: "reconfigure" },
1031 { object: obj, name: prop, type: "update", oldValue: 6 },
1032 { object: obj, name: prop, type: "reconfigure", oldValue: 8 },
1033 { object: obj, name: prop, type: "reconfigure", oldValue: 7 },
1034 { object: obj, name: prop, type: "reconfigure" },
1035 { object: obj, name: prop, type: "reconfigure" },
1036 { object: obj, name: prop, type: "reconfigure" },
1037 { object: obj, name: prop, type: "reconfigure" },
1038 { object: obj, name: prop, type: "reconfigure" },
1039 { object: obj, name: prop, type: "delete" },
1040 { object: obj, name: prop, type: "add" },
1041 { object: obj, name: prop, type: "delete" },
1042 { object: obj, name: prop, type: "add" },
1043 { object: obj, name: prop, type: "reconfigure" },
1044 { object: obj, name: prop, type: "update", oldValue: 9 },
1045 { object: obj, name: prop, type: "update", oldValue: 10 },
1046 { object: obj, name: prop, type: "update", oldValue: 11 },
1047 { object: obj, name: prop, type: "update", oldValue: 12 },
1048 { object: obj, name: prop, type: "delete", oldValue: 36 },
1049 { object: obj, name: prop, type: "add" },
1051 Object.unobserve(obj, observer.callback);
1052 delete obj[prop];
1055 function TestObserveNonConfigurable(obj, prop, desc) { argument
1057 Object.observe(obj, observer.callback);
1058 Object.unobserve(obj, observer.callback);
1059 obj[prop] = 1;
1060 Object.observe(obj, observer.callback);
1061 obj[prop] = 4;
1062 obj[prop] = 4; // ignored
1063 obj[prop] = 5;
1064 Object.defineProperty(obj, prop, {value: 6});
1065 Object.defineProperty(obj, prop, {value: 6}); // ignored
1066 Object.defineProperty(obj, prop, {value: 7});
1067 Object.defineProperty(obj, prop, {enumerable: desc.enumerable}); // ignored
1068 Object.defineProperty(obj, prop, {writable: false});
1069 obj[prop] = 7; // ignored
1072 { object: obj, name: prop, type: "update", oldValue: 1 },
1073 { object: obj, name: prop, type: "update", oldValue: 4 },
1074 { object: obj, name: prop, type: "update", oldValue: 5 },
1075 { object: obj, name: prop, type: "update", oldValue: 6 },
1076 { object: obj, name: prop, type: "reconfigure" },
1078 Object.unobserve(obj, observer.callback);
1142 function blacklisted(obj, prop) { argument
1143 return (obj instanceof Int32Array && prop == 1) ||
1144 (obj instanceof Int32Array && prop === "length") ||
1145 (obj instanceof ArrayBuffer && prop == 1) ||
1146 (obj instanceof Function && prop === "name") || // Has its own test.
1147 (obj instanceof Function && prop === "length"); // Has its own test.
1151 var obj = objects[i];
1153 if (blacklisted(obj, prop)) continue;
1154 var desc = Object.getOwnPropertyDescriptor(obj, prop);
1155 print("***", typeof obj, stringifyNoThrow(obj), prop);
1157 TestObserveConfigurable(obj, prop);
1159 TestObserveNonConfigurable(obj, prop, desc);
1271 var obj = {};
1272 Object.observe(obj, observer.callback);
1274 obj["a" + i] = i;
1278 { object: obj, name: "a0", type: "add" },
1279 { object: obj, name: "a1", type: "add" },
1280 { object: obj, name: "a2", type: "add" },
1281 { object: obj, name: "a3", type: "add" },
1282 { object: obj, name: "a4", type: "add" },
1286 var obj = {};
1287 Object.observe(obj, observer.callback);
1289 obj[i] = i;
1293 { object: obj, name: "0", type: "add" },
1294 { object: obj, name: "1", type: "add" },
1295 { object: obj, name: "2", type: "add" },
1296 { object: obj, name: "3", type: "add" },
1297 { object: obj, name: "4", type: "add" },
1638 var obj = {};
1639 Object.observe(obj, observer.callback);
1642 obj.__proto__ = p;
1643 obj.__proto__ = p; // ignored
1644 obj.__proto__ = null;
1645 obj.__proto__ = q; // the __proto__ accessor is gone
1650 { object: obj, name: '__proto__', type: 'setPrototype',
1652 { object: obj, name: '__proto__', type: 'setPrototype', oldValue: p },
1653 { object: obj, name: '__proto__', type: 'add' },
1687 var obj = { __proto__: fun }; variable
1688 Object.observe(obj, observer.callback);
1689 obj.prototype = 7; class
1693 { object: obj, name: 'prototype', type: 'add' },