diff --git a/addon-sdk/Makefile.in b/addon-sdk/Makefile.in index 841a8a67c20c..f5d610991f17 100644 --- a/addon-sdk/Makefile.in +++ b/addon-sdk/Makefile.in @@ -18,7 +18,7 @@ sinclude $(topsrcdir)/config/rules.mk # This can switch to just zipping the files when native jetpacks land $(TESTADDONS)/%.xpi: FORCE $(call mkdir_deps,$(CURDIR)/$(TESTADDONS)) $(ADDONSRC)/% - $(PYTHON) $(srcdir)/source/bin/cfx xpi --pkgdir=$(lastword $^) --output-file=$@ + $(PYTHON) $(srcdir)/source/bin/cfx xpi --no-strip-xpi --pkgdir=$(lastword $^) --output-file=$@ #libs:: $(ADDONS) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 767abffab051..152fd2c190ad 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + @@ -134,10 +134,10 @@ - + - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index fe3ae517fdac..149f6972377e 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b5625ff256dc..a4b0a49b3d64 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d5d74c094049..e9e24457b85b 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 38acddcc7e09..5f7922987343 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index fe3ae517fdac..149f6972377e 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 4b1e940614b9..595641e59ede 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index c8313c95c3db..95190e086480 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index be1f9d10232e..26e66934deeb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "943c8b4039f59b08ba100390e164a076a20c892e", + "git_revision": "2b87ee8e7e2ec30a9851b6b59a899006a98767ab", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "c8f9d4bbb0ab4ddfb272c0ee955e640b9d122b54", + "revision": "a3f060d46f5e179164fe9435f30878ebdf58eb49", "repo_path": "integration/gaia-central" } diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index bae58fecbafb..c75828674f89 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 2503143a7c99..835fad350620 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 6cd5197d449c..419adde1f6fd 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1461,6 +1461,8 @@ pref("devtools.profiler.ui.show-platform-data", false); pref("devtools.profiler.ui.show-idle-blocks", true); // The default Performance UI settings +pref("devtools.performance.memory.sample-probability", "0.05"); +pref("devtools.performance.memory.max-log-length", 2147483647); // Math.pow(2,31) - 1 pref("devtools.performance.timeline.hidden-markers", "[]"); pref("devtools.performance.ui.invert-call-tree", true); pref("devtools.performance.ui.invert-flame-graph", false); diff --git a/browser/components/readinglist/test/xpcshell/test_scheduler.js b/browser/components/readinglist/test/xpcshell/test_scheduler.js index bb258a4720d2..8b2eb0333669 100644 --- a/browser/components/readinglist/test/xpcshell/test_scheduler.js +++ b/browser/components/readinglist/test/xpcshell/test_scheduler.js @@ -30,7 +30,7 @@ function createScheduler(options) { // avoid typos in the test and other footguns in the options. let allowedOptions = ["expectedDelay", "expectNewTimer", "syncFunction"]; for (let key of Object.keys(options)) { - if (!allowedOptions.includes(key)) { + if (allowedOptions.indexOf(key) == -1) { throw new Error("Invalid option " + key); } } diff --git a/browser/devtools/performance/modules/front.js b/browser/devtools/performance/modules/front.js index c28d3743f422..108f0421612c 100644 --- a/browser/devtools/performance/modules/front.js +++ b/browser/devtools/performance/modules/front.js @@ -329,7 +329,7 @@ PerformanceFront.prototype = { return 0; } yield this._request("memory", "attach"); - let memoryStartTime = yield this._request("memory", "startRecordingAllocations"); + let memoryStartTime = yield this._request("memory", "startRecordingAllocations", options); yield this._pullAllocationSites(); return memoryStartTime; }), diff --git a/browser/devtools/performance/performance-controller.js b/browser/devtools/performance/performance-controller.js index 2d5c667a5ea7..2a2e3113b651 100644 --- a/browser/devtools/performance/performance-controller.js +++ b/browser/devtools/performance/performance-controller.js @@ -182,7 +182,9 @@ let PerformanceController = { // ToolbarView, so that they may be accessible via the "gear" menu. // Every other pref should be registered here. this._nonBooleanPrefs = new ViewHelpers.Prefs("devtools.performance", { - "hidden-markers": ["Json", "timeline.hidden-markers"] + "hidden-markers": ["Json", "timeline.hidden-markers"], + "memory-sample-probability": ["Float", "memory.sample-probability"], + "memory-max-log-length": ["Int", "memory.max-log-length"] }); this._nonBooleanPrefs.registerObserver(); @@ -262,11 +264,13 @@ let PerformanceController = { let withMemory = this.getOption("enable-memory"); let withTicks = this.getOption("enable-framerate"); let withAllocations = this.getOption("enable-memory"); + let probability = this.getPref("memory-sample-probability"); + let maxLogLength = this.getPref("memory-max-log-length"); - let recording = this._createRecording({ withMemory, withTicks, withAllocations }); + let recording = this._createRecording({ withMemory, withTicks, withAllocations, probability, maxLogLength }); this.emit(EVENTS.RECORDING_WILL_START, recording); - yield recording.startRecording({ withTicks, withMemory, withAllocations }); + yield recording.startRecording({ withMemory, withTicks, withAllocations, probability, maxLogLength }); this.emit(EVENTS.RECORDING_STARTED, recording); this.setCurrentRecording(recording); diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini index 95e62ea65628..38a647845c42 100644 --- a/browser/devtools/performance/test/browser.ini +++ b/browser/devtools/performance/test/browser.ini @@ -54,6 +54,7 @@ support-files = [browser_perf-options-enable-memory-01.js] [browser_perf-options-enable-memory-02.js] [browser_perf-options-enable-framerate.js] +[browser_perf-options-allocations.js] [browser_perf-overview-render-01.js] [browser_perf-overview-render-02.js] [browser_perf-overview-render-03.js] diff --git a/browser/devtools/performance/test/browser_perf-options-allocations.js b/browser/devtools/performance/test/browser_perf-options-allocations.js new file mode 100644 index 000000000000..713493c53e07 --- /dev/null +++ b/browser/devtools/performance/test/browser_perf-options-allocations.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + + +/** + * Tests that setting the `devtools.performance.memory.` prefs propagate to the memory actor. + */ +function spawnTest () { + let { panel } = yield initPerformance(SIMPLE_URL); + let { EVENTS, PerformanceController, $, gFront } = panel.panelWin; + Services.prefs.setBoolPref(MEMORY_PREF, true); + + let originalProbability = Services.prefs.getCharPref("devtools.performance.memory.sample-probability"); + let originalLogLength = Services.prefs.getIntPref("devtools.performance.memory.max-log-length"); + + Services.prefs.setCharPref("devtools.performance.memory.sample-probability", "0.213"); + Services.prefs.setIntPref("devtools.performance.memory.max-log-length", 777777); + + yield startRecording(panel); + + let { probability, maxLogLength } = yield gFront._request("memory", "getAllocationsSettings"); + + yield stopRecording(panel); + + is(probability, 0.213, "allocations probability option is set on memory actor"); + is(maxLogLength, 777777, "allocations max log length option is set on memory actor"); + + Services.prefs.setBoolPref(MEMORY_PREF, false); + Services.prefs.setCharPref("devtools.performance.memory.sample-probability", originalProbability); + Services.prefs.setIntPref("devtools.performance.memory.max-log-length", originalLogLength); + yield teardown(panel); + finish(); +} diff --git a/browser/devtools/shared/test/browser.ini b/browser/devtools/shared/test/browser.ini index 096238c21858..89cf5dd3b671 100644 --- a/browser/devtools/shared/test/browser.ini +++ b/browser/devtools/shared/test/browser.ini @@ -58,7 +58,8 @@ skip-if = e10s # Layouthelpers test should not run in a content page. [browser_options-view-01.js] [browser_outputparser.js] skip-if = e10s # Test intermittently fails with e10s. Bug 1124162. -[browser_prefs.js] +[browser_prefs-01.js] +[browser_prefs-02.js] [browser_require_basic.js] [browser_spectrum.js] [browser_theme.js] diff --git a/browser/devtools/shared/test/browser_prefs.js b/browser/devtools/shared/test/browser_prefs-01.js similarity index 100% rename from browser/devtools/shared/test/browser_prefs.js rename to browser/devtools/shared/test/browser_prefs-01.js diff --git a/browser/devtools/shared/test/browser_prefs-02.js b/browser/devtools/shared/test/browser_prefs-02.js new file mode 100644 index 000000000000..0099aa959032 --- /dev/null +++ b/browser/devtools/shared/test/browser_prefs-02.js @@ -0,0 +1,39 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that ViewHelpers.Prefs work properly with custom types of Float and Json. + +let {ViewHelpers} = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {}); + +function test() { + let originalJson = Services.prefs.getCharPref("devtools.performance.timeline.hidden-markers"); + let originalFloat = Services.prefs.getCharPref("devtools.performance.memory.sample-probability"); + + let Prefs = new ViewHelpers.Prefs("devtools.performance", { + "float": ["Float", "memory.sample-probability"], + "json": ["Json", "timeline.hidden-markers"] + }); + + Prefs.registerObserver(); + + // Float + Services.prefs.setCharPref("devtools.performance.timeline.hidden-markers", "{\"a\":1}"); + is(Prefs.json.a, 1, "The JSON pref value is correctly casted on get."); + + Prefs.json = { b: 2 }; + is(Prefs.json.a, undefined, "The JSON pref value is correctly casted on set (1)."); + is(Prefs.json.b, 2, "The JSON pref value is correctly casted on set (2)."); + + // Float + Services.prefs.setCharPref("devtools.performance.memory.sample-probability", "3.14"); + is(Prefs.float, 3.14, "The float pref value is correctly casted on get."); + + Prefs.float = 6.28; + is(Prefs.float, 6.28, "The float pref value is correctly casted on set."); + + Prefs.unregisterObserver(); + + Services.prefs.setCharPref("devtools.performance.timeline.hidden-markers", originalJson); + Services.prefs.setCharPref("devtools.performance.memory.sample-probability", originalFloat); + finish(); +} diff --git a/browser/devtools/shared/timeline/marker-details.js b/browser/devtools/shared/timeline/marker-details.js index 8fbdc9f232a0..235a5825f93e 100644 --- a/browser/devtools/shared/timeline/marker-details.js +++ b/browser/devtools/shared/timeline/marker-details.js @@ -187,6 +187,7 @@ MarkerDetails.prototype = { if (displayName) { let functionLabel = this._document.createElement("label"); + functionLabel.className = "devtools-monospace"; functionLabel.setAttribute("value", displayName); hbox.appendChild(functionLabel); } diff --git a/browser/devtools/shared/widgets/ViewHelpers.jsm b/browser/devtools/shared/widgets/ViewHelpers.jsm index 9d19563a6ea3..8cd990b6215d 100644 --- a/browser/devtools/shared/widgets/ViewHelpers.jsm +++ b/browser/devtools/shared/widgets/ViewHelpers.jsm @@ -390,7 +390,8 @@ ViewHelpers.L10N.prototype = { * let prefs = new ViewHelpers.Prefs("root.path.to.branch", { * myIntPref: ["Int", "leaf.path.to.my-int-pref"], * myCharPref: ["Char", "leaf.path.to.my-char-pref"], - * myJsonPref: ["Json", "leaf.path.to.my-json-pref"] + * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], + * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] * ... * }); * @@ -477,8 +478,8 @@ ViewHelpers.Prefs.prototype = { /** * Maps a property name to a pref, defining lazy getters and setters. - * Supported types are "Bool", "Char", "Int" and "Json" (which is basically - * just sugar for "Char" using the standard JSON serializer). + * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" type and casting), + * and "Json" (which is basically just sugar for "Char" using the standard JSON serializer). * * @param string aAccessorName * @param string aType @@ -494,6 +495,10 @@ ViewHelpers.Prefs.prototype = { this._map(aAccessorName, "Char", aPrefsRoot, aPrefName, { in: JSON.parse, out: JSON.stringify }); return; } + if (aType == "Float") { + this._map(aAccessorName, "Char", aPrefsRoot, aPrefName, { in: Number.parseFloat, out: (n) => n + ""}); + return; + } Object.defineProperty(this, aAccessorName, { get: () => aSerializer.in(this._get(aType, aPrefsRoot, aPrefName)), diff --git a/browser/devtools/webide/content/jar.mn b/browser/devtools/webide/content/jar.mn index 2f7c45eeb35f..37d46612300b 100644 --- a/browser/devtools/webide/content/jar.mn +++ b/browser/devtools/webide/content/jar.mn @@ -28,3 +28,6 @@ webide.jar: content/wifi-auth.xhtml (wifi-auth.xhtml) content/logs.xhtml (logs.xhtml) content/logs.js (logs.js) + content/project-listing.xhtml (project-listing.xhtml) + content/project-listing.js (project-listing.js) + content/project-panel.js (project-panel.js) diff --git a/browser/devtools/webide/content/project-listing.js b/browser/devtools/webide/content/project-listing.js new file mode 100644 index 000000000000..76828c77f072 --- /dev/null +++ b/browser/devtools/webide/content/project-listing.js @@ -0,0 +1,49 @@ +/* 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/. */ + +const Cu = Components.utils; +const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; +const {AppManager} = require("devtools/webide/app-manager"); +const ProjectList = require("devtools/webide/project-list"); + +let projectList = new ProjectList(window, window.parent); + +window.addEventListener("load", function onLoad() { + window.removeEventListener("load", onLoad); + AppManager.on("app-manager-update", onAppManagerUpdate); + document.getElementById("new-app").onclick = CreateNewApp; + document.getElementById("hosted-app").onclick = ImportHostedApp; + document.getElementById("packaged-app").onclick = ImportPackagedApp; + projectList.update(); +}, true); + +window.addEventListener("unload", function onUnload() { + window.removeEventListener("unload", onUnload); + projectList = null; + AppManager.off("app-manager-update", onAppManagerUpdate); +}); + +function onAppManagerUpdate(event, what) { + switch (what) { + case "list-tabs-response": + case "runtime-apps-found": + case "project-validated": + case "project-removed": + case "project": + projectList.update(); + break; + } +} + +function CreateNewApp() { + projectList.newApp(); +} + +function ImportHostedApp() { + projectList.importHostedApp(); +} + +function ImportPackagedApp() { + projectList.importPackagedApp(); +} diff --git a/browser/devtools/webide/content/project-listing.xhtml b/browser/devtools/webide/content/project-listing.xhtml new file mode 100644 index 000000000000..2d11b891027a --- /dev/null +++ b/browser/devtools/webide/content/project-listing.xhtml @@ -0,0 +1,33 @@ + + + + + + %webideDTD; +]> + + + + + + + + +
+
+ + + + +
+ +
+ +
+
+
+ + diff --git a/browser/devtools/webide/content/project-panel.js b/browser/devtools/webide/content/project-panel.js new file mode 100644 index 000000000000..544bd6f2f7d5 --- /dev/null +++ b/browser/devtools/webide/content/project-panel.js @@ -0,0 +1,39 @@ +/* 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/. */ + +let ProjectPanel = { + // TODO: Expand function to save toggle state. + toggle: function(sidebarsEnabled, triggerPopup) { + let deferred = promise.defer(); + let doc = document; + + if (sidebarsEnabled) { + doc.querySelector("#project-listing-panel").setAttribute("sidebar-displayed", true); + doc.querySelector("#project-listing-splitter").setAttribute("sidebar-displayed", true); + deferred.resolve(); + } else if (triggerPopup) { + let panelNode = doc.querySelector("#project-panel"); + let panelVboxNode = doc.querySelector("#project-panel > #project-panel-box"); + let anchorNode = doc.querySelector("#project-panel-button > .panel-button-anchor"); + + window.setTimeout(() => { + // Open the popup only when the projects are added. + // Not doing it in the next tick can cause mis-calculations + // of the size of the panel. + function onPopupShown() { + panelNode.removeEventListener("popupshown", onPopupShown); + deferred.resolve(); + } + + panelNode.addEventListener("popupshown", onPopupShown); + panelNode.openPopup(anchorNode); + panelVboxNode.scrollTop = 0; + }, 0); + } else { + deferred.resolve(); + } + + return deferred.promise; + } +}; diff --git a/browser/devtools/webide/content/webide.js b/browser/devtools/webide/content/webide.js index 67c147eec25f..e2f3284ea3e7 100644 --- a/browser/devtools/webide/content/webide.js +++ b/browser/devtools/webide/content/webide.js @@ -24,6 +24,7 @@ const utils = require("devtools/webide/utils"); const Telemetry = require("devtools/shared/telemetry"); const {RuntimeScanners, WiFiScanner} = require("devtools/webide/runtimes"); const {showDoorhanger} = require("devtools/shared/doorhanger"); +const ProjectList = require("devtools/webide/project-list"); const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties"); @@ -51,6 +52,8 @@ window.addEventListener("unload", function onUnload() { UI.uninit(); }); +let projectList; + let UI = { init: function() { this._telemetry = new Telemetry(); @@ -64,6 +67,9 @@ let UI = { this.appManagerUpdate = this.appManagerUpdate.bind(this); AppManager.on("app-manager-update", this.appManagerUpdate); + projectList = new ProjectList(window, window); + ProjectPanel.toggle(projectList.sidebarsEnabled); + this.updateCommands(); this.updateRuntimeList(); @@ -72,6 +78,7 @@ let UI = { AppProjects.load().then(() => { this.autoSelectProject(); + projectList.update(); }, e => { console.error(e); this.reportError("error_appProjectsLoadFailed"); @@ -115,6 +122,7 @@ let UI = { window.removeEventListener("focus", this.onfocus, true); AppManager.off("app-manager-update", this.appManagerUpdate); AppManager.uninit(); + projectList = null; window.removeEventListener("message", this.onMessage); this.updateConnectionTelemetry(); this._telemetry.toolClosed("webide"); @@ -171,6 +179,7 @@ let UI = { UI.openProject(); UI.autoStartProject(); UI.saveLastSelectedProject(); + projectList.update(); }); return; case "project-is-not-running": @@ -190,12 +199,17 @@ let UI = { this.updateCommands(); this.updateProjectButton(); this.updateProjectEditorHeader(); + projectList.update(); + break; + case "project-removed": + projectList.update(); break; case "install-progress": this.updateProgress(Math.round(100 * details.bytesSent / details.totalBytes)); break; case "runtime-apps-found": this.autoSelectProject(); + projectList.update(); break; case "pre-package": this.prePackageLog(details); @@ -225,6 +239,7 @@ let UI = { } }, + // TODO: remove hidePanel when project layout is complete - Bug 1079347 hidePanels: function() { let panels = document.querySelectorAll("panel"); for (let p of panels) { @@ -527,14 +542,16 @@ let UI = { let project = AppManager.selectedProject; - if (!project) { - buttonNode.classList.add("no-project"); - labelNode.setAttribute("value", Strings.GetStringFromName("projectButton_label")); - imageNode.removeAttribute("src"); - } else { - buttonNode.classList.remove("no-project"); - labelNode.setAttribute("value", project.name); - imageNode.setAttribute("src", project.icon); + if (!projectList.sidebarsEnabled) { + if (!project) { + buttonNode.classList.add("no-project"); + labelNode.setAttribute("value", Strings.GetStringFromName("projectButton_label")); + imageNode.removeAttribute("src"); + } else { + buttonNode.classList.remove("no-project"); + labelNode.setAttribute("value", project.name); + imageNode.setAttribute("src", project.icon); + } } }, @@ -1039,217 +1056,19 @@ let Cmds = { * } */ newApp: function(testOptions) { - return UI.busyUntil(Task.spawn(function* () { - - // Open newapp.xul, which will feed ret.location - let ret = {location: null, testOptions: testOptions}; - window.openDialog("chrome://webide/content/newapp.xul", "newapp", "chrome,modal", ret); - if (!ret.location) - return; - - // Retrieve added project - let project = AppProjects.get(ret.location); - - // Select project - AppManager.selectedProject = project; - - }), "creating new app"); + projectList.newApp(testOptions); }, importPackagedApp: function(location) { - return UI.busyUntil(Task.spawn(function* () { - - let directory = utils.getPackagedDirectory(window, location); - - if (!directory) { - // User cancelled directory selection - return; - } - - yield UI.importAndSelectApp(directory); - }), "importing packaged app"); + projectList.importPackagedApp(location); }, importHostedApp: function(location) { - return UI.busyUntil(Task.spawn(function* () { - - let url = utils.getHostedURL(window, location); - - if (!url) { - return; - } - - yield UI.importAndSelectApp(url); - }), "importing hosted app"); + projectList.importHostedApp(location); }, showProjectPanel: function() { - let deferred = promise.defer(); - - let panelNode = document.querySelector("#project-panel"); - let panelVboxNode = document.querySelector("#project-panel > vbox"); - let anchorNode = document.querySelector("#project-panel-button > .panel-button-anchor"); - let projectsNode = document.querySelector("#project-panel-projects"); - - while (projectsNode.hasChildNodes()) { - projectsNode.firstChild.remove(); - } - - AppProjects.load().then(() => { - let projects = AppProjects.store.object.projects; - for (let i = 0; i < projects.length; i++) { - let project = projects[i]; - let panelItemNode = document.createElement("toolbarbutton"); - panelItemNode.className = "panel-item"; - projectsNode.appendChild(panelItemNode); - panelItemNode.setAttribute("label", project.name || AppManager.DEFAULT_PROJECT_NAME); - panelItemNode.setAttribute("image", project.icon || AppManager.DEFAULT_PROJECT_ICON); - if (!project.name || !project.icon) { - // The result of the validation process (storing names, icons, …) is not stored in - // the IndexedDB database when App Manager v1 is used. - // We need to run the validation again and update the name and icon of the app. - AppManager.validateAndUpdateProject(project).then(() => { - panelItemNode.setAttribute("label", project.name); - panelItemNode.setAttribute("image", project.icon); - }); - } - panelItemNode.addEventListener("click", () => { - UI.hidePanels(); - AppManager.selectedProject = project; - }, true); - } - - window.setTimeout(() => { - // Open the popup only when the projects are added. - // Not doing it in the next tick can cause mis-calculations - // of the size of the panel. - function onPopupShown() { - panelNode.removeEventListener("popupshown", onPopupShown); - deferred.resolve(); - } - panelNode.addEventListener("popupshown", onPopupShown); - panelNode.openPopup(anchorNode); - panelVboxNode.scrollTop = 0; - }, 0); - }, deferred.reject); - - - let runtimeappsHeaderNode = document.querySelector("#panel-header-runtimeapps"); - let sortedApps = []; - for (let [manifestURL, app] of AppManager.apps) { - sortedApps.push(app); - } - sortedApps = sortedApps.sort((a, b) => { - return a.manifest.name > b.manifest.name; - }); - let mainProcess = AppManager.isMainProcessDebuggable(); - if (AppManager.connected && (sortedApps.length > 0 || mainProcess)) { - runtimeappsHeaderNode.removeAttribute("hidden"); - } else { - runtimeappsHeaderNode.setAttribute("hidden", "true"); - } - - let runtimeAppsNode = document.querySelector("#project-panel-runtimeapps"); - while (runtimeAppsNode.hasChildNodes()) { - runtimeAppsNode.firstChild.remove(); - } - - if (mainProcess) { - let panelItemNode = document.createElement("toolbarbutton"); - panelItemNode.className = "panel-item"; - panelItemNode.setAttribute("label", Strings.GetStringFromName("mainProcess_label")); - panelItemNode.setAttribute("image", AppManager.DEFAULT_PROJECT_ICON); - runtimeAppsNode.appendChild(panelItemNode); - panelItemNode.addEventListener("click", () => { - UI.hidePanels(); - AppManager.selectedProject = { - type: "mainProcess", - name: Strings.GetStringFromName("mainProcess_label"), - icon: AppManager.DEFAULT_PROJECT_ICON - }; - }, true); - } - - for (let i = 0; i < sortedApps.length; i++) { - let app = sortedApps[i]; - let panelItemNode = document.createElement("toolbarbutton"); - panelItemNode.className = "panel-item"; - panelItemNode.setAttribute("label", app.manifest.name); - panelItemNode.setAttribute("image", app.iconURL); - runtimeAppsNode.appendChild(panelItemNode); - panelItemNode.addEventListener("click", () => { - UI.hidePanels(); - AppManager.selectedProject = { - type: "runtimeApp", - app: app.manifest, - icon: app.iconURL, - name: app.manifest.name - }; - }, true); - } - - // Build the tab list right now, so it's fast... - this._buildProjectPanelTabs(); - - // But re-list them and rebuild, in case any tabs navigated since the last - // time they were listed. - if (AppManager.connected) { - AppManager.listTabs().then(() => { - this._buildProjectPanelTabs(); - }).catch(console.error); - } - - return deferred.promise; - }, - - _buildProjectPanelTabs: function() { - let tabs = AppManager.tabStore.tabs; - let tabsHeaderNode = document.querySelector("#panel-header-tabs"); - if (AppManager.connected && tabs.length > 0) { - tabsHeaderNode.removeAttribute("hidden"); - } else { - tabsHeaderNode.setAttribute("hidden", "true"); - } - - let tabsNode = document.querySelector("#project-panel-tabs"); - while (tabsNode.hasChildNodes()) { - tabsNode.firstChild.remove(); - } - - for (let i = 0; i < tabs.length; i++) { - let tab = tabs[i]; - let url; - try { - url = new URL(tab.url); - } catch (e) { - // Don't try to handle invalid URLs, especially from Valence. - continue; - } - // Wanted to use nsIFaviconService here, but it only works for visited - // tabs, so that's no help for any remote tabs. Maybe some favicon wizard - // knows how to get high-res favicons easily, or we could offer actor - // support for this (bug 1061654). - tab.favicon = url.origin + "/favicon.ico"; - tab.name = tab.title || Strings.GetStringFromName("project_tab_loading"); - if (url.protocol.startsWith("http")) { - tab.name = url.hostname + ": " + tab.name; - } - let panelItemNode = document.createElement("toolbarbutton"); - panelItemNode.className = "panel-item"; - panelItemNode.setAttribute("label", tab.name); - panelItemNode.setAttribute("image", tab.favicon); - tabsNode.appendChild(panelItemNode); - panelItemNode.addEventListener("click", () => { - UI.hidePanels(); - AppManager.selectedProject = { - type: "tab", - app: tab, - icon: tab.favicon, - location: tab.url, - name: tab.name - }; - }, true); - } + ProjectPanel.toggle(projectList.sidebarsEnabled, true); }, showRuntimePanel: function() { @@ -1346,7 +1165,7 @@ let Cmds = { }, removeProject: function() { - return AppManager.removeSelectedProject(); + AppManager.removeSelectedProject(); }, toggleEditors: function() { diff --git a/browser/devtools/webide/content/webide.xul b/browser/devtools/webide/content/webide.xul index 387d4d63b67e..859570a439ab 100644 --- a/browser/devtools/webide/content/webide.xul +++ b/browser/devtools/webide/content/webide.xul @@ -12,6 +12,7 @@ + + @@ -150,7 +152,7 @@ - + @@ -191,18 +193,26 @@ - -