SourceEditor PREF_CMNEXT_ENABLED should be tool specific
Categories
(DevTools :: Source Editor, defect)
Tracking
(firefox152 fixed)
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: bomsy)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
If devtools.webconsole.codemirrorNext is set to true, if I open the Inspector and click on a stylesheet location, nothing happens, and I'm seeing the following error in the browser toolbox:
TypeError: sourceEditor.setSelection is not a function
load resource://devtools/client/styleeditor/StyleSheetEditor.sys.mjs:541
showSummaryEditor resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1813
setActiveSummary resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1793
summaryPromise resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1156
promise callback*#selectEditor resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1151
#sourceLoaded resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1065
#addStyleSheetEditor resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:750
promise resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:576
#addStyleSheet resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:577
#handleStyleSheetResource resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:1637
initialize resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs:194
open resource://devtools/client/styleeditor/panel.js:48
onLoad resource://devtools/client/framework/toolbox.js:2866
That's because in the source editor, we check devtools.webconsole.codemirrorNext to see if cm6 should be enabled https://searchfox.org/firefox-main/rev/0ae2fcae6a70566ab9e13e401480387b34911bad/devtools/client/shared/sourceeditor/editor.js#105
const PREF_CMNEXT_ENABLED = "devtools.webconsole.codemirrorNext";
// Since Editor is a thin layer over CodeMirror some methods
// are mapped directly—without any changes.
if (!Services.prefs.getBoolPref(PREF_CMNEXT_ENABLED)) {
CM_MAPPING.forEach(name => {
Editor.prototype[name] = function (...args) {
const cm = editors.get(this);
return cm[name].apply(cm, args);
};
});
}
so here, when opening the Style Editor, we'll miss those mapping, but the Style Editor is only working with cm5, so that's causing problems.
We should rather try to use this.config.cm6 to apply those mapping
| Reporter | ||
Updated•1 month ago
|
| Assignee | ||
Comment 2•1 month ago
|
||
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
These mapped CM5 methods should not be called for CM6, but lets add a check to makes sure we do not attempt to lookup on the CM6 codemirror instance.
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 5•1 month ago
|
||
| bugherder | ||
Updated•10 days ago
|
Description
•