Bug 1544623 - Tolerate missing CodeMirror, r=jlast.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 15 Apr 2019 14:27:15 -1000
changeset 469752 0f3a9d72b563
parent 469751 bc06cd47cbc1
child 469753 7a56f4bec684
push id35881
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 09:38:58 +0000
treeherdermozilla-central@bbca68b2af26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1544623
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544623 - Tolerate missing CodeMirror, r=jlast. Differential Revision: https://phabricator.services.mozilla.com/D27630
devtools/client/debugger/src/utils/editor/index.js
devtools/client/shared/sourceeditor/editor.js
--- a/devtools/client/debugger/src/utils/editor/index.js
+++ b/devtools/client/debugger/src/utils/editor/index.js
@@ -32,17 +32,17 @@ export function getEditor() {
   return editor;
 }
 
 export function removeEditor() {
   editor = null;
 }
 
 function getCodeMirror() {
-  return editor && editor.codeMirror;
+  return editor && editor.hasCodeMirror ? editor.codeMirror : null;
 }
 
 export function startOperation() {
   const codeMirror = getCodeMirror();
   if (!codeMirror) {
     return;
   }
 
--- a/devtools/client/shared/sourceeditor/editor.js
+++ b/devtools/client/shared/sourceeditor/editor.js
@@ -258,16 +258,23 @@ Editor.prototype = {
         "CodeMirror instance does not exist. You must wait " +
           "for it to be appended to the DOM."
       );
     }
     return editors.get(this);
   },
 
   /**
+   * Return whether there is a CodeMirror instance associated with this Editor.
+   */
+  get hasCodeMirror() {
+    return editors.has(this);
+  },
+
+  /**
    * Appends the current Editor instance to the element specified by
    * 'el'. You can also provide your own iframe to host the editor as
    * an optional second parameter. This method actually creates and
    * loads CodeMirror and all its dependencies.
    *
    * This method is asynchronous and returns a promise.
    */
   appendTo: function(el, env) {