Bug 97833

Summary: Encapsulate private properties in PerfTestRunner better
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: Tools / TestsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, arv, eric, haraken, morrita, ojan, tkent, zoltan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 97743, 97852    
Bug Blocks: 77037    
Attachments:
Description Flags
Cleanup
none
Fixed a test ojan: review+

Description Ryosuke Niwa 2012-09-27 17:23:50 PDT
Right now, "private" properties of PerfTestRunner are just regular properties prefixed with _. We can do better by enclosing everything in a closure.
Comment 1 Ryosuke Niwa 2012-09-28 14:50:03 PDT
Created attachment 166315 [details]
Cleanup
Comment 2 Ryosuke Niwa 2012-09-28 14:51:51 PDT
Created attachment 166316 [details]
Fixed a test
Comment 3 Ojan Vafai 2012-10-01 16:41:15 PDT
Comment on attachment 166316 [details]
Fixed a test

This is fine. A less fragile approach would be to wrap the whole file in an anonymous function and at the end of the function only expose the things you really want to expose, e.g.:

window.PerfTestRunner = PerfTestRunner;

That way, everything is private by default and people don't need to move code around to enable it to use a private helper function.
Comment 4 Ryosuke Niwa 2012-10-01 16:43:51 PDT
(In reply to comment #3)
> (From update of attachment 166316 [details])
> This is fine. A less fragile approach would be to wrap the whole file in an anonymous function and at the end of the function only expose the things you really want to expose, e.g.:

Yup. I'm doing that in a follow up. I'm just trying to make the diff unreadable.
Comment 5 Ryosuke Niwa 2012-10-01 16:44:02 PDT
*readable.
Comment 6 Ryosuke Niwa 2012-10-01 16:47:55 PDT
Committed r130099: <http://trac.webkit.org/changeset/130099>