Bug 101530 - [EFL][WK2] Add ewk_context_additional_plugin_path_set API
Summary: [EFL][WK2] Add ewk_context_additional_plugin_path_set API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: KwangYong Choi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-07 17:43 PST by KwangYong Choi
Modified: 2012-11-08 05:13 PST (History)
5 users (show)

See Also:


Attachments
Patch (4.42 KB, patch)
2012-11-07 17:43 PST, KwangYong Choi
no flags Details | Formatted Diff | Diff
Patch (4.15 KB, patch)
2012-11-08 00:02 PST, KwangYong Choi
no flags Details | Formatted Diff | Diff
Patch (4.20 KB, patch)
2012-11-08 02:19 PST, KwangYong Choi
no flags Details | Formatted Diff | Diff
Patch (4.21 KB, patch)
2012-11-08 03:37 PST, KwangYong Choi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KwangYong Choi 2012-11-07 17:43:06 PST
Add ewk_context_additional_plugin_path_set() to set additional plugin directory.

Currently, get additional plugin directories API is missing. Test can be modified after adding it.
Comment 1 KwangYong Choi 2012-11-07 17:43:52 PST
Created attachment 172900 [details]
Patch
Comment 2 Jinwoo Song 2012-11-07 22:47:35 PST
Comment on attachment 172900 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172900&action=review

rebase the patch as the ewk_context has been changed.

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:225
> +    WKContextSetAdditionalPluginsDirectory(m_context.get(), WKStringCreateWithUTF8CString(path));

You may use WebContext::setAdditionalPluginsDirectory() instead of WKContextSetAdditionalPluginsDirectory(), as ewk_context uses WebContext now.
Comment 3 Chris Dumez 2012-11-07 23:16:45 PST
Comment on attachment 172900 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172900&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:222
> +bool EwkContext::setAdditionalPluginPath(const char* path)

Should take a const String& in argument.

>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:225
>> +    WKContextSetAdditionalPluginsDirectory(m_context.get(), WKStringCreateWithUTF8CString(path));
> 
> You may use WebContext::setAdditionalPluginsDirectory() instead of WKContextSetAdditionalPluginsDirectory(), as ewk_context uses WebContext now.

Yes, please use C++ API instead of C API.

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:218
> +    /* FIXME: Get additional plugin path and compare with the path. */

I'm not sure this comment should be there. There does not seem to be an API to retrieve additional plugin paths at the moment.
Comment 4 KwangYong Choi 2012-11-07 23:42:04 PST
Comment on attachment 172900 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172900&action=review

>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:222
>> +bool EwkContext::setAdditionalPluginPath(const char* path)
> 
> Should take a const String& in argument.

OK.

>>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:225
>>> +    WKContextSetAdditionalPluginsDirectory(m_context.get(), WKStringCreateWithUTF8CString(path));
>> 
>> You may use WebContext::setAdditionalPluginsDirectory() instead of WKContextSetAdditionalPluginsDirectory(), as ewk_context uses WebContext now.
> 
> Yes, please use C++ API instead of C API.

OK.

>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:218
>> +    /* FIXME: Get additional plugin path and compare with the path. */
> 
> I'm not sure this comment should be there. There does not seem to be an API to retrieve additional plugin paths at the moment.

As you wrote, currently, there is no API to retrieve additional plugin directories. And these TRUE/FALSE tests are not enough for this API, I think. So, I added some comment here.
Comment 5 KwangYong Choi 2012-11-08 00:02:29 PST
Created attachment 172944 [details]
Patch
Comment 6 Mikhail Pozdnyakov 2012-11-08 00:24:05 PST
Comment on attachment 172944 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172944&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:204
> +bool EwkContext::setAdditionalPluginPath(const String& path)

does this method make sense at all if NETSCAPE_PLUGIN_API is not enabled?

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:208
> +    return true;

