MiniBrowser doesn't support data URLs
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 18:19:07 +0000 (18:19 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 18:19:07 +0000 (18:19 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/mac/BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index 8252b03b8354a6c908e4d664be5b829182149c06..34e33e0778f5917abfec20a7ad14e34c64de33dd 100644 (file)
@@ -1,3 +1,21 @@
+2014-08-01  Tim Horton  <timothy_horton@apple.com>
+
+        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  <ryuan.choi@samsung.com>
 
         [EFL][WK2] MiniBrower comes to crash when combo box is pressed
index 5e9ae862798b4a956aa98c923d1f3b975077d46f..6d9e3eff762cbf83af6ce924b3882332765eaf99 100644 (file)
@@ -64,6 +64,9 @@
     if ([address rangeOfString:@"://"].length > 0)
         return address;
 
+    if ([address hasPrefix:@"data:"])
+        return address;
+
     return [@"http://" stringByAppendingString:address];
 }
 
index bfc60f27cd5fa4596ae0fec6931c2a85d4783b1c..a97b3d2cdde7576da238ee4a52299de9882afde8 100644 (file)
@@ -98,7 +98,7 @@ static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @"TiledScr
 {
     [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 @@ static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @"TiledScr
     if (!URL.absoluteString.length)
         return;
 
-    urlText.stringValue = [URL absoluteString];
+    urlText.stringValue = [[URL absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 }
 
 - (void)loadURLString:(NSString *)urlString