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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 } | 869 } |
870 | 870 |
871 ExecutionState.prototype.prepareStep = function(opt_action, opt_count) { | 871 ExecutionState.prototype.prepareStep = function(opt_action, opt_count) { |
872 var action = Debug.StepAction.StepIn; | 872 var action = Debug.StepAction.StepIn; |
873 if (!IS_UNDEFINED(opt_action)) action = %ToNumber(opt_action); | 873 if (!IS_UNDEFINED(opt_action)) action = %ToNumber(opt_action); |
874 var count = opt_count ? %ToNumber(opt_count) : 1; | 874 var count = opt_count ? %ToNumber(opt_count) : 1; |
875 | 875 |
876 return %PrepareStep(this.break_id, action, count); | 876 return %PrepareStep(this.break_id, action, count); |
877 } | 877 } |
878 | 878 |
879 ExecutionState.prototype.evaluateGlobal = function(source, disable_break) { | 879 ExecutionState.prototype.evaluateGlobal = function(source, disable_break, opt_ad ditional_context) { |
Søren Thygesen Gjesse
2010/12/13 08:37:14
Long line - more below.
Peter Rybin
2010/12/14 00:02:52
Done.
| |
880 return MakeMirror( | 880 return MakeMirror( |
881 %DebugEvaluateGlobal(this.break_id, source, Boolean(disable_break))); | 881 %DebugEvaluateGlobal(this.break_id, source, Boolean(disable_break), opt_ad ditional_context)); |
882 }; | 882 }; |
883 | 883 |
884 ExecutionState.prototype.frameCount = function() { | 884 ExecutionState.prototype.frameCount = function() { |
885 return %GetFrameCount(this.break_id); | 885 return %GetFrameCount(this.break_id); |
886 }; | 886 }; |
887 | 887 |
888 ExecutionState.prototype.threadCount = function() { | 888 ExecutionState.prototype.threadCount = function() { |
889 return %GetThreadCount(this.break_id); | 889 return %GetThreadCount(this.break_id); |
890 }; | 890 }; |
891 | 891 |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { | 1830 DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
1831 if (!request.arguments) { | 1831 if (!request.arguments) { |
1832 return response.failed('Missing arguments'); | 1832 return response.failed('Missing arguments'); |
1833 } | 1833 } |
1834 | 1834 |
1835 // Pull out arguments. | 1835 // Pull out arguments. |
1836 var expression = request.arguments.expression; | 1836 var expression = request.arguments.expression; |
1837 var frame = request.arguments.frame; | 1837 var frame = request.arguments.frame; |
1838 var global = request.arguments.global; | 1838 var global = request.arguments.global; |
1839 var disable_break = request.arguments.disable_break; | 1839 var disable_break = request.arguments.disable_break; |
1840 var additional_context = request.arguments.additional_context; | |
1840 | 1841 |
1841 // The expression argument could be an integer so we convert it to a | 1842 // The expression argument could be an integer so we convert it to a |
1842 // string. | 1843 // string. |
1843 try { | 1844 try { |
1844 expression = String(expression); | 1845 expression = String(expression); |
1845 } catch(e) { | 1846 } catch(e) { |
1846 return response.failed('Failed to convert expression argument to string'); | 1847 return response.failed('Failed to convert expression argument to string'); |
1847 } | 1848 } |
1848 | 1849 |
1849 // Check for legal arguments. | 1850 // Check for legal arguments. |
1850 if (!IS_UNDEFINED(frame) && global) { | 1851 if (!IS_UNDEFINED(frame) && global) { |
1851 return response.failed('Arguments "frame" and "global" are exclusive'); | 1852 return response.failed('Arguments "frame" and "global" are exclusive'); |
1852 } | 1853 } |
1854 | |
1855 var additional_context_object; | |
1856 if (additional_context) { | |
1857 additional_context_object = {}; | |
1858 for (var key in additional_context) { | |
1859 var context_value_handle = additional_context[key]; | |
1860 var context_value_mirror = LookupMirror(context_value_handle); | |
1861 if (!context_value_mirror) { | |
1862 return response.failed( | |
1863 "Context object '" + key + "' #" + context_value_handle + "# not fou nd"); | |
1864 } | |
1865 additional_context_object[key] = context_value_mirror.value(); | |
1866 } | |
1867 } | |
1853 | 1868 |
1854 // Global evaluate. | 1869 // Global evaluate. |
1855 if (global) { | 1870 if (global) { |
1856 // Evaluate in the global context. | 1871 // Evaluate in the global context. |
1857 response.body = | 1872 response.body = |
1858 this.exec_state_.evaluateGlobal(expression, Boolean(disable_break)); | 1873 this.exec_state_.evaluateGlobal(expression, Boolean(disable_break), |
1874 additional_context_object); | |
1859 return; | 1875 return; |
1860 } | 1876 } |
1861 | 1877 |
1862 // Default value for disable_break is true. | 1878 // Default value for disable_break is true. |
1863 if (IS_UNDEFINED(disable_break)) { | 1879 if (IS_UNDEFINED(disable_break)) { |
1864 disable_break = true; | 1880 disable_break = true; |
1865 } | 1881 } |
1866 | 1882 |
1867 // No frames no evaluate in frame. | 1883 // No frames no evaluate in frame. |
1868 if (this.exec_state_.frameCount() == 0) { | 1884 if (this.exec_state_.frameCount() == 0) { |
1869 return response.failed('No frames'); | 1885 return response.failed('No frames'); |
1870 } | 1886 } |
1871 | 1887 |
1872 // Check whether a frame was specified. | 1888 // Check whether a frame was specified. |
1873 if (!IS_UNDEFINED(frame)) { | 1889 if (!IS_UNDEFINED(frame)) { |
1874 var frame_number = %ToNumber(frame); | 1890 var frame_number = %ToNumber(frame); |
1875 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { | 1891 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
1876 return response.failed('Invalid frame "' + frame + '"'); | 1892 return response.failed('Invalid frame "' + frame + '"'); |
1877 } | 1893 } |
1878 // Evaluate in the specified frame. | 1894 // Evaluate in the specified frame. |
1879 response.body = this.exec_state_.frame(frame_number).evaluate( | 1895 response.body = this.exec_state_.frame(frame_number).evaluate( |
1880 expression, Boolean(disable_break)); | 1896 expression, Boolean(disable_break), additional_context_object); |
1881 return; | 1897 return; |
1882 } else { | 1898 } else { |
1883 // Evaluate in the selected frame. | 1899 // Evaluate in the selected frame. |
1884 response.body = this.exec_state_.frame().evaluate( | 1900 response.body = this.exec_state_.frame().evaluate( |
1885 expression, Boolean(disable_break)); | 1901 expression, Boolean(disable_break), additional_context_object); |
1886 return; | 1902 return; |
1887 } | 1903 } |
1888 }; | 1904 }; |
1889 | 1905 |
1890 | 1906 |
1891 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { | 1907 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { |
1892 if (!request.arguments) { | 1908 if (!request.arguments) { |
1893 return response.failed('Missing arguments'); | 1909 return response.failed('Missing arguments'); |
1894 } | 1910 } |
1895 | 1911 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2270 case 'string': | 2286 case 'string': |
2271 case 'number': | 2287 case 'number': |
2272 json = value; | 2288 json = value; |
2273 break | 2289 break |
2274 | 2290 |
2275 default: | 2291 default: |
2276 json = null; | 2292 json = null; |
2277 } | 2293 } |
2278 return json; | 2294 return json; |
2279 } | 2295 } |
OLD | NEW |