Title: [171924] trunk/Tools
Revision
171924
Author
[email protected]
Date
2014-08-01 11:19:07 -0700 (Fri, 01 Aug 2014)

Log Message

MiniBrowser doesn't support data URLs
https://bugs.webkit.org/show_bug.cgi?id=135492

Reviewed by Simon Fraser.

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController addProtocolIfNecessary:]):
Don't add http:// to data: URLs.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController fetch:]):
(-[WK2BrowserWindowController updateTextFieldFromURL:]):
Percent-escape the contents of the address field before trying to make a URL.
Percent-unescape the URL when displaying it in the address field.
This is not great, but trivial and good-enough-for-Minibrowser.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (171923 => 171924)


--- trunk/Tools/ChangeLog	2014-08-01 18:16:19 UTC (rev 171923)
+++ trunk/Tools/ChangeLog	2014-08-01 18:19:07 UTC (rev 171924)
@@ -1,3 +1,21 @@
+2014-08-01  Tim Horton  <[email protected]>
+
+        MiniBrowser doesn't support data URLs
+        https://bugs.webkit.org/show_bug.cgi?id=135492
+
+        Reviewed by Simon Fraser.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController addProtocolIfNecessary:]):
+        Don't add http:// to data: URLs.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController fetch:]):
+        (-[WK2BrowserWindowController updateTextFieldFromURL:]):
+        Percent-escape the contents of the address field before trying to make a URL.
+        Percent-unescape the URL when displaying it in the address field.
+        This is not great, but trivial and good-enough-for-Minibrowser.
+
 2014-07-31  Ryuan Choi  <[email protected]>
 
         [EFL][WK2] MiniBrower comes to crash when combo box is pressed

Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (171923 => 171924)


--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2014-08-01 18:16:19 UTC (rev 171923)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2014-08-01 18:19:07 UTC (rev 171924)
@@ -64,6 +64,9 @@
     if ([address rangeOfString:@"://"].length > 0)
         return address;
 
+    if ([address hasPrefix:@"data:"])
+        return address;
+
     return [@"http://" stringByAppendingString:address];
 }
 

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (171923 => 171924)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2014-08-01 18:16:19 UTC (rev 171923)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2014-08-01 18:19:07 UTC (rev 171924)
@@ -98,7 +98,7 @@
 {
     [urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
 
-    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[urlText stringValue]]]];
+    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[[urlText stringValue] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
 }
 
 - (IBAction)showHideWebView:(id)sender
@@ -423,7 +423,7 @@
     if (!URL.absoluteString.length)
         return;
 
-    urlText.stringValue = [URL absoluteString];
+    urlText.stringValue = [[URL absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 }
 
 - (void)loadURLString:(NSString *)urlString
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to