Title: [97633] trunk
Revision
97633
Author
[email protected]
Date
2011-10-17 10:55:31 -0700 (Mon, 17 Oct 2011)

Log Message

Source/WebCore: Export KURL::baseAsString() so it can be called in WebProcessProxy::assumeReadAccessToBaseURL() in WebKit2.
https://bugs.webkit.org/show_bug.cgi?id=70168

Reviewed by Alexey Proskuryakov.

No new tests. There is no change in functionality.

* WebCore.exp.in: Export KURL::baseAsString().

Source/WebKit2: Calling WKPageLoadAlternateHTMLString() where baseURL does not point to a directory causes an invalid message to be returned from WebProcess
https://bugs.webkit.org/show_bug.cgi?id=70168

Reviewed by Alexey Proskuryakov.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::assumeReadAccessToBaseURL): Add the file path of url's base URL to m_localPathsWithAssumedReadAccess,
since url may not point to a directory.

Tools: Add a test to call WKPageLoadAlternateHTMLString() with a non-directory URL.
https://bugs.webkit.org/show_bug.cgi?id=70168

Reviewed by Alexey Proskuryakov.

* TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST): Call WKPageLoadAlternateHTMLString() with a file URL and make sure it finishes loading.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
Add the new file.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97632 => 97633)


--- trunk/Source/WebCore/ChangeLog	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Source/WebCore/ChangeLog	2011-10-17 17:55:31 UTC (rev 97633)
@@ -1,3 +1,14 @@
+2011-10-17  Ada Chan  <[email protected]>
+
+        Export KURL::baseAsString() so it can be called in WebProcessProxy::assumeReadAccessToBaseURL() in WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=70168
+
+        Reviewed by Alexey Proskuryakov.
+
+        No new tests. There is no change in functionality.
+
+        * WebCore.exp.in: Export KURL::baseAsString().
+
 2011-10-17  Ryosuke Niwa  <[email protected]>
 
         Touch Internals.cpp to make 64-bit GTK+ build happy.

Modified: trunk/Source/WebCore/WebCore.exp.in (97632 => 97633)


--- trunk/Source/WebCore/WebCore.exp.in	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-10-17 17:55:31 UTC (rev 97633)
@@ -1285,6 +1285,7 @@
 __ZNK7WebCore4KURL10protocolIsEPKc
 __ZNK7WebCore4KURL11createCFURLEv
 __ZNK7WebCore4KURL11isLocalFileEv
+__ZNK7WebCore4KURL12baseAsStringEv
 __ZNK7WebCore4KURL14fileSystemPathEv
 __ZNK7WebCore4KURL17lastPathComponentEv
 __ZNK7WebCore4KURL4hostEv

Modified: trunk/Source/WebKit2/ChangeLog (97632 => 97633)


--- trunk/Source/WebKit2/ChangeLog	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-17 17:55:31 UTC (rev 97633)
@@ -1,3 +1,14 @@
+2011-10-17  Ada Chan  <[email protected]>
+
+        Calling WKPageLoadAlternateHTMLString() where baseURL does not point to a directory causes an invalid message to be returned from WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=70168
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::assumeReadAccessToBaseURL): Add the file path of url's base URL to m_localPathsWithAssumedReadAccess,
+        since url may not point to a directory.
+
 2011-10-17  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Add methods to get/set a custom text enconding to WebKit2 GTK+ API

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (97632 => 97633)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2011-10-17 17:55:31 UTC (rev 97633)
@@ -209,9 +209,13 @@
     if (!url.isLocalFile())
         return;
 
+    // There's a chance that urlString does not point to a directory.
+    // Get url's base URL to add to m_localPathsWithAssumedReadAccess.
+    KURL baseURL(KURL(), url.baseAsString());
+    
     // Client loads an alternate string. This doesn't grant universal file read, but the web process is assumed
     // to have read access to this directory already.
-    m_localPathsWithAssumedReadAccess.add(url.fileSystemPath());
+    m_localPathsWithAssumedReadAccess.add(baseURL.fileSystemPath());
 }
 
 bool WebProcessProxy::checkURLReceivedFromWebProcess(const String& urlString)

