Track Changes - warn the user when a stylesheet is replaced
Categories
(DevTools :: Inspector: Changes, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: rcaliman, Unassigned)
References
(Blocks 1 open bug)
Details
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
•
|
||
For hot-reloading, one way to approach this is to add a listener in the Changes actor for the "stylesheet-added" event fired by the target actor.
In the handler, we check the StyleSheetActor's href against any of the source hrefs already collected in the this.changes
array in the Changes actor.
If there's a match, it means one of the stylesheets we've previously collected changes for has been reloaded (perhaps by a hot reloading script). We should then fire an event from the Changes actor to notify the client, devtools/client/inspector/changes/ChangesView.js.
On the client we can listen to this new event and show a warning that the collected changes may no longer be accurate due to the stylesheet reload and prompt the user to copy their changes before continuing (at their own risk) or refreshing the page.
For covering the Style Editor use case (the whole stylesheet content gets replaced when the user edits), we need to react to the "style-applied" event on the StyleSheetActor when the kind
argument is UPDATE_GENERAL
.
Reporter | ||
Updated•6 years ago
|
hey can this be assigned to me? started working on it.
Reporter | ||
Comment 3•5 years ago
|
||
Hi v.yathan,
This isn't really a good-first-bug to start working on if you don't have experience with DevTools.
I can assign it to you, but be warned, you'll be going deep into the code and have to understand the server-side Actor structure and Actor<-->Front communication flow. Are you really sure you want to start with this?
Hi rcaliman,
we are actually doing this as part of our course CSCD01 at University of Toronto Scarborough, with a group of 4.
we have worked on a couple bugs already, just didn't get them all processed to get merged in. (the actual pull request doesn't affect our marks, just the completion of the fix on our side)
so if its alright I would like it assigned to me, and I can let you know, if we have any problems with it.
Thanks,
Yathan Vidyananthan
Reporter | ||
Comment 5•5 years ago
|
||
Ok Yathan,
I will assign this to you. Aside from the explanations in comment #1, the DevTools documentation about the backend and clinet-server communication protocol will be useful.
Let me know when you need guidance.
We have gotten the changes.js listener to emit and event to changesview.js but the changesview.js file is not picking up the event. We are using this.emit("changed-sheet"); to emit the event within changes.js and listening for it in changesview.js but it doesn't seem to be picking it up. Any ideas why?
Reporter | ||
Comment 7•5 years ago
|
||
Hi Yathan,
The server (Actor) communicates to the client (Front) via a predefined protocol. If you introduce new events or methods on the server that need to be exposed to the front, you will also need to update the corresponding Spec.
In your case, you have to define the new "changed-sheet" event in https://searchfox.org/mozilla-central/source/devtools/shared/specs/changes.js
An in-depth example is in the "Writing Actors With protocol.js" chapter of the docs.
Reporter | ||
Comment 8•5 years ago
|
||
Hi, how are you doing on this feature? Do you need help continuing?
Reporter | ||
Comment 9•5 years ago
|
||
No answer from contributor for 1 month, unassigning this bug.
Reporter | ||
Updated•4 years ago
|
Updated•2 years ago
|
Description
•