Bug 1320084 - Remove project editor test files from firefox package. r=bgrins
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 04 Jan 2017 09:11:25 -0800
changeset 327964 b7495abfbb10f4f3674a4de03e4bd38f673dfbee
parent 327963 f9f9d3744d492aa998e893e8243d4d5aa3057f41
child 327965 769f1efe908d733509f9dd779c6e2b431e83ea8f
push id31160
push userphilringnalda@gmail.com
push dateThu, 05 Jan 2017 02:33:44 +0000
treeherdermozilla-central@f13abb8ba9f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1320084
milestone53.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 1320084 - Remove project editor test files from firefox package. r=bgrins MozReview-Commit-ID: FBvL2jtL2LZ
devtools/client/jar.mn
devtools/client/projecteditor/chrome/content/projecteditor-loader.js
devtools/client/projecteditor/chrome/content/projecteditor-loader.xul
devtools/client/projecteditor/chrome/content/projecteditor-test.xul
devtools/client/projecteditor/test/browser.ini
devtools/client/projecteditor/test/browser_projecteditor_immediate_destroy.js
devtools/client/projecteditor/test/head.js
devtools/client/projecteditor/test/projecteditor-test.xul
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -5,19 +5,16 @@
 devtools.jar:
 %   content devtools %content/
     content/shared/vendor/d3.js (shared/vendor/d3.js)
     content/shared/vendor/dagre-d3.js (shared/vendor/dagre-d3.js)
     content/shared/widgets/widgets.css (shared/widgets/widgets.css)
     content/shared/widgets/VariablesView.xul (shared/widgets/VariablesView.xul)
     content/projecteditor/chrome/content/projecteditor.xul (projecteditor/chrome/content/projecteditor.xul)
     content/projecteditor/lib/helpers/readdir.js (projecteditor/lib/helpers/readdir.js)
-    content/projecteditor/chrome/content/projecteditor-loader.xul (projecteditor/chrome/content/projecteditor-loader.xul)
-    content/projecteditor/chrome/content/projecteditor-test.xul (projecteditor/chrome/content/projecteditor-test.xul)
-    content/projecteditor/chrome/content/projecteditor-loader.js (projecteditor/chrome/content/projecteditor-loader.js)
     content/netmonitor/netmonitor.xul (netmonitor/netmonitor.xul)
     content/netmonitor/netmonitor.js (netmonitor/netmonitor.js)
     content/webconsole/webconsole.xul (webconsole/webconsole.xul)
 *   content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul)
     content/scratchpad/scratchpad.js (scratchpad/scratchpad.js)
     content/shared/splitview.css (shared/splitview.css)
     content/shared/theme-switching.js (shared/theme-switching.js)
     content/shared/frame-script-utils.js (shared/frame-script-utils.js)
