Bug 88050 - InternalSettings should write back its settings before owning frame is detached
Summary: InternalSettings should write back its settings before owning frame is detached
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hajime Morrita
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-01 00:04 PDT by Hajime Morrita
Modified: 2013-01-14 17:47 PST (History)
3 users (show)

See Also:


Attachments
Patch (2.23 KB, patch)
2012-06-01 00:49 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
Patch (2.33 KB, patch)
2012-06-01 01:15 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hajime Morrita 2012-06-01 00:04:45 PDT
We need to hook frame lifetime to make sure the settings coming back to the original value.
Comment 1 Hajime Morrita 2012-06-01 00:49:36 PDT
Created attachment 145232 [details]
Patch
Comment 2 Kent Tamura 2012-06-01 01:04:27 PDT
Comment on attachment 145232 [details]
Patch

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

> Source/WebCore/testing/InternalSettings.cpp:115
> +    if (Page* page = m_frame->page())
> +        restoreTo(page->settings());

nit: We have InternalsSettings::settings().
  if (Settings* settings = settings())
      restoreTo(settings);

BTW, is it always ok to restore the settings? For example,
1. An internals object is created for the main frame. (Inernals-A)
2. A test HTML contains an iframe.
3. The iframe is loaded.  An internals object for the iframe content is created (Internals-B). The current page settings are saved.
4. Internals-A changes some settings.
5. The iframe is deleted.
6. Internals-B::willDetachPage() is called. The settings saved in step 3 are restored.
  -> The setting change by Internals is lost.

> Source/WebCore/testing/InternalSettings.h:50
> +    virtual void willDetachPage() OVERRIDE;

Should FrameDestructionObserver::willDetach be pure virtual?
Comment 3 Hajime Morrita 2012-06-01 01:15:54 PDT
Created attachment 145236 [details]
Patch
Comment 4 Hajime Morrita 2012-06-01 01:18:21 PDT
(In reply to comment #2)
> (From update of attachment 145232 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=145232&action=review
> 
> > Source/WebCore/testing/InternalSettings.cpp:115
> > +    if (Page* page = m_frame->page())
> > +        restoreTo(page->settings());
> 
> nit: We have InternalsSettings::settings().
Yeah, let me use it.

>   if (Settings* settings = settings())
>       restoreTo(settings);
> 
> BTW, is it always ok to restore the settings? For example,
> 1. An internals object is created for the main frame. (Inernals-A)
> 2. A test HTML contains an iframe.
> 3. The iframe is loaded.  An internals object for the iframe content is created (Internals-B). The current page settings are saved.
> 4. Internals-A changes some settings.
> 5. The iframe is deleted.
> 6. Internals-B::willDetachPage() is called. The settings saved in step 3 are restored.
>   -> The setting change by Internals is lost.
Good point. Update patch limited the restore operation only for main frames.

> 
> > Source/WebCore/testing/InternalSettings.h:50
> > +    virtual void willDetachPage() OVERRIDE;
> 
> Should FrameDestructionObserver::willDetach be pure virtual?
Hmm sounds verbose since only a few actually implement it.
The updated patch let subclass call super class instead.
Comment 5 Kent Tamura 2012-06-01 01:21:39 PDT
Comment on attachment 145236 [details]
Patch

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

> Source/WebCore/testing/InternalSettings.cpp:118
> +    if (Page* page = m_frame->page()) {
> +        if (page->mainFrame() == m_frame)
> +            restoreTo(settings());
> +    }
> +

If an Internals object for a sub-frame changes a setting, it won't be reset, right?
Comment 6 Alexey Proskuryakov 2012-06-02 00:07:35 PDT
Is this part of bug 87993?

I think that you're on the right track overall, however it would be even better to start getting rid of any frame references in InternalSettings, because settings are per-page, and don't really have anything to do with frames.
Comment 7 Kent Tamura 2012-06-03 22:49:10 PDT
We shouldn't make multiple InternalSettings objects in one Page.
Comment 8 Hajime Morrita 2012-06-04 03:31:09 PDT
(In reply to comment #6)
> Is this part of bug 87993?
> 
> I think that you're on the right track overall, however it would be even better to start getting rid of any frame references in InternalSettings, because settings are per-page, and don't really have anything to do with frames.
Right. I wasn't aware of Bug 87993. But these are related.
And making IntenalSettings per-Page sounds right direction.

> We shouldn't make multiple InternalSettings objects in one Page.
Yeah, we currently don't have good place to do this. But we could have.

Lee me thing.
Maybe I should start from Bug 87933 and come back here after that.
Comment 9 Tony Chang 2013-01-14 15:14:41 PST
Does this bug still exist? Since InternalSettings' lifetime is the same as Page, I don't think this is a problem.
Comment 10 Hajime Morrita 2013-01-14 17:47:38 PST
Right. closing.