Title: [178970] trunk/Source/WebInspectorUI
Revision
178970
Author
jonowe...@apple.com
Date
2015-01-22 16:44:45 -0800 (Thu, 22 Jan 2015)

Log Message

Web Inspector: ResourceContentView.js incorrectly contains call to WebInspector.UIString with a variable parameter
https://bugs.webkit.org/show_bug.cgi?id=140268

Reviewed by Timothy Hatcher.

UIString no longer incorrectly used around variables. Drive-by fixes to prototype inheritance style.
Use of Promises corrected such that requesting content for a resource resolves rather than rejects if
a resource can't be found or has another error that isn't a web inspector error.

* Localizations/en.lproj/localizedStrings.js: Updated.
* UserInterface/Models/Resource.js: Change reject to resolve.
* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.requestContentFromBackend): Proper use of Error object.
* UserInterface/Models/SourceCode.js: Use correct inheritance style.
* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView.prototype._contentAvailable): Handle error now that promise resolves.
(WebInspector.ResourceContentView.prototype._contentError): Remove incorrect use of UIString.
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._contentAvailable): Handle error now that promise resolves.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (178969 => 178970)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-01-23 00:44:45 UTC (rev 178970)
@@ -1,3 +1,25 @@
+2015-01-22  Jonathan Wells  <jonowe...@apple.com>
+
+        Web Inspector: ResourceContentView.js incorrectly contains call to WebInspector.UIString with a variable parameter
+        https://bugs.webkit.org/show_bug.cgi?id=140268
+
+        Reviewed by Timothy Hatcher.
+
+        UIString no longer incorrectly used around variables. Drive-by fixes to prototype inheritance style.
+        Use of Promises corrected such that requesting content for a resource resolves rather than rejects if
+        a resource can't be found or has another error that isn't a web inspector error.
+
+        * Localizations/en.lproj/localizedStrings.js: Updated.
+        * UserInterface/Models/Resource.js: Change reject to resolve.
+        * UserInterface/Models/Script.js:
+        (WebInspector.Script.prototype.requestContentFromBackend): Proper use of Error object.
+        * UserInterface/Models/SourceCode.js: Use correct inheritance style.
+        * UserInterface/Views/ResourceContentView.js:
+        (WebInspector.ResourceContentView.prototype._contentAvailable): Handle error now that promise resolves.
+        (WebInspector.ResourceContentView.prototype._contentError): Remove incorrect use of UIString.
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype._contentAvailable): Handle error now that promise resolves.
+
 2015-01-22  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Expected gutter highlight when selecting console input line, just like output line

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -47,6 +47,7 @@
 localizedStrings["All Exceptions"] = "All Exceptions";
 localizedStrings["All Uncaught Exceptions"] = "All Uncaught Exceptions";
 localizedStrings["An error occured trying to\nread the  %s  table."] = "An error occured trying to\nread the  %s  table.";
+localizedStrings["An error occurred trying to load the resource."] = "An error occurred trying to load the resource.";
 localizedStrings["An unexpected error %s occurred."] = "An unexpected error %s occurred.";
 localizedStrings["An unexpected error occurred."] = "An unexpected error occurred.";
 localizedStrings["Angle"] = "Angle";

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -186,6 +186,7 @@
 
 WebInspector.Resource.prototype = {
     constructor: WebInspector.Resource,
+    __proto__: WebInspector.SourceCode.prototype,
 
     // Public
 
@@ -679,7 +680,7 @@
             return WebInspector.SourceCode.prototype.requestContent.call(this);
 
         if (this._failed)
-            return Promise.reject(new Error("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);
@@ -714,5 +715,3 @@
         cookie[WebInspector.Resource.MainResourceCookieKey] = this.isMainResource();
     }
 };
-
-WebInspector.Resource.prototype.__proto__ = WebInspector.SourceCode.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -58,6 +58,7 @@
 
 WebInspector.Script.prototype = {
     constructor: WebInspector.Script,
+    __proto__: WebInspector.SourceCode.prototype,
 
     // Public
 
@@ -110,12 +111,12 @@
         return this._scriptSyntaxTree;
     },
 
-    requestContentFromBackend: function(callback)
+    requestContentFromBackend: function()
     {
         if (!this._id) {
             // There is no identifier to request content with. Return false to cause the
             // pending callbacks to get null content.
-            return Promise.reject({ message: "There is no identifier to request content with." });
+            return Promise.reject(new Error("There is no identifier to request content with."));
         }
 
         return DebuggerAgent.getScriptSource.promise(this._id);
@@ -212,5 +213,3 @@
         this._scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(sourceText, this);
     }
 };
-
-WebInspector.Script.prototype.__proto__ = WebInspector.SourceCode.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -47,6 +47,7 @@
 
 WebInspector.SourceCode.prototype = {
     constructor: WebInspector.SourceCode,
+    __proto__: WebInspector.Object.prototype,
 
     // Public
 
@@ -206,5 +207,3 @@
         });
     }
 };
-
-WebInspector.SourceCode.prototype.__proto__ = WebInspector.Object.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -58,6 +58,7 @@
 
 WebInspector.ResourceContentView.prototype = {
     constructor: WebInspector.ResourceContentView,
+    __proto__: WebInspector.ContentView.prototype,
 
     // Public
 
@@ -88,6 +89,11 @@
 
     _contentAvailable: function(parameters)
     {
+        if (parameters.error) {
+            this._contentError({ message: parameters.error });
+            return;
+        }
+
         // Content is ready to show, call the public method now.
         this.contentAvailable(parameters.content, parameters.base64Encoded);
     },
@@ -99,7 +105,7 @@
             return;
 
         this.element.removeChildren();
-        this.element.appendChild(WebInspector.createMessageTextView(WebInspector.UIString(error.message), true));
+        this.element.appendChild(WebInspector.createMessageTextView(error.message, true));
     },
 
     _issueWasAdded: function(event)
@@ -120,5 +126,3 @@
         WebInspector.handlePossibleLinkClick(event, this.resource.parentFrame);
     }
 };
-
-WebInspector.ResourceContentView.prototype.__proto__ = WebInspector.ContentView.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (178969 => 178970)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-01-23 00:31:24 UTC (rev 178969)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-01-23 00:44:45 UTC (rev 178970)
@@ -510,6 +510,10 @@
 
     _contentAvailable: function(parameters)
     {
+        // Return if resource is not available.
+        if (parameters.error)
+            return;
+
         var sourceCode = parameters.sourceCode;
         var content = parameters.content;
         var base64Encoded = parameters.base64Encoded;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to