Closed Bug 1798774 Opened 3 years ago Closed 2 months ago

Every keystroke is shown as a change (no special characters involved)

Categories

(DevTools :: Inspector: Changes, defect, P2)

defect

Tracking

(firefox-esr102 wontfix, firefox107 wontfix, firefox108 wontfix, firefox109 wontfix, firefox145 fixed)

RESOLVED FIXED
145 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox107 --- wontfix
firefox108 --- wontfix
firefox109 --- wontfix
firefox145 --- fixed

People

(Reporter: victoria, Assigned: nchevobbe)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files)

Related to #1590031 and #1783893

STR:

  • Go to https://k3vifk.csb.app/
  • Open inspector and select the footer of the first modal (.spotlight-modal footer)
  • Edit margin: 24px 0 0 0; by putting the cursor next to "24" and increasing the count with the up arrow key multiple times. (Bug also happens when changing the value with a number key)

Result:

  • Every change to this value is shown in Changes as opposed to only the most recent one (see screenshot)
Summary: Every keystroke is shown as a change when incrementing a value with arrow key, no special characters involved → Every keystroke is shown as a change, no special characters involved
Summary: Every keystroke is shown as a change, no special characters involved → Every keystroke is shown as a change (no special characters involved)

Similar to Bug 1783893 and Bug 1590031.
I checked back in ESR 102, before the fixes for the two bugs mentioned above landed, and this issue was already here, so not a recent regression.

Severity: -- → S3
Priority: -- → P3
See Also: → 1590031, 1783893
See Also: → 1988436
Priority: P3 → P2
Duplicate of this bug: 1988436
Flags: needinfo?(jdescottes)

Reduced test case:

  • data:text/html,<iframe src="data:text/html,1"></iframe><div style="margin: 10px 0 0 0">inspectme

This issue only happens when the test page contains an iframe. Then any update in the rule view will trigger many updates.

Flags: needinfo?(jdescottes)

Whenever a target is created, we create a "watcher" for CSSChanges which listens to events on a singleton:

https://searchfox.org/firefox-main/rev/bd4c9573f3f4304df50e943f4358a7af7688b4c0/devtools/server/actors/resources/css-changes.js#19-36

class CSSChangeWatcher {
  constructor() {
    this.onTrackChange = this.onTrackChange.bind(this);
  }

  async watch(targetActor, { onAvailable }) {
    this.onAvailable = onAvailable;
    TrackChangeEmitter.on("track-change", this.onTrackChange);
  }

  onTrackChange(change) {
    this.onAvailable([change]);
  }

  destroy() {
    TrackChangeEmitter.off("track-change", this.onTrackChange);
  }
}

So when we have several targets in the same process, we emit duplicated resources for the same change.

This updates all the call to the singleton TrackChangeEmitter trackChange method
to include a targetActor so it can then be checked against CSSChangeWatcher own
targetActor to only consume events from the same targetActor.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Attachment #9514633 - Attachment description: Bug 1798774 - [devtools] Make CSSChangeWatcher ignore track-change events from unrelated targetActor. r=#devtools. → Bug 1798774 - [devtools] Prevent sending duplicated CSS_CHANGE resources on pages with multiple documents. r=#devtools.
Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e1486392e3a4 https://hg.mozilla.org/integration/autoland/rev/7c18baea2f78 [devtools] Prevent sending duplicated CSS_CHANGE resources on pages with multiple documents. r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: