Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 * @this {WebInspector.ExtensionServer} | 477 * @this {WebInspector.ExtensionServer} |
| 478 */ | 478 */ |
| 479 function pushResourceData(contentProvider) | 479 function pushResourceData(contentProvider) |
| 480 { | 480 { |
| 481 if (!resources[contentProvider.contentURL()]) | 481 if (!resources[contentProvider.contentURL()]) |
| 482 resources[contentProvider.contentURL()] = this._makeResource(con tentProvider); | 482 resources[contentProvider.contentURL()] = this._makeResource(con tentProvider); |
| 483 } | 483 } |
| 484 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network); | 484 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network); |
| 485 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts)); | 485 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts)); |
| 486 uiSourceCodes.forEach(pushResourceData.bind(this)); | 486 uiSourceCodes.forEach(pushResourceData.bind(this)); |
| 487 for (var target of WebInspector.targetManager.targets()) | 487 for (var target of WebInspector.targetManager.targets()) { |
|
dgozman
2016/07/14 16:29:28
browser capability
eostroukhov-old
2016/07/20 23:46:15
Done.
| |
| 488 target.resourceTreeModel.forAllResources(pushResourceData.bind(this) ); | 488 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(ta rget); |
| 489 if (resourceTreeModel) | |
| 490 resourceTreeModel.forAllResources(pushResourceData.bind(this)); | |
| 491 } | |
| 489 return Object.values(resources); | 492 return Object.values(resources); |
| 490 }, | 493 }, |
| 491 | 494 |
| 492 /** | 495 /** |
| 493 * @param {!WebInspector.ContentProvider} contentProvider | 496 * @param {!WebInspector.ContentProvider} contentProvider |
| 494 * @param {!Object} message | 497 * @param {!Object} message |
| 495 * @param {!MessagePort} port | 498 * @param {!MessagePort} port |
| 496 */ | 499 */ |
| 497 _getResourceContent: function(contentProvider, message, port) | 500 _getResourceContent: function(contentProvider, message, port) |
| 498 { | 501 { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 function hasMatchingURL(frame) | 925 function hasMatchingURL(frame) |
| 923 { | 926 { |
| 924 found = (frame.url === url) ? frame : null; | 927 found = (frame.url === url) ? frame : null; |
| 925 return found; | 928 return found; |
| 926 } | 929 } |
| 927 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL); | 930 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL); |
| 928 return found; | 931 return found; |
| 929 } | 932 } |
| 930 | 933 |
| 931 if (typeof options === "object") { | 934 if (typeof options === "object") { |
| 932 var frame = options.frameURL ? resolveURLToFrame(options.frameURL) : WebInspector.targetManager.mainTarget().resourceTreeModel.mainFrame; | 935 var frame; |
| 936 if (options.frameURL) | |
| 937 frame = resolveURLToFrame(options.frameURL) | |
| 938 else { | |
| 939 var target = WebInspector.targetManager.mainTarget(); | |
| 940 var resourceTreeModel = target && WebInspector.ResourceTreeModel .fromTarget(target); | |
| 941 frame = resourceTreeModel && resourceTreeModel.mainFrame; | |
| 942 } | |
| 933 if (!frame) { | 943 if (!frame) { |
| 934 if (options.frameURL) | 944 if (options.frameURL) |
| 935 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL); | 945 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL); |
| 936 else | 946 else |
| 937 console.warn("evaluate: the main frame is not yet available" ); | 947 console.warn("evaluate: the main frame is not yet available" ); |
| 938 return this._status.E_NOTFOUND(options.frameURL || "<top>"); | 948 return this._status.E_NOTFOUND(options.frameURL || "<top>"); |
| 939 } | 949 } |
| 940 | 950 |
| 941 var contextSecurityOrigin; | 951 var contextSecurityOrigin; |
| 942 if (options.useContentScriptContext) | 952 if (options.useContentScriptContext) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 /** | 1081 /** |
| 1072 * @typedef {{code: string, description: string, details: !Array.<*>}} | 1082 * @typedef {{code: string, description: string, details: !Array.<*>}} |
| 1073 */ | 1083 */ |
| 1074 WebInspector.ExtensionStatus.Record; | 1084 WebInspector.ExtensionStatus.Record; |
| 1075 | 1085 |
| 1076 WebInspector.extensionAPI = {}; | 1086 WebInspector.extensionAPI = {}; |
| 1077 defineCommonExtensionSymbols(WebInspector.extensionAPI); | 1087 defineCommonExtensionSymbols(WebInspector.extensionAPI); |
| 1078 | 1088 |
| 1079 /** @type {!WebInspector.ExtensionServer} */ | 1089 /** @type {!WebInspector.ExtensionServer} */ |
| 1080 WebInspector.extensionServer; | 1090 WebInspector.extensionServer; |
| OLD | NEW |