Bug 94248

Summary: [EFL][WK2] ewk_back_forward_list_item properties should be in sync with WebProcessProxy::m_backForwardListItemMap
Product: WebKit Reporter: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Component: WebKit EFLAssignee: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, gyuyoung.kim, kenneth, lucas.de.marchi, tmpsantos, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 92617    
Attachments:
Description Flags
patch
none
patch v2
none
patch v3
none
patch v4
none
patch v4 none

Description Mikhail Pozdnyakov 2012-08-16 13:32:25 PDT
Currently ewk_back_forward_list_item properties are initialized from WKBackForwardListItemRef once in the constructor and then just stored.
This is erroneous approach as back forward items can be initialized within several iterations, meaning several ipc calls to UI process and several updates of WebProcessProxy::m_backForwardListItemMap where the items are stored. Hence the values of ewk_back_forward_list_item properties should be updated with the corresponding WKBackForwardListItem.. functions invokes every time they are called.
Comment 1 Mikhail Pozdnyakov 2012-08-16 13:47:56 PDT
Created attachment 158892 [details]
patch
Comment 2 Chris Dumez 2012-08-16 13:51:36 PDT
Comment on attachment 158892 [details]
patch

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

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:92
> +    return item->uri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem));

Personally, I would prefer this on 2 lines.

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:99
> +    return item->title = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyTitle(item->wkItem.get()));

Ditto. + You should use wkItem directly instead of item->wkItem.get().

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:106
> +    return item->originalUri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(item->wkItem.get()));

Ditto.
Comment 3 Mikhail Pozdnyakov 2012-08-16 14:13:53 PDT
Created attachment 158897 [details]
patch v2

Chris, thanks for review!
Comment 4 Chris Dumez 2012-08-16 14:20:00 PDT
Comment on attachment 158897 [details]
patch v2

LGTM.
Comment 5 Gyuyoung Kim 2012-08-16 19:12:34 PDT
Comment on attachment 158897 [details]
patch v2

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

> Source/WebKit2/ChangeLog:14
> +        with the corresponding WKBackForwardListItem.. functions invokes every time

Use '.' instead '..' at the end of WKBackForwardListItem.

> Source/WebKit2/ChangeLog:17
> +        * PlatformEfl.cmake:

PlatformEfl.cmake is not modified by this patch.

> Source/WebKit2/ChangeLog:24
> +        * UIProcess/API/efl/tests/resources/default_test_page.html:

ditto.
Comment 6 Mikhail Pozdnyakov 2012-08-17 00:01:44 PDT
Created attachment 159014 [details]
patch v3

Fixed ChangeLog
Comment 7 Kenneth Rohde Christiansen 2012-08-17 04:11:56 PDT
Comment on attachment 159014 [details]
patch v3

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

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:42
> +    mutable WKEinaSharedString uri;

hmm you need to assign to this from const methods? maybe mention in the changelog

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:69
> +    if (!(item)->wkItem) {                                                 \
> +        EINA_LOG_CRIT("item->wkItem is NULL.");                            \
> +        return __VA_ARGS__;                                                \
> +    }                                                                      \
> +    if (!(item)->wkItem.get()) {                                           \
> +        EINA_LOG_CRIT("item->wkItem.get() is NULL.");                      \
> +        return __VA_ARGS__;                                                \
> +    }                                                                      \

It is a RetainPtr class... what is the diff between checking if wkItem is Null and wkItem.get() ?
Comment 8 Mikhail Pozdnyakov 2012-08-17 06:55:43 PDT
Created attachment 159113 [details]
patch v4

Took Kenneth feedback into consideration.
Comment 9 Mikhail Pozdnyakov 2012-08-17 07:00:59 PDT
Created attachment 159117 [details]
patch v4
Comment 10 Mikhail Pozdnyakov 2012-08-17 07:02:57 PDT
Comment on attachment 159014 [details]
patch v3

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

>> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:69
>> +    }                                                                      \
> 
> It is a RetainPtr class... what is the diff between checking if wkItem is Null and wkItem.get() ?

Agree, it has bool operator overloaded. Thanks for the catch.
Comment 11 Thiago Marcos P. Santos 2012-08-17 09:05:10 PDT
Comment on attachment 159117 [details]
patch v4

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

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:44
> +    mutable WKEinaSharedString uri;
> +    mutable WKEinaSharedString title;
> +    mutable WKEinaSharedString originalUri;

Controversial but I think it is a legit case of using mutable. Looks to me it is because the getter is lazy initialized, right?

> Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp:66
> +#define EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem_, ...)    \
> +    if (!(item)) {                                                         \
> +        EINA_LOG_CRIT("item is NULL.");                                    \
> +        return __VA_ARGS__;                                                \
> +    }                                                                      \
> +    if (!(item)->wkItem) {                                                 \
> +        EINA_LOG_CRIT("item->wkItem is NULL.");                            \
> +        return __VA_ARGS__;                                                \
> +    }                                                                      \
> +    WKBackForwardListItemRef wkItem_ = (item)->wkItem.get()

Why are you using __VA_ARGS__ here?
Comment 12 WebKit Review Bot 2012-08-18 14:47:22 PDT
Comment on attachment 159117 [details]
patch v4

Clearing flags on attachment: 159117

Committed r125969: <http://trac.webkit.org/changeset/125969>
Comment 13 WebKit Review Bot 2012-08-18 14:47:28 PDT
All reviewed patches have been landed.  Closing bug.