Diff
Modified: trunk/Source/WebKit2/ChangeLog (149193 => 149194)
--- trunk/Source/WebKit2/ChangeLog 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-26 16:55:12 UTC (rev 149194)
@@ -1,3 +1,53 @@
+2013-04-25 Andy Estes <aes...@apple.com>
+
+ [WebKit2] Loading a resource from a custom protocol in a synchronous XHR times out
+ https://bugs.webkit.org/show_bug.cgi?id=115223
+
+ Reviewed by Darin Adler.
+
+ When WebKit performs a synchronous load on the Mac, it spins a nested
+ run loop in a mode that only accepts input from the NSURLConnection
+ performing the load. When the load is for a custom protocol in WebKit2,
+ we proxy it to the UI process via CoreIPC messages, but the response
+ messages from the UI process are never processed as long as the run
+ loop is in a non-common mode (and we wouldn't want to process messages
+ that could re-enter WebCore in the middle of loading, anyway). Since
+ these messages never make it back to the NSURLConnection handling the
+ request, the connection eventually times out.
+
+ Fix this by using a work queue to handle custom protocol messages in
+ the networking process. The work queue can process incoming custom
+ protocol messages while the main thread is blocked.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::initializeConnection): Called
+ initializeConnection() on all the NetworkProcess's supplements.
+ * Shared/ChildProcessSupplement.h: Added a base class for
+ NetworkProcessSupplement and WebProcessSupplement which defines
+ initializeConnection and provides an empty default implementation.
+ (WebKit::ChildProcessSupplement::~ChildProcessSupplement):
+ (WebKit::ChildProcessSupplement::initializeConnection):
+ * Shared/Network/CustomProtocols/CustomProtocolManager.h:
+ * Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm:
+ (WebKit::CustomProtocolManager::CustomProtocolManager): Instantiated a
+ work queue for message processing.
+ (WebKit::CustomProtocolManager::initializeConnection): Added the work
+ queue as a message receiver on the CoreIPC connection.
+ (WebKit::CustomProtocolManager::initialize): If we're in the web
+ process and the network process is being used, unregister and destroy
+ the work queue we previously created. It'd be better to not create it
+ in the first place, but we have to register our work queue with the
+ CoreIPC connection before it is established, which is before the UI
+ process has told us whether the network process is in use.
+ * Shared/Network/NetworkProcessSupplement.h: Inherited from
+ ChildProcessSupplement.
+ * WebKit2.xcodeproj/project.pbxproj: Added ChildProcessSupplement.h.
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeConnection): Called
+ initializeConnection() on all the WebProcess's supplements.
+ * WebProcess/WebProcessSupplement.h: Inherited from
+ ChildProcessSupplement.
+
2013-04-26 Eduardo Lima Mitev <el...@igalia.com>
[GTK] Compilation of ProcessLauncherGtk.cpp fails due to unresolved symbols
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (149193 => 149194)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2013-04-26 16:55:12 UTC (rev 149194)
@@ -174,6 +174,11 @@
#if USE(SECURITY_FRAMEWORK)
SecItemShim::shared().initializeConnection(connection);
#endif
+
+ NetworkProcessSupplementMap::const_iterator it = m_supplements.begin();
+ NetworkProcessSupplementMap::const_iterator end = m_supplements.end();
+ for (; it != end; ++it)
+ it->value->initializeConnection(connection);
}
void NetworkProcess::createNetworkConnectionToWebProcess()
Copied: trunk/Source/WebKit2/Shared/ChildProcessSupplement.h (from rev 149193, trunk/Source/WebKit2/WebProcess/WebProcessSupplement.h) (0 => 149194)
--- trunk/Source/WebKit2/Shared/ChildProcessSupplement.h (rev 0)
+++ trunk/Source/WebKit2/Shared/ChildProcessSupplement.h 2013-04-26 16:55:12 UTC (rev 149194)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef ChildProcessSupplement_h
+#define ChildProcessSupplement_h
+
+namespace CoreIPC {
+class Connection;
+} // namespace CoreIPC
+
+namespace WebKit {
+
+class ChildProcessSupplement {
+public:
+ virtual ~ChildProcessSupplement()
+ {
+ }
+
+ virtual void initializeConnection(CoreIPC::Connection*)
+ {
+ }
+};
+
+} // namespace WebKit
+
+#endif // ChildProcessSupplement_h
Modified: trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h (149193 => 149194)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h 2013-04-26 16:55:12 UTC (rev 149194)
@@ -28,9 +28,10 @@
#if ENABLE(CUSTOM_PROTOCOLS)
-#include "MessageReceiver.h"
+#include "Connection.h"
#include "NetworkProcessSupplement.h"
#include "WebProcessSupplement.h"
+#include "WorkQueue.h"
#include <wtf/HashSet.h>
#include <wtf/Threading.h>
#include <wtf/text/WTFString.h>
@@ -56,7 +57,7 @@
class ChildProcess;
struct NetworkProcessCreationParameters;
-class CustomProtocolManager : public WebProcessSupplement, public NetworkProcessSupplement, public CoreIPC::MessageReceiver {
+class CustomProtocolManager : public WebProcessSupplement, public NetworkProcessSupplement, public CoreIPC::Connection::WorkQueueMessageReceiver {
WTF_MAKE_NONCOPYABLE(CustomProtocolManager);
public:
explicit CustomProtocolManager(ChildProcess*);
@@ -75,6 +76,9 @@
#endif
private:
+ // ChildProcessSupplement
+ void initializeConnection(CoreIPC::Connection*) OVERRIDE;
+
// WebProcessSupplement
void initialize(const WebProcessCreationParameters&) OVERRIDE;
@@ -93,6 +97,7 @@
HashSet<String> m_registeredSchemes;
ChildProcess* m_childProcess;
+ RefPtr<WorkQueue> m_messageQueue;
#if PLATFORM(MAC)
typedef HashMap<uint64_t, RetainPtr<WKCustomProtocol> > CustomProtocolMap;
Modified: trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm (149193 => 149194)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm 2013-04-26 16:55:12 UTC (rev 149194)
@@ -116,19 +116,26 @@
CustomProtocolManager::CustomProtocolManager(ChildProcess* childProcess)
: m_childProcess(childProcess)
+ , m_messageQueue(WorkQueue::create("com.apple.WebKit.CustomProtocolManager"))
{
- m_childProcess->addMessageReceiver(Messages::CustomProtocolManager::messageReceiverName(), this);
-
ASSERT(!sharedCustomProtocolManager);
sharedCustomProtocolManager = this;
}
+void CustomProtocolManager::initializeConnection(CoreIPC::Connection* connection)
+{
+ connection->addWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName(), m_messageQueue.get(), this);
+}
+
void CustomProtocolManager::initialize(const WebProcessCreationParameters& parameters)
{
#if ENABLE(NETWORK_PROCESS)
ASSERT(parameters.urlSchemesRegisteredForCustomProtocols.isEmpty() || !parameters.usesNetworkProcess);
- if (parameters.usesNetworkProcess)
+ if (parameters.usesNetworkProcess) {
+ m_childProcess->connection()->removeWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName());
+ m_messageQueue = nullptr;
return;
+ }
#endif
[NSURLProtocol registerClass:[WKCustomProtocol class]];
Modified: trunk/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h (149193 => 149194)
--- trunk/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h 2013-04-26 16:55:12 UTC (rev 149194)
@@ -26,17 +26,15 @@
#ifndef NetworkProcessSupplement_h
#define NetworkProcessSupplement_h
+#include "ChildProcessSupplement.h"
+
namespace WebKit {
struct NetworkProcessCreationParameters;
-class NetworkProcessSupplement {
+class NetworkProcessSupplement : public ChildProcessSupplement {
#if ENABLE(NETWORK_PROCESS)
public:
- virtual ~NetworkProcessSupplement()
- {
- }
-
virtual void initialize(const NetworkProcessCreationParameters&)
{
}
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (149193 => 149194)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-04-26 16:55:12 UTC (rev 149194)
@@ -295,6 +295,7 @@
1CBC945E16515ED200D68AAE /* DockBottom.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBC945D16515ED200D68AAE /* DockBottom.pdf */; };
1QQ417CB12C00CCA002BE67B /* TextCheckerCompletion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */; };
1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */; };
+ 290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */; };
293EBEAB1627D9C9005F89F1 /* WKDOMText.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EBEA91627D9C9005F89F1 /* WKDOMText.h */; settings = {ATTRIBUTES = (Public, ); }; };
293EBEAC1627D9C9005F89F1 /* WKDOMText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */; };
29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 29501723162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1719,6 +1720,7 @@
1CB75C931701E880009F809F /* DockRight.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = DockRight.pdf; path = Resources/DockRight.pdf; sourceTree = "<group>"; };
1CBC945D16515ED200D68AAE /* DockBottom.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = DockBottom.pdf; path = Resources/DockBottom.pdf; sourceTree = "<group>"; };
1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerCompletion.h; sourceTree = "<group>"; };
+ 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessSupplement.h; sourceTree = "<group>"; };
293EBEA91627D9C9005F89F1 /* WKDOMText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMText.h; sourceTree = "<group>"; };
293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKDOMText.mm; sourceTree = "<group>"; };
29501723162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInBrowserContextControllerPrivate.h; sourceTree = "<group>"; };
@@ -3204,6 +3206,7 @@
1A2D956D12848564001EB962 /* ChildProcess.h */,
E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */,
E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
+ 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */,
1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
5136183B163126DA00A99DDE /* ConnectionStack.cpp */,
5136183C163126DA00A99DDE /* ConnectionStack.h */,
@@ -5617,6 +5620,7 @@
5167EEA0170377BF007681CA /* DiskCacheMonitor.h in Headers */,
BC646C1D11DD399F006455B0 /* WKBackForwardListItem.h in Headers */,
BCDDB317124EBD130048D13C /* WKBase.h in Headers */,
+ 290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */,
BCBAAC73144E619E0053F82F /* WKBrowsingContextController.h in Headers */,
BCBAAC74144E61A50053F82F /* WKBrowsingContextControllerInternal.h in Headers */,
3788A05C14743C90006319E5 /* WKBrowsingContextControllerPrivate.h in Headers */,
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (149193 => 149194)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-04-26 16:55:12 UTC (rev 149194)
@@ -229,6 +229,11 @@
#if USE(SECURITY_FRAMEWORK)
SecItemShim::shared().initializeConnection(connection);
#endif
+
+ WebProcessSupplementMap::const_iterator it = m_supplements.begin();
+ WebProcessSupplementMap::const_iterator end = m_supplements.end();
+ for (; it != end; ++it)
+ it->value->initializeConnection(connection);
m_webConnection = WebConnectionToUIProcess::create(this);
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcessSupplement.h (149193 => 149194)
--- trunk/Source/WebKit2/WebProcess/WebProcessSupplement.h 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Source/WebKit2/WebProcess/WebProcessSupplement.h 2013-04-26 16:55:12 UTC (rev 149194)
@@ -26,16 +26,14 @@
#ifndef WebProcessSupplement_h
#define WebProcessSupplement_h
+#include "ChildProcessSupplement.h"
+
namespace WebKit {
struct WebProcessCreationParameters;
-class WebProcessSupplement {
+class WebProcessSupplement : public ChildProcessSupplement {
public:
- virtual ~WebProcessSupplement()
- {
- }
-
virtual void initialize(const WebProcessCreationParameters&)
{
}
Modified: trunk/Tools/ChangeLog (149193 => 149194)
--- trunk/Tools/ChangeLog 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Tools/ChangeLog 2013-04-26 16:55:12 UTC (rev 149194)
@@ -1,3 +1,29 @@
+2013-04-25 Andy Estes <aes...@apple.com>
+
+ [WebKit2] Loading a resource from a custom protocol in a synchronous XHR times out
+ https://bugs.webkit.org/show_bug.cgi?id=115223
+
+ Reviewed by Darin Adler.
+
+ Added an API test.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added new files.
+ * TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm: Added.
+ (TestWebKitAPI::TEST): Tested that a synchronous XHR does not time out
+ when it loads a request with a custom protocol.
+ * TestWebKitAPI/Tests/WebKit2/custom-protocol-sync-xhr.html: Added.
+ * TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm: Moved the
+ NSURLProtocol subclass to TestProtocol.{h, mm} and did some
+ miscellaneous cleanup.
+ * TestWebKitAPI/mac/TestProtocol.h: Copied from Source/WebKit2/WebProcess/WebProcessSupplement.h.
+ * TestWebKitAPI/mac/TestProtocol.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm.
+ (+[TestProtocol canInitWithRequest:]):
+ (+[TestProtocol canonicalRequestForRequest:]):
+ (+[TestProtocol requestIsCacheEquivalent:toRequest:]):
+ (+[TestProtocol scheme]):
+ (-[TestProtocol startLoading]):
+ (-[TestProtocol stopLoading]):
+
2013-04-26 Martin Robinson <mrobin...@igalia.com>
Remove the remaining Skia #ifdefs
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (149193 => 149194)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-04-26 16:55:12 UTC (rev 149194)
@@ -35,6 +35,9 @@
26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F1B44215CA434F00D1E4BF /* AtomicString.cpp */; };
26F1B44515CA434F00D1E4BF /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */; };
+ 290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
+ 290F4278172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 290F4276172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm */; };
+ 290F427B172A23A500939FF0 /* TestProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = 290F4279172A23A500939FF0 /* TestProtocol.mm */; };
2943BE86161DFEB800999E3D /* UserContentTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2943BE84161DFEB800999E3D /* UserContentTest.mm */; };
29AB8AA1164C735800D49BEC /* CustomProtocolsTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */; };
29AB8AA4164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */; };
@@ -232,6 +235,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ 290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */,
C2CF975B16CEC71B0054E99D /* JSContextBackForwardCache1.html in Copy Resources */,
C2CF975A16CEC7140054E99D /* JSContextBackForwardCache2.html in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
@@ -302,6 +306,10 @@
26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CancelLoadFromResourceLoadDelegate.html; sourceTree = "<group>"; };
26F1B44215CA434F00D1E4BF /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = WTF/AtomicString.cpp; sourceTree = "<group>"; };
26F1B44315CA434F00D1E4BF /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImpl.cpp; path = WTF/StringImpl.cpp; sourceTree = "<group>"; };
+ 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "custom-protocol-sync-xhr.html"; sourceTree = "<group>"; };
+ 290F4276172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CustomProtocolsSyncXHRTest.mm; sourceTree = "<group>"; };
+ 290F4279172A23A500939FF0 /* TestProtocol.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestProtocol.mm; sourceTree = "<group>"; };
+ 290F427A172A23A500939FF0 /* TestProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestProtocol.h; sourceTree = "<group>"; };
2943BE84161DFEB800999E3D /* UserContentTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UserContentTest.mm; path = WebKit2ObjC/UserContentTest.mm; sourceTree = "<group>"; };
29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolsTest.mm; path = WebKit2ObjC/CustomProtocolsTest.mm; sourceTree = "<group>"; };
29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; };
@@ -598,6 +606,7 @@
isa = PBXGroup;
children = (
29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */,
+ 290F4276172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm */,
2943BE84161DFEB800999E3D /* UserContentTest.mm */,
BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */,
BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */,
@@ -745,6 +754,7 @@
children = (
C045F9461385C2F800C0F3CD /* 18-characters.html */,
76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
+ 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
1A02C84B125D4A5E00E3F4BD /* find.html */,
@@ -779,6 +789,8 @@
C081224413FC19EC00DC39AE /* SyntheticBackingScaleFactorWindow.m */,
29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */,
29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */,
+ 290F427A172A23A500939FF0 /* TestProtocol.h */,
+ 290F4279172A23A500939FF0 /* TestProtocol.mm */,
C08587BE13FE956C001EF4E5 /* WebKitAgnosticTest.h */,
C08587BD13FE956C001EF4E5 /* WebKitAgnosticTest.mm */,
);
@@ -1022,6 +1034,7 @@
1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */,
BCBD3710125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp in Sources */,
BCBD3761125ABCFE00D2C29F /* FrameMIMETypePNG.cpp in Sources */,
+ 290F427B172A23A500939FF0 /* TestProtocol.mm in Sources */,
1AA9E55914980A9900001A8A /* Functional.cpp in Sources */,
C0C5D3BE14598B6F00A802A6 /* GetBackingScaleFactor.mm in Sources */,
F660AA0D15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */,
@@ -1104,6 +1117,7 @@
FE217ECD1640A54A0052988B /* VMInspector.cpp in Sources */,
520BCF4D141EB09E00937EA8 /* WebArchive.cpp in Sources */,
0F17BBD615AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */,
+ 290F4278172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm in Sources */,
C08587BF13FE956C001EF4E5 /* WebKitAgnosticTest.mm in Sources */,
51FBBB4D1513D4E900822738 /* WebViewCanPasteURL.mm in Sources */,
37E38C34169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm (0 => 149194)
--- trunk/Tools/TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm 2013-04-26 16:55:12 UTC (rev 149194)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#import "config.h"
+#import "_javascript_Test.h"
+#import "Test.h"
+
+#import "PlatformUtilities.h"
+#import "TestBrowsingContextLoadDelegate.h"
+#import "TestProtocol.h"
+#import <WebKit2/WKBrowsingContextGroupPrivate.h>
+#import <WebKit2/WKPreferencesPrivate.h>
+#import <WebKit2/WKRetainPtr.h>
+#import <WebKit2/WKString.h>
+#import <WebKit2/WKViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+static bool testFinished = false;
+
+namespace TestWebKitAPI {
+
+TEST(WebKit2CustomProtocolsTest, SyncXHR)
+{
+ [NSURLProtocol registerClass:[TestProtocol class]];
+ [WKBrowsingContextController registerSchemeForCustomProtocol:[TestProtocol scheme]];
+
+ RetainPtr<WKProcessGroup> processGroup(AdoptNS, [[WKProcessGroup alloc] init]);
+ RetainPtr<WKBrowsingContextGroup> browsingContextGroup(AdoptNS, [[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]);
+
+ // Allow file URLs to load non-file resources
+ WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate());
+ WKPreferencesSetUniversalAccessFromFileURLsAllowed(preferences.get(), true);
+ WKPageGroupSetPreferences(browsingContextGroup.get()._pageGroupRef, preferences.get());
+
+ RetainPtr<WKView> wkView(AdoptNS, [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]);
+ RetainPtr<TestBrowsingContextLoadDelegate> delegate(AdoptNS, [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
+ EXPECT_JS_EQ(wkView.get().pageRef, "window._testResult", "PASS");
+ testFinished = true;
+ }]);
+ wkView.get().browsingContextController.loadDelegate = delegate.get();
+
+ WKPageLoadURL(wkView.get().pageRef, Util::createURLForResource("custom-protocol-sync-xhr", "html"));
+
+ TestWebKitAPI::Util::run(&testFinished);
+}
+
+} // namespace TestWebKitAPI
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/custom-protocol-sync-xhr.html (0 => 149194)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/custom-protocol-sync-xhr.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/custom-protocol-sync-xhr.html 2013-04-26 16:55:12 UTC (rev 149194)
@@ -0,0 +1,6 @@
+<script>
+ var request = new XMLHttpRequest();
+ request.open('GET', 'test://test', false);
+ request.send(null);
+ window._testResult = request.responseText;
+</script>
\ No newline at end of file
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm (149193 => 149194)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm 2013-04-26 16:24:37 UTC (rev 149193)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm 2013-04-26 16:55:12 UTC (rev 149194)
@@ -28,57 +28,17 @@
#import "PlatformUtilities.h"
#import "TestBrowsingContextLoadDelegate.h"
-#import <Foundation/Foundation.h>
+#import "TestProtocol.h"
#import <WebKit2/WebKit2.h>
-static NSString *testScheme = @"test";
-static NSString *testHost = @"test";
static bool testFinished = false;
-@interface TestProtocol : NSURLProtocol {
-}
-@end
+namespace TestWebKitAPI {
-@implementation TestProtocol
-
-+ (BOOL)canInitWithRequest:(NSURLRequest *)request
+TEST(WebKit2CustomProtocolsTest, MainResource)
{
- return [[[request URL] scheme] caseInsensitiveCompare:testScheme] == NSOrderedSame;
-}
-
-+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
-{
- return request;
-}
-
-+ (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b
-{
- return NO;
-}
-
-- (void)startLoading
-{
- EXPECT_TRUE([[[[self request] URL] scheme] isEqualToString:testScheme]);
- EXPECT_TRUE([[[[self request] URL] host] isEqualToString:testHost]);
-
- NSData *data = "" dataUsingEncoding:NSASCIIStringEncoding];
- NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[[self request] URL] MIMEType:@"text/html" expectedContentLength:[data length] textEncodingName:nil];
- [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
- [[self client] URLProtocol:self didLoadData:data];
- [[self client] URLProtocolDidFinishLoading:self];
- [response release];
-}
-
-- (void)stopLoading
-{
-}
-
-@end
-
-TEST(WebKit2CustomProtocolsTest, CustomProtocolUsed)
-{
[NSURLProtocol registerClass:[TestProtocol class]];
- [WKBrowsingContextController registerSchemeForCustomProtocol:testScheme];
+ [WKBrowsingContextController registerSchemeForCustomProtocol:[TestProtocol scheme]];
WKProcessGroup *processGroup = [[WKProcessGroup alloc] init];
WKBrowsingContextGroup *browsingContextGroup = [[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"];
@@ -86,7 +46,9 @@
wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
testFinished = true;
}];
- [wkView.browsingContextController loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@", testScheme, testHost]]]];
+ [wkView.browsingContextController loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://test", [TestProtocol scheme]]]]];
- TestWebKitAPI::Util::run(&testFinished);
-}
\ No newline at end of file
+ Util::run(&testFinished);
+}
+
+} // namespace TestWebKitAPI
Copied: trunk/Tools/TestWebKitAPI/mac/TestProtocol.h (from rev 149193, trunk/Source/WebKit2/WebProcess/WebProcessSupplement.h) (0 => 149194)
--- trunk/Tools/TestWebKitAPI/mac/TestProtocol.h (rev 0)
+++ trunk/Tools/TestWebKitAPI/mac/TestProtocol.h 2013-04-26 16:55:12 UTC (rev 149194)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef TestProtocol_h
+#define TestProtocol_h
+
+@interface TestProtocol : NSURLProtocol {
+}
++ (NSString *)scheme;
+@end
+
+#endif // TestProtocol_h
Copied: trunk/Tools/TestWebKitAPI/mac/TestProtocol.mm (from rev 149193, trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm) (0 => 149194)
--- trunk/Tools/TestWebKitAPI/mac/TestProtocol.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/mac/TestProtocol.mm 2013-04-26 16:55:12 UTC (rev 149194)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#import "config.h"
+#import "TestProtocol.h"
+
+static NSString *testScheme = @"test";
+
+@implementation TestProtocol
+
++ (BOOL)canInitWithRequest:(NSURLRequest *)request
+{
+ return [[[request URL] scheme] caseInsensitiveCompare:testScheme] == NSOrderedSame;
+}
+
++ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
+{
+ return request;
+}
+
++ (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b
+{
+ return NO;
+}
+
++ (NSString *)scheme
+{
+ return testScheme;
+}
+
+- (void)startLoading
+{
+ EXPECT_TRUE([[[[self request] URL] scheme] isEqualToString:testScheme]);
+
+ NSData *data = "" dataUsingEncoding:NSASCIIStringEncoding];
+ NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[[self request] URL] MIMEType:@"text/html" expectedContentLength:[data length] textEncodingName:nil];
+ [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
+ [[self client] URLProtocol:self didLoadData:data];
+ [[self client] URLProtocolDidFinishLoading:self];
+ [response release];
+}
+
+- (void)stopLoading
+{
+}
+
+@end