Bug 21412 - Refactor user initiated profile count to be more stable
Summary: Refactor user initiated profile count to be more stable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Kevin McCullough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-06 14:50 PDT by Kevin McCullough
Modified: 2008-10-06 16:08 PDT (History)
0 users

See Also:


Attachments
Proposed patch (7.25 KB, patch)
2008-10-06 14:55 PDT, Kevin McCullough
timothy: review-
Details | Formatted Diff | Diff
New patch with changes (6.71 KB, patch)
2008-10-06 15:25 PDT, Kevin McCullough
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.