Modified: trunk/Source/WebInspectorUI/ChangeLog (179712 => 179713)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-02-05 22:46:30 UTC (rev 179712)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-02-05 22:47:40 UTC (rev 179713)
@@ -1,3 +1,30 @@
+2015-02-04 Jono Wells <[email protected]>
+
+ Web Inspector: REGRESSION: Inline SourceMap resources show empty content when opened.
+ https://bugs.webkit.org/show_bug.cgi?id=141225
+
+ Reviewed by Timothy Hatcher.
+
+ Change WebInspector.SourceMapResource.prototype.requestContentFromBackend to correctly and consistently handle
+ calls to NetworkAgent. The helper function sourceMapResourceLoaded will now properly handle parameters as a single
+ payload, including manual calls in the case where the source map content is in a data URI. Also
+ WebInspector.SourceCode.prototype._processContent now properly handles an error string used for displaying
+ resource loading error messages in the resource content view.
+
+ * UserInterface/Models/Resource.js: drive-by style fix.
+
+ * UserInterface/Models/SourceCode.js:
+ (WebInspector.SourceCode.prototype._processContent):
+ Properly handle error string.
+
+ * UserInterface/Models/SourceMapResource.js:
+ (WebInspector.SourceMapResource.prototype.requestContentFromBackend):
+ (WebInspector.SourceMapResource.prototype.requestContentFromBackend.sourceMapResourceLoaded):
+ Formerly sourceMapResourceLoadError, now handles parameters from the NetworkAgent correctly.
+
+ (WebInspector.SourceMapResource.prototype.requestContentFromBackend.sourceMapResourceLoadError):
+ This function now handles NetworkAgent errors only.
+
2015-02-05 Brian J. Burg <[email protected]>
Web Inspector: eliminate some unnecessary layout/painting in timeline overview and ruler
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (179712 => 179713)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2015-02-05 22:46:30 UTC (rev 179712)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2015-02-05 22:47:40 UTC (rev 179713)
@@ -680,7 +680,7 @@
return WebInspector.SourceCode.prototype.requestContent.call(this);
if (this._failed)
- return Promise.resolve({ error: WebInspector.UIString("An error occurred trying to load the resource.") });
+ return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
if (!this._finishThenRequestContentPromise) {
var listener = new WebInspector.EventListener(this, true);
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (179712 => 179713)
--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2015-02-05 22:46:30 UTC (rev 179712)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2015-02-05 22:47:40 UTC (rev 179713)
@@ -191,6 +191,7 @@
{
// Different backend APIs return one of `content, `body`, or `scriptSource`.
var content = parameters.content || parameters.body || parameters.scriptSource;
+ var error = parameters.error;
var base64Encoded = parameters.base64Encoded;
var revision = this.revisionForRequestedContent;
@@ -201,6 +202,7 @@
delete this._ignoreRevisionContentDidChangeEvent;
return Promise.resolve({
+ error: error,
sourceCode: this,
content: content,
base64Encoded: base64Encoded
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js (179712 => 179713)
--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js 2015-02-05 22:46:30 UTC (rev 179712)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js 2015-02-05 22:47:40 UTC (rev 179713)
@@ -49,6 +49,7 @@
WebInspector.SourceMapResource.prototype = {
constructor: WebInspector.SourceMapResource,
+ __proto__: WebInspector.Resource.prototype,
// Public
@@ -84,26 +85,36 @@
// Force inline content to be asynchronous to match the expected load pattern.
// FIXME: We don't know the MIME-type for inline content. Guess by analyzing the content?
// Returns a promise.
- return sourceMapResourceLoaded.call(this, null, inlineContent, this.mimeType, 200);
+ return sourceMapResourceLoaded.call(this, {content: inlineContent, mimeType: this.mimeType, status: 200});
}
- function sourceMapResourceLoadError(error, body, mimeType, statusCode)
+ function sourceMapResourceNotAvailable(error, content, mimeType, statusCode)
{
this.markAsFailed();
return Promise.resolve({
- error: error,
- content: body.content,
+ error: WebInspector.UIString("An error occurred trying to load the resource."),
+ content: content,
mimeType: mimeType,
statusCode: statusCode
});
}
- function sourceMapResourceLoaded(body, mimeType, statusCode)
+ function sourceMapResourceLoadError(error)
{
+ // There was an error calling NetworkAgent.loadResource.
+ console.error(error || "There was an unknown error calling NetworkAgent.loadResource.");
+ this.markAsFailed();
+ return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
+ }
+
+ function sourceMapResourceLoaded(parameters)
+ {
+ var {error, content, mimeType, statusCode} = parameters;
+
const base64encoded = false;
- if (statusCode >= 400)
- return sourceMapResourceLoadError(error, body, mimeType, statusCode);
+ if (statusCode >= 400 || error)
+ return sourceMapResourceNotAvailable(error, content, mimeType, statusCode);
// FIXME: Add support for picking the best MIME-type. Right now the file extension is the best bet.
// The constructor set MIME-type based on the file extension and we ignore mimeType here.
@@ -111,17 +122,15 @@
this.markAsFinished();
return Promise.resolve({
- content: body.content,
+ content: content,
mimeType: mimeType,
base64encoded: base64encoded,
statusCode: statusCode
});
}
- if (!NetworkAgent.loadResource) {
- sourceMapResourceLoaded.call(this, "error: no NetworkAgent.loadResource");
- return Promise.reject(new Error("No NetworkAgent.loadResource"));
- }
+ if (!NetworkAgent.loadResource)
+ return sourceMapResourceLoadError.call(this);
var frameIdentifier = null;
if (this._sourceMap.originalSourceCode instanceof WebInspector.Resource && this._sourceMap.originalSourceCode.parentFrame)
@@ -163,5 +172,3 @@
return new WebInspector.SourceCodeTextRange(this._sourceMap.originalSourceCode, startSourceCodeLocation, endSourceCodeLocation);
}
};
-
-WebInspector.SourceMapResource.prototype.__proto__ = WebInspector.Resource.prototype;