Bug 184191 - Drop MainFrame class
Summary: Drop MainFrame class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on: 186950
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-30 14:11 PDT by Chris Dumez
Modified: 2018-06-22 16:52 PDT (History)
11 users (show)

See Also:


Attachments
WIP patch (83.33 KB, patch)
2018-03-30 16:24 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP patch (94.39 KB, patch)
2018-03-30 16:47 PDT, Chris Dumez
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.34 MB, application/zip)
2018-03-30 17:45 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews115 for mac-sierra (3.11 MB, application/zip)
2018-03-30 18:32 PDT, EWS Watchlist
no flags Details
WIP Patch (200.75 KB, patch)
2018-03-31 11:44 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (233.34 KB, patch)
2018-03-31 12:05 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (235.61 KB, patch)
2018-03-31 15:30 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.15 MB, application/zip)
2018-03-31 17:48 PDT, EWS Watchlist
no flags Details
Patch (235.61 KB, patch)
2018-03-31 18:16 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-03-30 14:11:34 PDT
Drop MainFrame class and merge contents into Page since there is a 1:1 relationship between the Page and the MainFrame.

This is ground work for introducing LocalFrame / RemoteFrame concepts.
Comment 1 Chris Dumez 2018-03-30 16:24:52 PDT
Created attachment 336894 [details]
WIP patch
Comment 2 EWS Watchlist 2018-03-30 16:26:17 PDT
Attachment 336894 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:245:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 32 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2018-03-30 16:47:10 PDT
Created attachment 336896 [details]
WIP patch
Comment 4 EWS Watchlist 2018-03-30 16:48:36 PDT
Attachment 336896 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:245:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 38 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 EWS Watchlist 2018-03-30 17:45:30 PDT
Comment on attachment 336896 [details]
WIP patch

Attachment 336896 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/7153144

New failing tests:
fast/loader/unload-reload.html
Comment 6 EWS Watchlist 2018-03-30 17:45:32 PDT
Created attachment 336902 [details]
Archive of layout-test-results from ews103 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 7 EWS Watchlist 2018-03-30 18:32:54 PDT
Comment on attachment 336896 [details]
WIP patch

Attachment 336896 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/7153270

New failing tests:
fast/loader/unload-mutation-crash.html
fast/events/before-unload-remove-itself.html
fast/events/before-unload-remove-itself-async-delegate.html
Comment 8 EWS Watchlist 2018-03-30 18:32:56 PDT
Created attachment 336904 [details]
Archive of layout-test-results from ews115 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 9 Chris Dumez 2018-03-31 11:44:39 PDT
Created attachment 336928 [details]
WIP Patch
Comment 10 EWS Watchlist 2018-03-31 11:47:05 PDT
Attachment 336928 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:244:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 142 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Chris Dumez 2018-03-31 12:05:53 PDT
Created attachment 336929 [details]
Patch
Comment 12 EWS Watchlist 2018-03-31 12:10:21 PDT
Attachment 336929 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:244:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 147 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Chris Dumez 2018-03-31 15:30:46 PDT
Created attachment 336934 [details]
Patch
Comment 14 EWS Watchlist 2018-03-31 15:33:50 PDT
Attachment 336934 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:244:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 147 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 EWS Watchlist 2018-03-31 17:48:01 PDT
Comment on attachment 336934 [details]
Patch

Attachment 336934 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/7161461

New failing tests:
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
Comment 16 EWS Watchlist 2018-03-31 17:48:12 PDT
Created attachment 336938 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 17 Chris Dumez 2018-03-31 18:16:40 PDT
Created attachment 336942 [details]
Patch
Comment 18 EWS Watchlist 2018-03-31 18:20:26 PDT
Attachment 336942 [details] did not pass style-queue:


