Bug 140713 - [WK2] willDestroyGlobalObjectForDOMWindowExtension callback which registered in injectedBundle is not called while WebPage is being closed
Summary: [WK2] willDestroyGlobalObjectForDOMWindowExtension callback which registered ...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-20 20:07 PST by Joonghun Park
Modified: 2019-05-03 06:55 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.45 KB, patch)
2015-01-20 20:32 PST, Joonghun Park
no flags Details | Formatted Diff | Diff
Patch (2.45 KB, patch)
2015-01-20 22:13 PST, Joonghun Park
no flags Details | Formatted Diff | Diff
Patch (2.35 KB, patch)
2015-01-23 14:16 PST, Joonghun Park
no flags Details | Formatted Diff | Diff
Patch (2.35 KB, patch)
2015-01-23 14:18 PST, Joonghun Park
beidson: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joonghun Park 2015-01-20 20:07:10 PST
When using WKBundleDOMWindowExtension in InjectedBundle, willDestroyGlobalObjectForDOMWindowExtension is not called 
because InjectedBundlePageLoaderClient's initialization in WebPage::close() is called too early, namely, before setting the frame's m_view to 0;
So move initialize(0) calls to WebPage's m_*client group to the end of WebPage::close() function to correct such problems.
Comment 1 Joonghun Park 2015-01-20 20:32:52 PST
Created attachment 245044 [details]
Patch
Comment 2 Gyuyoung Kim 2015-01-20 20:56:43 PST
Comment on attachment 245044 [details]
Patch

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

This patch should be reviewed by WK2 owner.

> Source/WebKit2/ChangeLog:10
> +        So move initialize(0) calls to WebPage's m_*client group to the end of WebPage::close() function 

typo: m_*client -> m_client
Comment 3 Joonghun Park 2015-01-20 22:13:04 PST
Created attachment 245048 [details]
Patch
Comment 4 Anders Carlsson 2015-01-23 11:52:42 PST
Comment on attachment 245048 [details]
Patch

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

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1024
> +    // The WebPage can be destroyed by this call.
> +    WebProcess::shared().removeWebPage(m_pageID);

This can't be moved here - this call will destroy the WebPage object whose members are accessed later!
Comment 5 Joonghun Park 2015-01-23 14:16:11 PST
Created attachment 245246 [details]
Patch
Comment 6 Joonghun Park 2015-01-23 14:18:31 PST
Created attachment 245248 [details]
Patch
Comment 7 Joonghun Park 2015-02-28 00:03:59 PST
(In reply to comment #4)
> Comment on attachment 245048 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=245048&action=review
> 
> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1024
> > +    // The WebPage can be destroyed by this call.
> > +    WebProcess::shared().removeWebPage(m_pageID);
> 
> This can't be moved here - this call will destroy the WebPage object whose
> members are accessed later!

Could you please review the change which I revised?
Comment 8 Gyuyoung Kim 2015-10-13 22:19:38 PDT
Is this patch still valid ?
Comment 9 Darin Adler 2015-10-14 09:34:39 PDT
Hard to say, but:

1) We need a regression test for this, too, not just a bug fix.

2) There’s risk to reordering that destruction sequence, so we have to make sure we have done sufficient testing of what other effects the change has.
Comment 10 Brady Eidson 2017-04-24 19:04:57 PDT
Comment on attachment 245248 [details]
Patch

This patch has been pending review since 2015 with no recent activity.
It seems unlikely that it would even still apply to trunk in its current form.

(Also it hasn't been updated for Darin's feedback)

Clearing from the review queue.

Feel free to update and resubmit if the patch is still relevant.