Bug 164678

Summary: Web Inspector: Should be able to display a name for a Worker
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cdumez, commit-queue, eoconnor, esprehn+autocc, hi, inspector-bugzilla-changes, joepeck, keith_miller, kondapallykalyan, mark.lam, msaboff, rniwa, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=172016
https://bugs.webkit.org/show_bug.cgi?id=188779
Bug Depends on: 188779    
Bug Blocks:    
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[IMAGE] Named Workers none

Description Joseph Pecoraro 2016-11-11 23:53:19 PST
Summary:
Should be able to display a name for a Worker

Websites may spawn multiple workers with the same URL but use them for different purposes. It would be nice to name the Worker, such as setting a `name` or `displayName` property on the Worker object from the Page.

    var worker1 = new Worker("worker.js")
    worker1.name = "Foo Worker";

    var worker2 = new Worker("worker.js");
    worker2.name = "Bar Worker";

This could be similar to the `displayName` convention debuggers use with functions.
http://www.alertdebugging.com/2009/04/29/building-a-better-javascript-profiler-with-webkit/
Comment 1 Radar WebKit Bug Importer 2016-11-11 23:56:02 PST
<rdar://problem/29233008>
Comment 2 Joseph Pecoraro 2016-11-14 21:48:40 PST
Created attachment 294810 [details]
[PATCH] Proposed Fix

This adds a `attribute DOMString name;` to Worker.idl. I'll have to discuss how/if we should go about standardizing this.
Comment 3 Joseph Pecoraro 2016-11-14 21:49:20 PST
Created attachment 294811 [details]
[IMAGE] Named Workers

Sidebar shows Named and Unnamed workers (defaults to a display name for the URL).
Comment 4 Joseph Pecoraro 2016-11-15 18:49:17 PST
Comment on attachment 294810 [details]
[PATCH] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js:175
> +    _nameUpdated(event)
> +    {
> +        this._updateTitles();
> +    }

When this happens we need to resort this among its siblings.

Also if Thread Line Indicators land this patch would need to be updated to update those.
Comment 5 Joseph Pecoraro 2016-12-09 16:14:08 PST
Going to clear the review on the until we go through some standardization process.

I'm also going to break out useful parts of this (Like moving WorkerTarget and MainTarget into their own file) as cleanup now, because I liked it and I've been missing it!
Comment 6 Joseph Pecoraro 2017-05-11 20:24:11 PDT
Looks like this made standardization progress:
https://github.com/whatwg/html/issues/2477
https://github.com/whatwg/html/pull/2664#issuecomment-300692176

Solution was a name property on an options dictionary:

    var worker = new Worker("worker.js", {name: "Foo Worker"});

I think it also sets the `self.name` within the Worker scope.

    assert( self.name === "Foo Worker" );

So, I should be able to move forward with this.
Comment 7 Devin Rousso 2020-05-04 11:39:00 PDT

*** This bug has been marked as a duplicate of bug 211244 ***
Comment 8 Joseph Pecoraro 2020-05-04 11:43:34 PDT
(In reply to Devin Rousso from comment #7)
> 
> *** This bug has been marked as a duplicate of bug 211244 ***

\o/