Bug 1292592 - remove xul dependency in sourceeditor draft
authorFred Lin <gasolin@mozilla.com>
Tue, 30 Aug 2016 10:52:31 +0800
changeset 409148 e84e8907390a0e64a21f18a6f4922a4378460ff3
parent 409147 8fdff7ffdcee621fec75557a8e95eefc78624f9d
child 530281 8b1153d4cad37fd861c88755bca27474e357a6ee
push id28403
push userbmo:gasolin@mozilla.com
push dateFri, 02 Sep 2016 09:05:40 +0000
bugs1292592
milestone51.0a1
Bug 1292592 - remove xul dependency in sourceeditor MozReview-Commit-ID: CXCVlrRAm7F
devtools/client/jar.mn
devtools/client/shared/theme-switching.js
devtools/client/sourceeditor/codemirror/addon/comment/moz.build
devtools/client/sourceeditor/codemirror/addon/dialog/moz.build
devtools/client/sourceeditor/codemirror/addon/edit/moz.build
devtools/client/sourceeditor/codemirror/addon/fold/moz.build
devtools/client/sourceeditor/codemirror/addon/moz.build
devtools/client/sourceeditor/codemirror/addon/search/moz.build
devtools/client/sourceeditor/codemirror/addon/selection/moz.build
devtools/client/sourceeditor/codemirror/keymap/moz.build
devtools/client/sourceeditor/codemirror/lib/moz.build
devtools/client/sourceeditor/codemirror/mode/moz.build
devtools/client/sourceeditor/codemirror/moz.build
devtools/client/sourceeditor/editor.html
devtools/client/sourceeditor/editor.js
devtools/client/sourceeditor/moz.build
devtools/client/sourceeditor/test/codemirror/codemirror.html
devtools/client/sourceeditor/test/codemirror/vimemacs.html
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -26,16 +26,17 @@ devtools.jar:
     content/styleeditor/styleeditor.xul (styleeditor/styleeditor.xul)
     content/storage/storage.xul (storage/storage.xul)
     content/inspector/fonts/fonts.js (inspector/fonts/fonts.js)
     content/inspector/layout/layout.js (inspector/layout/layout.js)
     content/inspector/markup/markup.xhtml (inspector/markup/markup.xhtml)
     content/animationinspector/animation-controller.js (animationinspector/animation-controller.js)
     content/animationinspector/animation-panel.js (animationinspector/animation-panel.js)
     content/animationinspector/animation-inspector.xhtml (animationinspector/animation-inspector.xhtml)
+    content/sourceeditor/editor.html (sourceeditor/editor.html)
     content/sourceeditor/codemirror/addon/comment/comment.js (sourceeditor/codemirror/addon/comment/comment.js)
     content/sourceeditor/codemirror/addon/edit/trailingspace.js (sourceeditor/codemirror/addon/edit/trailingspace.js)
     content/sourceeditor/codemirror/addon/edit/matchbrackets.js (sourceeditor/codemirror/addon/edit/matchbrackets.js)
     content/sourceeditor/codemirror/addon/edit/closebrackets.js (sourceeditor/codemirror/addon/edit/closebrackets.js)
     content/sourceeditor/codemirror/addon/dialog/dialog.js (sourceeditor/codemirror/addon/dialog/dialog.js)
     content/sourceeditor/codemirror/addon/dialog/dialog.css (sourceeditor/codemirror/addon/dialog/dialog.css)
     content/sourceeditor/codemirror/addon/fold/foldcode.js (sourceeditor/codemirror/addon/fold/foldcode.js)
     content/sourceeditor/codemirror/addon/fold/brace-fold.js (sourceeditor/codemirror/addon/fold/brace-fold.js)
