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

Side by Side Diff: test/mjsunit/readonly.js

Issue 1417063011: [runtime] support new Proxy() instead of Proxy.create and install getPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding proxy trap strings Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 var p = Object.create(o.__proto__); 118 var p = Object.create(o.__proto__);
119 Object.defineProperty(p, name, {value: -45, writable: false}); 119 Object.defineProperty(p, name, {value: -45, writable: false});
120 o.__proto__ = p; 120 o.__proto__ = p;
121 } 121 }
122 122
123 // Allow Proxy to be undefined, so test can run in non-Harmony mode as well. 123 // Allow Proxy to be undefined, so test can run in non-Harmony mode as well.
124 var global = this; 124 var global = this;
125 125
126 function ReadonlyByProxy(o, name) { 126 function ReadonlyByProxy(o, name) {
127 if (!global.Proxy) return ReadonlyByFreeze(o, name); // Dummy. 127 if (!global.Proxy) return ReadonlyByFreeze(o, name); // Dummy.
128 var p = global.Proxy.create({ 128 var p = new global.Proxy({}, {
129 getPropertyDescriptor: function() { 129 getPropertyDescriptor: function() {
130 return {value: -46, writable: false, configurable: true}; 130 return {value: -46, writable: false, configurable: true};
131 } 131 }
132 }); 132 });
133 o.__proto__ = p; 133 o.__proto__ = p;
134 } 134 }
135 135
136 var readonlys = [ 136 var readonlys = [
137 ReadonlyByNonwritableDataProperty, ReadonlyByAccessorPropertyWithoutSetter, 137 ReadonlyByNonwritableDataProperty, ReadonlyByAccessorPropertyWithoutSetter,
138 ReadonlyByGetter, ReadonlyByFreeze, ReadonlyByProto, ReadonlyByProxy 138 ReadonlyByGetter, ReadonlyByFreeze, ReadonlyByProto, ReadonlyByProxy
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 var o = c(); 223 var o = c();
224 Assign2(o, i); 224 Assign2(o, i);
225 assertEquals(i, o.a); 225 assertEquals(i, o.a);
226 } 226 }
227 %OptimizeFunctionOnNextCall(Assign2); 227 %OptimizeFunctionOnNextCall(Assign2);
228 ReadonlyByNonwritableDataProperty(p, "a"); 228 ReadonlyByNonwritableDataProperty(p, "a");
229 var o = c(); 229 var o = c();
230 Assign2(o, 0); 230 Assign2(o, 0);
231 assertTrue(o.a < 0); 231 assertTrue(o.a < 0);
232 })(); 232 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698