Title: [218684] trunk
Revision
218684
Author
[email protected]
Date
2017-06-22 00:40:44 -0700 (Thu, 22 Jun 2017)

Log Message

[WPE] Add initial web extensions API
https://bugs.webkit.org/show_bug.cgi?id=173640

Reviewed by Žan Doberšek.

.:

* Source/cmake/OptionsWPE.cmake:

Source/WebKit2:

Build the glib web extensions API files and the builtin injected bundle library for WPE.

* PlatformWPE.cmake:
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed): Use a different injected bundle filename in WPE and GTK+.
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(webkit_web_page_class_init): Do not expose DOM bindings in WPE.
(webkitWebPageCreate): Ditto.
* WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h: Added.
* WebProcess/InjectedBundle/API/wpe/WebKitFrame.h: Added.
* WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h: Added.
* WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h: Added.
* WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h: Added.
* WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Added.
* WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Added.

Tools:

Add style checker exceptions for WPE web extensions API files.

* Scripts/webkitpy/style/checker.py:

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (218683 => 218684)


--- trunk/ChangeLog	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/ChangeLog	2017-06-22 07:40:44 UTC (rev 218684)
@@ -1,3 +1,12 @@
+2017-06-22  Carlos Garcia Campos  <[email protected]>
+
+        [WPE] Add initial web extensions API
+        https://bugs.webkit.org/show_bug.cgi?id=173640
+
+        Reviewed by Žan Doberšek.
+
+        * Source/cmake/OptionsWPE.cmake:
+
 2017-06-21  Yoshiaki Jitsukawa  <[email protected]>
 
         [MSVC] Fix compilation in CP932 (Shift_JIS) environment

Modified: trunk/Source/WebKit2/ChangeLog (218683 => 218684)


--- trunk/Source/WebKit2/ChangeLog	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-22 07:40:44 UTC (rev 218684)
@@ -1,3 +1,26 @@
+2017-06-22  Carlos Garcia Campos  <[email protected]>
+
+        [WPE] Add initial web extensions API
+        https://bugs.webkit.org/show_bug.cgi?id=173640
+
+        Reviewed by Žan Doberšek.
+
+        Build the glib web extensions API files and the builtin injected bundle library for WPE.
+
+        * PlatformWPE.cmake:
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkitWebContextConstructed): Use a different injected bundle filename in WPE and GTK+.
+        * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
+        (webkit_web_page_class_init): Do not expose DOM bindings in WPE.
+        (webkitWebPageCreate): Ditto.
+        * WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Added.
+        * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Added.
+
 2017-06-21  David Kilzer  <[email protected]>
 
         REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]

Modified: trunk/Source/WebKit2/PlatformWPE.cmake (218683 => 218684)


--- trunk/Source/WebKit2/PlatformWPE.cmake	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Source/WebKit2/PlatformWPE.cmake	2017-06-22 07:40:44 UTC (rev 218684)
@@ -1,6 +1,7 @@
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKIT2_DIR})
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WPE_API_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DIR})
+file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_EXTENSION_DIR})
 
 configure_file(wpe/wpe-webkit.pc.in ${CMAKE_BINARY_DIR}/wpe-webkit.pc @ONLY)
 
@@ -22,7 +23,19 @@
     COMMAND ln -n -s -f ${WEBKIT2_DIR}/UIProcess/API/wpe ${FORWARDING_HEADERS_WPE_DIR}/wpe
 )
 
+add_custom_command(
+    OUTPUT ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
+    DEPENDS ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/wpe
+    COMMAND ln -n -s -f ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/wpe ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
+)
+
+add_custom_target(webkit2wpe-fake-api-headers
+    DEPENDS ${FORWARDING_HEADERS_WPE_DIR}/wpe
+            ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
+)
+
 set(WEBKIT2_EXTRA_DEPENDENCIES
+    webkit2wpe-fake-api-headers
     webkit2wpe-forwarding-headers
 )
 
@@ -211,6 +224,14 @@
     WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
     WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
 
