WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
184591
Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
https://bugs.webkit.org/show_bug.cgi?id=184591
Summary
Split WindowProxy handling out of ScriptController and into a new class owned...
Chris Dumez
Reported
2018-04-13 09:10:38 PDT
Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame. RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
Attachments
Patch
(44.20 KB, patch)
2018-04-13 10:11 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(44.47 KB, patch)
2018-04-13 10:29 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(44.89 KB, patch)
2018-04-13 11:11 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(44.85 KB, patch)
2018-04-13 11:57 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(45.85 KB, patch)
2018-04-13 12:04 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2018-04-13 10:11:23 PDT
Created
attachment 337903
[details]
Patch
Chris Dumez
Comment 2
2018-04-13 10:29:12 PDT
Created
attachment 337905
[details]
Patch
Chris Dumez
Comment 3
2018-04-13 11:11:29 PDT
Created
attachment 337909
[details]
Patch
Sam Weinig
Comment 4
2018-04-13 11:43:56 PDT
Comment on
attachment 337909
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=337909&action=review
> Source/WebCore/bindings/js/DOMWrapperWorld.h:64 > + HashSet<WindowProxyController*> m_controllersWithWindowProxies;
I think this can just be called m_windowProxyControllers.
> Source/WebCore/bindings/js/JSDOMWindowBase.cpp:270 > - return frame.script().windowProxy(world)->window(); > + return frame.script().globalObject(world);
Why globalObject() and not window() here?
> Source/WebCore/bindings/js/JSDOMWindowProxy.cpp:127 > JSDOMWindowProxy* toJSDOMWindowProxy(Frame& frame, DOMWrapperWorld& world) > { > - return frame.script().windowProxy(world); > + return &frame.windowProxyController().windowProxy(world); > }
Can we switch this function to return a reference since this will never return null? Or,
> Source/WebCore/bindings/js/WindowProxyController.h:41 > + Vector<JSC::Strong<JSDOMWindowProxy>> windowProxiesAsVector() const;
Do all the places that use windowProxiesAsVector() really need to copy to a Vector?
Chris Dumez
Comment 5
2018-04-13 11:55:14 PDT
Comment on
attachment 337909
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=337909&action=review
>> Source/WebCore/bindings/js/DOMWrapperWorld.h:64 >> + HashSet<WindowProxyController*> m_controllersWithWindowProxies; > > I think this can just be called m_windowProxyControllers.
Ok.
>> Source/WebCore/bindings/js/JSDOMWindowBase.cpp:270 >> + return frame.script().globalObject(world); > > Why globalObject() and not window() here?
This is identical but shorter since ScriptController::globalObject() is implemented as: JSDOMWindow* globalObject(DOMWrapperWorld& world) { return windowProxyController().windowProxy(world).window(); } Once benefit also is that in the next patch, JSDOMWindowProxy::window() will start returning a more generic type, which ScriptController::globalObject() can keep returning a JSDOMWindow* since it is associated with a (local) Frame.
>> Source/WebCore/bindings/js/JSDOMWindowProxy.cpp:127 >> } > > Can we switch this function to return a reference since this will never return null? Or,
I will look into it, I was trying to limit patch size.
>> Source/WebCore/bindings/js/WindowProxyController.h:41 >> + Vector<JSC::Strong<JSDOMWindowProxy>> windowProxiesAsVector() const; > > Do all the places that use windowProxiesAsVector() really need to copy to a Vector?
Some of them definitely do and this maintain pre-existing behavior. I am trying to reduce the risk of regression from my refactoring by maintaining pre-existing behavior as much as possible.
Chris Dumez
Comment 6
2018-04-13 11:57:55 PDT
Created
attachment 337915
[details]
Patch
Chris Dumez
Comment 7
2018-04-13 12:04:09 PDT
Created
attachment 337916
[details]
Patch
Sam Weinig
Comment 8
2018-04-13 13:43:55 PDT
Comment on
attachment 337916
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=337916&action=review
> Source/WebCore/bindings/js/WindowProxyController.h:41 > + Vector<JSC::Strong<JSDOMWindowProxy>> windowProxiesAsVector() const;
I kind of feel this function should have the word "copy" somewhere in its name, but I can't think of one that isn't overly verbose.
> Source/WebCore/bindings/js/WindowProxyController.h:43 > + ProxyMap releaseWindowProxies() { return std::exchange(m_windowProxies, ProxyMap()); }
Does anyone call this?
> Source/WebCore/bindings/js/WindowProxyController.h:44 > + void setWindowProxies(ProxyMap&& windowProxies) { m_windowProxies = WTFMove(windowProxies); }
Does anyone call this?
Chris Dumez
Comment 9
2018-04-13 13:47:53 PDT
Comment on
attachment 337916
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=337916&action=review
>> Source/WebCore/bindings/js/WindowProxyController.h:41 >> + Vector<JSC::Strong<JSDOMWindowProxy>> windowProxiesAsVector() const; > > I kind of feel this function should have the word "copy" somewhere in its name, but I can't think of one that isn't overly verbose.
copyWindowProxies() ?
>> Source/WebCore/bindings/js/WindowProxyController.h:43 >> + ProxyMap releaseWindowProxies() { return std::exchange(m_windowProxies, ProxyMap()); } > > Does anyone call this?
The next patch.
>> Source/WebCore/bindings/js/WindowProxyController.h:44 >> + void setWindowProxies(ProxyMap&& windowProxies) { m_windowProxies = WTFMove(windowProxies); } > > Does anyone call this?
The next patch.
WebKit Commit Bot
Comment 10
2018-04-13 14:24:00 PDT
Comment on
attachment 337916
[details]
Patch Clearing flags on attachment: 337916 Committed
r230643
: <
https://trac.webkit.org/changeset/230643
>
WebKit Commit Bot
Comment 11
2018-04-13 14:24:02 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12
2018-04-15 15:33:22 PDT
<
rdar://problem/39444728
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug