| Index: Source/devtools/front_end/NetworkUISourceCodeProvider.js
|
| diff --git a/Source/devtools/front_end/NetworkUISourceCodeProvider.js b/Source/devtools/front_end/NetworkUISourceCodeProvider.js
|
| index 8aa1a9798153fb8fd57556bf9279eae19f7038a0..173dd1c3afc84e7fa421458142b9eec28f95c4df 100644
|
| --- a/Source/devtools/front_end/NetworkUISourceCodeProvider.js
|
| +++ b/Source/devtools/front_end/NetworkUISourceCodeProvider.js
|
| @@ -100,7 +100,7 @@ WebInspector.NetworkUISourceCodeProvider.prototype = {
|
| _resourceAdded: function(event)
|
| {
|
| var resource = /** @type {!WebInspector.Resource} */ (event.data);
|
| - this._addFile(resource.url, resource);
|
| + this._addFile(resource.url, new WebInspector.NetworkUISourceCodeProvider.FallbackResource(resource));
|
| },
|
|
|
| /**
|
| @@ -140,6 +140,107 @@ WebInspector.NetworkUISourceCodeProvider.prototype = {
|
| }
|
|
|
| /**
|
| + * @constructor
|
| + * @implements {WebInspector.ContentProvider}
|
| + * @param {!WebInspector.Resource} resource
|
| + */
|
| +WebInspector.NetworkUISourceCodeProvider.FallbackResource = function(resource)
|
| +{
|
| + this._resource = resource;
|
| +}
|
| +
|
| +WebInspector.NetworkUISourceCodeProvider.FallbackResource.prototype = {
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + contentURL: function()
|
| + {
|
| + return this._resource.contentURL();
|
| + },
|
| +
|
| + /**
|
| + * @return {!WebInspector.ResourceType}
|
| + */
|
| + contentType: function()
|
| + {
|
| + return this._resource.contentType();
|
| + },
|
| +
|
| + /**
|
| + * @param {function(?string)} callback
|
| + */
|
| + requestContent: function(callback)
|
| + {
|
| + /**
|
| + * @this {WebInspector.NetworkUISourceCodeProvider.FallbackResource}
|
| + */
|
| + function loadFallbackContent()
|
| + {
|
| + var scripts = WebInspector.debuggerModel.scriptsForSourceURL(this._resource.url);
|
| + if (!scripts.length) {
|
| + callback(null);
|
| + return;
|
| + }
|
| +
|
| + var contentProvider;
|
| + if (this._resource.type === WebInspector.resourceTypes.Document)
|
| + contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
|
| + else if (this._resource.type === WebInspector.resourceTypes.Script)
|
| + contentProvider = scripts[0];
|
| +
|
| + console.assert(contentProvider, "Resource content request failed. " + this._resource.url);
|
| +
|
| + contentProvider.requestContent(callback);
|
| + }
|
| +
|
| + /**
|
| + * @param {?string} content
|
| + * @this {WebInspector.NetworkUISourceCodeProvider.FallbackResource}
|
| + */
|
| + function requestContentLoaded(content)
|
| + {
|
| + if (content)
|
| + callback(content)
|
| + else
|
| + loadFallbackContent.call(this);
|
| + }
|
| +
|
| + this._resource.requestContent(requestContentLoaded.bind(this));
|
| + },
|
| +
|
| + /**
|
| + * @param {string} query
|
| + * @param {boolean} caseSensitive
|
| + * @param {boolean} isRegex
|
| + * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
|
| + */
|
| + searchInContent: function(query, caseSensitive, isRegex, callback)
|
| + {
|
| + /**
|
| + * @param {?string} content
|
| + */
|
| + function documentContentLoaded(content)
|
| + {
|
| + if (content === null) {
|
| + callback([]);
|
| + return;
|
| + }
|
| +
|
| + var result = WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex);
|
| + callback(result);
|
| + }
|
| +
|
| + if (this.contentType() === WebInspector.resourceTypes.Document) {
|
| + this.requestContent(documentContentLoaded);
|
| + return;
|
| + }
|
| +
|
| + this._resource.searchInContent(query, caseSensitive, isRegex, callback);
|
| + }
|
| +}
|
| +
|
| +/**
|
| * @type {!WebInspector.SimpleWorkspaceProvider}
|
| */
|
| WebInspector.networkWorkspaceProvider;
|
|
|