--- a/devtools/client/shared/theme-switching.js
+++ b/devtools/client/shared/theme-switching.js
@@ -1,23 +1,28 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* eslint-env browser */
 "use strict";
 (function () {
+  const { utils: Cu } = Components;
+  const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
+  const Services = require("Services");
+  const { gDevTools } = require("devtools/client/framework/devtools");
+  const { watchCSS } = require("devtools/client/shared/css-reload");
   const SCROLLBARS_URL = "chrome://devtools/skin/floating-scrollbars-dark-theme.css";
   let documentElement = document.documentElement;
 
   let os;
   let platform = navigator.platform;
   if (platform.startsWith("Win")) {
     os = "win";
-  } else if (platform.startsWith("Mac")) {
+  } else if(platform.startsWith("Mac")) {
     os = "mac";
   } else {
     os = "linux";
   }
 
   documentElement.setAttribute("platform", os);
 
   // no-theme attributes allows to just est the platform attribute
@@ -105,29 +110,29 @@
 
     let loadEvents = [];
     for (let url of newThemeDef.stylesheets) {
       let {styleSheet, loadPromise} = appendStyleSheet(url);
       devtoolsStyleSheets.get(newThemeDef).push(styleSheet);
       loadEvents.push(loadPromise);
     }
 
-    // Floating scroll-bars like in OSX
-    let hiddenDOMWindow = Cc["@mozilla.org/appshell/appShellService;1"]
-                 .getService(Ci.nsIAppShellService)
-                 .hiddenDOMWindow;
-
-    // TODO: extensions might want to customize scrollbar styles too.
-    if (!hiddenDOMWindow.matchMedia("(-moz-overlay-scrollbars)").matches) {
-      if (newTheme == "dark") {
-        StylesheetUtils.loadSheet(window, SCROLLBARS_URL, "agent");
-      } else if (oldTheme == "dark") {
-        StylesheetUtils.removeSheet(window, SCROLLBARS_URL, "agent");
+    try {
+      const StylesheetUtils = require("sdk/stylesheet/utils");
+      // TODO: extensions might want to customize scrollbar styles too.
+      if (!Services.appShell.hiddenDOMWindow.matchMedia("(-moz-overlay-scrollbars)").matches) {
+        if (newTheme == "dark") {
+          StylesheetUtils.loadSheet(window, SCROLLBARS_URL, "agent");
+        } else if (oldTheme == "dark") {
+          StylesheetUtils.removeSheet(window, SCROLLBARS_URL, "agent");
+        }
+        forceStyle();
       }
-      forceStyle();
+    } catch(e) {
+      console.warn("customize scrollbar styles is only supported in firefox");
     }
 
     Promise.all(loadEvents).then(() => {
       // Unload all stylesheets and classes from the old theme.
       if (oldThemeDef) {
         for (let name of oldThemeDef.classList) {
           documentElement.classList.remove(name);
         }
@@ -157,23 +162,16 @@
   }
 
   function handlePrefChange(event, data) {
     if (data.pref == "devtools.theme") {
       switchTheme(data.newValue, data.oldValue);
     }
   }
 
-  const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-  const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
-  const Services = require("Services");
-  const { gDevTools } = require("devtools/client/framework/devtools");
-  const StylesheetUtils = require("sdk/stylesheet/utils");
-  const { watchCSS } = require("devtools/client/shared/css-reload");
-
   if (documentElement.hasAttribute("force-theme")) {
     switchTheme(documentElement.getAttribute("force-theme"));
   } else {
     switchTheme(Services.prefs.getCharPref("devtools.theme"));
 
     gDevTools.on("pref-changed", handlePrefChange);
     window.addEventListener("unload", function () {
       gDevTools.off("pref-changed", handlePrefChange);
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/comment/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'comment.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/dialog/moz.build
@@ -0,0 +1,10 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'dialog.css',
+    'dialog.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/edit/moz.build
@@ -0,0 +1,11 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'closebrackets.js',
+    'matchbrackets.js',
+    'trailingspace.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/fold/moz.build
@@ -0,0 +1,13 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'brace-fold.js',
+    'comment-fold.js',
+    'foldcode.js',
+    'foldgutter.js',
+    'xml-fold.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/moz.build
@@ -0,0 +1,14 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += [
+    'comment',
+    'dialog',
+    'edit',
+    'fold',
+    'search',
+    'selection'
+]
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/search/moz.build
@@ -0,0 +1,10 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'search.js',
+    'searchcursor.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/addon/selection/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'active-line.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/keymap/moz.build
@@ -0,0 +1,11 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'emacs.js',
+    'sublime.js',
+    'vim.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/lib/moz.build
@@ -0,0 +1,10 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'codemirror.css',
+    'codemirror.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/mode/moz.build
@@ -0,0 +1,14 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'clike.js',
+    'css.js',
+    'htmlmixed.js',
+    'javascript.js',
+    'wasm.js',
+    'xml.js'
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/codemirror/moz.build
@@ -0,0 +1,16 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += [
+    'addon',
+    'keymap',
+    'lib',
+    'mode'
+]
+
+DevToolsModules(
+    'mozilla.css',
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/sourceeditor/editor.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html dir='ltr'>
+  <head>
+    <style>
+      html, body { height: 100%; }
+      body { margin: 0; overflow: hidden; }
+      .CodeMirror {
+        width: 100%;
+        height: 100% !important;
+        line-height: 1.25 !important;
+      }
+    </style>
+    <link href="codemirror/lib/codemirror.css" rel="stylesheet">
+    <link href="codemirror/addon/dialog/dialog.css" rel="stylesheet">
+    <link href="codemirror/mozilla.css" rel="stylesheet">
+    <script src="resource://devtools/client/shared/theme-switching.js"></script>
+    <script src="codemirror/lib/codemirror.js"></script>
+    <script src="codemirror/addon/dialog/dialog.js"></script>
+    <script src="codemirror/addon/search/searchcursor.js"></script>
+    <script src="codemirror/addon/search/search.js"></script>
+    <script src="codemirror/addon/edit/matchbrackets.js"></script>
+    <script src="codemirror/addon/edit/closebrackets.js"></script>
+    <script src="codemirror/addon/comment/comment.js"></script>
+    <script src="codemirror/mode/javascript.js"></script>
+    <script src="codemirror/mode/xml.js"></script>
+    <script src="codemirror/mode/css.js"></script>
+    <script src="codemirror/mode/htmlmixed.js"></script>
+    <script src="codemirror/mode/clike.js"></script>
+    <script src="codemirror/mode/wasm.js"></script>
+    <script src="codemirror/addon/selection/active-line.js"></script>
+    <script src="codemirror/addon/edit/trailingspace.js"></script>
+    <script src="codemirror/keymap/emacs.js"></script>
+    <script src="codemirror/keymap/vim.js"></script>
+    <script src="codemirror/keymap/sublime.js"></script>
+    <script src="codemirror/addon/fold/foldcode.js"></script>
+    <script src="codemirror/addon/fold/brace-fold.js"></script>
+    <script src="codemirror/addon/fold/comment-fold.js"></script>
+    <script src="codemirror/addon/fold/xml-fold.js"></script>
+    <script src="codemirror/addon/fold/foldgutter.js"></script>
+  </head>
+  <body class='theme-body devtools-monospace'></body>
+</html>
--- a/devtools/client/sourceeditor/editor.js
+++ b/devtools/client/sourceeditor/editor.js
@@ -12,17 +12,16 @@ const {
   DETECT_INDENT,
   getIndentationFromIteration
 } = require("devtools/shared/indentation");
 
 const ENABLE_CODE_FOLDING = "devtools.editor.enableCodeFolding";
 const KEYMAP = "devtools.editor.keymap";
 const AUTO_CLOSE = "devtools.editor.autoclosebrackets";
 const AUTOCOMPLETE = "devtools.editor.autocomplete";
-const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const VALID_KEYMAPS = new Set(["emacs", "vim", "sublime"]);
 
 // Maximum allowed margin (in number of lines) from top or bottom of the editor
 // while shifting to a line which was initially out of view.
 const MAX_VERTICAL_OFFSET = 3;
 
 // Match @Scratchpad/N:LINE[:COLUMN] or (LINE[:COLUMN]) anywhere at an end of
 // line in text selection.
@@ -35,67 +34,18 @@ const events = require("devtools/shared/
 const { PrefObserver } = require("devtools/client/styleeditor/utils");
 const { getClientCssProperties } = require("devtools/shared/fronts/css-properties");
 
 const {LocalizationHelper} = require("devtools/shared/l10n");
 const L10N = new LocalizationHelper("devtools/locale/sourceeditor.properties");
 
 const { OS } = Services.appinfo;
 
-// CM_STYLES, CM_SCRIPTS and CM_IFRAME represent the HTML,
-// JavaScript and CSS that is injected into an iframe in
-// order to initialize a CodeMirror instance.
-
-const CM_STYLES = [
-  "chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css",
-  "chrome://devtools/content/sourceeditor/codemirror/mozilla.css"
-];
-
-const CM_SCRIPTS = [
-  "chrome://devtools/content/shared/theme-switching.js",
-  "chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/search/searchcursor.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/search/search.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/edit/matchbrackets.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/edit/closebrackets.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/comment/comment.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/javascript.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/xml.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/css.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/htmlmixed.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/clike.js",
-  "chrome://devtools/content/sourceeditor/codemirror/mode/wasm.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/selection/active-line.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/edit/trailingspace.js",
-  "chrome://devtools/content/sourceeditor/codemirror/keymap/emacs.js",
-  "chrome://devtools/content/sourceeditor/codemirror/keymap/vim.js",
-  "chrome://devtools/content/sourceeditor/codemirror/keymap/sublime.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/fold/foldcode.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/fold/brace-fold.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/fold/comment-fold.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/fold/xml-fold.js",
-  "chrome://devtools/content/sourceeditor/codemirror/addon/fold/foldgutter.js"
-];
-
-const CM_IFRAME =
-  "data:text/html;charset=utf8,<!DOCTYPE html>" +
-  "<html dir='ltr'>" +
-  "  <head>" +
-  "    <style>" +
-  "      html, body { height: 100%; }" +
-  "      body { margin: 0; overflow: hidden; }" +
-  "      .CodeMirror { width: 100%; height: 100% !important; " +
-  "line-height: 1.25 !important;}" +
-  "    </style>" +
-  CM_STYLES.map(style => "<link rel='stylesheet' href='" + style + "'>").join("\n") +
-  "  </head>" +
-  "  <body class='theme-body devtools-monospace'></body>" +
-  "</html>";
+// CM_IFRAME represent the HTML embeded in iframe
+const CM_IFRAME = "chrome://devtools/content/sourceeditor/editor.html";
 
 const CM_MAPPING = [
   "focus",
   "hasFocus",
   "lineCount",
   "somethingSelected",
   "getCursor",
   "setSelection",
@@ -260,42 +210,46 @@ Editor.prototype = {
    *
    * This method is asynchronous and returns a promise.
    */
   appendTo: function (el, env) {
     let def = promise.defer();
     let cm = editors.get(this);
 
     if (!env) {
-      env = el.ownerDocument.createElementNS(XUL_NS, "iframe");
+      env = el.ownerDocument.createElement("iframe");
     }
 
     env.flex = 1;
 
     if (cm) {
       throw new Error("You can append an editor only once.");
     }
 
     let onLoad = () => {
       // Once the iframe is loaded, we can inject CodeMirror
       // and its dependencies into its DOM.
 
       env.removeEventListener("load", onLoad, true);
-      let win = env.contentWindow.wrappedJSObject;
+      let win = env.contentWindow;
 
       if (!this.config.themeSwitching) {
         win.document.documentElement.setAttribute("force-theme", "light");
       }
 
-      let scriptsToInject = CM_SCRIPTS.concat(this.config.externalScripts);
-      scriptsToInject.forEach(url => {
-        if (url.startsWith("chrome://")) {
-          Services.scriptloader.loadSubScript(url, win, "utf8");
-        }
-      });
+      let scriptsToInject = this.config.externalScripts;
+      try {
+        scriptsToInject.forEach(url => {
+          if (url.startsWith("chrome://")) {
+            Services.scriptloader.loadSubScript(url, win.wrappedJSObject, "utf8");
+          }
+        });
+      } catch(e) {
+        console.warn("loading externalScripts is only supported in firefox");
+      }
       // Replace the propertyKeywords, colorKeywords and valueKeywords
       // properties of the CSS MIME type with the values provided by the CSS properties
       // database.
 
       const {
         propertyKeywords,
         colorKeywords,
         valueKeywords
--- a/devtools/client/sourceeditor/moz.build
+++ b/devtools/client/sourceeditor/moz.build
@@ -1,18 +1,20 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
+    'codemirror',
     'tern',
 ]
 
 DevToolsModules(
     'autocomplete.js',
     'css-autocompleter.js',
     'debugger.js',
+    'editor.html',
     'editor.js'
 )
 
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
--- a/devtools/client/sourceeditor/test/codemirror/codemirror.html
+++ b/devtools/client/sourceeditor/test/codemirror/codemirror.html
@@ -1,26 +1,26 @@
 <!doctype html>
 <html>
   <head>
     <meta charset="utf-8">
     <title>CodeMirror: Basic Tests</title>
-    <link rel="stylesheet" href="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css">
+    <link rel="stylesheet" href="resource://devtools/client/sourceeditor/codemirror/lib/codemirror.css">
     <link rel="stylesheet" href="cm_mode_test.css">
     <!--<link rel="stylesheet" href="../doc/docs.css">-->
 
-    <script src="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/search/searchcursor.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/edit/matchbrackets.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/comment/comment.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/mode/javascript.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/vim.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/emacs.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/sublime.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/lib/codemirror.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/search/searchcursor.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/dialog/dialog.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/edit/matchbrackets.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/comment/comment.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/mode/javascript.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/vim.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/emacs.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/sublime.js"></script>
 
     <!--<script src="../addon/mode/overlay.js"></script>
     <script src="../addon/mode/multiplex.js"></script>
     <script src="../mode/xml/xml.js"></script>-->
 
     <style type="text/css">
       .ok {color: #090;}
       .fail {color: #e00;}
--- a/devtools/client/sourceeditor/test/codemirror/vimemacs.html
+++ b/devtools/client/sourceeditor/test/codemirror/vimemacs.html
@@ -1,26 +1,26 @@
 <!doctype html>
 <html>
   <head>
     <meta charset="utf-8">
     <title>CodeMirror: VIM/Emacs tests</title>
-    <link rel="stylesheet" href="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css">
+    <link rel="stylesheet" href="resource://devtools/client/sourceeditor/codemirror/lib/codemirror.css">
     <link rel="stylesheet" href="cm_mode_test.css">
     <!--<link rel="stylesheet" href="../doc/docs.css">-->
 
-    <script src="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/search/searchcursor.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/edit/matchbrackets.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/addon/comment/comment.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/mode/javascript.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/vim.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/sublime.js"></script>
-    <script src="chrome://devtools/content/sourceeditor/codemirror/keymap/emacs.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/lib/codemirror.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/search/searchcursor.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/dialog/dialog.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/edit/matchbrackets.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/addon/comment/comment.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/mode/javascript.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/vim.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/sublime.js"></script>
+    <script src="resource://devtools/client/sourceeditor/codemirror/keymap/emacs.js"></script>
 
     <!--<script src="../addon/mode/overlay.js"></script>
     <script src="../addon/mode/multiplex.js"></script>
     <script src="../mode/xml/xml.js"></script>-->
 
     <style type="text/css">
       .ok {color: #090;}
       .fail {color: #e00;}