Bug 184823 - REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
Summary: REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away enc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-20 09:30 PDT by Michael Catanzaro
Modified: 2018-04-27 01:41 PDT (History)
7 users (show)

See Also:


Attachments
Patch (9.13 KB, patch)
2018-04-26 03:54 PDT, Carlos Garcia Campos
mcatanzaro: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2018-04-20 09:30:53 PDT
Since r230812, decodeBackForwardListItemState in WebKitWebViewSessionState.cpp no longer reads the encoded BackForwardList identifier.

First, we should figure out if this is bad. Does the BackForwardList still get deserialized properly? It's not clear to me.

If it's not bad, we should at least stop encoding the identifier, since it's silly to encode something that's never decoded. To avoid the need to change the serialization format, we could just start encoding 0, for example, with a comment to indicate that it should be dropped if we ever need to bump the serialization format.
Comment 1 Carlos Garcia Campos 2018-04-21 00:01:38 PDT
(In reply to Michael Catanzaro from comment #0)
> Since r230812, decodeBackForwardListItemState in
> WebKitWebViewSessionState.cpp no longer reads the encoded BackForwardList
> identifier.

Right.

> First, we should figure out if this is bad. Does the BackForwardList still
> get deserialized properly? It's not clear to me.

Nah, it's not bad because WebBackForwardList::restoreFromState() assigns a new identifier to the item without checking the saved one. This was done before as well, so I think we were saving the identifier in the state for nothing. Brady, correct me if I'm wrong.

> If it's not bad, we should at least stop encoding the identifier, since it's
> silly to encode something that's never decoded. To avoid the need to change
> the serialization format, we could just start encoding 0, for example, with
> a comment to indicate that it should be dropped if we ever need to bump the
> serialization format.

It should be easy to handle this change, I think.
Comment 2 Carlos Garcia Campos 2018-04-26 03:54:04 PDT
Created attachment 338868 [details]
Patch
Comment 3 EWS Watchlist 2018-04-26 03:55:54 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 4 Michael Catanzaro 2018-04-26 09:36:57 PDT
Comment on attachment 338868 [details]
Patch

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

> Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp:394
> +    GRefPtr<GVariant> variant;
> +    for (unsigned i = 0; sessionStateTypeStringVersions[i]; ++i) {
> +        sessionStateTypeString = sessionStateTypeStringVersions[i];
> +        variant = g_variant_new_from_bytes(G_VARIANT_TYPE(sessionStateTypeString), data, FALSE);
> +        if (g_variant_is_normal_form(variant.get()))
> +            break;
> +        variant = nullptr;
> +    }

You've tested this to ensure it doesn't emit a bunch of warnings or criticals when the type doesn't match?
Comment 5 Carlos Garcia Campos 2018-04-26 23:37:03 PDT
(In reply to Michael Catanzaro from comment #4)
> Comment on attachment 338868 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=338868&action=review
> 
> > Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp:394
> > +    GRefPtr<GVariant> variant;
> > +    for (unsigned i = 0; sessionStateTypeStringVersions[i]; ++i) {
> > +        sessionStateTypeString = sessionStateTypeStringVersions[i];
> > +        variant = g_variant_new_from_bytes(G_VARIANT_TYPE(sessionStateTypeString), data, FALSE);
> > +        if (g_variant_is_normal_form(variant.get()))
> > +            break;
> > +        variant = nullptr;
> > +    }
> 
> You've tested this to ensure it doesn't emit a bunch of warnings or
> criticals when the type doesn't match?

Yes, of course I tested it. My ephy history was successfully encoded with version 1 (2 is tried first) and decoded with 2.
Comment 6 Carlos Garcia Campos 2018-04-26 23:37:35 PDT
(In reply to Carlos Garcia Campos from comment #5)
> (In reply to Michael Catanzaro from comment #4)
> > Comment on attachment 338868 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=338868&action=review
> > 
> > > Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp:394
> > > +    GRefPtr<GVariant> variant;
> > > +    for (unsigned i = 0; sessionStateTypeStringVersions[i]; ++i) {
> > > +        sessionStateTypeString = sessionStateTypeStringVersions[i];
> > > +        variant = g_variant_new_from_bytes(G_VARIANT_TYPE(sessionStateTypeString), data, FALSE);
> > > +        if (g_variant_is_normal_form(variant.get()))
> > > +            break;
> > > +        variant = nullptr;
> > > +    }
> > 
> > You've tested this to ensure it doesn't emit a bunch of warnings or
> > criticals when the type doesn't match?
> 
> Yes, of course I tested it. My ephy history was successfully encoded with
> version 1 (2 is tried first) and decoded with 2.

Ok, the opposite, decoded with 1 and encoded with 2 ...
Comment 7 Carlos Garcia Campos 2018-04-27 01:41:04 PDT
Committed r231090: <https://trac.webkit.org/changeset/231090>