m_webContext->setAdditionalPluginsDirectory does not return bool and we should not do it too.
Comment 7 Chris Dumez 2012-11-08 00:28:12 PST
(In reply to comment #6)
> (From update of attachment 172944 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=172944&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:204
> > +bool EwkContext::setAdditionalPluginPath(const String& path)
> 
> does this method make sense at all if NETSCAPE_PLUGIN_API is not enabled?
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:208
> > +    return true;
> 
> m_webContext->setAdditionalPluginsDirectory does not return bool and we should not do it too.

I agree with both comments.
Comment 8 Gyuyoung Kim 2012-11-08 01:10:51 PST
Comment on attachment 172944 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172944&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:324
> +Eina_Bool ewk_context_additional_plugin_path_set(Ewk_Context* ewkContext, const char* path)

It seems to me ewk_settings.cpp is more proper place for this function. Can't this API be moved to there ?
Comment 9 Chris Dumez 2012-11-08 01:22:01 PST
Comment on attachment 172944 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172944&action=review

>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:324
>> +Eina_Bool ewk_context_additional_plugin_path_set(Ewk_Context* ewkContext, const char* path)
> 
> It seems to me ewk_settings.cpp is more proper place for this function. Can't this API be moved to there ?

Why? It is a WebContext API not a WebPreferences one.
Comment 10 Gyuyoung Kim 2012-11-08 01:37:31 PST
(In reply to comment #9)
> (From update of attachment 172944 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=172944&action=review
> 
> >> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:324
> >> +Eina_Bool ewk_context_additional_plugin_path_set(Ewk_Context* ewkContext, const char* path)
> > 
> > It seems to me ewk_settings.cpp is more proper place for this function. Can't this API be moved to there ?
> 
> Why? It is a WebContext API not a WebPreferences one.

Yes, I know it well. But, I just check this because this functionality just sets plugin path. It looks this is close to global setting, not related to context. Of course, this functionality can only be supported by context for now.
Comment 11 KwangYong Choi 2012-11-08 02:19:04 PST
Created attachment 172966 [details]
Patch

Applied Mikhail mentioned.

I'm not sure this API can be moved to settings. I think, it can be handled by another bug if it's possible. :)
Comment 12 Gyuyoung Kim 2012-11-08 02:38:01 PST
(In reply to comment #11)
> Created an attachment (id=172966) [details]
> Patch
> 
> Applied Mikhail mentioned.
> 
> I'm not sure this API can be moved to settings. I think, it can be handled by another bug if it's possible. :)

Yes, I think so. I just would check if this can be moved.
Comment 13 Mikhail Pozdnyakov 2012-11-08 02:42:00 PST
Comment on attachment 172966 [details]
Patch

LGTM
Comment 14 Gyuyoung Kim 2012-11-08 03:18:13 PST
Comment on attachment 172966 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172966&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:326
> +    impl->setAdditionalPluginPath(String(path));

I think you need to use filenameToString as gtk port.

context->priv->context->setAdditionalPluginsDirectory(WebCore::filenameToString(directory));
Comment 15 Chris Dumez 2012-11-08 03:26:22 PST
Comment on attachment 172966 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172966&action=review

>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:326
>> +    impl->setAdditionalPluginPath(String(path));
> 
> I think you need to use filenameToString as gtk port.
> 
> context->priv->context->setAdditionalPluginsDirectory(WebCore::filenameToString(directory));

Only GTK port has filenameToString().

In any case, using String(path) is seriously wrong as the path will be processed as ASCII. It should be String::fromUTF8(path).
Comment 16 Gyuyoung Kim 2012-11-08 03:34:37 PST
(In reply to comment #15)
> (From update of attachment 172966 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=172966&action=review
> 
> >> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:326
> >> +    impl->setAdditionalPluginPath(String(path));
> > 
> > I think you need to use filenameToString as gtk port.
> > 
> > context->priv->context->setAdditionalPluginsDirectory(WebCore::filenameToString(directory));
> 
> Only GTK port has filenameToString().
> 
> In any case, using String(path) is seriously wrong as the path will be processed as ASCII. It should be String::fromUTF8(path).

If gtk port only has it, we should use String::fromUTF8() instead.
Comment 17 KwangYong Choi 2012-11-08 03:37:42 PST
Created attachment 172994 [details]
Patch

Changed to String::fromUTF8(path)
Comment 18 Chris Dumez 2012-11-08 03:43:28 PST
Comment on attachment 172994 [details]
Patch

LGTM.
Comment 19 WebKit Review Bot 2012-11-08 04:15:07 PST
Comment on attachment 172994 [details]
Patch

Clearing flags on attachment: 172994

Committed r133880: <http://trac.webkit.org/changeset/133880>
Comment 20 WebKit Review Bot 2012-11-08 04:15:12 PST
All reviewed patches have been landed.  Closing bug.
Comment 21 Raphael Kubo da Costa (:rakuco) 2012-11-08 04:46:25 PST
Build fix landed in http://trac.webkit.org/changeset/133882
Comment 22 Gyuyoung Kim 2012-11-08 05:13:28 PST
(In reply to comment #21)
> Build fix landed in http://trac.webkit.org/changeset/133882

Oops, thanks.