Diff
Modified: trunk/Source/WebCore/ChangeLog (227736 => 227737)
--- trunk/Source/WebCore/ChangeLog 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/ChangeLog 2018-01-29 17:45:17 UTC (rev 227737)
@@ -1,3 +1,27 @@
+2018-01-29 Brady Eidson <beid...@apple.com>
+
+ Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
+ https://bugs.webkit.org/show_bug.cgi?id=182229
+
+ Reviewed by Chris Dumez.
+
+ Covered by existing LayoutTests and a new API test.
+
+ * dom/messageports/MessagePortChannel.cpp:
+ (WebCore::MessagePortChannel::checkRemotePortForActivity): Don't use the global singleton
+ provider. Instead use the provider that belongs to the owning registry.
+
+ * dom/messageports/MessagePortChannelProviderImpl.cpp:
+ (WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl): Pass a reference
+ to *this to the Registry.
+ * dom/messageports/MessagePortChannelProviderImpl.h:
+
+ * dom/messageports/MessagePortChannelRegistry.cpp:
+ (WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry): Keep a Provider member so
+ MessagePortChannels can get to it instead of relying on the global singleton provider.
+ * dom/messageports/MessagePortChannelRegistry.h:
+ (WebCore::MessagePortChannelRegistry::provider):
+
2018-01-29 Per Arne Vollan <pvol...@apple.com>
Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing
Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp (227736 => 227737)
--- trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp 2018-01-29 17:45:17 UTC (rev 227737)
@@ -240,7 +240,7 @@
callback(hasActivity);
} };
- MessagePortChannelProvider::singleton().checkProcessLocalPortForActivity(remotePort, *m_processes[i], WTFMove(outerCallback));
+ m_registry.provider().checkProcessLocalPortForActivity(remotePort, *m_processes[i], WTFMove(outerCallback));
}
bool MessagePortChannel::hasAnyMessagesPendingOrInFlight() const
Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.cpp (227736 => 227737)
--- trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.cpp 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.cpp 2018-01-29 17:45:17 UTC (rev 227737)
@@ -33,6 +33,11 @@
namespace WebCore {
+MessagePortChannelProviderImpl::MessagePortChannelProviderImpl()
+ : m_registry(*this)
+{
+}
+
MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl()
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.h (227736 => 227737)
--- trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.h 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.h 2018-01-29 17:45:17 UTC (rev 227737)
@@ -32,6 +32,7 @@
class MessagePortChannelProviderImpl : public MessagePortChannelProvider {
public:
+ MessagePortChannelProviderImpl();
~MessagePortChannelProviderImpl() final;
private:
Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.cpp (227736 => 227737)
--- trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.cpp 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.cpp 2018-01-29 17:45:17 UTC (rev 227737)
@@ -30,6 +30,11 @@
namespace WebCore {
+MessagePortChannelRegistry::MessagePortChannelRegistry(MessagePortChannelProvider& provider)
+ : m_provider(provider)
+{
+}
+
MessagePortChannelRegistry::~MessagePortChannelRegistry()
{
ASSERT(m_openChannels.isEmpty());
Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.h (227736 => 227737)
--- trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.h 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannelRegistry.h 2018-01-29 17:45:17 UTC (rev 227737)
@@ -35,6 +35,7 @@
class MessagePortChannelRegistry {
public:
+ WEBCORE_EXPORT MessagePortChannelRegistry(MessagePortChannelProvider&);
WEBCORE_EXPORT ~MessagePortChannelRegistry();
WEBCORE_EXPORT void didCreateMessagePortChannel(const MessagePortIdentifier& port1, const MessagePortIdentifier& port2);
@@ -50,8 +51,12 @@
WEBCORE_EXPORT void messagePortChannelCreated(MessagePortChannel&);
WEBCORE_EXPORT void messagePortChannelDestroyed(MessagePortChannel&);
+ MessagePortChannelProvider& provider() { return m_provider; }
+
private:
HashMap<MessagePortIdentifier, MessagePortChannel*> m_openChannels;
+ MessagePortChannelProvider& m_provider;
+
};
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (227736 => 227737)
--- trunk/Source/WebKit/ChangeLog 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebKit/ChangeLog 2018-01-29 17:45:17 UTC (rev 227737)
@@ -1,3 +1,18 @@
+2018-01-29 Brady Eidson <beid...@apple.com>
+
+ Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
+ https://bugs.webkit.org/show_bug.cgi?id=182229
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/UIMessagePortChannelProvider.cpp:
+ (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider):
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::m_configurationPreferenceValues): The UI process does not need to override the
+ global singleton provider. It can remain the default ProviderImpl to allow WK1 views
+ to work fine, too.
+
2018-01-29 Carlos Garcia Campos <cgar...@igalia.com>
WebDriver: ASSERTION FAILED: !m_loadTimer.isActive()
Modified: trunk/Source/WebKit/UIProcess/UIMessagePortChannelProvider.cpp (227736 => 227737)
--- trunk/Source/WebKit/UIProcess/UIMessagePortChannelProvider.cpp 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebKit/UIProcess/UIMessagePortChannelProvider.cpp 2018-01-29 17:45:17 UTC (rev 227737)
@@ -41,6 +41,7 @@
}
UIMessagePortChannelProvider::UIMessagePortChannelProvider()
+ : m_registry(*this)
{
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (227736 => 227737)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-01-29 17:45:17 UTC (rev 227737)
@@ -415,11 +415,6 @@
this->dispatchActivityStateChange();
});
#endif
-
- static std::once_flag once;
- std::call_once(once, [] {
- MessagePortChannelProvider::setSharedProvider(UIMessagePortChannelProvider::singleton());
- });
}
WebPageProxy::~WebPageProxy()
Modified: trunk/Tools/ChangeLog (227736 => 227737)
--- trunk/Tools/ChangeLog 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Tools/ChangeLog 2018-01-29 17:45:17 UTC (rev 227737)
@@ -1,3 +1,13 @@
+2018-01-29 Brady Eidson <beid...@apple.com>
+
+ Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
+ https://bugs.webkit.org/show_bug.cgi?id=182229
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm: Added.
+
2018-01-29 Carlos Garcia Campos <cgar...@igalia.com>
WebDriver: properly recover w3c tests after a webdriver server crash
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (227736 => 227737)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-01-29 17:07:22 UTC (rev 227736)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-01-29 17:45:17 UTC (rev 227737)
@@ -176,6 +176,7 @@
514958BE1F7427AC00E87BAD /* WKWebViewAutofillTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */; };
515BE16F1D428BB100DD7C68 /* StoreBlobToBeDeleted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */; };
515BE1711D428E4B00DD7C68 /* StoreBlobThenDelete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */; };
+ 5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5165FE03201EE617009F7EC3 /* MessagePortProviders.mm */; };
51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */; };
51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */; };
51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */; };
@@ -1331,6 +1332,7 @@
514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewAutofillTests.mm; sourceTree = "<group>"; };
515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = StoreBlobToBeDeleted.html; sourceTree = "<group>"; };
515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StoreBlobThenDelete.mm; sourceTree = "<group>"; };
+ 5165FE03201EE617009F7EC3 /* MessagePortProviders.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MessagePortProviders.mm; sourceTree = "<group>"; };
51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "WebProcessKillIDBCleanup-1.html"; sourceTree = "<group>"; };
51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "WebProcessKillIDBCleanup-2.html"; sourceTree = "<group>"; };
51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessKillIDBCleanup.mm; sourceTree = "<group>"; };
@@ -2110,6 +2112,7 @@
51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */,
46C519D81D355A7300DAA51A /* LocalStorageNullEntries.mm */,
7A6A2C6F1DCCF87B00C0D085 /* LocalStorageQuirkTest.mm */,
+ 5165FE03201EE617009F7EC3 /* MessagePortProviders.mm */,
51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */,
1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
5CAE4637201937CD0051610F /* NetworkProcessCrashNonPersistentDataStore.mm */,
@@ -3557,6 +3560,7 @@
7CCE7F0C1A411AE600447C4C /* PrivateBrowsingPushStateNoHistoryCallback.cpp in Sources */,
4647B1261EBA3B850041D7EF /* ProcessDidTerminate.cpp in Sources */,
7C83E0C11D0A652F00FEBCF3 /* ProvisionalURLNotChange.mm in Sources */,
+ 5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */,
7CCE7EC81A411A7E00447C4C /* PublicSuffix.mm in Sources */,
7C83E0C21D0A653500FEBCF3 /* QuickLook.mm in Sources */,
7CCE7F0D1A411AE600447C4C /* ReloadPageAfterCrash.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm (0 => 227737)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm 2018-01-29 17:45:17 UTC (rev 227737)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2018 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"
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/WebFrame.h>
+#import <wtf/RetainPtr.h>
+
+static bool didFinishLoad;
+
+@interface MessagePortFrameLoadDelegate : NSObject <WebFrameLoadDelegate> {
+}
+@end
+@implementation MessagePortFrameLoadDelegate
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(MessagePort, Providers)
+{
+ // Loading a WebView that uses message ports guarantees that the default MessagePortChannelProviderImpl is set.
+ auto wk1View = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400) frameName:nil groupName:nil]);
+ auto delegate = adoptNS([[MessagePortFrameLoadDelegate alloc] init]);
+ [wk1View.get() setFrameLoadDelegate:delegate.get()];
+ [[wk1View mainFrame] loadHTMLString:@"<script>new MessageChannel;</script>" baseURL:nil];
+
+ Util::run(&didFinishLoad);
+
+ // Now using a WKWebView to load content that uses message ports will use the WK2-style message ports.
+ // This should not conflict with WK1-style message ports.
+ // The conflict is caught by a RELEASE_ASSERT so, if this doesn't crash, it passes.
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+ [webView synchronouslyLoadHTMLString:@"<script>new MessageChannel;</script>"];
+}
+
+} // namespace TestWebKitAPI
+
+#endif // WK_API_ENABLED