Bug 96803 - Web Inspector: [Extensions API] explicitly manage extension audit progress
Summary: Web Inspector: [Extensions API] explicitly manage extension audit progress
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Kosyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-14 10:10 PDT by Andrey Kosyakov
Modified: 2012-09-18 07:54 PDT (History)
8 users (show)

See Also:


Attachments
Patch (15.61 KB, patch)
2012-09-14 10:18 PDT, Andrey Kosyakov
no flags Details | Formatted Diff | Diff
Patch (18.23 KB, patch)
2012-09-17 09:54 PDT, Andrey Kosyakov
no flags Details | Formatted Diff | Diff
Patch (18.28 KB, patch)
2012-09-18 00:41 PDT, Andrey Kosyakov
apavlov: review+
apavlov: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Kosyakov 2012-09-14 10:10:51 PDT
Currently we update extension audit progress implicitly, based on number of results added and an expected number of results declared when creating the category.
It's suggested to make progress indication explicit to the extension code.
Comment 1 Andrey Kosyakov 2012-09-14 10:18:31 PDT
Created attachment 164179 [details]
Patch
Comment 2 Pavel Feldman 2012-09-14 10:27:01 PDT
Comment on attachment 164179 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164179&action=review

Should this new API have a test?

> Source/WebCore/inspector/front-end/AuditsPanel.js:284
> +                progress.done();

Thisbshould not be needed
Comment 3 Yury Semikhatsky 2012-09-17 04:43:59 PDT
Comment on attachment 164179 [details]
Patch

r- per pfeldman's comments.
Comment 4 Andrey Kosyakov 2012-09-17 09:54:09 PDT
Created attachment 164410 [details]
Patch
Comment 5 Alexander Pavlov (apavlov) 2012-09-18 00:08:00 PDT
Comment on attachment 164410 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164410&action=review

> Source/WebCore/ChangeLog:3
> +        Web Inspector: [Extensions API] exlpicitly manage extension audit progress

Please fix this line, too

> Source/WebCore/ChangeLog:12
> +        - retain old magic for computing audit progress if extension specifies extension results count;

Remove trailing ';'

> Source/WebCore/ChangeLog:34
> +        (WebInspector.ProgressIndicator.prototype.done): Assure only first call to done() has effect;

Ditto

> Source/WebCore/inspector/front-end/AuditsPanel.js:132
> +            category.run(requests, ruleResultReadyCallback.bind(this, result), categoryDoneCallback.bind(this), subprogresses[i]);

Can you instantiate subprogresses here instead? Or do you need to always know the full amount of work up front?

> Source/WebCore/inspector/front-end/ExtensionAPI.js:514
> +            console.warn("Passing resultCouint to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.");

resultCouint -> resultCount
Comment 6 Andrey Kosyakov 2012-09-18 00:38:18 PDT
Comment on attachment 164410 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164410&action=review

>> Source/WebCore/ChangeLog:12
>> +        - retain old magic for computing audit progress if extension specifies extension results count;
> 
> Remove trailing ';'

replaced with '.'

>> Source/WebCore/inspector/front-end/AuditsPanel.js:132
>> +            category.run(requests, ruleResultReadyCallback.bind(this, result), categoryDoneCallback.bind(this), subprogresses[i]);
> 
> Can you instantiate subprogresses here instead? Or do you need to always know the full amount of work up front?

The reason I'm doing this upfront is that when all children are marked as done, the parent progress indicator is marked as done and hence is removed from view.
So this is a guard against an audit category potentially marking its progress as done very early and hence causing the entire progress bar to disappear.
I'm moving this down closer to usage, though.

>> Source/WebCore/inspector/front-end/ExtensionAPI.js:514
>> +            console.warn("Passing resultCouint to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.");
> 
> resultCouint -> resultCount

fixed
Comment 7 Andrey Kosyakov 2012-09-18 00:41:06 PDT
Created attachment 164507 [details]
Patch
Comment 8 Alexander Pavlov (apavlov) 2012-09-18 00:44:06 PDT
Comment on attachment 164507 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164507&action=review

> Source/WebCore/inspector/front-end/AuditsPanel.js:101
> +        var compositeProgress = new WebInspector.CompositeProgress(this._progress);

Please move this below, somewhere around var subprogresses = [];
Comment 9 Andrey Kosyakov 2012-09-18 04:43:09 PDT
Committed r128875: <http://trac.webkit.org/changeset/128875>
Comment 10 Raphael Kubo da Costa (:rakuco) 2012-09-18 07:17:12 PDT
I get an additional message here when running inspector/extensions/extensions-audit-api.html on EFL:

   CONSOLE MESSAGE: line 480: Passing resultCount to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.
Comment 11 Andrey Kosyakov 2012-09-18 07:34:09 PDT
(In reply to comment #10)
> I get an additional message here when running inspector/extensions/extensions-audit-api.html on EFL:
> 
>    CONSOLE MESSAGE: line 480: Passing resultCount to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.

The console message is there by design, however, the test expectations differ in EFL because other platforms just don't dump console output coming from inspector page to test output (I remember fixing this for chromium in bug 69632). So the long term fix would be to get efl's DRT changed to skip inspector console output as well, and short term would be to add custom expectations or skip the test. It looks like this test is already skipped in LayoutTests/platform/efl/Skipped, I wonder if EFL is using both NRWT and older run-webkit-test that uses Skipped?
Comment 12 Raphael Kubo da Costa (:rakuco) 2012-09-18 07:48:18 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > I get an additional message here when running inspector/extensions/extensions-audit-api.html on EFL:
> > 
> >    CONSOLE MESSAGE: line 480: Passing resultCount to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.
> 
> The console message is there by design, however, the test expectations differ in EFL because other platforms just don't dump console output coming from inspector page to test output (I remember fixing this for chromium in bug 69632). So the long term fix would be to get efl's DRT changed to skip inspector console output as well

Thanks for the information, I will work on that.

> It looks like this test is already skipped in LayoutTests/platform/efl/Skipped, I wonder if EFL is using both NRWT and older run-webkit-test that uses Skipped?

EFL uses NRWT; Skipped has extensions-api.html and extensions-audits.html, but not extensions-audit-apis.html :-)
Comment 13 Andrey Kosyakov 2012-09-18 07:54:15 PDT
(In reply to comment #12)
> EFL uses NRWT; Skipped has extensions-api.html and extensions-audits.html, but not extensions-audit-apis.html :-)

Ouch, sorry -- I missed it's extensions-audit-apis.html. Then I guess we could as well avoid using that deprecated parameter there -- it's not really required for the test and I guess it would be the must practical fix, as it would save us another Skipped test.
The problem of inspector console output, though, remains relevant for some other tests (extensions-audits.html would be one example).