<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:cgarcia&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <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&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=250778&amp;action=diff" name="attach_250778" title="Patch">attachment 250778</a> <a href="attachment.cgi?id=250778&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=250778&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=250778&amp;action=review</a>

<span class="quote">&gt; Source/WebKit2/ChangeLog:8
&gt; +        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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:37
&gt; + * SECTION: WebKitWebExtension</span >

So, the section documentation is what is missing then.

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:41
&gt; + * #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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:45
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:46
&gt; + * To create a #WebKitWebExtension you should write a module which implements a function</span >

Do not use # here.

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:47
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:48
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:49
&gt; + * types are WebKitWebExtensionInitializeFunction() and WebKitWebExtensionInitializeWithUserDataFunction()</span >

WebKitWebExtensionInitializeFunction and WebKitWebExtensionInitializeWithUserDataFunction are not functions, use # instead of ().

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:50
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:51
&gt; + * the `G_MODULE_EXPORT` macro.</span >

#G_MODULE_EXPORT

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:71
&gt; + * G_MODULE_EXPORT void
&gt; + * webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension,
&gt; + *                                                 const GVariant     *user_data)
&gt; + * {
&gt; + *     g_signal_connect (extension, &quot;page-created&quot;,
&gt; + *                       G_CALLBACK (web_page_created_callback),
&gt; + *                       NULL);
&gt; + * }</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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:76
&gt; + * a #WebKitWebPage is created. You should also modify your building tools (e.g. CMake or
&gt; + * Autotools) to compile this individual module.</span >

I'm not sure we should mention build systems in api docs.

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:78
&gt; + * WebKit has to know where it can find the created #WebKitWebExtension. To do so you</span >

Dot not use # here.

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:80
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:83
&gt; + * 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">&gt; Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:100
&gt; + *       context, WEB_EXTENSIONS_DIRECTORY);
&gt; + *   webkit_web_context_set_web_extensions_initialization_user_data (
&gt; + *      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>