Title: [112571] trunk/Source/WebKit/mac
Revision
112571
Author
[email protected]
Date
2012-03-29 13:46:41 -0700 (Thu, 29 Mar 2012)

Log Message

        [Mac] REGRESSION: Removing translation of local paths in KURL constructor broke some applications
        https://bugs.webkit.org/show_bug.cgi?id=82548
        <rdar://problem/11125355>
        <rdar://problem/11142152>

        Reviewed by Brady Eidson.

        * WebView/WebFrame.mm:
        (-[WebFrame loadRequest:]): Fixed this bug.
        (-[WebFrame loadHTMLString:baseURL:]): Also added translation to another API, so that I don't
        have to come back again.
        (-[WebFrame loadAlternateHTMLString:baseURL:forUnreachableURL:]): Ditto.

        * WebView/WebView.mm: (-[WebView setMainFrameURL:]): Changed another place where clients used
        to pass file paths instead of URLs.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (112570 => 112571)


--- trunk/Source/WebKit/mac/ChangeLog	2012-03-29 20:39:54 UTC (rev 112570)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-03-29 20:46:41 UTC (rev 112571)
@@ -1,3 +1,21 @@
+2012-03-28  Alexey Proskuryakov  <[email protected]>
+
+        [Mac] REGRESSION: Removing translation of local paths in KURL constructor broke some applications
+        https://bugs.webkit.org/show_bug.cgi?id=82548
+        <rdar://problem/11125355>
+        <rdar://problem/11142152>
+
+        Reviewed by Brady Eidson.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame loadRequest:]): Fixed this bug.
+        (-[WebFrame loadHTMLString:baseURL:]): Also added translation to another API, so that I don't
+        have to come back again.
+        (-[WebFrame loadAlternateHTMLString:baseURL:forUnreachableURL:]): Ditto.
+
+        * WebView/WebView.mm: (-[WebView setMainFrameURL:]): Changed another place where clients used
+        to pass file paths instead of URLs.
+
 2012-03-29  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r112553.

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (112570 => 112571)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2012-03-29 20:39:54 UTC (rev 112570)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2012-03-29 20:46:41 UTC (rev 112571)
@@ -1400,7 +1400,14 @@
     Frame* coreFrame = _private->coreFrame;
     if (!coreFrame)
         return;
-    coreFrame->loader()->load(request, false);
+
+    ResourceRequest resourceRequest(request);
+    // Modifying the original request here breaks -[WebDataSource initialRequest], but we don't want
+    // to implement this "path as URL" quirk anywhere except for API boundary.
+    if (!resourceRequest.url().isValid())
+        resourceRequest.setURL([NSURL fileURLWithPath:[[request URL] absoluteString]]);
+
+    coreFrame->loader()->load(resourceRequest, false);
 }
 
 static NSURL *createUniqueWebDataURL()
@@ -1454,14 +1461,14 @@
 {
     WebCoreThreadViolationCheckRoundTwo();
 
-    [self _loadHTMLString:string baseURL:baseURL unreachableURL:nil];
+    [self _loadHTMLString:string baseURL:[baseURL _webkit_URLFromURLOrPath] unreachableURL:nil];
 }
 
 - (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL
 {
     WebCoreThreadViolationCheckRoundTwo();
 
-    [self _loadHTMLString:string baseURL:baseURL unreachableURL:unreachableURL];
+    [self _loadHTMLString:string baseURL:[baseURL _webkit_URLFromURLOrPath] unreachableURL:[unreachableURL _webkit_URLFromURLOrPath]];
 }
 
 - (void)loadArchive:(WebArchive *)archive

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (112570 => 112571)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-03-29 20:39:54 UTC (rev 112570)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-03-29 20:46:41 UTC (rev 112571)
@@ -4232,7 +4232,13 @@
 
 - (void)setMainFrameURL:(NSString *)URLString
 {
-    [[self mainFrame] loadRequest: [NSURLRequest requestWithURL: [NSURL _web_URLWithDataAsString: URLString]]];
+    NSURL *url;
+    if ([URLString hasPrefix:@"/"])
+        url = "" fileURLWithPath:URLString];
+    else
+        url = "" _web_URLWithDataAsString:URLString];
+
+    [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
 }
 
 - (NSString *)mainFrameURL
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to