Add an option to set the mode while setting the editor text
Categories
(DevTools :: Debugger, task, P2)
Tracking
(Not tracked)
People
(Reporter: bomsy, Assigned: bomsy, NeedInfo)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
Currently the editor mode is set separately from the editor text, even though they are called immediately after each other.
if (selectedSource.isStyleSheet) {
await editor.setMode(SourceEditor.modes.css);
}
await editor.setText(selectedSourceTextContent.value.value, {
documentId: selectedSource.id,
});
This means that two separate transactions will be dispatched to update the editor state. The issue is that even though we expect these updates to be made to the same state snapshot, there is no guarantee as intermediate side effects might change the snapshot before the second update, leading to index shifting bugs.
To make sure the same state snapshot is updated, lets combine both into the same transaction. We can do this by allowing to define a mode when setting the editor text.
| Assignee | ||
Comment 1•1 month ago
|
||
Fixes browser_dbg-preview.js
Updated•1 month ago
|
| Assignee | ||
Updated•8 days ago
|
Comment 5•17 hours ago
|
||
Backed out for causing dt failures @ browser_dbg-editor-mode.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/5729c00d4cd86bdd209cc6eb732d2a12dd3a7f00
Description
•