ERROR: Source/WebCore/page/Page.cpp:244:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 147 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 19 Simon Fraser (smfr) 2018-03-31 22:00:37 PDT
I wish we would rename Page.
Comment 20 Darin Adler 2018-04-01 18:32:16 PDT
I originally created MainFrame because I hoped to move state from Page to Frame to fix object lifetime problems. The MainFrame lives longer than the Page and is guaranteed to live longer than any of its subframes too. Whereas the Page can be destroyed and Frame objects will still be left behind since they are reference counted and it is not.

But it’s OK with me if you want to get rid of it. I guess we never made substantial progress on using it they way we had intended.
Comment 21 Chris Dumez 2018-04-01 19:12:41 PDT
The issue is that I need to add support for remote frames and remote windows (when they are actually in another process). So a page’s main frame can either be local or remote. My plan was to rename Frame to LocalFrame and introduce a new RemoteFrame class, both would subclass a Frame base class.

But right now, MainFrame is a subclass of Frame (soon to be LocalFrame). This is an issue given that a MainFrame can be remote when you window.open() another origin.
Comment 22 Darin Adler 2018-04-03 09:05:54 PDT
Your plan is OK with me. I wanted you to know why I created MainFrame. I am a little surprised that we want multiple classes of Frame itself. Since Frame is a constellation of classes such as FrameLoader, it seems that making Frame itself an abstract base class isn’t so powerful -- much of the behavior we want to make different is on those other objects, not the Frame object itself. It would be bad to expand Frame itself too much and make it a "god" class again. We have been working to cut it down for quite a while.
Comment 23 Chris Dumez 2018-04-03 10:35:05 PDT
(In reply to Darin Adler from comment #22)
> Your plan is OK with me. I wanted you to know why I created MainFrame. I am
> a little surprised that we want multiple classes of Frame itself. Since
> Frame is a constellation of classes such as FrameLoader, it seems that
> making Frame itself an abstract base class isn’t so powerful -- much of the
> behavior we want to make different is on those other objects, not the Frame
> object itself. It would be bad to expand Frame itself too much and make it a
> "god" class again. We have been working to cut it down for quite a while.

I do believe I will need the concept of RemoteFrame for 2 reasons:
- I need to hang my RemoteDOMWindow off something. I plan to reuse the Page but swap its main Frame to be a RemoteFrame when navigated cross origin. Then the RemoteFrame would own the RemoteDOMWindow (I do not think we need a Document when a Frame / Window is remote)
- a newly opened window has an opener and while window.opener returns a DOMWindow, an opener is really a Frame. The reason I say that is that window.opener will start returning a different DOMWindow when the opener Frame is navigated. Therefore, when a new Window is opened cross origin and has an opener, I believe I will need FrameLoader::opener to be a RemoteFrame. And we will keep this Frame’s Window with the remote process.
Comment 24 WebKit Commit Bot 2018-04-03 11:01:48 PDT
Comment on attachment 336942 [details]
Patch

Clearing flags on attachment: 336942

Committed r230211: <https://trac.webkit.org/changeset/230211>
Comment 25 WebKit Commit Bot 2018-04-03 11:01:50 PDT
All reviewed patches have been landed.  Closing bug.
Comment 26 Radar WebKit Bug Importer 2018-04-03 11:03:31 PDT
<rdar://problem/39146741>
Comment 27 Darin Adler 2018-04-04 09:02:09 PDT
Instead of the names Frame, RemoteFrame, and LocalFrame, I suggest you consider names like PossiblyRemoteFrame, RemoteFrame, and Frame.
Comment 28 Chris Dumez 2018-04-05 09:54:26 PDT
(In reply to Darin Adler from comment #27)
> Instead of the names Frame, RemoteFrame, and LocalFrame, I suggest you
> consider names like PossiblyRemoteFrame, RemoteFrame, and Frame.

Although short-term, we'll hopefully not have too many PossiblyRemoteFrames, I think that in the longer term, most frames will be possibly remote. This is why I suggested Frame, because it is shorter and I expect in the future, most of them our code will use Frame. PossiblyRemoteFrame seems very long.