Bug 164678 - Web Inspector: Should be able to display a name for a Worker
Summary: Web Inspector: Should be able to display a name for a Worker
Status: RESOLVED DUPLICATE of bug 211244
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
Keywords: InRadar
Depends on: 188779
  Show dependency treegraph
Reported: 2016-11-11 23:53 PST by Joseph Pecoraro
Modified: 2020-05-04 11:43 PDT (History)
14 users (show)

See Also:

[PATCH] Proposed Fix (50.92 KB, patch)
2016-11-14 21:48 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[IMAGE] Named Workers (165.09 KB, image/png)
2016-11-14 21:49 PST, Joseph Pecoraro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-11-11 23:53:19 PST
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.
Comment 1 Radar WebKit Bug Importer 2016-11-11 23:56:02 PST
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:

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 ***