Bug 21412

Summary: Refactor user initiated profile count to be more stable
Product: WebKit Reporter: Kevin McCullough <kmccullough>
Component: Web Inspector (Deprecated)Assignee: Kevin McCullough <kmccullough>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Proposed patch
timothy: review-
New patch with changes timothy: review+

Description Kevin McCullough 2008-10-06 14:50:53 PDT
We increment the user initiated profile count in the Web Inspector's JS, but this causes problems as it's incremented every time we display the log message, and is only currently working by being very careful to clear messages and the count at the right time.

We should move this into the InspectorController
Comment 1 Kevin McCullough 2008-10-06 14:55:24 PDT
Created attachment 24126 [details]
Proposed patch
Comment 2 Timothy Hatcher 2008-10-06 15:06:14 PDT
Comment on attachment 24126 [details]
Proposed patch

I am not sure m_startedProfileNumber is a good name. Maybe m_runningUserInitiatedProfileNumber, m_recordingUserInitiatedProfileNumber or m_activeUserInitiatedProfileNumber?

 137         if (profile.title.indexOf(UserInitiatedProfileName) != 0) {

Use !== here.

 237         if (title.indexOf(UserInitiatedProfileName, 0) == 0) {

Use === here.

 238             title = WebInspector.UIString("Profile %d", title.substring(35));

Use UserInitiatedProfileName.length instead of the magic number.

 380     if (this.profile.title.indexOf(UserInitiatedProfileName, 0) == 0)
 381         this._profileNumber = this.profile.title.substring(35);

Same applies here: === and no magic number. Also indexOf only takes 1 argument.

 398         if (this.profile.title.indexOf(UserInitiatedProfileName, 0) == 0)

The indexOf function only takes 1 argument and use ===.

443  console.log("followLink");

r=me to remove that console.log in a separate commit.

r- for now.
Comment 3 Kevin McCullough 2008-10-06 15:25:22 PDT
Created attachment 24127 [details]
New patch with changes
Comment 4 Oliver Hunt 2008-10-06 15:29:46 PDT
Comment on attachment 24127 [details]
New patch with changes

r=me
Comment 5 Timothy Hatcher 2008-10-06 15:42:20 PDT
Comment on attachment 24127 [details]
New patch with changes

nextUserInitiatedProfileNumber should be m_ nextUserInitiatedProfileNumber.
Comment 6 Kevin McCullough 2008-10-06 16:08:38 PDT
Committed revision 37349.