deleted file mode 100644
--- a/devtools/client/projecteditor/chrome/content/projecteditor-loader.js
+++ /dev/null
@@ -1,176 +0,0 @@
-var Cu = Components.utils;
-const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
-const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {});
-const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-const promise = require("promise");
-const ProjectEditor = require("devtools/client/projecteditor/lib/projecteditor");
-
-const SAMPLE_PATH = buildTempDirectoryStructure();
-const SAMPLE_NAME = "DevTools Content Application Name";
-const SAMPLE_PROJECT_URL = "data:text/html;charset=utf-8,<body><h1>Project Overview</h1></body>";
-const SAMPLE_ICON = "chrome://devtools/skin/images/tool-debugger.svg";
-
-/**
- * Create a workspace for working on projecteditor, available at
- * chrome://devtools/content/projecteditor/chrome/content/projecteditor-loader.xul.
- * This emulates the integration points that the app manager uses.
- */
-var appManagerEditor;
-
-// Log a message to the project overview URL to make development easier
-function log(msg) {
-  if (!appManagerEditor) {
-    return;
-  }
-
-  let doc = appManagerEditor.iframe.contentDocument;
-  let el = doc.createElement("p");
-  el.textContent = msg;
-  doc.body.appendChild(el);
-}
-
-document.addEventListener("DOMContentLoaded", function onDOMReady(e) {
-  document.removeEventListener("DOMContentLoaded", onDOMReady, false);
-  let iframe = document.getElementById("projecteditor-iframe");
-  window.projecteditor = ProjectEditor.ProjectEditor(iframe);
-
-  projecteditor.on("onEditorCreated", (editor, a) => {
-    log("editor created: " + editor);
-    if (editor.label === "app-manager") {
-      appManagerEditor = editor;
-      appManagerEditor.on("load", function foo() {
-        appManagerEditor.off("load", foo);
-        log("Working on: " + SAMPLE_PATH);
-      });
-    }
-  });
-  projecteditor.on("onEditorDestroyed", (editor) => {
-    log("editor destroyed: " + editor);
-  });
-  projecteditor.on("onEditorSave", (editor, resource) => {
-    log("editor saved: " + editor, resource.path);
-  });
-  projecteditor.on("onTreeSelected", (resource) => {
-    log("tree selected: " + resource.path);
-  });
-  projecteditor.on("onEditorLoad", (editor) => {
-    log("editor loaded: " + editor);
-  });
-  projecteditor.on("onEditorActivated", (editor) => {
-    log("editor focused: " + editor);
-  });
-  projecteditor.on("onEditorDeactivated", (editor) => {
-    log("editor blur: " + editor);
-  });
-  projecteditor.on("onEditorChange", (editor) => {
-    log("editor changed: " + editor);
-  });
-  projecteditor.on("onCommand", (cmd) => {
-    log("Command: " + cmd);
-  });
-
-  projecteditor.loaded.then(() => {
-    projecteditor.setProjectToAppPath(SAMPLE_PATH, {
-      name: SAMPLE_NAME,
-      iconUrl: SAMPLE_ICON,
-      projectOverviewURL: SAMPLE_PROJECT_URL,
-      validationStatus: "valid"
-    }).then(() => {
-      let allResources = projecteditor.project.allResources();
-      console.log("All resources have been loaded", allResources, allResources.map(r=>r.basename).join("|"));
-    });
-
-  });
-
-}, false);
-
-/**
- * Build a temporary directory as a workspace for this loader
- * https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O
- */
-function buildTempDirectoryStructure() {
-
-  // First create (and remove) the temp dir to discard any changes
-  let TEMP_DIR = FileUtils.getDir("TmpD", ["ProjectEditor"], true);
-  TEMP_DIR.remove(true);
-
-  // Now rebuild our fake project.
-  TEMP_DIR = FileUtils.getDir("TmpD", ["ProjectEditor"], true);
-
-  FileUtils.getDir("TmpD", ["ProjectEditor", "css"], true);
-  FileUtils.getDir("TmpD", ["ProjectEditor", "data"], true);
-  FileUtils.getDir("TmpD", ["ProjectEditor", "img", "icons"], true);
-  FileUtils.getDir("TmpD", ["ProjectEditor", "js"], true);
-
-  let htmlFile = FileUtils.getFile("TmpD", ["ProjectEditor", "index.html"]);
-  htmlFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  writeToFile(htmlFile, [
-    "<!DOCTYPE html>",
-    '<html lang="en">',
-    " <head>",
-    '   <meta charset="utf-8" />',
-    "   <title>ProjectEditor Temp File</title>",
-    '   <link rel="stylesheet" href="style.css" />',
-    " </head>",
-    ' <body id="home">',
-    "   <p>ProjectEditor Temp File</p>",
-    " </body>",
-    "</html>"].join("\n")
-  );
-
-  let readmeFile = FileUtils.getFile("TmpD", ["ProjectEditor", "README.md"]);
-  readmeFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  writeToFile(readmeFile, [
-    "## Readme"
-  ].join("\n")
-  );
-
-  let licenseFile = FileUtils.getFile("TmpD", ["ProjectEditor", "LICENSE"]);
-  licenseFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  writeToFile(licenseFile, [
-    "/* 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/. */"
-  ].join("\n")
-  );
-
-  let cssFile = FileUtils.getFile("TmpD", ["ProjectEditor", "css", "styles.css"]);
-  cssFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  writeToFile(cssFile, [
-    "body {",
-    " background: red;",
-    "}"
-  ].join("\n")
-  );
-
-  FileUtils.getFile("TmpD", ["ProjectEditor", "js", "script.js"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-
-  FileUtils.getFile("TmpD", ["ProjectEditor", "img", "fake.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "16x16.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "32x32.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "128x128.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-  FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "vector.svg"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-
-  return TEMP_DIR.path;
-}
-
-
-// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O#Writing_to_a_file
-function writeToFile(file, data) {
-
-  let defer = promise.defer();
-  var ostream = FileUtils.openSafeFileOutputStream(file);
-
-  var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
-                  createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
-  converter.charset = "UTF-8";
-  var istream = converter.convertToInputStream(data);
-
-  // The last argument (the callback) is optional.
-  NetUtil.asyncCopy(istream, ostream, function (status) {
-    if (!Components.isSuccessCode(status)) {
-      // Handle error!
-      console.log("ERROR WRITING TEMP FILE", status);
-    }
-  });
-}
deleted file mode 100644
--- a/devtools/client/projecteditor/chrome/content/projecteditor-loader.xul
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-<!DOCTYPE window [
-<!ENTITY % toolboxDTD SYSTEM "chrome://devtools/locale/toolbox.dtd" >
- %toolboxDTD;
-]>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<script type="application/javascript;version=1.8" src="projecteditor-loader.js"></script>
-
-  <commandset id="toolbox-commandset">
-    <command id="projecteditor-cmd-close" oncommand="window.close();"/>
-  </commandset>
-
-  <keyset id="projecteditor-keyset">
-    <key id="projecteditor-key-close"
-         key="&closeCmd.key;"
-         command="projecteditor-cmd-close"
-         modifiers="accel"/>
-  </keyset>
-
-  <iframe id="projecteditor-iframe" flex="1" forceOwnRefreshDriver=""></iframe>
-</window>
--- a/devtools/client/projecteditor/test/browser.ini
+++ b/devtools/client/projecteditor/test/browser.ini
@@ -1,15 +1,16 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   head.js
   helper_homepage.html
   helper_edits.js
+  projecteditor-test.xul
 
 [browser_projecteditor_app_options.js]
 [browser_projecteditor_confirm_unsaved.js]
 [browser_projecteditor_contextmenu_01.js]
 [browser_projecteditor_contextmenu_02.js]
 skip-if = true # Bug 1173950
 [browser_projecteditor_delete_file.js]
 skip-if = e10s # Frequent failures in e10s - Bug 1020027
--- a/devtools/client/projecteditor/test/browser_projecteditor_immediate_destroy.js
+++ b/devtools/client/projecteditor/test/browser_projecteditor_immediate_destroy.js
@@ -12,17 +12,17 @@ thisTestLeaksUncaughtRejectionsAndShould
 thisTestLeaksUncaughtRejectionsAndShouldBeFixed("TypeError: this.window is null");
 
 // Test that projecteditor can be destroyed in various states of loading
 // without causing any leaks or exceptions.
 
 add_task(function* () {
 
   info("Testing tab closure when projecteditor is in various states");
-  let loaderUrl = "chrome://devtools/content/projecteditor/chrome/content/projecteditor-test.xul";
+  let loaderUrl = "chrome://mochitests/content/browser/devtools/client/projecteditor/test/projecteditor-test.xul";
 
   yield addTab(loaderUrl).then(() => {
     let iframe = content.document.getElementById("projecteditor-iframe");
     ok(iframe, "Tab has placeholder iframe for projecteditor");
 
     info("Closing the tab without doing anything");
     gBrowser.removeCurrentTab();
   });
--- a/devtools/client/projecteditor/test/head.js
+++ b/devtools/client/projecteditor/test/head.js
@@ -104,17 +104,17 @@ function addProjectEditorTabForTempDirec
   return addProjectEditorTab(opts).then((projecteditor) => {
     return projecteditor.setProjectToAppPath(TEMP_PATH, customOpts).then(() => {
       return projecteditor;
     });
   });
 }
 
 function addProjectEditorTab(opts = {}) {
-  return addTab("chrome://devtools/content/projecteditor/chrome/content/projecteditor-test.xul").then(() => {
+  return addTab("chrome://mochitests/content/browser/devtools/client/projecteditor/test/projecteditor-test.xul").then(() => {
     let iframe = content.document.getElementById("projecteditor-iframe");
     if (opts.menubar !== false) {
       opts.menubar = content.document.querySelector("menubar");
     }
     let projecteditor = ProjectEditor.ProjectEditor(iframe, opts);
 
 
     ok(iframe, "Tab has placeholder iframe for projecteditor");
rename from devtools/client/projecteditor/chrome/content/projecteditor-test.xul
rename to devtools/client/projecteditor/test/projecteditor-test.xul