OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 897 |
898 /** | 898 /** |
899 * @param {!WebInspector.RemoteObject} remoteObject | 899 * @param {!WebInspector.RemoteObject} remoteObject |
900 */ | 900 */ |
901 _saveToTempVariable: function(remoteObject) | 901 _saveToTempVariable: function(remoteObject) |
902 { | 902 { |
903 var currentExecutionContext = WebInspector.context.flavor(WebInspector.E
xecutionContext); | 903 var currentExecutionContext = WebInspector.context.flavor(WebInspector.E
xecutionContext); |
904 if (!currentExecutionContext) | 904 if (!currentExecutionContext) |
905 return; | 905 return; |
906 | 906 |
907 currentExecutionContext.evaluate("window", "", false, true, false, false
, didGetGlobalObject.bind(null, currentExecutionContext.target())); | 907 if (remoteObject.language == 'dart') { |
| 908 currentExecutionContext.evaluate("$consoleVariables", "", true, true
, false, false, didGetGlobalObject.bind(null, currentExecutionContext.target()))
; |
| 909 } else { |
| 910 currentExecutionContext.evaluate("window", "", false, true, false, f
alse, didGetGlobalObject.bind(null, currentExecutionContext.target())); |
| 911 } |
908 /** | 912 /** |
909 * @param {!WebInspector.Target} target | 913 * @param {!WebInspector.Target} target |
910 * @param {?WebInspector.RemoteObject} global | 914 * @param {?WebInspector.RemoteObject} global |
911 * @param {boolean=} wasThrown | 915 * @param {boolean=} wasThrown |
912 */ | 916 */ |
913 function didGetGlobalObject(target, global, wasThrown) | 917 function didGetGlobalObject(target, global, wasThrown) |
914 { | 918 { |
915 /** | 919 /** |
916 * @suppressReceiverCheck | 920 * @suppressReceiverCheck |
917 * @this {Window} | 921 * @this {Window} |
918 */ | 922 */ |
919 function remoteFunction(value) | 923 function remoteFunction(value) |
920 { | 924 { |
921 var prefix = "temp"; | 925 var prefix = "temp"; |
922 var index = 1; | 926 var index = 1; |
923 while ((prefix + index) in this) | 927 while ((prefix + index) in this) |
924 ++index; | 928 ++index; |
925 var name = prefix + index; | 929 var name = prefix + index; |
926 this[name] = value; | 930 this[name] = value; |
927 return name; | 931 return name; |
928 } | 932 } |
929 | 933 |
| 934 var dartRemoteFunction = |
| 935 "(val) {\n" + |
| 936 " var index = 1;\n" + |
| 937 " var vars = variables();\n" + |
| 938 " while(vars.contains('temp$index')) { ++index; };\n" + |
| 939 " var name = 'temp$index';\n" + |
| 940 " setVariable(name, val);\n" + |
| 941 " return name;\n" + |
| 942 "}"; |
| 943 |
930 if (wasThrown || !global) | 944 if (wasThrown || !global) |
931 failedToSave(target, global); | 945 failedToSave(target, global); |
932 else | 946 else |
933 global.callFunction(remoteFunction, [WebInspector.RemoteObject.t
oCallArgument(remoteObject)], didSave.bind(null, global)); | 947 global.callFunction(remoteObject.language == 'dart' ? dartRemote
Function : remoteFunction, [WebInspector.RemoteObject.toCallArgument(remoteObjec
t)], didSave.bind(null, global)); |
934 } | 948 } |
935 | 949 |
936 /** | 950 /** |
937 * @param {!WebInspector.RemoteObject} global | 951 * @param {!WebInspector.RemoteObject} global |
938 * @param {?WebInspector.RemoteObject} result | 952 * @param {?WebInspector.RemoteObject} result |
939 * @param {boolean=} wasThrown | 953 * @param {boolean=} wasThrown |
940 */ | 954 */ |
941 function didSave(global, result, wasThrown) | 955 function didSave(global, result, wasThrown) |
942 { | 956 { |
943 var currentExecutionContext = WebInspector.context.flavor(WebInspect
or.ExecutionContext); | 957 var currentExecutionContext = WebInspector.context.flavor(WebInspect
or.ExecutionContext); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 var disabled = forbidden || (status === "disabled"); | 1376 var disabled = forbidden || (status === "disabled"); |
1363 | 1377 |
1364 this._disableJSInfo.classList.toggle("hidden", !forbidden); | 1378 this._disableJSInfo.classList.toggle("hidden", !forbidden); |
1365 this._disableJSCheckbox.checked = disabled; | 1379 this._disableJSCheckbox.checked = disabled; |
1366 this._disableJSCheckbox.disabled = forbidden; | 1380 this._disableJSCheckbox.disabled = forbidden; |
1367 } | 1381 } |
1368 }, | 1382 }, |
1369 | 1383 |
1370 __proto__: WebInspector.UISettingDelegate.prototype | 1384 __proto__: WebInspector.UISettingDelegate.prototype |
1371 } | 1385 } |
OLD | NEW |