WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
149733
Web Inspector: Simplify TimelineRecordBar a bit
https://bugs.webkit.org/show_bug.cgi?id=149733
Summary
Web Inspector: Simplify TimelineRecordBar a bit
Joseph Pecoraro
Reported
2015-10-01 17:08:06 PDT
Simplify TimelineRecordBar a bit. Its setter is only ever used with multiple records. Require an array instead of dynamically converting inputs.
Attachments
[PATCH] Proposed Fix
(1.31 KB, patch)
2015-10-01 17:08 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2015-10-01 17:08:45 PDT
Created
attachment 262301
[details]
[PATCH] Proposed Fix
Matt Baker
Comment 2
2015-10-01 17:17:57 PDT
Comment on
attachment 262301
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=262301&action=review
> Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js:199 > + console.assert(records instanceof Array, "records should be an array");
Should we return if !(records instance Array)? What's our policy toward this style of defensive coding? Nit: I'd format the assert message as a complete sentence: "Records should be an array."
Darin Adler
Comment 3
2015-10-06 09:16:02 PDT
Joe, are you waiting to set commit-queue+ until you think about Matt’s comment? Surprised this is still not landed.
Joseph Pecoraro
Comment 4
2015-10-06 11:27:59 PDT
Comment on
attachment 262301
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=262301&action=review
>> Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js:199 >> + console.assert(records instanceof Array, "records should be an array"); > > Should we return if !(records instance Array)? What's our policy toward this style of defensive coding? > Nit: I'd format the assert message as a complete sentence: "Records should be an array."
In this case, our policy should be to use the API correctly. Adding an assert here would just help us catch any possible outliers that I didn't see on auditing the code. Ideally this assert can be removed entirely.
Matt Baker
Comment 5
2015-10-06 11:42:30 PDT
(In reply to
comment #4
)
> Comment on
attachment 262301
[details]
> [PATCH] Proposed Fix > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=262301&action=review
> > >> Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js:199 > >> + console.assert(records instanceof Array, "records should be an array"); > > > > Should we return if !(records instance Array)? What's our policy toward this style of defensive coding? > > Nit: I'd format the assert message as a complete sentence: "Records should be an array." > > In this case, our policy should be to use the API correctly. Adding an > assert here would just help us catch any possible outliers that I didn't see > on auditing the code. Ideally this assert can be removed entirely.
So we'll continue to assert that inputs are valid to catch improper API use, but not attempt to sanitize invalid input or early return. Sounds reasonable.
WebKit Commit Bot
Comment 6
2015-10-06 12:14:16 PDT
Comment on
attachment 262301
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 262301 Committed
r190632
: <
http://trac.webkit.org/changeset/190632
>
WebKit Commit Bot
Comment 7
2015-10-06 12:14:21 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