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

Side by Side Diff: test/mjsunit/strong/load-builtins.js

Issue 1189153002: Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « test/mjsunit/strong/functions.js ('k') | test/mjsunit/strong/load-element.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --strong-mode --allow-natives-syntax
6
7 function getGlobal() {
8 return this;
9 }
10
11 function polluteGlobal() {
12 bar = 0;
13 }
14
15 (function() {
16 "use strict";
17
18 let builtins = [
19 Array,
20 Object,
21 Function,
22 getGlobal()
23 ];
24
25 for (let builtin of builtins) {
26 assertThrows(function(){"use strong"; builtin.foo}, TypeError);
27 assertThrows(function(){"use strong"; builtin[0]}, TypeError);
28 assertThrows(function(){"use strong"; builtin[10000]}, TypeError);
29 builtin.foo = 1;
30 assertDoesNotThrow(function(){"use strong"; builtin.foo});
31 assertThrows(function(){"use strong"; builtin.bar});
32 assertThrows(function(){"use strong"; builtin[0]}, TypeError);
33 assertThrows(function(){"use strong"; builtin[10000]}, TypeError);
34 builtin[0] = 1;
35 assertDoesNotThrow(function(){"use strong"; builtin.foo});
36 assertThrows(function(){"use strong"; builtin.bar});
37 assertDoesNotThrow(function(){"use strong"; builtin[0]});
38 assertThrows(function(){"use strong"; builtin[10000]}, TypeError);
39 }
40 polluteGlobal();
41 assertDoesNotThrow(function(){"use strong"; getGlobal().bar});
42 })();
OLDNEW
« no previous file with comments | « test/mjsunit/strong/functions.js ('k') | test/mjsunit/strong/load-element.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698