OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
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 are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 return; | 934 return; |
935 | 935 |
936 if (error || !object) | 936 if (error || !object) |
937 callback(null); | 937 callback(null); |
938 else | 938 else |
939 callback(this.target().runtimeModel.createRemoteObject(object)); | 939 callback(this.target().runtimeModel.createRemoteObject(object)); |
940 } | 940 } |
941 }, | 941 }, |
942 | 942 |
943 /** | 943 /** |
| 944 * @param {string=} objectGroup |
| 945 * @return {!Promise<!WebInspector.RemoteObject>} |
| 946 */ |
| 947 resolveToObjectPromise: function(objectGroup) |
| 948 { |
| 949 return new Promise(resolveToObject.bind(this)); |
| 950 /** |
| 951 * @param {function(?)} fulfill |
| 952 * @param {function(*)} reject |
| 953 * @this {WebInspector.DOMNode} |
| 954 */ |
| 955 function resolveToObject(fulfill, reject) |
| 956 { |
| 957 this.resolveToObject(objectGroup, mycallback); |
| 958 function mycallback(object) |
| 959 { |
| 960 if (object) |
| 961 fulfill(object) |
| 962 else |
| 963 reject(null); |
| 964 } |
| 965 } |
| 966 }, |
| 967 |
| 968 /** |
944 * @param {function(?DOMAgent.BoxModel)} callback | 969 * @param {function(?DOMAgent.BoxModel)} callback |
945 */ | 970 */ |
946 boxModel: function(callback) | 971 boxModel: function(callback) |
947 { | 972 { |
948 this._agent.getBoxModel(this.id, this._domModel._wrapClientCallback(call
back)); | 973 this._agent.getBoxModel(this.id, this._domModel._wrapClientCallback(call
back)); |
949 }, | 974 }, |
950 | 975 |
951 setAsInspectedNode: function() | 976 setAsInspectedNode: function() |
952 { | 977 { |
953 var node = this; | 978 var node = this; |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 } | 2220 } |
2196 | 2221 |
2197 /** | 2222 /** |
2198 * @param {!WebInspector.Target} target | 2223 * @param {!WebInspector.Target} target |
2199 * @return {?WebInspector.DOMModel} | 2224 * @return {?WebInspector.DOMModel} |
2200 */ | 2225 */ |
2201 WebInspector.DOMModel.fromTarget = function(target) | 2226 WebInspector.DOMModel.fromTarget = function(target) |
2202 { | 2227 { |
2203 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); | 2228 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); |
2204 } | 2229 } |
OLD | NEW |