Modified: trunk/Tools/ChangeLog (97632 => 97633)


--- trunk/Tools/ChangeLog	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Tools/ChangeLog	2011-10-17 17:55:31 UTC (rev 97633)
@@ -1,3 +1,18 @@
+2011-10-17  Ada Chan  <[email protected]>
+
+        Add a test to call WKPageLoadAlternateHTMLString() with a non-directory URL.
+        https://bugs.webkit.org/show_bug.cgi?id=70168
+
+        Reviewed by Alexey Proskuryakov.
+
+        * TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::TEST): Call WKPageLoadAlternateHTMLString() with a file URL and make sure it finishes loading.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+        Add the new file.
+
 2011-10-17  Darin Adler  <[email protected]>
 
         Add some more *.pyc ignores in directories with Python scripts.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (97632 => 97633)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-10-17 17:55:31 UTC (rev 97633)
@@ -31,6 +31,7 @@
 		4BFDFFA9131477770061F24B /* HitTestResultNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */; };
 		520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */; };
 		520BCF4D141EB09E00937EA8 /* WebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4B141EB09E00937EA8 /* WebArchive.cpp */; };
+		52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */; };
 		81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
 		939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; };
 		A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */; };
@@ -162,6 +163,7 @@
 		4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle.cpp; sourceTree = "<group>"; };
 		520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive_Bundle.cpp; sourceTree = "<group>"; };
 		520BCF4B141EB09E00937EA8 /* WebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive.cpp; sourceTree = "<group>"; };
+		52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadAlternateHTMLStringWithNonDirectoryURL.cpp; sourceTree = "<group>"; };
 		81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = WTF/StringBuilder.cpp; sourceTree = "<group>"; };
 		8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
 		939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorOnBack.mm; sourceTree = "<group>"; };
@@ -363,6 +365,7 @@
 				4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */,
 				BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
 				BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
+				52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */,
 				33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */,
 				33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */,
 				33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */,
@@ -621,6 +624,7 @@
 				520BCF4D141EB09E00937EA8 /* WebArchive.cpp in Sources */,
 				F6FDDDD314241AD4004F1729 /* PrivateBrowsingPushStateNoHistoryCallback.cpp in Sources */,
 				C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
+				52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp (0 => 97633)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp	2011-10-17 17:55:31 UTC (rev 97633)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "_javascript_Test.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+
+#include <WebKit2/WKContext.h>
+#include <WebKit2/WKPage.h>
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+    
+static bool didFinishLoad = false;
+    
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+    didFinishLoad = true;
+}
+
+TEST(WebKit2, LoadAlternateHTMLStringWithNonDirectoryURL)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    PlatformWebView webView(context.get());
+
+    WKPageLoaderClient loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+    
+    loaderClient.version = 0;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+
+    WKRetainPtr<WKURLRef> fileURL(AdoptWK, Util::createURLForResource("simple", "html"));
+    WKRetainPtr<WKStringRef> alternateHTMLString(AdoptWK, WKStringCreateWithUTF8CString("<html><body><img src=''></body></html>"));
+    
+    // Call WKPageLoadAlternateHTMLString() with fileURL which does not point to a directory
+    WKPageLoadAlternateHTMLString(webView.page(), alternateHTMLString.get(), fileURL.get(), fileURL.get());
+    
+    // If we can finish loading the html without resulting in an invalid message being sent from the WebProcess, this test passes.
+    Util::run(&didFinishLoad);
+}
+
+} // namespace TestWebKitAPI

Modified: trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj (97632 => 97633)


--- trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj	2011-10-17 17:24:53 UTC (rev 97632)
+++ trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj	2011-10-17 17:55:31 UTC (rev 97633)
@@ -492,6 +492,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Tests\WebKit2\LoadAlternateHTMLStringWithNonDirectoryURL.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\Tests\WebKit2\LoadCanceledNoServerRedirectCallback.cpp"
 					>
 				</File>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to