(In reply to Daisuke Akatsuka (:daisuke) from comment #2) > Hello Alex! > > I have started to work on this though, have one question. > I think one of the goal here is removing the stylesheet/stylesheets actor used so far. > As the current legacy-listener for stylesheets is using the stylesheet actor as it is as resource, first, I am thinking about avoid using the actor at the resource. > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/devtools/shared/resources/legacy-listeners/stylesheet.js#18-23 > > Then, I took a look at the actor, it seems that we can cover the following events if we use `onResourceUpdated` mechanism. > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/devtools/shared/specs/stylesheets.js#31-46 > > On the other hand, I’m thinking about how we should approach methods such as `toggleDisabled`. > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/devtools/shared/specs/stylesheets.js#48-69 > For example, adding methods to the resource, or adding an actor that is particular for inputting, or something new mechanism to edit the stylesheet etc etc.. > Do you have any ideas? The resource can still involve actors. See how we convert an actor's "form" into a front on the client side: https://searchfox.org/mozilla-central/source/devtools/shared/resources/transformers/console-messages.js You may also have a look at what we do for storage: https://phabricator.services.mozilla.com/D86570#change-nMEzqhMgn4Yx ``` const { types } = require("devtools/shared/protocol.js"); if (resourceType == ResourceWatcher.TYPES.COOKIE) { // Instantiate the front for this given storage resource = types.getType("cookies").read(resource, this.watcher); resource.resourceType = ResourceWatcher.TYPES.COOKIE; ``` (Note that such code should be in a transformer) I'm fine doing that. I imagine that's the easiest option. But we might revisit that while working on CDP. It may be better to have a new actor which would receive a `resourceId` and implement all these action methods.
Bug 1644193 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Daisuke Akatsuka (:daisuke) from comment #2) > On the other hand, I’m thinking about how we should approach methods such as `toggleDisabled`. > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/devtools/shared/specs/stylesheets.js#48-69 > For example, adding methods to the resource, or adding an actor that is particular for inputting, or something new mechanism to edit the stylesheet etc etc.. > Do you have any ideas? The resource can still involve actors. See how we convert an actor's "form" into a front on the client side: https://searchfox.org/mozilla-central/source/devtools/shared/resources/transformers/console-messages.js You may also have a look at what we do for storage: https://phabricator.services.mozilla.com/D86570#change-nMEzqhMgn4Yx ``` const { types } = require("devtools/shared/protocol.js"); if (resourceType == ResourceWatcher.TYPES.COOKIE) { // Instantiate the front for this given storage resource = types.getType("cookies").read(resource, this.watcher); resource.resourceType = ResourceWatcher.TYPES.COOKIE; ``` (Note that such code should be in a transformer) I'm fine doing that. I imagine that's the easiest option. But we might revisit that while working on CDP. It may be better to have a new actor which would receive a `resourceId` and implement all these action methods.