Changeset 179713 in webkit
- Timestamp:
- Feb 5, 2015 2:47:40 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r179701 r179713 1 2015-02-04 Jono Wells <jonowells@apple.com> 2 3 Web Inspector: REGRESSION: Inline SourceMap resources show empty content when opened. 4 https://bugs.webkit.org/show_bug.cgi?id=141225 5 6 Reviewed by Timothy Hatcher. 7 8 Change WebInspector.SourceMapResource.prototype.requestContentFromBackend to correctly and consistently handle 9 calls to NetworkAgent. The helper function sourceMapResourceLoaded will now properly handle parameters as a single 10 payload, including manual calls in the case where the source map content is in a data URI. Also 11 WebInspector.SourceCode.prototype._processContent now properly handles an error string used for displaying 12 resource loading error messages in the resource content view. 13 14 * UserInterface/Models/Resource.js: drive-by style fix. 15 16 * UserInterface/Models/SourceCode.js: 17 (WebInspector.SourceCode.prototype._processContent): 18 Properly handle error string. 19 20 * UserInterface/Models/SourceMapResource.js: 21 (WebInspector.SourceMapResource.prototype.requestContentFromBackend): 22 (WebInspector.SourceMapResource.prototype.requestContentFromBackend.sourceMapResourceLoaded): 23 Formerly sourceMapResourceLoadError, now handles parameters from the NetworkAgent correctly. 24 25 (WebInspector.SourceMapResource.prototype.requestContentFromBackend.sourceMapResourceLoadError): 26 This function now handles NetworkAgent errors only. 27 1 28 2015-02-05 Brian J. Burg <burg@cs.washington.edu> 2 29 -
trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js
r178970 r179713 681 681 682 682 if (this._failed) 683 return Promise.resolve({ error: WebInspector.UIString("An error occurred trying to load the resource.")});683 return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")}); 684 684 685 685 if (!this._finishThenRequestContentPromise) { -
trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js
r178970 r179713 192 192 // Different backend APIs return one of `content, `body`, or `scriptSource`. 193 193 var content = parameters.content || parameters.body || parameters.scriptSource; 194 var error = parameters.error; 194 195 var base64Encoded = parameters.base64Encoded; 195 196 … … 202 203 203 204 return Promise.resolve({ 205 error: error, 204 206 sourceCode: this, 205 207 content: content, -
trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
r177791 r179713 50 50 WebInspector.SourceMapResource.prototype = { 51 51 constructor: WebInspector.SourceMapResource, 52 __proto__: WebInspector.Resource.prototype, 52 53 53 54 // Public … … 85 86 // FIXME: We don't know the MIME-type for inline content. Guess by analyzing the content? 86 87 // Returns a promise. 87 return sourceMapResourceLoaded.call(this, null, inlineContent, this.mimeType, 200);88 return sourceMapResourceLoaded.call(this, {content: inlineContent, mimeType: this.mimeType, status: 200}); 88 89 } 89 90 90 function sourceMapResource LoadError(error, body, mimeType, statusCode)91 function sourceMapResourceNotAvailable(error, content, mimeType, statusCode) 91 92 { 92 93 this.markAsFailed(); 93 94 return Promise.resolve({ 94 error: error,95 content: body.content,95 error: WebInspector.UIString("An error occurred trying to load the resource."), 96 content: content, 96 97 mimeType: mimeType, 97 98 statusCode: statusCode … … 99 100 } 100 101 101 function sourceMapResourceLoad ed(body, mimeType, statusCode)102 function sourceMapResourceLoadError(error) 102 103 { 104 // There was an error calling NetworkAgent.loadResource. 105 console.error(error || "There was an unknown error calling NetworkAgent.loadResource."); 106 this.markAsFailed(); 107 return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")}); 108 } 109 110 function sourceMapResourceLoaded(parameters) 111 { 112 var {error, content, mimeType, statusCode} = parameters; 113 103 114 const base64encoded = false; 104 115 105 if (statusCode >= 400 )106 return sourceMapResource LoadError(error, body, mimeType, statusCode);116 if (statusCode >= 400 || error) 117 return sourceMapResourceNotAvailable(error, content, mimeType, statusCode); 107 118 108 119 // FIXME: Add support for picking the best MIME-type. Right now the file extension is the best bet. … … 112 123 113 124 return Promise.resolve({ 114 content: body.content,125 content: content, 115 126 mimeType: mimeType, 116 127 base64encoded: base64encoded, … … 119 130 } 120 131 121 if (!NetworkAgent.loadResource) { 122 sourceMapResourceLoaded.call(this, "error: no NetworkAgent.loadResource"); 123 return Promise.reject(new Error("No NetworkAgent.loadResource")); 124 } 132 if (!NetworkAgent.loadResource) 133 return sourceMapResourceLoadError.call(this); 125 134 126 135 var frameIdentifier = null; … … 164 173 } 165 174 }; 166 167 WebInspector.SourceMapResource.prototype.__proto__ = WebInspector.Resource.prototype;
Note: See TracChangeset
for help on using the changeset viewer.