+    WebProcess/InjectedBundle/API/glib/WebKitConsoleMessage.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitWebEditor.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp
+    WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp
+
     WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp
 
     WebProcess/MediaCache/WebMediaKeyStorageManager.cpp
@@ -350,6 +371,7 @@
 list(APPEND WebKit2_INCLUDE_DIRECTORIES
     "${FORWARDING_HEADERS_DIR}"
     "${FORWARDING_HEADERS_WPE_DIR}"
+    "${FORWARDING_HEADERS_WPE_EXTENSION_DIR}"
     "${DERIVED_SOURCES_DIR}"
     "${DERIVED_SOURCES_WPE_API_DIR}"
     "${WEBCORE_DIR}/platform/graphics/cairo"
@@ -381,6 +403,8 @@
     "${WEBKIT2_DIR}/UIProcess/gstreamer"
     "${WEBKIT2_DIR}/UIProcess/linux"
     "${WEBKIT2_DIR}/UIProcess/soup"
+    "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/glib"
+    "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/wpe"
     "${WEBKIT2_DIR}/WebProcess/soup"
     "${WEBKIT2_DIR}/WebProcess/unix"
     "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/soup"
@@ -480,6 +504,10 @@
 target_include_directories(WPEWebInspectorResources PUBLIC ${WPEWebInspectorResources_INCLUDE_DIRECTORIES})
 install(TARGETS WPEWebInspectorResources DESTINATION "${LIB_INSTALL_DIR}")
 
+add_library(WPEInjectedBundle MODULE "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
+add_webkit2_prefix_header(WPEInjectedBundle)
+target_link_libraries(WPEInjectedBundle WebKit2)
+
 if (EXPORT_DEPRECATED_WEBKIT2_C_API)
     set(WPE_INSTALLED_WEBKIT_HEADERS
         ${WEBKIT2_DIR}/Shared/API/c/WKArray.h

Modified: trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebContext.cpp (218683 => 218684)


--- trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebContext.cpp	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebContext.cpp	2017-06-22 07:40:44 UTC (rev 218684)
@@ -229,6 +229,12 @@
 
 WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)
 
+#if PLATFORM(GTK)
+#define INJECTED_BUNDLE_FILENAME "libwebkit2gtkinjectedbundle.so"
+#elif PLATFORM(WPE)
+#define INJECTED_BUNDLE_FILENAME "libWPEInjectedBundle.so"
+#endif
+
 static const char* injectedBundleDirectory()
 {
 #if ENABLE(DEVELOPER_MODE)
@@ -242,7 +248,7 @@
         G_DIR_SEPARATOR_S "injected-bundle" G_DIR_SEPARATOR_S;
     return injectedBundlePath;
 #elif PLATFORM(WPE)
-    // FIXME: Add web extensions API support to WPE.
+    // FIXME: Make it possible to use installed injected bundle in WPE.
     return nullptr;
 #endif
 }
@@ -296,7 +302,7 @@
 {
     G_OBJECT_CLASS(webkit_web_context_parent_class)->constructed(object);
 
-    GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory(), "libwebkit2gtkinjectedbundle.so", nullptr));
+    GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory(), INJECTED_BUNDLE_FILENAME, nullptr));
 
     API::ProcessPoolConfiguration configuration;
     configuration.setInjectedBundlePath(WebCore::stringFromFileSystemRepresentation(bundleFilename.get()));

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (218683 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2017-06-22 07:40:44 UTC (rev 218684)
@@ -33,8 +33,6 @@
 #include "WebImage.h"
 #include "WebKitConsoleMessagePrivate.h"
 #include "WebKitContextMenuPrivate.h"
-#include "WebKitDOMDocumentPrivate.h"
-#include "WebKitDOMElementPrivate.h"
 #include "WebKitFramePrivate.h"
 #include "WebKitPrivate.h"
 #include "WebKitScriptWorldPrivate.h"
@@ -41,7 +39,6 @@
 #include "WebKitURIRequestPrivate.h"
 #include "WebKitURIResponsePrivate.h"
 #include "WebKitWebEditorPrivate.h"
-#include "WebKitWebHitTestResultPrivate.h"
 #include "WebKitWebPagePrivate.h"
 #include "WebProcess.h"
 #include <WebCore/Document.h>
@@ -56,6 +53,12 @@
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 
+#if PLATFORM(GTK)
+#include "WebKitDOMDocumentPrivate.h"
+#include "WebKitDOMElementPrivate.h"
+#include "WebKitWebHitTestResultPrivate.h"
+#endif
+
 using namespace WebKit;
 using namespace WebCore;
 
@@ -62,9 +65,13 @@
 enum {
     DOCUMENT_LOADED,
     SEND_REQUEST,
+#if PLATFORM(GTK)
     CONTEXT_MENU,
+#endif
     CONSOLE_MESSAGE_SENT,
+#if PLATFORM(GTK)
     FORM_CONTROLS_ASSOCIATED,
+#endif
 
     LAST_SIGNAL
 };
@@ -324,6 +331,7 @@
 private:
     bool getCustomMenuFromDefaultItems(WebPage&, const WebCore::HitTestResult& hitTestResult, const Vector<WebCore::ContextMenuItem>& defaultMenu, Vector<WebContextMenuItemData>& newMenu, RefPtr<API::Object>& userData) override
     {
+#if PLATFORM(GTK)
         GRefPtr<WebKitContextMenu> contextMenu = adoptGRef(webkitContextMenuCreate(kitItems(defaultMenu)));
         GRefPtr<WebKitWebHitTestResult> webHitTestResult = adoptGRef(webkitWebHitTestResultCreate(hitTestResult));
         gboolean returnValue;
@@ -338,6 +346,10 @@
 
         webkitContextMenuPopulate(contextMenu.get(), newMenu);
         return true;
+#elif PLATFORM(WPE)
+        // FIXME: use a shared WebKitHitTestResult in WPE.
+        return false;
+#endif
     }
 
     WebKitWebPage* m_webPage;
@@ -359,6 +371,7 @@
     WebKitWebPage* m_webPage;
 };
 
