Title: [152380] trunk/Source/WebInspectorUI
Revision
152380
Author
[email protected]
Date
2013-07-03 16:13:46 -0700 (Wed, 03 Jul 2013)

Log Message

Guard remaining calls to decodeURIComponent with a try/catch.

https://bugs.webkit.org/show_bug.cgi?id=118371

Reviewed by Joseph Pecoraro.

* UserInterface/Main.js:
(WebInspector.displayNameForURL):
(WebInspector.updateWindowTitle):
* UserInterface/Utilities.js:
(arrayResult):
(queryString):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (152379 => 152380)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-07-03 22:33:36 UTC (rev 152379)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-07-03 23:13:46 UTC (rev 152380)
@@ -1,3 +1,18 @@
+2013-07-03  Timothy Hatcher  <[email protected]>
+
+        Guard remaining calls to decodeURIComponent with a try/catch.
+
+        https://bugs.webkit.org/show_bug.cgi?id=118371
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Main.js:
+        (WebInspector.displayNameForURL):
+        (WebInspector.updateWindowTitle):
+        * UserInterface/Utilities.js:
+        (arrayResult):
+        (queryString):
+
 2013-07-03  Jessie Berlin  <[email protected]>
 
         Ran update-webkit-localizable-strings.

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.js (152379 => 152380)


--- trunk/Source/WebInspectorUI/UserInterface/Main.js	2013-07-03 22:33:36 UTC (rev 152379)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.js	2013-07-03 23:13:46 UTC (rev 152380)
@@ -357,12 +357,14 @@
 {
     if (!urlComponents)
         urlComponents = parseURL(url);
+
     var displayName;
     try {
         displayName = decodeURIComponent(urlComponents.lastPathComponent || "");
     } catch (e) {
         displayName = urlComponents.lastPathComponent;
     }
+
     return displayName || WebInspector.displayNameForHost(urlComponents.host) || url;
 }
 
@@ -377,14 +379,22 @@
     var mainFrame = this.frameResourceManager.mainFrame;
     console.assert(mainFrame);
 
+    var urlComponents = mainFrame.mainResource.urlComponents;
+
+    var lastPathComponent;
+    try {
+        lastPathComponent = decodeURIComponent(urlComponents.lastPathComponent || "");
+    } catch (e) {
+        lastPathComponent = urlComponents.lastPathComponent;
+    }
+
     // Build a title based on the URL components.
-    var urlComponents = mainFrame.mainResource.urlComponents;
-    if (urlComponents.host && urlComponents.lastPathComponent)
-        var title = this.displayNameForHost(urlComponents.host) + " \u2014 " + decodeURIComponent(urlComponents.lastPathComponent);
+    if (urlComponents.host && lastPathComponent)
+        var title = this.displayNameForHost(urlComponents.host) + " \u2014 " + lastPathComponent;
     else if (urlComponents.host)
         var title = this.displayNameForHost(urlComponents.host);
-    else if (urlComponents.lastPathComponent)
-        var title = decodeURIComponent(urlComponents.lastPathComponent);
+    else if (lastPathComponent)
+        var title = lastPathComponent;
     else
         var title = mainFrame.url;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Utilities.js (152379 => 152380)


--- trunk/Source/WebInspectorUI/UserInterface/Utilities.js	2013-07-03 22:33:36 UTC (rev 152379)
+++ trunk/Source/WebInspectorUI/UserInterface/Utilities.js	2013-07-03 23:13:46 UTC (rev 152380)
@@ -1170,8 +1170,12 @@
 
     function decode(string)
     {
-        // Replace "+" with " " then decode precent encoded values.
-        return decodeURIComponent(string.replace(/\+/g, " "));
+        try {
+            // Replace "+" with " " then decode precent encoded values.
+            return decodeURIComponent(string.replace(/\+/g, " "));
+        } catch (e) {
+            return string;
+        }
     }
 
     var parameters = arrayResult ? [] : {};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to