OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 } | 1851 } |
1852 | 1852 |
1853 // Check for legal arguments. | 1853 // Check for legal arguments. |
1854 if (!IS_UNDEFINED(frame) && global) { | 1854 if (!IS_UNDEFINED(frame) && global) { |
1855 return response.failed('Arguments "frame" and "global" are exclusive'); | 1855 return response.failed('Arguments "frame" and "global" are exclusive'); |
1856 } | 1856 } |
1857 | 1857 |
1858 var additional_context_object; | 1858 var additional_context_object; |
1859 if (additional_context) { | 1859 if (additional_context) { |
1860 additional_context_object = {}; | 1860 additional_context_object = {}; |
1861 for (var key in additional_context) { | 1861 for (var i = 0; i < additional_context.length; i++) { |
1862 var context_value_handle = additional_context[key]; | 1862 var mapping = additional_context[i]; |
1863 var context_value_mirror = LookupMirror(context_value_handle); | 1863 if (!IS_STRING(mapping.name) || !IS_NUMBER(mapping.handle)) { |
| 1864 return response.failed("Context element #" + i + |
| 1865 " must contain name:string and handle:number"); |
| 1866 } |
| 1867 var context_value_mirror = LookupMirror(mapping.handle); |
1864 if (!context_value_mirror) { | 1868 if (!context_value_mirror) { |
1865 return response.failed( | 1869 return response.failed("Context object '" + mapping.name + |
1866 "Context object '" + key + "' #" + context_value_handle + | 1870 "' #" + mapping.handle + "# not found"); |
1867 "# not found"); | |
1868 } | 1871 } |
1869 additional_context_object[key] = context_value_mirror.value(); | 1872 additional_context_object[mapping.name] = context_value_mirror.value(); |
1870 } | 1873 } |
1871 } | 1874 } |
1872 | 1875 |
1873 // Global evaluate. | 1876 // Global evaluate. |
1874 if (global) { | 1877 if (global) { |
1875 // Evaluate in the global context. | 1878 // Evaluate in the global context. |
1876 response.body = this.exec_state_.evaluateGlobal( | 1879 response.body = this.exec_state_.evaluateGlobal( |
1877 expression, Boolean(disable_break), additional_context_object); | 1880 expression, Boolean(disable_break), additional_context_object); |
1878 return; | 1881 return; |
1879 } | 1882 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 case 'string': | 2292 case 'string': |
2290 case 'number': | 2293 case 'number': |
2291 json = value; | 2294 json = value; |
2292 break | 2295 break |
2293 | 2296 |
2294 default: | 2297 default: |
2295 json = null; | 2298 json = null; |
2296 } | 2299 } |
2297 return json; | 2300 return json; |
2298 } | 2301 } |
OLD | NEW |