Diff
Modified: trunk/ChangeLog (241282 => 241283)
--- trunk/ChangeLog 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/ChangeLog 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1,3 +1,14 @@
+2019-02-11 Adrian Perez de Castro <[email protected]>
+
+ [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=193622
+
+ Reviewed by Michael Catanzaro.
+
+ * Source/cmake/OptionsGTK.cmake: Enable CONTENT_EXTENSIONS by default.
+ * Source/cmake/OptionsWPE.cmake: Ditto.
+ * Source/cmake/WebKitFeatures.cmake: Add a private CONTENT_EXTENSIONS option.
+
2019-02-07 Miguel Gomez <[email protected]>
[WPE] Implement GStreamer based holepunch
Modified: trunk/LayoutTests/ChangeLog (241282 => 241283)
--- trunk/LayoutTests/ChangeLog 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/LayoutTests/ChangeLog 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1,3 +1,12 @@
+2019-02-11 Adrian Perez de Castro <[email protected]>
+
+ [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=193622
+
+ Reviewed by Michael Catanzaro.
+
+ * platform/gtk/TestExpectations: Un-skip tests for content extensions and add expectations.
+
2019-02-11 Daniel Bates <[email protected]>
[iOS] Mouse/Touch/Pointer events are missing modifier keys
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (241282 => 241283)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2019-02-12 00:07:21 UTC (rev 241283)
@@ -123,6 +123,34 @@
# The 64 bits release bot has been made to use 8 bpp depth, so this won't pass there.
webkit.org/b/121951 fast/dom/Window/window-screen-properties.html [ Failure Pass ]
+# Content extensions, the failures need up-to-date expectations.
+http/tests/contentextensions/basic-filter.html [ Failure ]
+http/tests/contentextensions/block-cookies-in-csp-report.php [ Failure ]
+http/tests/contentextensions/block-cookies-in-image-load-in-onunload.html [ Failure Timeout ]
+http/tests/contentextensions/block-cookies-in-ping.html [ Failure ]
+http/tests/contentextensions/block-cookies-send.html [ Failure ]
+http/tests/contentextensions/block-csp-report.php [ Failure ]
+http/tests/contentextensions/block-everything-unless-domain-redirect.php [ Failure ]
+http/tests/contentextensions/block-image-load-in-onunload.html [ Failure Timeout ]
+http/tests/contentextensions/block-ping.html [ Failure ]
+http/tests/contentextensions/character-set-basic-support.html [ Failure ]
+http/tests/contentextensions/css-display-none.html [ Failure ]
+http/tests/contentextensions/domain-rules.html [ Failure ]
+http/tests/contentextensions/fetch-redirect-blocked.html [ Failure ]
+http/tests/contentextensions/filters-with-quantifiers-combined.html [ Failure ]
+http/tests/contentextensions/hide-on-csp-report.php [ Failure ]
+http/tests/contentextensions/hide-on-ping-with-ping-that-redirects.html [ Failure ]
+http/tests/contentextensions/hide-on-ping.html [ Failure ]
+http/tests/contentextensions/injected-script-callback.html [ Failure ]
+http/tests/contentextensions/main-resource-redirect-blocked.php [ Failure ]
+http/tests/contentextensions/main-resource-redirect-error.html [ Failure ]
+http/tests/contentextensions/media-filtered.html [ Failure ]
+http/tests/contentextensions/reload-without-contentextensions.html [ Failure ]
+http/tests/contentextensions/subresource-redirect-blocked.html [ Failure ]
+http/tests/contentextensions/text-track-blocked.html [ Failure ]
+http/tests/contentextensions/top-url.html [ Failure ]
+http/tests/contentextensions/whitelist.html [ Failure ]
+
# This test requires Mac ObjC bindings, although it currently passes
Bug(GTK) http/tests/security/dataTransfer-set-data-file-url.html [ WontFix Pass ]
@@ -3816,6 +3844,8 @@
fast/text/emoji-gender-fe0f-8.html [ Pass ]
fast/text/emoji-gender-fe0f-9.html [ Pass ]
+http/tests/contentextensions [ Pass ]
+
imported/w3c/web-platform-tests/css/css-scoping/stylesheet-title-001.html [ Pass ]
imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-capitalize-026.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (241282 => 241283)
--- trunk/Source/WebCore/ChangeLog 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebCore/ChangeLog 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1,3 +1,15 @@
+2019-02-11 Adrian Perez de Castro <[email protected]>
+
+ [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=193622
+
+ Reviewed by Michael Catanzaro.
+
+ No new tests needed.
+
+ * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
+ * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
+
2019-02-11 Daniel Bates <[email protected]>
[iOS] Mouse/Touch/Pointer events are missing modifier keys
Modified: trunk/Source/WebCore/Sources.txt (241282 => 241283)
--- trunk/Source/WebCore/Sources.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebCore/Sources.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1393,6 +1393,7 @@
loader/PolicyChecker.cpp
loader/ProgressTracker.cpp
loader/ResourceCryptographicDigest.cpp
+loader/ResourceLoadInfo.cpp
loader/ResourceLoadNotifier.cpp
loader/ResourceLoadObserver.cpp
loader/ResourceLoadStatistics.cpp
Modified: trunk/Source/WebCore/SourcesCocoa.txt (241282 => 241283)
--- trunk/Source/WebCore/SourcesCocoa.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -109,8 +109,6 @@
history/mac/HistoryItemMac.mm
-loader/ResourceLoadInfo.cpp
-
loader/archive/cf/LegacyWebArchive.cpp
loader/archive/cf/LegacyWebArchiveMac.mm
Modified: trunk/Source/WebKit/ChangeLog (241282 => 241283)
--- trunk/Source/WebKit/ChangeLog 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/ChangeLog 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1,3 +1,37 @@
+2019-02-11 Adrian Perez de Castro <[email protected]>
+
+ [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=193622
+
+ Reviewed by Michael Catanzaro.
+
+ * NetworkProcess/cache/NetworkCacheData.h: Define an adoptAndMapFile() implementation
+ for GFileIOStream objects.
+ * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
+ (WebKit::NetworkCache::adoptAndMapFile): Added implementation, which extracts the file
+ descriptor from a GFileIOStream, as it inherits from GFileDescriptorBased, and then
+ reuses the version of adoptAndMapFile() which takes a file descritor for the actual work.
+ * NetworkProcess/NetworkLoadChecker.cpp:
+ (Webkit::NetworkLoadChecker::checkRequest): Use "this" when referring to
+ processContentExtensionRulesForLoad() in order to avoid ambiguity.
+ * Sources.txt: Add WKUserContentExtensionStoreRef.cpp, all ports use it now.
+ * SourcesCocoa.txt: Remove WKUserContentExtensionStoreRef.cpp, because it is not
+ Cocoa-specific anymore.
+ * SourcesGTK.txt: Add APIContentRuleListStoreGLib.cpp.
+ * SourcesWPE.txt: Ditto.
+ * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
+ (WKUserContentExtensionStoreCreate): Added.
+ (toResult): Added.
+ (WKUserContentExtensionStoreCompile): Added.
+ (WKUserContentExtensionStoreLookup): Added.
+ (WKUserContentExtensionStoreRemove): Added.
+ * UIProcess/API/C/WKUserContentExtensionStoreRef.h: Add declarations for the new C API
+ functions and for the WKUserContentExtensionStoreResult status enum.
+ * UIProcess/API/glib/APIContentRuleListStoreGLib.cpp: Added.
+ (API::ContentRuleListStore::defaultStorePath): Add a dummy implementation. The public API
+ for the GLib based ports (GTK+ and WPE) will not allow using the default store and will
+ always indicating a path.
+
2019-02-11 Daniel Bates <[email protected]>
[iOS] Mouse/Touch/Pointer events are missing modifier keys
Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp (241282 => 241283)
--- trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp 2019-02-12 00:07:21 UTC (rev 241283)
@@ -238,7 +238,7 @@
}
#if ENABLE(CONTENT_EXTENSIONS)
- processContentExtensionRulesForLoad(WTFMove(request), [this, handler = WTFMove(handler), originalRequest = WTFMove(originalRequest)](auto result) mutable {
+ this->processContentExtensionRulesForLoad(WTFMove(request), [this, handler = WTFMove(handler), originalRequest = WTFMove(originalRequest)](auto result) mutable {
if (!result.has_value()) {
ASSERT(result.error().isCancellation());
handler(WTFMove(result.error()));
@@ -249,7 +249,7 @@
return;
}
- continueCheckingRequestOrDoSyntheticRedirect(WTFMove(originalRequest), WTFMove(result.value().request), WTFMove(handler));
+ this->continueCheckingRequestOrDoSyntheticRedirect(WTFMove(originalRequest), WTFMove(result.value().request), WTFMove(handler));
});
#else
this->continueCheckingRequestOrDoSyntheticRedirect(WTFMove(originalRequest), WTFMove(request), WTFMove(handler));
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h (241282 => 241283)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h 2019-02-12 00:07:21 UTC (rev 241283)
@@ -98,6 +98,9 @@
Data concatenate(const Data&, const Data&);
bool bytesEqual(const Data&, const Data&);
Data adoptAndMapFile(int fd, size_t offset, size_t);
+#if USE(GLIB) && !PLATFORM(WIN)
+Data adoptAndMapFile(GFileIOStream*, size_t offset, size_t);
+#endif
Data mapFile(const char* path);
using Salt = std::array<uint8_t, 8>;
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataSoup.cpp (241282 => 241283)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataSoup.cpp 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataSoup.cpp 2019-02-12 00:07:21 UTC (rev 241283)
@@ -33,6 +33,10 @@
#include <sys/types.h>
#include <unistd.h>
+#if USE(GLIB) && !PLATFORM(WIN)
+#include <gio/gfiledescriptorbased.h>
+#endif
+
namespace WebKit {
namespace NetworkCache {
@@ -126,6 +130,15 @@
return { WTFMove(buffer), fd };
}
+#if USE(GLIB) && !PLATFORM(WIN)
+Data adoptAndMapFile(GFileIOStream* stream, size_t offset, size_t size)
+{
+ GInputStream* inputStream = g_io_stream_get_input_stream(G_IO_STREAM(stream));
+ int fd = g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream));
+ return adoptAndMapFile(fd, offset, size);
+}
+#endif
+
RefPtr<SharedMemory> Data::tryCreateSharedMemory() const
{
if (isNull() || !isMap())
Modified: trunk/Source/WebKit/Sources.txt (241282 => 241283)
--- trunk/Source/WebKit/Sources.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/Sources.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -348,6 +348,7 @@
UIProcess/API/C/WKSessionStateRef.cpp
UIProcess/API/C/WKTextChecker.cpp
UIProcess/API/C/WKUserContentControllerRef.cpp
+UIProcess/API/C/WKUserContentExtensionStoreRef.cpp
UIProcess/API/C/WKUserMediaPermissionCheck.cpp
UIProcess/API/C/WKUserMediaPermissionRequest.cpp
UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Modified: trunk/Source/WebKit/SourcesCocoa.txt (241282 => 241283)
--- trunk/Source/WebKit/SourcesCocoa.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -221,7 +221,6 @@
UIProcess/API/C/WKContextMenuListener.cpp
UIProcess/API/C/WKMediaSessionFocusManager.cpp
UIProcess/API/C/WKTestingSupport.cpp
-UIProcess/API/C/WKUserContentExtensionStoreRef.cpp
UIProcess/API/C/WKUserScriptRef.cpp
UIProcess/API/C/cg/WKIconDatabaseCG.cpp
Modified: trunk/Source/WebKit/SourcesGTK.txt (241282 => 241283)
--- trunk/Source/WebKit/SourcesGTK.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/SourcesGTK.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -126,6 +126,7 @@
UIProcess/API/C/gtk/WKTextCheckerGtk.cpp
UIProcess/API/C/gtk/WKView.cpp
+UIProcess/API/glib/APIContentRuleListStoreGLib.cpp @no-unify
UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp @no-unify
UIProcess/API/glib/IconDatabase.cpp @no-unify
UIProcess/API/glib/WebKitApplicationInfo.cpp @no-unify
Modified: trunk/Source/WebKit/SourcesWPE.txt (241282 => 241283)
--- trunk/Source/WebKit/SourcesWPE.txt 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/SourcesWPE.txt 2019-02-12 00:07:21 UTC (rev 241283)
@@ -109,6 +109,7 @@
UIProcess/API/C/wpe/WKView.cpp
+UIProcess/API/glib/APIContentRuleListStoreGLib.cpp @no-unify
UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp @no-unify
UIProcess/API/glib/IconDatabase.cpp @no-unify
UIProcess/API/glib/WebKitApplicationInfo.cpp @no-unify
Modified: trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp (241282 => 241283)
--- trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp 2019-02-12 00:07:21 UTC (rev 241283)
@@ -26,8 +26,10 @@
#include "config.h"
#include "WKUserContentExtensionStoreRef.h"
+#include "APIContentRuleList.h"
#include "APIContentRuleListStore.h"
#include "WKAPICast.h"
+#include <wtf/CompletionHandler.h>
using namespace WebKit;
@@ -39,3 +41,66 @@
return 0;
#endif
}
+
+WKUserContentExtensionStoreRef WKUserContentExtensionStoreCreate(WKStringRef path)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ return toAPI(&API::ContentRuleListStore::storeWithPath(toWTFString(path), false).leakRef());
+#else
+ UNUSED_PARAM(path);
+ return nullptr;
+#endif
+}
+
+#if ENABLE(CONTENT_EXTENSIONS)
+static inline WKUserContentExtensionStoreResult toResult(const std::error_code& error)
+{
+ if (!error)
+ return kWKUserContentExtensionStoreSuccess;
+
+ switch (static_cast<API::ContentRuleListStore::Error>(error.value())) {
+ case API::ContentRuleListStore::Error::LookupFailed:
+ return kWKUserContentExtensionStoreLookupFailed;
+ case API::ContentRuleListStore::Error::VersionMismatch:
+ return kWKUserContentExtensionStoreVersionMismatch;
+ case API::ContentRuleListStore::Error::CompileFailed:
+ return kWKUserContentExtensionStoreCompileFailed;
+ case API::ContentRuleListStore::Error::RemoveFailed:
+ return kWKUserContentExtensionStoreRemoveFailed;
+ }
+}
+#endif
+
+void WKUserContentExtensionStoreCompile(WKUserContentExtensionStoreRef store, WKStringRef identifier, WKStringRef jsonSource, void* context, WKUserContentExtensionStoreFunction callback)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ toImpl(store)->compileContentRuleList(toWTFString(identifier), toWTFString(jsonSource), [context, callback](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
+ callback(error ? nullptr : toAPI(contentRuleList.leakRef()), toResult(error), context);
+ });
+#else
+ UNUSED_PARAM(jsonSource);
+ callback(nullptr, kWKUserContentExtensionStoreCompileFailed, context);
+#endif
+}
+
+void WKUserContentExtensionStoreLookup(WKUserContentExtensionStoreRef store, WKStringRef identifier, void* context, WKUserContentExtensionStoreFunction callback)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ toImpl(store)->lookupContentRuleList(toWTFString(identifier), [context, callback](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
+ callback(error ? nullptr : toAPI(contentRuleList.leakRef()), toResult(error), context);
+ });
+#else
+ callback(nullptr, kWKUserContentExtensionStoreLookupFailed, context);
+#endif
+}
+
+void WKUserContentExtensionStoreRemove(WKUserContentExtensionStoreRef store, WKStringRef identifier, void* context, WKUserContentExtensionStoreFunction callback)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ toImpl(store)->removeContentRuleList(toWTFString(identifier), [context, callback](std::error_code error) {
+ callback(nullptr, toResult(error), context);
+ });
+#else
+ callback(nullptr, kWKUserContentExtensionStoreRemoveFailed, context);
+#endif
+}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.h (241282 => 241283)
--- trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.h 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.h 2019-02-12 00:07:21 UTC (rev 241283)
@@ -34,6 +34,22 @@
WK_EXPORT WKTypeID WKUserContentExtensionStoreGetTypeID();
+WK_EXPORT WKUserContentExtensionStoreRef WKUserContentExtensionStoreCreate(WKStringRef path);
+
+typedef uint32_t WKUserContentExtensionStoreResult;
+enum {
+ kWKUserContentExtensionStoreSuccess = 0,
+ kWKUserContentExtensionStoreLookupFailed,
+ kWKUserContentExtensionStoreVersionMismatch,
+ kWKUserContentExtensionStoreCompileFailed,
+ kWKUserContentExtensionStoreRemoveFailed,
+};
+
+typedef void (*WKUserContentExtensionStoreFunction)(WKUserContentFilterRef, WKUserContentExtensionStoreResult, void*);
+WK_EXPORT void WKUserContentExtensionStoreCompile(WKUserContentExtensionStoreRef, WKStringRef identifier, WKStringRef jsonSource, void* context, WKUserContentExtensionStoreFunction callback);
+WK_EXPORT void WKUserContentExtensionStoreLookup(WKUserContentExtensionStoreRef, WKStringRef identifier, void* context, WKUserContentExtensionStoreFunction callback);
+WK_EXPORT void WKUserContentExtensionStoreRemove(WKUserContentExtensionStoreRef, WKStringRef identifier, void* context, WKUserContentExtensionStoreFunction callback);
+
#ifdef __cplusplus
}
#endif
Copied: trunk/Source/WebKit/UIProcess/API/glib/APIContentRuleListStoreGLib.cpp (from rev 241282, trunk/Source/WebKit/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp) (0 => 241283)
--- trunk/Source/WebKit/UIProcess/API/glib/APIContentRuleListStoreGLib.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/APIContentRuleListStoreGLib.cpp 2019-02-12 00:07:21 UTC (rev 241283)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * 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 "APIContentRuleListStore.h"
+
+namespace API {
+
+#if ENABLE(CONTENT_EXTENSIONS)
+String ContentRuleListStore::defaultStorePath(bool)
+{
+ ASSERT_NOT_REACHED();
+ return String();
+}
+#endif
+
+}; // namespace API
Modified: trunk/Source/cmake/OptionsGTK.cmake (241282 => 241283)
--- trunk/Source/cmake/OptionsGTK.cmake 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/cmake/OptionsGTK.cmake 2019-02-12 00:07:21 UTC (rev 241283)
@@ -150,12 +150,13 @@
# Private options shared with other WebKit ports. Add options here when
# we need a value different from the default defined in WebKitFeatures.cmake.
# Changing these options is completely unsupported.
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_RTC PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
Modified: trunk/Source/cmake/OptionsWPE.cmake (241282 => 241283)
--- trunk/Source/cmake/OptionsWPE.cmake 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/cmake/OptionsWPE.cmake 2019-02-12 00:07:21 UTC (rev 241283)
@@ -47,6 +47,7 @@
# we need a value different from the default defined in WebKitFeatures.cmake.
# Changing these options is completely unsupported.
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
Modified: trunk/Source/cmake/WebKitFeatures.cmake (241282 => 241283)
--- trunk/Source/cmake/WebKitFeatures.cmake 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Source/cmake/WebKitFeatures.cmake 2019-02-12 00:07:21 UTC (rev 241283)
@@ -102,6 +102,7 @@
WEBKIT_OPTION_DEFINE(ENABLE_BUBBLEWRAP_SANDBOX "Toggle Bubblewrap sandboxing support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_CACHE_PARTITIONING "Toggle cache partitioning support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_CHANNEL_MESSAGING "Toggle Channel Messaging support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_CONTENT_EXTENSIONS "Toggle Content Extensions support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_CONTENT_FILTERING "Toggle content filtering support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_CONTEXT_MENUS "Toggle Context Menu support" PRIVATE ON)
WEBKIT_OPTION_DEFINE(ENABLE_CSS3_TEXT "Toggle CSS3 Text support" PRIVATE OFF)
Modified: trunk/Tools/ChangeLog (241282 => 241283)
--- trunk/Tools/ChangeLog 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/ChangeLog 2019-02-12 00:07:21 UTC (rev 241283)
@@ -1,3 +1,35 @@
+2019-02-11 Adrian Perez de Castro <[email protected]>
+
+ [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=193622
+
+ Reviewed by Michael Catanzaro.
+
+ This adds support for loading content extension rule sets from the JSON files which
+ accompany the corresponding layout test, using the C API. The Cocoa specific parts
+ of WKTR for this could be removed, but that is left for a follow-up patch with
+ cleanups.
+
+ * Scripts/webkitperl/FeatureList.pm: Add an option to toggle CONTENT_EXTENSIONS.
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::testPath): Subtract one from the length when constructing the result std::string to
+ avoid having the null-terminator copied into the result.
+ (WTR::TestController::configureViewForTest): Call configureContentExtensionForTest() as
+ part of the preparations to run a test.
+ (WTR::ContentExtensionStoreCallbackContext::ContentExtensionStoreCallbackContext): Added.
+ (WTR::contentExtensionStoreCallback): Added.
+ (WTR::contentExtensionJSONPath): Used to calculate the path to the JSON rule set to be
+ used for content extensions test.
+ (WTR::TestController::configureContentExtensionForTest): Added, handles enabling content
+ extensions and compiling the JSON rule set for tests involving content extensions.
+ (WTR::TestController::resetContentExtensions): Removes the content extension built for
+ testing and disables content extensions.
+ (WTR::TestController::resetPreferencesToConsistentValues): Add a call to
+ resetContentExtensions().
+ (WTR::TestController::userContentController): Added implementation for ports other than Cocoa.
+ * WebKitTestRunner/TestController.h: Add declarations for resetContentExtensions(),
+ configureContentExtensionForTest(), and userContentController().
+
2019-02-11 Daniel Bates <[email protected]>
[iOS] Mouse/Touch/Pointer events are missing modifier keys
Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (241282 => 241283)
--- trunk/Tools/Scripts/webkitperl/FeatureList.pm 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm 2019-02-12 00:07:21 UTC (rev 241283)
@@ -62,6 +62,7 @@
$cachePartitioningSupport,
$channelMessagingSupport,
$cloopSupport,
+ $contentExtensionsSupport,
$contentFilteringSupport,
$contextMenusSupport,
$css3TextSupport,
@@ -227,6 +228,9 @@
{ option => "channel-messaging", desc => "Toggle Channel Messaging support",
define => "ENABLE_CHANNEL_MESSAGING", value => \$channelMessagingSupport },
+ { option => "content-extensions", desc => "Toggle Content Extensions support",
+ define => "ENABLE_CONTENT_EXTENSIONS", value => \$contentExtensionsSupport },
+
{ option => "content-filtering", desc => "Toggle content filtering support",
define => "ENABLE_CONTENT_FILTERING", value => \$contentFilteringSupport },
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (241282 => 241283)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2019-02-12 00:07:21 UTC (rev 241283)
@@ -60,6 +60,8 @@
#include <WebKit/WKRetainPtr.h>
#include <WebKit/WKSecurityOriginRef.h>
#include <WebKit/WKTextChecker.h>
+#include <WebKit/WKUserContentControllerRef.h>
+#include <WebKit/WKUserContentExtensionStoreRef.h>
#include <WebKit/WKUserMediaPermissionCheck.h>
#include <WebKit/WKWebsiteDataStoreRef.h>
#include <algorithm>
@@ -537,7 +539,9 @@
auto pageConfiguration = adoptWK(WKPageConfigurationCreate());
WKPageConfigurationSetContext(pageConfiguration.get(), m_context.get());
WKPageConfigurationSetPageGroup(pageConfiguration.get(), m_pageGroup.get());
- WKPageConfigurationSetUserContentController(pageConfiguration.get(), adoptWK(WKUserContentControllerCreate()).get());
+
+ m_userContentController = adoptWK(WKUserContentControllerCreate());
+ WKPageConfigurationSetUserContentController(pageConfiguration.get(), userContentController());
return pageConfiguration;
}
@@ -932,6 +936,9 @@
// Reset Custom Policy Delegate.
setCustomPolicyDelegate(false, false);
+ // Reset Content Extensions.
+ resetContentExtensions();
+
m_shouldDownloadUndisplayableMIMETypes = false;
m_workQueueManager.clearWorkQueue();
@@ -1102,12 +1109,13 @@
auto path = adoptWK(WKURLCopyPath(url));
auto buffer = std::vector<char>(WKStringGetMaximumUTF8CStringSize(path.get()));
auto length = WKStringGetUTF8CString(path.get(), buffer.data(), buffer.size());
+ RELEASE_ASSERT(length > 0);
#if OS(WINDOWS)
// Remove the first '/' if it starts with something like "/C:/".
if (length >= 4 && buffer[0] == '/' && buffer[2] == ':' && buffer[3] == '/')
return std::string(buffer.data() + 1, length - 1);
#endif
- return std::string(buffer.data(), length);
+ return std::string(buffer.data(), length - 1);
}
return std::string();
}
@@ -1327,10 +1335,119 @@
ensureViewSupportsOptionsForTest(test);
updateWebViewSizeForTest(test);
updateWindowScaleForTest(mainWebView(), test);
-
+ configureContentExtensionForTest(test);
platformConfigureViewForTest(test);
}
+#if ENABLE(CONTENT_EXTENSIONS) && !PLATFORM(COCOA)
+struct ContentExtensionStoreCallbackContext {
+ explicit ContentExtensionStoreCallbackContext(TestController& controller)
+ : testController(controller)
+ {
+ }
+
+ TestController& testController;
+ uint32_t status { kWKUserContentExtensionStoreSuccess };
+ WKRetainPtr<WKUserContentFilterRef> filter;
+ bool done { false };
+};
+
+static void contentExtensionStoreCallback(WKUserContentFilterRef filter, uint32_t status, void* userData)
+{
+ auto* context = static_cast<ContentExtensionStoreCallbackContext*>(userData);
+ context->status = status;
+ context->filter = filter ? adoptWK(filter) : nullptr;
+ context->done = true;
+ context->testController.notifyDone();
+}
+
+static std::string contentExtensionJSONPath(WKURLRef url)
+{
+ auto path = testPath(url);
+ if (path.length())
+ return path + ".json";
+
+ auto p = adoptWK(WKURLCopyPath(url));
+ auto buffer = std::vector<char>(WKStringGetMaximumUTF8CStringSize(p.get()));
+ const auto length = WKStringGetUTF8CString(p.get(), buffer.data(), buffer.size());
+ return std::string("LayoutTests/http/tests") + std::string(buffer.data(), length - 1) + ".json";
+}
+#endif
+
+#if !PLATFORM(COCOA)
+#if ENABLE(CONTENT_EXTENSIONS)
+void TestController::configureContentExtensionForTest(const TestInvocation& test)
+{
+ const char* contentExtensionsPath = libraryPathForTesting();
+ if (!contentExtensionsPath)
+ contentExtensionsPath = "/tmp/wktr-contentextensions";
+
+ if (!test.urlContains("contentextensions/")) {
+ WKPageSetUserContentExtensionsEnabled(m_mainWebView->page(), false);
+ return;
+ }
+
+ std::string jsonFilePath(contentExtensionJSONPath(test.url()));
+ std::ifstream jsonFile(jsonFilePath);
+ if (!jsonFile.good()) {
+ WTFLogAlways("Could not open file '%s'", jsonFilePath.c_str());
+ return;
+ }
+
+ std::string jsonFileContents {std::istreambuf_iterator<char>(jsonFile), std::istreambuf_iterator<char>()};
+ auto jsonSource = adoptWK(WKStringCreateWithUTF8CString(jsonFileContents.c_str()));
+
+ auto storePath = adoptWK(WKStringCreateWithUTF8CString(contentExtensionsPath));
+ auto extensionStore = adoptWK(WKUserContentExtensionStoreCreate(storePath.get()));
+ ASSERT(extensionStore);
+
+ auto filterIdentifier = adoptWK(WKStringCreateWithUTF8CString("TestContentExtension"));
+
+ ContentExtensionStoreCallbackContext context(*this);
+ WKUserContentExtensionStoreCompile(extensionStore.get(), filterIdentifier.get(), jsonSource.get(), &context, contentExtensionStoreCallback);
+ runUntil(context.done, noTimeout);
+ ASSERT(context.status == kWKUserContentExtensionStoreSuccess);
+ ASSERT(context.filter);
+
+ WKPageSetUserContentExtensionsEnabled(mainWebView()->page(), true);
+ WKUserContentControllerAddUserContentFilter(userContentController(), context.filter.get());
+}
+
+void TestController::resetContentExtensions()
+{
+ if (!mainWebView())
+ return;
+
+ WKPageSetUserContentExtensionsEnabled(mainWebView()->page(), false);
+
+ const char* contentExtensionsPath = libraryPathForTesting();
+ if (!contentExtensionsPath)
+ return;
+
+ WKUserContentControllerRemoveAllUserContentFilters(userContentController());
+
+ auto storePath = adoptWK(WKStringCreateWithUTF8CString(contentExtensionsPath));
+ auto extensionStore = adoptWK(WKUserContentExtensionStoreCreate(storePath.get()));
+ ASSERT(extensionStore);
+
+ auto filterIdentifier = adoptWK(WKStringCreateWithUTF8CString("TestContentExtension"));
+
+ ContentExtensionStoreCallbackContext context(*this);
+ WKUserContentExtensionStoreRemove(extensionStore.get(), filterIdentifier.get(), &context, contentExtensionStoreCallback);
+ runUntil(context.done, noTimeout);
+ ASSERT(!context.filter);
+}
+#else // ENABLE(CONTENT_EXTENSIONS)
+void TestController::configureContentExtensionForTest(const TestInvocation&)
+{
+}
+
+void TestController::resetContentExtensions()
+{
+}
+#endif // ENABLE(CONTENT_EXTENSIONS)
+#endif // !PLATFORM(COCOA)
+
class CommandTokenizer {
public:
explicit CommandTokenizer(const std::string& input)
Modified: trunk/Tools/WebKitTestRunner/TestController.h (241282 => 241283)
--- trunk/Tools/WebKitTestRunner/TestController.h 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2019-02-12 00:07:21 UTC (rev 241283)
@@ -107,6 +107,7 @@
PlatformWebView* mainWebView() { return m_mainWebView.get(); }
WKContextRef context() { return m_context.get(); }
+ WKUserContentControllerRef userContentController() { return m_userContentController.get(); }
EventSenderProxy* eventSenderProxy() { return m_eventSenderProxy.get(); }
@@ -148,6 +149,10 @@
unsigned userMediaPermissionRequestCountForOrigin(WKStringRef userMediaDocumentOriginString, WKStringRef topLevelDocumentOriginString);
void resetUserMediaPermissionRequestCountForOrigin(WKStringRef userMediaDocumentOriginString, WKStringRef topLevelDocumentOriginString);
+ // Content Extensions.
+ void configureContentExtensionForTest(const TestInvocation&);
+ void resetContentExtensions();
+
// Policy delegate.
void setCustomPolicyDelegate(bool enabled, bool permissive);
@@ -459,6 +464,7 @@
std::unique_ptr<PlatformWebView> m_mainWebView;
WKRetainPtr<WKContextRef> m_context;
WKRetainPtr<WKPageGroupRef> m_pageGroup;
+ WKRetainPtr<WKUserContentControllerRef> m_userContentController;
#if PLATFORM(IOS_FAMILY)
Vector<std::unique_ptr<InstanceMethodSwizzler>> m_inputModeSwizzlers;
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (241282 => 241283)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2019-02-12 00:07:21 UTC (rev 241283)
@@ -238,8 +238,8 @@
if (!m_calendarSwizzler)
m_calendarSwizzler = std::make_unique<ClassMethodSwizzler>([NSCalendar class], @selector(currentCalendar), reinterpret_cast<IMP>(swizzledCalendar));
}
-
-void TestController::cocoaResetStateToConsistentValues(const TestOptions& options)
+
+void TestController::resetContentExtensions()
{
#if WK_API_ENABLED
__block bool doneRemoving = false;
@@ -249,13 +249,21 @@
platformRunUntil(doneRemoving, noTimeout);
[[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
+ if (auto* webView = mainWebView()) {
+ TestRunnerWKWebView *platformView = webView->platformView();
+ [platformView.configuration.userContentController _removeAllUserContentFilters];
+ }
+#endif
+}
+void TestController::cocoaResetStateToConsistentValues(const TestOptions& options)
+{
+#if WK_API_ENABLED
m_calendarSwizzler = nullptr;
m_overriddenCalendarIdentifier = nil;
if (auto* webView = mainWebView()) {
TestRunnerWKWebView *platformView = webView->platformView();
- [platformView.configuration.userContentController _removeAllUserContentFilters];
platformView._viewScale = 1;
platformView._minimumEffectiveDeviceWidth = 0;
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (241282 => 241283)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2019-02-12 00:07:21 UTC (rev 241283)
@@ -105,6 +105,10 @@
m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
}
+void TestController::configureContentExtensionForTest(const TestInvocation&)
+{
+}
+
void TestController::platformResetPreferencesToConsistentValues()
{
WKPreferencesRef preferences = platformPreferences();
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (241282 => 241283)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2019-02-11 23:24:23 UTC (rev 241282)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2019-02-12 00:07:21 UTC (rev 241283)
@@ -118,7 +118,7 @@
options.shouldShowWebView = shouldShowWebView();
}
-void TestController::platformConfigureViewForTest(const TestInvocation& test)
+void TestController::configureContentExtensionForTest(const TestInvocation& test)
{
#if WK_API_ENABLED
if (!test.urlContains("contentextensions/"))
@@ -153,6 +153,10 @@
#endif
}
+void TestController::platformConfigureViewForTest(const TestInvocation& test)
+{
+}
+
static NSSet *allowedFontFamilySet()
{
static NSSet *fontFamilySet = [[NSSet setWithObjects: