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

Side by Side Diff: src/js/proxy.js

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fix protoype walks with access checks Created 5 years 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 2015 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 18 matching lines...) Expand all
29 // Proxy Builtins 29 // Proxy Builtins
30 30
31 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]: 31 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]:
32 // Call the trap, which should return an iterator, exhaust the iterator, 32 // Call the trap, which should return an iterator, exhaust the iterator,
33 // and return an array containing the values. 33 // and return an array containing the values.
34 function ProxyEnumerate(trap, handler, target) { 34 function ProxyEnumerate(trap, handler, target) {
35 // 7. Let trapResult be ? Call(trap, handler, «target»). 35 // 7. Let trapResult be ? Call(trap, handler, «target»).
36 var trap_result = %_Call(trap, handler, target); 36 var trap_result = %_Call(trap, handler, target);
37 // 8. If Type(trapResult) is not Object, throw a TypeError exception. 37 // 8. If Type(trapResult) is not Object, throw a TypeError exception.
38 if (!IS_SPEC_OBJECT(trap_result)) { 38 if (!IS_SPEC_OBJECT(trap_result)) {
39 throw MakeTypeError(kProxyHandlerReturned, handler, "non-Object", 39 throw MakeTypeError(kProxyTrapReturnedNonObject, handler, trap_result,
40 "enumerate"); 40 "enumerate");
41 } 41 }
42 // 9. Return trapResult. 42 // 9. Return trapResult.
43 var result = []; 43 var result = [];
44 for (var it = trap_result.next(); !it.done; it = trap_result.next()) { 44 for (var it = trap_result.next(); !it.done; it = trap_result.next()) {
45 var key = it.value; 45 var key = it.value;
46 // Not yet spec'ed as of 2015-11-25, but will be spec'ed soon: 46 // Not yet spec'ed as of 2015-11-25, but will be spec'ed soon:
47 // If the iterator returns a non-string value, throw a TypeError. 47 // If the iterator returns a non-string value, throw a TypeError.
48 if (!IS_STRING(key)) { 48 if (!IS_STRING(key)) {
49 throw MakeTypeError(kProxyHandlerReturned, handler, "non-String", 49 throw MakeTypeError(kProxyTrapReturned, handler, "non-String",
50 "enumerate-iterator"); 50 "enumerate");
51 } 51 }
52 result.push(key); 52 result.push(key);
53 } 53 }
54 return result; 54 return result;
55 } 55 }
56 56
57 //------------------------------------------------------------------- 57 //-------------------------------------------------------------------
58 58
59 //Set up non-enumerable properties of the Proxy object. 59 //Set up non-enumerable properties of the Proxy object.
60 utils.InstallFunctions(GlobalProxy, DONT_ENUM, [ 60 utils.InstallFunctions(GlobalProxy, DONT_ENUM, [
61 "revocable", ProxyCreateRevocable 61 "revocable", ProxyCreateRevocable
62 ]); 62 ]);
63 63
64 // ------------------------------------------------------------------- 64 // -------------------------------------------------------------------
65 // Exports 65 // Exports
66 66
67 %InstallToContext([ 67 %InstallToContext([
68 "proxy_enumerate", ProxyEnumerate, 68 "proxy_enumerate", ProxyEnumerate,
69 ]); 69 ]);
70 70
71 }) 71 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698