+#if PLATFORM(GTK)
 class PageFormClient final : public API::InjectedBundle::FormClient {
 public:
     explicit PageFormClient(WebKitWebPage* webPage)
@@ -380,6 +393,7 @@
 private:
     WebKitWebPage* m_webPage;
 };
+#endif
 
 static void webkitWebPageGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
 {
@@ -464,6 +478,7 @@
         WEBKIT_TYPE_URI_REQUEST,
         WEBKIT_TYPE_URI_RESPONSE);
 
+#if PLATFORM(GTK)
     /**
      * WebKitWebPage::context-menu:
      * @web_page: the #WebKitWebPage on which the signal is emitted
@@ -493,6 +508,7 @@
         G_TYPE_BOOLEAN, 2,
         WEBKIT_TYPE_CONTEXT_MENU,
         WEBKIT_TYPE_WEB_HIT_TEST_RESULT);
+#endif
 
     /**
      * WebKitWebPage::console-message-sent:
@@ -515,6 +531,7 @@
         G_TYPE_NONE, 1,
         WEBKIT_TYPE_CONSOLE_MESSAGE | G_SIGNAL_TYPE_STATIC_SCOPE);
 
+#if PLATFORM(GTK)
     /**
      * WebKitWebPage::form-controls-associated:
      * @web_page: the #WebKitWebPage on which the signal is emitted
@@ -541,6 +558,7 @@
         g_cclosure_marshal_VOID__BOXED,
         G_TYPE_NONE, 1,
         G_TYPE_PTR_ARRAY);
+#endif
 }
 
 WebPage* webkitWebPageGetPage(WebKitWebPage *webPage)
@@ -557,7 +575,9 @@
     webPage->setInjectedBundlePageLoaderClient(std::make_unique<PageLoaderClient>(page));
     webPage->setInjectedBundleContextMenuClient(std::make_unique<PageContextMenuClient>(page));
     webPage->setInjectedBundleUIClient(std::make_unique<PageUIClient>(page));
+#if PLATFORM(GTK)
     webPage->setInjectedBundleFormClient(std::make_unique<PageFormClient>(page));
+#endif
 
     return page;
 }
@@ -605,6 +625,7 @@
         ASSERT_NOT_REACHED();
 }
 
+#if PLATFORM(GTK)
 /**
  * webkit_web_page_get_dom_document:
  * @web_page: a #WebKitWebPage
@@ -624,6 +645,7 @@
 
     return kit(coreFrame->document());
 }
+#endif
 
 /**
  * webkit_web_page_get_id:

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitConsoleMessage_h
+#define WebKitConsoleMessage_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_CONSOLE_MESSAGE (webkit_console_message_get_type())
+
+/**
+ * WebKitConsoleMessageSource:
+ * @WEBKIT_CONSOLE_MESSAGE_SOURCE_JAVASCRIPT: Message produced by _javascript_.
+ * @WEBKIT_CONSOLE_MESSAGE_SOURCE_NETWORK: Network messages.
+ * @WEBKIT_CONSOLE_MESSAGE_SOURCE_CONSOLE_API: Messages produced by console API.
+ * @WEBKIT_CONSOLE_MESSAGE_SOURCE_SECURITY: Security messages.
+ * @WEBKIT_CONSOLE_MESSAGE_SOURCE_OTHER: Other messages.
+ *
+ * Enum values used to denote the various sources of console messages.
+ *
+ * Since: 2.12
+ */
+typedef enum {
+    WEBKIT_CONSOLE_MESSAGE_SOURCE_JAVASCRIPT,
+    WEBKIT_CONSOLE_MESSAGE_SOURCE_NETWORK,
+    WEBKIT_CONSOLE_MESSAGE_SOURCE_CONSOLE_API,
+    WEBKIT_CONSOLE_MESSAGE_SOURCE_SECURITY,
+    WEBKIT_CONSOLE_MESSAGE_SOURCE_OTHER
+} WebKitConsoleMessageSource;
+
+/**
+ * WebKitConsoleMessageLevel:
+ * @WEBKIT_CONSOLE_MESSAGE_LEVEL_INFO: Information message.
+ * @WEBKIT_CONSOLE_MESSAGE_LEVEL_LOG: Log message.
+ * @WEBKIT_CONSOLE_MESSAGE_LEVEL_WARNING: Warning message.
+ * @WEBKIT_CONSOLE_MESSAGE_LEVEL_ERROR: Error message.
+ * @WEBKIT_CONSOLE_MESSAGE_LEVEL_DEBUG: Debug message.
+ *
+ * Enum values used to denote the various levels of console messages.
+ *
+ * Since: 2.12
+ */
+typedef enum {
+    WEBKIT_CONSOLE_MESSAGE_LEVEL_INFO,
+    WEBKIT_CONSOLE_MESSAGE_LEVEL_LOG,
+    WEBKIT_CONSOLE_MESSAGE_LEVEL_WARNING,
+    WEBKIT_CONSOLE_MESSAGE_LEVEL_ERROR,
+    WEBKIT_CONSOLE_MESSAGE_LEVEL_DEBUG
+} WebKitConsoleMessageLevel;
+
+typedef struct _WebKitConsoleMessage WebKitConsoleMessage;
+
+WEBKIT_API GType
+webkit_console_message_get_type      (void);
+
+WEBKIT_API WebKitConsoleMessage *
+webkit_console_message_copy          (WebKitConsoleMessage *console_message);
+
+WEBKIT_API void
+webkit_console_message_free          (WebKitConsoleMessage *console_message);
+
+WEBKIT_API WebKitConsoleMessageSource
+webkit_console_message_get_source    (WebKitConsoleMessage *console_message);
+
+WEBKIT_API WebKitConsoleMessageLevel
+webkit_console_message_get_level     (WebKitConsoleMessage *console_message);
+
+WEBKIT_API const gchar *
+webkit_console_message_get_text      (WebKitConsoleMessage *console_message);
+
+WEBKIT_API guint
+webkit_console_message_get_line      (WebKitConsoleMessage *console_message);
+
+WEBKIT_API const gchar *
+webkit_console_message_get_source_id (WebKitConsoleMessage *console_message);
+
+G_END_DECLS
+
+#endif

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitFrame_h
+#define WebKitFrame_h
+
+#include <_javascript_Core/JSBase.h>
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+#include <wpe/WebKitScriptWorld.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_FRAME            (webkit_frame_get_type())
+#define WEBKIT_FRAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FRAME, WebKitFrame))
+#define WEBKIT_IS_FRAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FRAME))
+#define WEBKIT_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_FRAME, WebKitFrameClass))
+#define WEBKIT_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_FRAME))
+#define WEBKIT_FRAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_FRAME, WebKitFrameClass))
+
+typedef struct _WebKitFrame        WebKitFrame;
+typedef struct _WebKitFrameClass   WebKitFrameClass;
+typedef struct _WebKitFramePrivate WebKitFramePrivate;
+
+struct _WebKitFrame {
+    GObject parent;
+
+    WebKitFramePrivate *priv;
+};
+
+struct _WebKitFrameClass {
+    GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_frame_get_type                                (void);
+
+WEBKIT_API gboolean
+webkit_frame_is_main_frame                           (WebKitFrame       *frame);
+
+WEBKIT_API const gchar *
+webkit_frame_get_uri                                 (WebKitFrame       *frame);
+
+WEBKIT_API JSGlobalContextRef
+webkit_frame_get_javascript_global_context           (WebKitFrame       *frame);
+
+WEBKIT_API JSGlobalContextRef
+webkit_frame_get_javascript_context_for_script_world (WebKitFrame       *frame,
+                                                      WebKitScriptWorld *world);
+
+G_END_DECLS
+
+#endif

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitScriptWorld_h
+#define WebKitScriptWorld_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_SCRIPT_WORLD            (webkit_script_world_get_type())
+#define WEBKIT_SCRIPT_WORLD(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_SCRIPT_WORLD, WebKitScriptWorld))
+#define WEBKIT_IS_SCRIPT_WORLD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_SCRIPT_WORLD))
+#define WEBKIT_SCRIPT_WORLD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_SCRIPT_WORLD, WebKitScriptWorldClass))
+#define WEBKIT_IS_SCRIPT_WORLD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_SCRIPT_WORLD))
+#define WEBKIT_SCRIPT_WORLD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_SCRIPT_WORLD, WebKitScriptWorldClass))
+
+typedef struct _WebKitScriptWorld        WebKitScriptWorld;
+typedef struct _WebKitScriptWorldClass   WebKitScriptWorldClass;
+typedef struct _WebKitScriptWorldPrivate WebKitScriptWorldPrivate;
+
+struct _WebKitScriptWorld {
+    GObject parent;
+
+    WebKitScriptWorldPrivate *priv;
+};
+
+struct _WebKitScriptWorldClass {
+    GObjectClass parent_class;
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+};
+
+WEBKIT_API GType
+webkit_script_world_get_type    (void);
+
+WEBKIT_API WebKitScriptWorld *
+webkit_script_world_get_default (void);
+
+WEBKIT_API WebKitScriptWorld *
+webkit_script_world_new         (void);
+
+G_END_DECLS
+
+#endif

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2015 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <ape/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitWebEditor_h
+#define WebKitWebEditor_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+#include <wpe/WebKitWebPage.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_EDITOR               (webkit_web_editor_get_type())
+#define WEBKIT_WEB_EDITOR(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_EDITOR, WebKitWebEditor))
+#define WEBKIT_IS_WEB_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_EDITOR))
+#define WEBKIT_WEB_EDITOR_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_EDITOR, WebKitWebEditorClass))
+#define WEBKIT_IS_WEB_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_EDITOR))
+#define WEBKIT_WEB_EDITOR_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_EDITOR, WebKitWebEditorClass))
+
+typedef struct _WebKitWebEditor        WebKitWebEditor;
+typedef struct _WebKitWebEditorClass   WebKitWebEditorClass;
+typedef struct _WebKitWebEditorPrivate WebKitWebEditorPrivate;
+
+/* Forward declarations */
+typedef struct _WebKitWebPage          WebKitWebPage;
+
+struct _WebKitWebEditor {
+    GObject parent;
+
+    WebKitWebEditorPrivate *priv;
+};
+
+struct _WebKitWebEditorClass {
+    GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_web_editor_get_type (void);
+
+WEBKIT_API WebKitWebPage *
+webkit_web_editor_get_page (WebKitWebEditor *editor);
+
+G_END_DECLS
+
+#endif // WebKitWebEditor_h

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitWebExtension_h
+#define WebKitWebExtension_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+#include <wpe/WebKitWebPage.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_EXTENSION            (webkit_web_extension_get_type())
+#define WEBKIT_WEB_EXTENSION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtension))
+#define WEBKIT_IS_WEB_EXTENSION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_EXTENSION))
+#define WEBKIT_WEB_EXTENSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtensionClass))
+#define WEBKIT_IS_WEB_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_EXTENSION))
+#define WEBKIT_WEB_EXTENSION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtensionClass))
+
+typedef struct _WebKitWebExtension        WebKitWebExtension;
+typedef struct _WebKitWebExtensionClass   WebKitWebExtensionClass;
+typedef struct _WebKitWebExtensionPrivate WebKitWebExtensionPrivate;
+
+/**
+ * WebKitWebExtensionInitializeFunction:
+ * @extension: a #WebKitWebExtension
+ *
+ * Type definition for a function that will be called to initialize
+ * the web extension when the web process starts.
+ */
+typedef void (* WebKitWebExtensionInitializeFunction) (WebKitWebExtension *extension);
+
+/**
+ * WebKitWebExtensionInitializeWithUserDataFunction:
+ * @extension: a #WebKitWebExtension
+ * @user_data: a #GVariant
+ *
+ * Type definition for a function that will be called to initialize
+ * the web extensions when the web process starts, and which receives
+ * as additional argument the user data set with
+ * webkit_web_context_set_web_extensions_initialization_user_data().
+ *
+ * Since: 2.4
+ */
+typedef void (* WebKitWebExtensionInitializeWithUserDataFunction) (WebKitWebExtension *extension,
+                                                                   const GVariant     *user_data);
+
+struct _WebKitWebExtension {
+    GObject parent;
+
+    WebKitWebExtensionPrivate *priv;
+};
+
+struct _WebKitWebExtensionClass {
+    GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_web_extension_get_type (void);
+
+WEBKIT_API WebKitWebPage *
+webkit_web_extension_get_page (WebKitWebExtension *extension,
+                               guint64             page_id);
+
+G_END_DECLS
+
+#endif

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitWebPage_h
+#define WebKitWebPage_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+#include <wpe/WebKitFrame.h>
+#include <wpe/WebKitWebEditor.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_PAGE            (webkit_web_page_get_type())
+#define WEBKIT_WEB_PAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_PAGE, WebKitWebPage))
+#define WEBKIT_IS_WEB_PAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_PAGE))
+#define WEBKIT_WEB_PAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_PAGE, WebKitWebPageClass))
+#define WEBKIT_IS_WEB_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_PAGE))
+#define WEBKIT_WEB_PAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_PAGE, WebKitWebPageClass))
+
+typedef struct _WebKitWebPage        WebKitWebPage;
+typedef struct _WebKitWebPageClass   WebKitWebPageClass;
+typedef struct _WebKitWebPagePrivate WebKitWebPagePrivate;
+
+/* Forward declarations */
+typedef struct _WebKitWebEditor      WebKitWebEditor;
+
+struct _WebKitWebPage {
+    GObject parent;
+
+    WebKitWebPagePrivate *priv;
+};
+
+struct _WebKitWebPageClass {
+    GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_web_page_get_type         (void);
+
+WEBKIT_API guint64
+webkit_web_page_get_id           (WebKitWebPage *web_page);
+
+WEBKIT_API const gchar *
+webkit_web_page_get_uri          (WebKitWebPage *web_page);
+
+WEBKIT_API WebKitFrame *
+webkit_web_page_get_main_frame   (WebKitWebPage *web_page);
+
+WEBKIT_API WebKitWebEditor *
+webkit_web_page_get_editor       (WebKitWebPage *web_page);
+
+G_END_DECLS
+
+#endif

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h (0 => 218684)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h	2017-06-22 07:40:44 UTC (rev 218684)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef __WEBKIT_H__
+#error "Headers <wpe/webkit.h> and <wpe/webkit-web-extension.h> cannot be included together."
+#endif
+
+#ifndef __WEBKIT_WEB_EXTENSION_H__
+#define __WEBKIT_WEB_EXTENSION_H__
+
+#define __WEBKIT_WEB_EXTENSION_H_INSIDE__
+
+#include <wpe/WebKitConsoleMessage.h>
+#include <wpe/WebKitContextMenu.h>
+#include <wpe/WebKitContextMenuActions.h>
+#include <wpe/WebKitContextMenuItem.h>
+#include <wpe/WebKitFrame.h>
+#include <wpe/WebKitScriptWorld.h>
+#include <wpe/WebKitURIRequest.h>
+#include <wpe/WebKitURIResponse.h>
+#include <wpe/WebKitWebEditor.h>
+#include <wpe/WebKitWebExtension.h>
+#include <wpe/WebKitWebPage.h>
+
+#undef __WEBKIT_WEB_EXTENSION_H_INSIDE__
+
+#endif

Modified: trunk/Source/cmake/OptionsWPE.cmake (218683 => 218684)


--- trunk/Source/cmake/OptionsWPE.cmake	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Source/cmake/OptionsWPE.cmake	2017-06-22 07:40:44 UTC (rev 218684)
@@ -148,6 +148,7 @@
 
 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
+set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT2_DIR}/wpe)
 
 # Build with -fvisibility=hidden to reduce the size of the shared library.

Modified: trunk/Tools/ChangeLog (218683 => 218684)


--- trunk/Tools/ChangeLog	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Tools/ChangeLog	2017-06-22 07:40:44 UTC (rev 218684)
@@ -1,3 +1,14 @@
+2017-06-22  Carlos Garcia Campos  <[email protected]>
+
+        [WPE] Add initial web extensions API
+        https://bugs.webkit.org/show_bug.cgi?id=173640
+
+        Reviewed by Žan Doberšek.
+
+        Add style checker exceptions for WPE web extensions API files.
+
+        * Scripts/webkitpy/style/checker.py:
+
 2017-06-21  Wenson Hsieh  <[email protected]>
 
         [iOS DnD] [WK2] Cancelling a drag interaction using the ObjC SPI causes subsequent dragging to fail

Modified: trunk/Tools/Scripts/webkitpy/style/checker.py (218683 => 218684)


--- trunk/Tools/Scripts/webkitpy/style/checker.py	2017-06-22 07:33:34 UTC (rev 218683)
+++ trunk/Tools/Scripts/webkitpy/style/checker.py	2017-06-22 07:40:44 UTC (rev 218684)
@@ -153,7 +153,8 @@
       os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'gtk'),
       os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'wpe'),
       os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'glib'),
-      os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk')],
+      os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk'),
+      os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'wpe')],
      ["-readability/enum_casing"]),
 
     ([# To use GStreamer GL without conflicts of GL symbols,
@@ -313,6 +314,7 @@
     re.compile(re.escape(os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'gtk') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
     re.compile(re.escape(os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'wpe') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
     re.compile(re.escape(os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
+    re.compile(re.escape(os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'wpe') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
 
     # GObject DOM bindings copied from generated code using different coding style.
     os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk', 'DOM'),
@@ -319,7 +321,8 @@
 
     os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'gtk', 'webkit2.h'),
     os.path.join('Source', 'WebKit2', 'UIProcess', 'API', 'wpe', 'webkit.h'),
-    os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk', 'webkit-web-extension.h')]
+    os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk', 'webkit-web-extension.h'),
+    os.path.join('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'wpe', 'webkit-web-extension.h')]
 
 # Files to skip that are more common or obvious.
 #
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to