summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/WebPageProxy.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-04-24 22:40:03 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-04-25 18:29:55 +0000
commit4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (patch)
tree02bd448d49627f059df0d8036fbdb9d9ee883a50 /Source/WebKit2/UIProcess/WebPageProxy.cpp
parentbd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff)
downloadqtwebkit-4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4.tar.gz
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/UIProcess/WebPageProxy.cpp')
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp66
1 files changed, 65 insertions, 1 deletions
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 9b2033f32..3bb4a0134 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -103,6 +103,7 @@
#include "WebProcessPool.h"
#include "WebProcessProxy.h"
#include "WebProtectionSpace.h"
+#include "WebURLSchemeHandler.h"
#include "WebUserContentControllerProxy.h"
#include "WebsiteDataStore.h"
#include <WebCore/BitmapImage.h>
@@ -179,6 +180,27 @@
#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
#define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
+// Instead of URLParser class added later
+namespace URLParser
+{
+static WTF::Optional<String> maybeCanonicalizeScheme(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return WTF::Nullopt;
+
+ if (!isASCIIAlpha(scheme[0]))
+ return WTF::Nullopt;
+
+ for (size_t i = 1; i < scheme.length(); ++i) {
+ if (isASCIIAlphanumeric(scheme[i]) || scheme[i] == '+' || scheme[i] == '-' || scheme[i] == '.')
+ continue;
+ return WTF::Nullopt;
+ }
+
+ return scheme.convertToASCIILowercase();
+}
+}
+
using namespace WebCore;
// Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
@@ -500,7 +522,9 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
WebPageProxy::~WebPageProxy()
{
- ASSERT(m_process->webPage(m_pageID) != this);
+ // QtWebPageSGNode may be the last owner of WebPageProxy, but it is destroyed
+ // in the renderer thread which causes assertion failure when accessing globalPageMap
+ ASSERT(!RunLoop::isMain() || m_process->webPage(m_pageID) != this);
#if !ASSERT_DISABLED
for (WebPageProxy* page : m_process->pages())
ASSERT(page != this);
@@ -5264,6 +5288,9 @@ WebPageCreationParameters WebPageProxy::creationParameters()
#endif
parameters.shouldScaleViewToFitDocument = m_shouldScaleViewToFitDocument;
+ for (auto& iterator : m_urlSchemeHandlersByScheme)
+ parameters.urlSchemeHandlers.set(iterator.key, iterator.value->identifier());
+
return parameters;
}
@@ -6240,4 +6267,41 @@ void WebPageProxy::didRestoreScrollPosition()
m_pageClient.didRestoreScrollPosition();
}
+void WebPageProxy::setURLSchemeHandlerForScheme(Ref<WebURLSchemeHandler>&& handler, const String& scheme)
+{
+ auto canonicalizedScheme = URLParser::maybeCanonicalizeScheme(scheme);
+ ASSERT(canonicalizedScheme);
+// ASSERT(!URLParser::isSpecialScheme(canonicalizedScheme.value()));
+
+ auto schemeResult = m_urlSchemeHandlersByScheme.add(canonicalizedScheme.value(), handler.ptr());
+ ASSERT_UNUSED(schemeResult, schemeResult.isNewEntry);
+
+ auto identifier = handler->identifier();
+ auto identifierResult = m_urlSchemeHandlersByIdentifier.add(identifier, WTFMove(handler));
+ ASSERT_UNUSED(identifierResult, identifierResult.isNewEntry);
+
+ m_process->send(Messages::WebPage::RegisterURLSchemeHandler(identifier, canonicalizedScheme.value()), m_pageID);
+}
+
+WebURLSchemeHandler* WebPageProxy::urlSchemeHandlerForScheme(const String& scheme)
+{
+ return m_urlSchemeHandlersByScheme.get(scheme);
+}
+
+void WebPageProxy::startURLSchemeHandlerTask(uint64_t handlerIdentifier, uint64_t resourceIdentifier, const WebCore::ResourceRequest& request)
+{
+ auto iterator = m_urlSchemeHandlersByIdentifier.find(handlerIdentifier);
+ ASSERT(iterator != m_urlSchemeHandlersByIdentifier.end());
+
+ iterator->value->startTask(*this, resourceIdentifier, request);
+}
+
+void WebPageProxy::stopURLSchemeHandlerTask(uint64_t handlerIdentifier, uint64_t resourceIdentifier)
+{
+ auto iterator = m_urlSchemeHandlersByIdentifier.find(handlerIdentifier);
+ ASSERT(iterator != m_urlSchemeHandlersByIdentifier.end());
+
+ iterator->value->stopTask(*this, resourceIdentifier);
+}
+
} // namespace WebKit