WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
174703
Web Inspector: Avoid subclassing WebInspector.Object if we do not need to
https://bugs.webkit.org/show_bug.cgi?id=174703
Summary
Web Inspector: Avoid subclassing WebInspector.Object if we do not need to
Joseph Pecoraro
Reported
2017-07-20 20:08:16 PDT
Avoid subclassing WebInspector.Object if we do not need to
Attachments
[PATCH] Proposed Fix
(49.39 KB, patch)
2017-07-20 20:10 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2017-07-20 20:10:28 PDT
Created
attachment 316063
[details]
[PATCH] Proposed Fix
Joseph Pecoraro
Comment 2
2017-07-20 20:11:23 PDT
Found files with: $ ack --files-without-matches 'Event = \{' | xargs ack 'extends WebInspector\.Object\b' Then had to add back just a couple (TestHarness and HeapSnapshotWorkerProxy). I didn't modify any Views / Controllers.
Blaze Burg
Comment 3
2017-07-21 11:29:35 PDT
Comment on
attachment 316063
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=316063&action=review
Is there any particular motivation for this? Code cleanup, correctness, performance?
> Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js:26 > +WebInspector.ApplicationCacheFrame = class ApplicationCacheFrame
I guess we don't type check anywhere that the target of saveIdentityToCookie is a subclass of object?
> Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js:27 > {
Sidenote: this class needs to be cleaned up. It knows a lot of style classes for being in Models/ directory.
> Source/WebInspectorUI/UserInterface/Models/Probe.js:27 > +WebInspector.ProbeSample = class ProbeSample
r-, this class dispatches events.
Joseph Pecoraro
Comment 4
2017-07-21 11:46:14 PDT
Comment on
attachment 316063
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=316063&action=review
>> Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js:26 >> +WebInspector.ApplicationCacheFrame = class ApplicationCacheFrame > > I guess we don't type check anywhere that the target of saveIdentityToCookie is a subclass of object?
Correct, all cases of code using `instanceof WebInspector.Object\b` were in Event related code:
> Base/EventListenerSet.js > 49: var emitterIsValid = emitter && (emitter instanceof WebInspector.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function")); > > Base/EventListener.js > 44: var emitterIsValid = emitter && (emitter instanceof WebInspector.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
>> Source/WebInspectorUI/UserInterface/Models/Probe.js:27 >> +WebInspector.ProbeSample = class ProbeSample > > r-, this class dispatches events.
Where? Probe does, but I don't see where ProbeSample does. Can you point it out to me?
Joseph Pecoraro
Comment 5
2017-07-21 11:49:07 PDT
> Is there any particular motivation for this? Code cleanup, correctness, performance?
Just cleanup and clarity. Not having a `this._listeners = null` property/value on all of these objects might be a tiny memory improvement but probably not. It will make printing these objects slightly nicer in our console not having that property around.
Blaze Burg
Comment 6
2017-07-21 12:01:17 PDT
Comment on
attachment 316063
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=316063&action=review
>>> Source/WebInspectorUI/UserInterface/Models/Probe.js:27 >>> +WebInspector.ProbeSample = class ProbeSample >> >> r-, this class dispatches events. > > Where? Probe does, but I don't see where ProbeSample does. Can you point it out to me?
Oops, didn't see the second class. I recant!
WebKit Commit Bot
Comment 7
2017-07-21 12:36:44 PDT
Comment on
attachment 316063
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 316063 Committed
r219734
: <
http://trac.webkit.org/changeset/219734
>
WebKit Commit Bot
Comment 8
2017-07-21 12:36:45 PDT
All reviewed patches have been landed. Closing bug.
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