Bug 232699 - Web Inspector: sync changes to settings across instances
Summary: Web Inspector: sync changes to settings across instances
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-04 00:02 PDT by Devin Rousso
Modified: 2021-11-10 23:03 PST (History)
3 users (show)

See Also:


Attachments
[Patch] WIP (66.24 KB, patch)
2021-11-04 01:49 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2021-11-04 00:02:09 PDT
.
Comment 1 Devin Rousso 2021-11-04 01:49:25 PDT
Created attachment 443285 [details]
[Patch] WIP

Now that `BroadcastChannel` exists, I figured I'd give this a shot as it's something I've always wanted to try :)

Having used it briefly, however, I'm a bit conflicted.

On one hand, there definitely is something super awesome about things just magically syncing between Web Inspector instances (e.g. adding a JS breakpoint in one will make it appear (assuming you're inspecting the same page) in the other).  If not everything it would at least be nice to have more general UI things sync (e.g. Appearance, indentation style, etc.).

On the other hand, having Web Inspector instances be (mostly) isolated means that you can do different things in each while they're both simultaneously open.  As an example, when debugging two versions of the same site (e.g. the server sends back different content depending on some state) it may actually be incorrect to sync things like breakpoints as the contents of resources with the same `objectIdentifier` may not be the same (note that `objectIdentifier` is intended to be a way of uniquely identifying something within a specific Web Inspector, not globally).

Regardless, there are still some kinks to work out in this
- figure out how to guarantee that `WI.FrontendSynchronizer.close();` is called, no matter how Web Inspector is closed
- make sure all `WI.Setting` actually listen for changes (e.g. `_bootstrapScriptEnabledSetting`)
- write some tests (will likely have to be an API test as I don't think LayoutTests allow for multiple pages/inspectors)
- confirm that no extra work is being done if there are no other Web Inspector frontends to talk to
- audit the codepaths surrounding each usage of `WI.FrontendSynchronizer` to really make sure that there's no re-entrancy or infinite ping-pong (`BroadcastChannel` is only supposed to send a `"message"` to _other_ instances, but if they then turn around and send it right back then we're in a bit of a pickle)
Comment 2 Radar WebKit Bug Importer 2021-11-10 23:03:19 PST
<rdar://problem/85286040>