<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] webkit_web_extension_initialize[_with_user_data] not documented"
href="https://bugs.webkit.org/show_bug.cgi?id=142786">bug 142786</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Attachment #250778 Flags</td>
<td>review+, commit-queue+
</td>
<td>review?, commit-queue-
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] webkit_web_extension_initialize[_with_user_data] not documented"
href="https://bugs.webkit.org/show_bug.cgi?id=142786#c13">Comment # 13</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] webkit_web_extension_initialize[_with_user_data] not documented"
href="https://bugs.webkit.org/show_bug.cgi?id=142786">bug 142786</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=250778&action=diff" name="attach_250778" title="Patch">attachment 250778</a> <a href="attachment.cgi?id=250778&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=250778&action=review">https://bugs.webkit.org/attachment.cgi?id=250778&action=review</a>
<span class="quote">> Source/WebKit2/ChangeLog:8
> + WebKitWebExtension has no documentation at all the only information</span >
no documentation at all is at least inaccurate, WebKitWebExtension has a signal and a public method and both are documented. Initialization functions are also documented in WebKitWebExtension.h
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:37
> + * SECTION: WebKitWebExtension</span >
So, the section documentation is what is missing then.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:41
> + * #WebKitWebExtension is a plugin for the WebProcess. It allows you to execute code in the</span >
Do not use # here, since this creates a link to this point exactly. I would avoid using 'plugin' here, since it could be confused with browser plugins. I would use loadable module, for example.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:45
> + * WebExtensions are a single compilation unit that are loaded in a way similar to a GTK module.</span >
I wouldn't mention GTK modules here either, I think previous paragraph already explained that this is loadable module loaded by the web process.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:46
> + * To create a #WebKitWebExtension you should write a module which implements a function</span >
Do not use # here.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:47
> + * named `webkit_web_extension_initialize` or, in case you need to initilize the extension with</span >
Use webkit_web_extension_initialize() instead of the quotes
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:48
> + * some data from the UI, `webkit_web_extension_initialize_with_user_data`. These functions</span >
webkit_web_extension_initialize_with_user_data()
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:49
> + * types are WebKitWebExtensionInitializeFunction() and WebKitWebExtensionInitializeWithUserDataFunction()</span >
WebKitWebExtensionInitializeFunction and WebKitWebExtensionInitializeWithUserDataFunction are not functions, use # instead of ().
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:50
> + * respectively. In addition the implemented function has to be public and it has to use</span >
I would rephrase this a bit, something like. Web extensions must have a initialization function that could be either webkit_web_extension_initialize() with prototype #WebKitWebExtensionInitializeFunction or webkit_web_extension_initialize_with_user_data() with prototype #WebKitWebExtensionInitializeWithUserDataFunction. This function is called when the web process is initialized.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:51
> + * the `G_MODULE_EXPORT` macro.</span >
#G_MODULE_EXPORT
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:71
> + * G_MODULE_EXPORT void
> + * webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension,
> + * const GVariant *user_data)
> + * {
> + * g_signal_connect (extension, "page-created",
> + * G_CALLBACK (web_page_created_callback),
> + * NULL);
> + * }</span >
If we are not going to use the data in the example, it would be better to use webkit_web_extension_initialize() instead.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:76
> + * a #WebKitWebPage is created. You should also modify your building tools (e.g. CMake or
> + * Autotools) to compile this individual module.</span >
I'm not sure we should mention build systems in api docs.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:78
> + * WebKit has to know where it can find the created #WebKitWebExtension. To do so you</span >
Dot not use # here.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:80
> + * must be called as soon as posible in our app and before any WebProcess is launched.</span >
in our app? I would just mention initialize-web-extensions signal as the recommended place to avoid confusions.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:83
> + * To provide the initialization data used by the `webkit_web_extension_initialize_with_user_data`</span >
I guess you provide init data to the function, not by the function. In any case, I think Martin or any other native english speaker should review all this doc.
<span class="quote">> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:100
> + * context, WEB_EXTENSIONS_DIRECTORY);
> + * webkit_web_context_set_web_extensions_initialization_user_data (
> + * context, g_variant_new_uint32 (unique_id++));</span >
It seems one of these lines is not correctly indented</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>