Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [DevTools] No RTM for non-browser targets Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 * @this {WebInspector.ExtensionServer} 490 * @this {WebInspector.ExtensionServer}
491 */ 491 */
492 function pushResourceData(contentProvider) 492 function pushResourceData(contentProvider)
493 { 493 {
494 if (!resources.has(contentProvider.contentURL())) 494 if (!resources.has(contentProvider.contentURL()))
495 resources.set(contentProvider.contentURL(), this._makeResource(c ontentProvider)); 495 resources.set(contentProvider.contentURL(), this._makeResource(c ontentProvider));
496 } 496 }
497 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network); 497 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network);
498 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts)); 498 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts));
499 uiSourceCodes.forEach(pushResourceData.bind(this)); 499 uiSourceCodes.forEach(pushResourceData.bind(this));
500 for (var target of WebInspector.targetManager.targets()) 500 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Capability.DOM))
501 target.resourceTreeModel.forAllResources(pushResourceData.bind(this) ); 501 WebInspector.ResourceTreeModel.fromTarget(target).forAllResources(pu shResourceData.bind(this));
502 return resources.valuesArray(); 502 return resources.valuesArray();
503 }, 503 },
504 504
505 /** 505 /**
506 * @param {!WebInspector.ContentProvider} contentProvider 506 * @param {!WebInspector.ContentProvider} contentProvider
507 * @param {!Object} message 507 * @param {!Object} message
508 * @param {!MessagePort} port 508 * @param {!MessagePort} port
509 */ 509 */
510 _getResourceContent: function(contentProvider, message, port) 510 _getResourceContent: function(contentProvider, message, port)
511 { 511 {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 function hasMatchingURL(frame) 935 function hasMatchingURL(frame)
936 { 936 {
937 found = (frame.url === url) ? frame : null; 937 found = (frame.url === url) ? frame : null;
938 return found; 938 return found;
939 } 939 }
940 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL); 940 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL);
941 return found; 941 return found;
942 } 942 }
943 943
944 if (typeof options === "object") { 944 if (typeof options === "object") {
945 var frame = options.frameURL ? resolveURLToFrame(options.frameURL) : WebInspector.targetManager.mainTarget().resourceTreeModel.mainFrame; 945 var frame;
946 if (options.frameURL)
dgozman 2016/08/19 20:23:37 style: both branches should have {}
eostroukhov 2016/08/20 01:22:30 Done.
947 frame = resolveURLToFrame(options.frameURL)
dgozman 2016/08/19 20:23:37 style: missing semicolon
eostroukhov 2016/08/20 01:22:30 Done.
948 else {
949 var target = WebInspector.targetManager.mainTarget();
950 var resourceTreeModel = target && WebInspector.ResourceTreeModel .fromTarget(target);
951 frame = resourceTreeModel && resourceTreeModel.mainFrame;
952 }
946 if (!frame) { 953 if (!frame) {
947 if (options.frameURL) 954 if (options.frameURL)
948 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL); 955 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL);
949 else 956 else
950 console.warn("evaluate: the main frame is not yet available" ); 957 console.warn("evaluate: the main frame is not yet available" );
951 return this._status.E_NOTFOUND(options.frameURL || "<top>"); 958 return this._status.E_NOTFOUND(options.frameURL || "<top>");
952 } 959 }
953 960
954 var contextSecurityOrigin; 961 var contextSecurityOrigin;
955 if (options.useContentScriptContext) 962 if (options.useContentScriptContext)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 /** 1091 /**
1085 * @typedef {{code: string, description: string, details: !Array.<*>}} 1092 * @typedef {{code: string, description: string, details: !Array.<*>}}
1086 */ 1093 */
1087 WebInspector.ExtensionStatus.Record; 1094 WebInspector.ExtensionStatus.Record;
1088 1095
1089 WebInspector.extensionAPI = {}; 1096 WebInspector.extensionAPI = {};
1090 defineCommonExtensionSymbols(WebInspector.extensionAPI); 1097 defineCommonExtensionSymbols(WebInspector.extensionAPI);
1091 1098
1092 /** @type {!WebInspector.ExtensionServer} */ 1099 /** @type {!WebInspector.ExtensionServer} */
1093 WebInspector.extensionServer; 1100 WebInspector.extensionServer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698