Bug 95752

Summary: Web Inspector: Fix inconsistencies in NetworkUISourceCodeProvider implementation.
Product: WebKit Reporter: Vsevolod Vlasov <vsevik>
Component: Web Inspector (Deprecated)Assignee: Vsevolod Vlasov <vsevik>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch apavlov: review+

Description Vsevolod Vlasov 2012-09-04 08:32:40 PDT
NetworkUISourceCodeProvider should not receive ResourceAdded event until resource was finished.
StyleSourceMapping should listen for workspace event instead of being called directly by NetworkUISourceCodeProvider.
ProjectDidReset event should be introduced instead of setTimeout hacks in mappings.

Patch to follow.
Comment 1 Vsevolod Vlasov 2012-09-04 09:39:56 PDT
Created attachment 162053 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-09-05 23:45:28 PDT
Comment on attachment 162053 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        NetworkUISourceCodeProvider does not receive ResourceAdded event until resource was finished anymore.

was -> is (or "has been")

> Source/WebCore/ChangeLog:9
> +        StyleSourceMapping now listens for workspace event instead of being called directly by NetworkUISourceCodeProvider.

StylesSourceMapping

> Source/WebCore/ChangeLog:10
> +        StyleSourceMapping is now created from inspector.js.

ditto

> Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js:72
> +            var uiSourceCode = new WebInspector.StyleSource(resource);

Duplicate "var uiSourceCode" declaration

> Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js:75
> +            var uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, resource, false);

ditto

> Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js:78
> +            var uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, resource, true);

You can unify the two cases by using "resource.type === WebInspector.resourceTypes.Script" as the last argument

> LayoutTests/inspector/debugger/network-uisourcecode-provider.html:10
> +    var lastResouceId = 0;

Let's fix the name while we are here - "lastResourceId".

> LayoutTests/inspector/debugger/script-snippet-model.html:8
> +setTimeout(InspectorTest.completeTest.bind(InspectorTest), 1000);

???

> LayoutTests/inspector/debugger/script-snippet-model.html:36
> +                InspectorTest.assertEquals(workspace.uiSourceCodes().length, 1, "Only one snippet uiSourceCode should be present after project navigation.");

(expected, found, message)
Comment 3 Vsevolod Vlasov 2012-09-05 23:55:33 PDT
Created attachment 162429 [details]
Patch
Comment 4 Vsevolod Vlasov 2012-09-06 00:40:38 PDT
Committed r127705: <http://trac.webkit.org/changeset/127705>