merge mozilla-central to autoland. r=merge a=merge on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-07-27 18:18:54 +02:00
commit 7ea64bd7aa
63 changed files with 438 additions and 356 deletions

View File

@ -138,9 +138,8 @@ devtools/shared/qrcode/tests/mochitest/test_decode.html
devtools/shared/tests/mochitest/*.html
devtools/shared/webconsole/test/test_*.html
# Ignore devtools preferences files
# Ignore devtools pre-processed files
devtools/client/preferences/**
devtools/shim/devtools-startup-prefs.js
# Ignore devtools third-party libs
devtools/shared/jsbeautify/*

View File

@ -55,13 +55,57 @@ browser/chrome/browser/skin/classic/browser/connection-secure.svg
browser/chrome/browser/skin/classic/browser/controlcenter/warning-gray.svg
browser/chrome/browser/skin/classic/browser/newtab/close.png
# devtools reduction is bug 1311178
browser/features/devtools@mozilla.org/chrome/skin/images/security-state-broken.svg
browser/features/devtools@mozilla.org/chrome/skin/images/security-state-secure.svg
browser/features/devtools@mozilla.org/chrome/skin/toolbars.css
browser/features/devtools@mozilla.org/chrome/modules/client/themes/toolbars.css
browser/chrome/devtools/content/dom/content/dom-view.css
browser/chrome/devtools/content/dom/dom.html
browser/chrome/devtools/content/dom/main.js
browser/chrome/devtools/content/framework/toolbox-options.js
browser/chrome/devtools/content/inspector/fonts/fonts.js
browser/chrome/devtools/content/inspector/inspector.xhtml
browser/chrome/devtools/content/memory/initializer.js
browser/chrome/devtools/content/projecteditor/lib/helpers/readdir.js
browser/chrome/devtools/content/shared/frame-script-utils.js
browser/chrome/devtools/content/shared/theme-switching.js
browser/chrome/devtools/modules/devtools/client/dom/content/dom-view.css
browser/chrome/devtools/modules/devtools/client/dom/dom.html
browser/chrome/devtools/modules/devtools/client/dom/main.js
browser/chrome/devtools/modules/devtools/client/framework/toolbox-options.js
browser/chrome/devtools/modules/devtools/client/inspector/fonts/fonts.js
browser/chrome/devtools/modules/devtools/client/inspector/inspector.xhtml
browser/chrome/devtools/modules/devtools/client/jsonview/css/controls.png
browser/chrome/devtools/modules/devtools/client/jsonview/css/controls@2x.png
browser/chrome/devtools/modules/devtools/client/memory/initializer.js
browser/chrome/devtools/modules/devtools/client/projecteditor/lib/helpers/readdir.js
browser/chrome/devtools/modules/devtools/client/shared/frame-script-utils.js
browser/chrome/devtools/modules/devtools/client/shared/theme-switching.js
browser/chrome/devtools/modules/devtools/client/themes/common.css
browser/chrome/devtools/modules/devtools/client/themes/toolbars.css
browser/chrome/devtools/modules/devtools/client/themes/variables.css
browser/chrome/devtools/skin/common.css
browser/chrome/devtools/skin/toolbars.css
browser/chrome/devtools/skin/images/command-scratchpad.svg
browser/chrome/devtools/skin/images/controls.png
browser/chrome/devtools/skin/images/controls@2x.png
browser/chrome/devtools/skin/images/debugger-blackbox.svg
browser/chrome/devtools/skin/images/debugger-prettyprint.svg
browser/chrome/devtools/skin/images/filetypes/store.svg
browser/chrome/devtools/skin/images/itemToggle.svg
browser/chrome/devtools/skin/images/security-state-broken.svg
browser/chrome/devtools/skin/images/security-state-local.svg
browser/chrome/devtools/skin/images/security-state-secure.svg
browser/chrome/devtools/skin/images/tabs-icon.svg
browser/chrome/devtools/skin/images/tool-scratchpad.svg
browser/chrome/devtools/skin/images/tool-storage.svg
browser/chrome/devtools/skin/images/tool-styleeditor.svg
browser/chrome/devtools/skin/promisedebugger.css
browser/chrome/devtools/skin/variables.css
modules/devtools/Console.jsm
modules/devtools/Loader.jsm
modules/devtools/Simulator.jsm
modules/devtools/shared/Console.jsm
modules/devtools/shared/Loader.jsm
modules/devtools/shared/apps/Simulator.jsm
browser/modules/devtools/client/framework/gDevTools.jsm
browser/modules/devtools/gDevTools.jsm
browser/chrome/icons/default/default16.png
browser/chrome/icons/default/default32.png
browser/chrome/icons/default/default48.png

View File

@ -627,10 +627,20 @@
#endif
@RESPATH@/browser/features/*
; [Webide Files]
@RESPATH@/browser/chrome/webide@JAREXT@
@RESPATH@/browser/chrome/webide.manifest
@RESPATH@/browser/@PREF_DIR@/webide-prefs.js
; [DevTools Shim Files]
@RESPATH@/browser/chrome/devtools-shim@JAREXT@
@RESPATH@/browser/chrome/devtools-shim.manifest
@RESPATH@/browser/@PREF_DIR@/devtools-startup-prefs.js
; DevTools
@RESPATH@/browser/chrome/devtools@JAREXT@
@RESPATH@/browser/chrome/devtools.manifest
@RESPATH@/browser/@PREF_DIR@/devtools.js
@RESPATH@/browser/@PREF_DIR@/debugger.js
; shell icons
#ifdef XP_UNIX

292
devtools/bootstrap.js vendored
View File

@ -8,7 +8,176 @@
"use strict";
const Cu = Components.utils;
const Ci = Components.interfaces;
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm", {});
// MultiWindowKeyListener instance for Ctrl+Alt+R key
let listener;
// nsIURI to the addon root folder
let resourceURI;
function actionOccurred(id) {
let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let Telemetry = require("devtools/client/shared/telemetry");
let telemetry = new Telemetry();
telemetry.actionOccurred(id);
}
// Synchronously fetch the content of a given URL
function readURI(uri) {
let stream = NetUtil.newChannel({
uri: NetUtil.newURI(uri, "UTF-8"),
loadUsingSystemPrincipal: true}
).open2();
let count = stream.available();
let data = NetUtil.readInputStreamToString(stream, count, {
charset: "UTF-8"
});
stream.close();
return data;
}
/**
* Interpret the processing instructions contained in a preferences file, based on a
* limited set of supported #if statements. After we ship as an addon, we don't want to
* introduce anymore processing instructions, so all unrecognized preprocessing
* instructions will be treated as an error.
*
* This function is mostly copied from devtools/client/inspector/webpack/prefs-loader.js
*
* @param {String} content
* The string content of a preferences file.
* @return {String} the content stripped of preprocessing instructions.
*/
function interpretPreprocessingInstructions(content) {
const ifMap = {
"#if MOZ_UPDATE_CHANNEL == beta": AppConstants.MOZ_UPDATE_CHANNEL === "beta",
"#if defined(NIGHTLY_BUILD)": AppConstants.NIGHTLY_BUILD,
"#ifdef MOZ_DEV_EDITION": AppConstants.MOZ_DEV_EDITION,
"#ifdef RELEASE_OR_BETA": AppConstants.RELEASE_OR_BETA,
};
let lines = content.split("\n");
let ignoring = false;
let newLines = [];
let continuation = false;
for (let line of lines) {
if (line.startsWith("#if")) {
if (!(line in ifMap)) {
throw new Error("missing line in ifMap: " + line);
}
ignoring = !ifMap[line];
} else if (line.startsWith("#else")) {
ignoring = !ignoring;
} else if (line.startsWith("#endif")) {
ignoring = false;
}
let isPrefLine = /^ *(sticky_)?pref\("([^"]+)"/.test(line);
if (continuation || (!ignoring && isPrefLine)) {
newLines.push(line);
// The call to pref(...); might span more than one line.
continuation = !/\);/.test(line);
}
}
return newLines.join("\n");
}
// Read a preference file and set all of its defined pref as default values
// (This replicates the behavior of preferences files from mozilla-central)
function processPrefFile(url) {
let content = readURI(url);
content = interpretPreprocessingInstructions(content);
content.match(/pref\("[^"]+",\s*.+\s*\)/g).forEach(item => {
let m = item.match(/pref\("([^"]+)",\s*(.+)\s*\)/);
let name = m[1];
let val = m[2].trim();
// Prevent overriding prefs that have been changed by the user
if (Services.prefs.prefHasUserValue(name)) {
return;
}
let defaultBranch = Services.prefs.getDefaultBranch("");
if ((val.startsWith("\"") && val.endsWith("\"")) ||
(val.startsWith("'") && val.endsWith("'"))) {
val = val.substr(1, val.length - 2);
val = val.replace(/\\"/g, '"');
defaultBranch.setCharPref(name, val);
} else if (val.match(/[0-9]+/)) {
defaultBranch.setIntPref(name, parseInt(val, 10));
} else if (val == "true" || val == "false") {
defaultBranch.setBoolPref(name, val == "true");
} else {
console.log("Unable to match preference type for value:", val);
}
});
}
function setPrefs() {
processPrefFile(resourceURI.spec + "./client/preferences/devtools.js");
processPrefFile(resourceURI.spec + "./client/preferences/debugger.js");
processPrefFile(resourceURI.spec + "./client/webide/webide-prefs.js");
}
// Helper to listen to a key on all windows
function MultiWindowKeyListener({ keyCode, ctrlKey, altKey, callback }) {
let keyListener = function (event) {
if (event.ctrlKey == !!ctrlKey &&
event.altKey == !!altKey &&
event.keyCode === keyCode) {
callback(event);
// Call preventDefault to avoid duplicated events when
// doing the key stroke within a tab.
event.preventDefault();
}
};
let observer = function (window, topic, data) {
// Listen on keyup to call keyListener only once per stroke
if (topic === "domwindowopened") {
window.addEventListener("keyup", keyListener);
} else {
window.removeEventListener("keyup", keyListener);
}
};
return {
start: function () {
// Automatically process already opened windows
let e = Services.ww.getWindowEnumerator();
while (e.hasMoreElements()) {
let window = e.getNext();
observer(window, "domwindowopened", null);
}
// And listen for new ones to come
Services.ww.registerNotification(observer);
},
stop: function () {
Services.ww.unregisterNotification(observer);
let e = Services.ww.getWindowEnumerator();
while (e.hasMoreElements()) {
let window = e.getNext();
observer(window, "domwindowclosed", null);
}
}
};
}
let getTopLevelWindow = function (window) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
};
function unload(reason) {
// This frame script is going to be executed in all processes:
@ -46,17 +215,132 @@ function unload(reason) {
Cu.unload("resource://devtools/shared/deprecated-sync-thenables.js");
}
function startup(data) {}
function reload(event) {
// We automatically reload the toolbox if we are on a browser tab
// with a toolbox already opened
let reloadToolbox = false;
if (event) {
let top = getTopLevelWindow(event.view);
let isBrowser = top.location.href.includes("/browser.xul");
if (isBrowser && top.gBrowser) {
// We do not use any devtools code before the call to Loader.jsm reload as
// any attempt to use Loader.jsm to load a module will instanciate a new
// Loader.
let nbox = top.gBrowser.getNotificationBox();
reloadToolbox =
top.document.getAnonymousElementByAttribute(nbox, "class",
"devtools-toolbox-bottom-iframe") ||
top.document.getAnonymousElementByAttribute(nbox, "class",
"devtools-toolbox-side-iframe") ||
Services.wm.getMostRecentWindow("devtools:toolbox");
}
}
let browserConsole = Services.wm.getMostRecentWindow("devtools:webconsole");
let reopenBrowserConsole = false;
if (browserConsole) {
browserConsole.close();
reopenBrowserConsole = true;
}
dump("Reload DevTools. (reload-toolbox:" + reloadToolbox + ")\n");
// Invalidate xul cache in order to see changes made to chrome:// files
Services.obs.notifyObservers(null, "startupcache-invalidate");
unload("reload");
// Update the preferences before starting new code
setPrefs();
const {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
devtools.require("devtools/client/framework/devtools-browser");
// Go over all top level windows to reload all devtools related things
let windowsEnum = Services.wm.getEnumerator(null);
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
let windowtype = window.document.documentElement.getAttribute("windowtype");
if (windowtype == "navigator:browser" && window.gBrowser) {
// Enumerate tabs on firefox windows
for (let tab of window.gBrowser.tabs) {
let browser = tab.linkedBrowser;
let location = browser.documentURI.spec;
let mm = browser.messageManager;
// To reload JSON-View tabs and any devtools document
if (location.startsWith("about:debugging") ||
location.startsWith("chrome://devtools/")) {
browser.reload();
}
// We have to use a frame script to query "baseURI"
mm.loadFrameScript("data:text/javascript,new " + function () {
let isJSONView =
content.document.baseURI.startsWith("resource://devtools/");
if (isJSONView) {
content.location.reload();
}
}, false);
}
} else if (windowtype === "devtools:webide") {
window.location.reload();
}
}
if (reloadToolbox) {
// Reopen the toolbox automatically if we are reloading from toolbox
// shortcut and are on a browser window.
// Wait for a second before opening the toolbox to avoid races
// between the old and the new one.
let {setTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
setTimeout(() => {
let { TargetFactory } = devtools.require("devtools/client/framework/target");
let { gDevTools } = devtools.require("devtools/client/framework/devtools");
let top = getTopLevelWindow(event.view);
let target = TargetFactory.forTab(top.gBrowser.selectedTab);
gDevTools.showToolbox(target);
}, 1000);
}
// Browser console document can't just be reloaded.
// HUDService is going to close it on unload.
// Instead we have to manually toggle it.
if (reopenBrowserConsole) {
let HUDService = devtools.require("devtools/client/webconsole/hudservice");
HUDService.toggleBrowserConsole();
}
actionOccurred("reloadAddonReload");
}
function startup(data) {
dump("DevTools addon started.\n");
resourceURI = data.resourceURI;
listener = new MultiWindowKeyListener({
keyCode: Ci.nsIDOMKeyEvent.DOM_VK_R, ctrlKey: true, altKey: true,
callback: reload
});
listener.start();
reload();
}
function shutdown(data, reason) {
// On browser shutdown, do not try to cleanup anything
if (reason == APP_SHUTDOWN) {
return;
}
listener.stop();
listener = null;
unload("disable");
}
function install() {}
function install() {
try {
actionOccurred("reloadAddonInstalled");
} catch (e) {
// When installing on Firefox builds without devtools, telemetry doesn't
// work yet and throws.
}
}
function uninstall() {}

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../shared/tests/shared-xpcshell-head.js xpcshell-head.js
head = xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../shared/tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -187,7 +187,6 @@ BrowserToolboxProcess.prototype = {
// We would like to copy prefs into this new profile...
let prefsFile = debuggingProfileDir.clone();
prefsFile.append("prefs.js");
// ... but unfortunately, when we run tests, it seems the starting profile
// clears out the prefs file before re-writing it, and in practice the
// file is empty when we get here. So just copying doesn't work in that
@ -195,21 +194,8 @@ BrowserToolboxProcess.prototype = {
// We could force a sync pref flush and then copy it... but if we're doing
// that, we might as well just flush directly to the new profile, which
// always works:
// Before dumping the preferences to prefsFile, clear the current pref for
// extensions.lastAppVersion. The AddonManager expects this pref to be undefined
// when loading a new profile, this will trigger the installation of system addons
// without showing the addon update popup.
let appVersion = Services.prefs.getCharPref("extensions.lastAppVersion", "");
Services.prefs.clearUserPref("extensions.lastAppVersion");
Services.prefs.savePrefFile(prefsFile);
// Restore the overridden extensions.lastAppVersion preference.
if (appVersion) {
Services.prefs.setCharPref("extensions.lastAppVersion", appVersion);
}
dumpn("Finished creating the chrome toolbox user profile at: " +
this._dbgProfilePath);
},

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
firefox-appdir = browser
head = ../../../../../shared/tests/shared-xpcshell-head.js head.js
head = head.js
[test_compare_fragments_geometry.js]

View File

@ -2,12 +2,8 @@
# 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/.
[features/devtools@mozilla.org] chrome.jar:
devtools.jar:
% content devtools %content/
content/preferences/debugger.js (preferences/debugger.js)
* content/preferences/devtools.js (preferences/devtools.js)
content/preferences/DevToolsPreferences.jsm (preferences/DevToolsPreferences.jsm)
content/webide/webide-prefs.js (webide/webide-prefs.js)
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)

View File

@ -3,6 +3,6 @@
# 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/.
[features/devtools@mozilla.org] chrome.jar:
@AB_CD@.jar:
% locale devtools @AB_CD@ %locale/@AB_CD@/devtools/client/
locale/@AB_CD@/devtools/client/ (%*)

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools devtools-memory
head = ../../../../shared/tests/shared-xpcshell-head.js head.js ../../../framework/test/shared-redux-head.js
head = head.js ../../../framework/test/shared-redux-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -20,6 +20,7 @@ DIRS += [
'memory',
'netmonitor',
'performance',
'preferences',
'responsive.html',
'responsivedesign',
'scratchpad',
@ -39,6 +40,11 @@ DIRS += [
if CONFIG['MOZ_BUILD_APP'] == 'browser':
DIRS += ['themes/shims']
EXTRA_COMPONENTS += [
'devtools-startup.js',
'devtools-startup.manifest',
]
JAR_MANIFESTS += ['jar.mn']
DevToolsModules(

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../shared/tests/shared-xpcshell-head.js head.js
head = head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,88 +0,0 @@
/* 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/. */
"use strict";
const Cu = Components.utils;
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
this.EXPORTED_SYMBOLS = ["DevToolsPreferences"];
// Synchronously fetch the content of a given URL
function readURI(uri) {
let stream = NetUtil.newChannel({
uri: NetUtil.newURI(uri, "UTF-8"),
loadUsingSystemPrincipal: true}
).open2();
let count = stream.available();
let data = NetUtil.readInputStreamToString(stream, count, {
charset: "UTF-8"
});
stream.close();
return data;
}
/**
* Cleanup the preferences file content from all empty and comment lines.
*
* @param {String} content
* The string content of a preferences file.
* @return {String} the content stripped of unnecessary lines.
*/
function cleanupPreferencesFileContent(content) {
let lines = content.split("\n");
let newLines = [];
let continuation = false;
for (let line of lines) {
let isPrefLine = /^ *pref\("([^"]+)"/.test(line);
if (continuation || isPrefLine) {
newLines.push(line);
// The call to pref(...); might span more than one line.
continuation = !/\);/.test(line);
}
}
return newLines.join("\n");
}
// Read a preference file and set all of its defined pref as default values
// (This replicates the behavior of preferences files from mozilla-central)
function processPrefFile(url) {
let content = readURI(url);
content = cleanupPreferencesFileContent(content);
content.match(/pref\("[^"]+",\s*.+\s*\)/g).forEach(item => {
let m = item.match(/pref\("([^"]+)",\s*(.+)\s*\)/);
let name = m[1];
let val = m[2].trim();
// Prevent overriding prefs that have been changed by the user
if (Services.prefs.prefHasUserValue(name)) {
return;
}
let defaultBranch = Services.prefs.getDefaultBranch("");
if ((val.startsWith("\"") && val.endsWith("\"")) ||
(val.startsWith("'") && val.endsWith("'"))) {
val = val.substr(1, val.length - 2);
val = val.replace(/\\"/g, '"');
defaultBranch.setCharPref(name, val);
} else if (val.match(/[0-9]+/)) {
defaultBranch.setIntPref(name, parseInt(val, 10));
} else if (val == "true" || val == "false") {
defaultBranch.setBoolPref(name, val == "true");
} else {
console.log("Unable to match preference type for value:", val);
}
});
}
this.DevToolsPreferences = {
loadPrefs: function () {
processPrefFile("chrome://devtools/content/preferences/devtools.js");
processPrefFile("chrome://devtools/content/preferences/debugger.js");
processPrefFile("chrome://devtools/content/webide/webide-prefs.js");
}
};

View File

@ -47,6 +47,8 @@ pref("devtools.command-button-measure.enabled", false);
pref("devtools.command-button-noautohide.enabled", false);
// Inspector preferences
// Enable the Inspector
pref("devtools.inspector.enabled", true);
// What was the last active sidebar in the inspector
pref("devtools.inspector.activeSidebar", "ruleview");
pref("devtools.inspector.remote", false);
@ -229,6 +231,13 @@ pref("devtools.dom.enabled", false);
// Web Audio Editor Inspector Width should be a preference
pref("devtools.webaudioeditor.inspectorWidth", 300);
// Default theme ("dark" or "light")
#ifdef MOZ_DEV_EDITION
sticky_pref("devtools.theme", "dark");
#else
sticky_pref("devtools.theme", "light");
#endif
// Web console filters
pref("devtools.webconsole.filter.error", true);
pref("devtools.webconsole.filter.warn", true);
@ -344,5 +353,8 @@ pref("devtools.editor.autocomplete", true);
// version for each user.
pref("devtools.telemetry.tools.opened.version", "{}");
// Enable the JSON View tool (an inspector for application/json documents).
pref("devtools.jsonview.enabled", true);
// Enable the HTML responsive design mode for all channels.
pref("devtools.responsive.html.enabled", true);

View File

@ -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/.
JS_PREFERENCE_PP_FILES += [
'devtools.js'
]
JS_PREFERENCE_FILES += [
'debugger.js',
]

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../shared/tests/shared-xpcshell-head.js head.js ../../../framework/test/shared-redux-head.js
head = head.js ../../../framework/test/shared-redux-head.js
firefox-appdir = browser
[test_add_device.js]

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../../shared/tests/shared-xpcshell-head.js head.js
head = head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../shared/tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../../../shared/tests/shared-xpcshell-head.js head_stringvalidator.js
head = head_stringvalidator.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../../shared/tests/shared-xpcshell-head.js head_tern.js
head = head_tern.js
firefox-appdir = browser
[test_autocompletion.js]

View File

@ -7,7 +7,7 @@
@import url(resource://devtools/client/themes/common.css);
@import url(chrome://devtools/skin/light-theme.css);
:root.theme-firebug {
:root {
font-size: 11px;
font-family: var(--proportional-font-family);
}

View File

@ -38,7 +38,7 @@ var styleSheets = [
// on the right CSS strategy FIXME.
// It would also be nice to include them using @import.
styleSheets.forEach(url => {
loadSheet(window, url, "author");
loadSheet(this, url, "author");
});
// Localization API used by React components

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../../../shared/tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -2,7 +2,7 @@
# 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/.
[features/devtools@mozilla.org] webide.jar:
webide.jar:
% content webide %content/
content/webide.xul (webide.xul)
content/webide.js (webide.js)

View File

@ -116,12 +116,6 @@ var UI = {
this.configureSimulator = this.configureSimulator.bind(this);
Simulators.on("configure", this.configureSimulator);
// This allows to use mac specific selectors in webide css files, using
// `:root[platform="mac"]`.
if (navigator.platform.startsWith("Mac")) {
document.documentElement.setAttribute("platform", "mac");
}
},
destroy: function () {

View File

@ -17,5 +17,9 @@ MOCHITEST_CHROME_MANIFESTS += [
'test/chrome.ini'
]
JS_PREFERENCE_FILES += [
'webide-prefs.js',
]
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: WebIDE')

View File

@ -2,9 +2,9 @@
# 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/.
[features/devtools@mozilla.org] webide.jar:
webide.jar:
% skin webide classic/1.0 %skin/
skin/webide.css (webide.css)
* skin/webide.css (webide.css)
skin/icons.png (icons.png)
skin/details.css (details.css)
skin/newapp.css (newapp.css)

View File

@ -138,11 +138,9 @@ window.busy-determined #action-busy-undetermined {
background-repeat: no-repeat, repeat;
background-size: 35%, auto;
background-position: center center, top left;
%ifndef XP_MACOSX
border-top: 1px solid #AAA;
}
:root[platform="mac"] #deck {
border-top-width: 0;
%endif
}
.devtools-horizontal-splitter {

View File

@ -17,7 +17,6 @@
<em:bootstrap>true</em:bootstrap>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
@ -25,13 +24,5 @@
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Fennec -->
<em:targetApplication>
<Description>
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
<em:minVersion>44.0a1</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

View File

@ -26,20 +26,6 @@ if CONFIG['MOZ_DEVTOOLS'] != 'addon':
'server',
'shared',
]
FINAL_TARGET_FILES.features['devtools@mozilla.org'] += [
'install.rdf',
]
# For Fennec, provide an empty bootstrap.js that doesn't do anything.
# DevTools initialization is handled by mobile/android/chrome/content/RemoteDebugger.js
if CONFIG['MOZ_DEVTOOLS'] == 'server':
FINAL_TARGET_FILES.features['devtools@mozilla.org'] += [
'server/bootstrap.js',
]
elif CONFIG['MOZ_DEVTOOLS'] != 'addon':
FINAL_TARGET_FILES.features['devtools@mozilla.org'] += [
'bootstrap.js',
]
# /browser uses DIST_SUBDIR. We opt-in to this treatment when building
# DevTools for the browser to keep the root omni.ja slim for use by external XUL

View File

@ -1,6 +1,5 @@
[DEFAULT]
tags = devtools
head = ../../../shared/tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,18 +0,0 @@
/* 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/. */
/* exported startup, shutdown, install, uninstall */
// Fake bootstrap used when shipping only server part of devtools.
"use strict";
function startup(data) {
}
function shutdown(data, reason) {
}
function install() {}
function uninstall() {}

View File

@ -13,6 +13,6 @@ DIRS += [
# installed to previously defined locations.
# Extra compatibility layer for old path after relocation in bug 1270173
FINAL_TARGET_FILES.features['devtools@mozilla.org'].chrome.modules.server += [
FINAL_TARGET_FILES.chrome.devtools.modules.devtools.server += [
'protocol.js',
]

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../shared/tests/shared-xpcshell-head.js head_dbg.js
head = head_dbg.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -16,21 +16,6 @@ var { requireRawId } = Cu.import("resource://devtools/shared/loader-plugin-raw.j
this.EXPORTED_SYMBOLS = ["DevToolsLoader", "devtools", "BuiltinProvider",
"require", "loader"];
// Fire an event to notify the DevTools addon bootstrap that DevTools are being
// initialized. The loader is always the first entry point for all DevTools consumers.
Services.obs.notifyObservers(null, "devtools-loader-starting");
// Load DevToolsPreferences as soon as DevTools code starts being required.
// With DevTools as an addon, the DevTools preferences need to be dynamically loaded.
const isParentProcess =
Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_DEFAULT;
const isFirefox = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
if (isParentProcess && isFirefox) {
// Load client preferences if we are in Firefox's parent process only.
const {DevToolsPreferences} =
Cu.import("chrome://devtools/content/preferences/DevToolsPreferences.jsm", {});
DevToolsPreferences.loadPrefs();
}
/**
* Providers are different strategies for loading the devtools.
*/

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js head_acorn.js
head = head_acorn.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,7 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android' # Bug 1380687 - xpcshell-tests can not run for system addons on android
[test_discovery.js]

View File

@ -10,11 +10,7 @@ with Files('**'):
if CONFIG['ENABLE_TESTS']:
DIRS += ['tests/gtest']
XPCSHELL_TESTS_MANIFESTS += [
'tests/unit/xpcshell.ini',
'tests/unit/xpcshell_ipc.ini',
]
XPCSHELL_TESTS_MANIFESTS += [ 'tests/unit/xpcshell.ini' ]
MOCHITEST_MANIFESTS += [ 'tests/mochitest/mochitest.ini' ]
MOCHITEST_CHROME_MANIFESTS += [ 'tests/mochitest/chrome.ini' ]

View File

@ -1,10 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* exported Cu, CC */
// Simplistic head.js simply gathering dependencies needed for test_SaveHeapSnapshot.js
var Cu = Components.utils;
var CC = Components.Constructor;

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools heapsnapshot devtools-memory
head = ../../../tests/shared-xpcshell-head.js head_heapsnapshot.js
head = head_heapsnapshot.js
firefox-appdir = browser
skip-if = toolkit == 'android'
@ -94,3 +94,4 @@ skip-if = os == 'linux' # Bug 1176173
[test_ReadHeapSnapshot_worker.js]
skip-if = os == 'linux' # Bug 1176173
[test_SaveHeapSnapshot.js]
[test_saveHeapSnapshot_e10s_01.js]

View File

@ -1,11 +0,0 @@
[DEFAULT]
tags = devtools heapsnapshot devtools-memory
head = head_heapsnapshot_ipc.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
test_SaveHeapSnapshot.js
[test_saveHeapSnapshot_e10s_01.js]
# Using a separate test suite for this test to avoid loading the shared xpcshell head.js
# test file which will fail when trying to load preferences in content.

View File

@ -2,8 +2,8 @@
# 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/.
[features/devtools@mozilla.org] chrome.jar:
% resource devtools %modules/
devtools.jar:
% resource devtools %modules/devtools/
# The typical approach would be to list all the resource files in this manifest
# for installation. Instead of doing this, use the DevToolsModules syntax via
# moz.build files to do the installation so that we can enforce correct paths

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js head_jsbeautify.js
head = head_jsbeautify.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -3,6 +3,6 @@
# 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/.
[features/devtools@mozilla.org] chrome.jar:
@AB_CD@.jar:
% locale devtools-shared @AB_CD@ %locale/@AB_CD@/devtools/shared/
locale/@AB_CD@/devtools/shared/ (%*)

View File

@ -6,10 +6,6 @@
include('../templates.mozbuild')
TEST_HARNESS_FILES.xpcshell.devtools.shared.tests += [
'tests/shared-xpcshell-head.js',
]
DIRS += [
'acorn',
'apps',

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../shared/tests/shared-xpcshell-head.js head.js
head = head.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,7 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android' # Bug 1380687 - xpcshell-tests can not run for system addons on android
[test_stack.js]

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js head_pretty-fast.js
head = head_pretty-fast.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,7 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android' # Bug 1380687 - xpcshell-tests can not run for system addons on android
[test_encode.js]

View File

@ -1,8 +1,7 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js head_dbg.js
head = head_dbg.js
firefox-appdir = browser
skip-if = toolkit == 'android' # Bug 1380687 - xpcshell-tests can not run for system addons on android
support-files=
testactors.js

View File

@ -4,8 +4,6 @@
# 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/.
DIST_SUBDIR = 'browser'
DevToolsModules(
'timeline.js',
)

View File

@ -1,30 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
(() => {
const {interfaces: Ci, utils: Cu} = Components;
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
// Load our bootstrap extension manifest so we can access our chrome/resource URIs.
const EXTENSION_ID = "devtools@mozilla.org";
let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile);
extensionDir.append("browser");
extensionDir.append("features");
extensionDir.append(EXTENSION_ID);
// If the unpacked extension doesn't exist, use the packed version.
// Typically running tests on a local build will rely on the unpacked version
// while running tests against a packaged Firefox build (on try for instance) will
// rely on the xpi.
if (!extensionDir.exists()) {
extensionDir = extensionDir.parent;
extensionDir.append(EXTENSION_ID + ".xpi");
}
Components.manager.addBootstrappedManifestLocation(extensionDir);
// Load devtools preferences that should normally be loaded by bootstrap.js
let {DevToolsPreferences} =
Cu.import("chrome://devtools/content/preferences/DevToolsPreferences.jsm", {});
DevToolsPreferences.loadPrefs();
})();

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../shared-xpcshell-head.js head_devtools.js
head = head_devtools.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js head_dbg.js
head = head_dbg.js
firefox-appdir = browser
skip-if = toolkit == 'android'

View File

@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
head = ../../../tests/shared-xpcshell-head.js
head =
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =

View File

@ -209,7 +209,11 @@ this.DevToolsShim = {
return;
}
this.gDevTools.restoreScratchpadSession(scratchpads);
if (!this.isInitialized()) {
this._initDevTools();
}
this._gDevTools.restoreScratchpadSession(scratchpads);
},
/**

View File

@ -1,22 +0,0 @@
/* 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/. */
// This Devtools preferences file will be loaded as a usual Firefox preferences file.
// Most DevTools prefs are included with the addon and loaded dynamically during the addon
// startup. For preferences that are required before the addon is loaded or that we can't
// process in JS, they can be defined in this file.
// Note that this preference file follows Firefox release cycle.
// Enable the JSON View tool (an inspector for application/json documents).
pref("devtools.jsonview.enabled", true);
// Enable the Inspector, this preference is used from mozilla-central.
pref("devtools.inspector.enabled", true);
// Default theme ("dark" or "light")
#ifdef MOZ_DEV_EDITION
sticky_pref("devtools.theme", "dark");
#else
sticky_pref("devtools.theme", "light");
#endif

View File

@ -6,15 +6,6 @@
JAR_MANIFESTS += ['jar.mn']
EXTRA_COMPONENTS += [
'devtools-startup.js',
'devtools-startup.manifest',
]
JS_PREFERENCE_PP_FILES += [
'devtools-startup-prefs.js',
]
# Register the about:debugging page only for 'addon' and 'all' builds.
if CONFIG['MOZ_DEVTOOLS'] != 'server':
EXTRA_COMPONENTS += [

View File

@ -4,9 +4,12 @@
"use strict";
const { DevToolsShim } =
const { DevToolsShim: realDevToolsShim } =
Components.utils.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
// Create a copy of the DevToolsShim for the test.
const DevToolsShim = Object.assign({}, realDevToolsShim);
// Test the DevToolsShim
/**
@ -41,13 +44,11 @@ function createMockDevTools() {
return mock;
}
let isInstalledMethodBackup = DevToolsShim.isInstalled;
function mockDevToolsInstalled() {
DevToolsShim.isInstalled = () => true;
}
function restoreDevToolsInstalled() {
DevToolsShim.isInstalled = isInstalledMethodBackup;
function mockDevToolsUninstalled() {
DevToolsShim.isInstalled = () => false;
}
/**
@ -71,8 +72,6 @@ function checkCalls(mock, method, length, lastArgs) {
}
function test_register_unregister() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
DevToolsShim.register(createMockDevTools());
@ -80,8 +79,6 @@ function test_register_unregister() {
DevToolsShim.unregister();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
restoreDevToolsInstalled();
}
function test_on_is_forwarded_to_devtools() {
@ -97,13 +94,9 @@ function test_on_is_forwarded_to_devtools() {
DevToolsShim.on("other_event", cb2);
checkCalls(mock, "on", 2, ["other_event", cb2]);
restoreDevToolsInstalled();
}
function test_off_called_before_registering_devtools() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
function cb1() {}
@ -114,13 +107,9 @@ function test_off_called_before_registering_devtools() {
DevToolsShim.register(mock);
checkCalls(mock, "on", 0);
restoreDevToolsInstalled();
}
function test_off_called_before_with_bad_callback() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
function cb1() {}
@ -135,13 +124,9 @@ function test_off_called_before_with_bad_callback() {
checkCalls(mock, "on", 1, ["test_event", cb1]);
// Calls to off should not be held and forwarded.
checkCalls(mock, "off", 0);
restoreDevToolsInstalled();
}
function test_registering_tool() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
let tool1 = {};
@ -168,13 +153,9 @@ function test_registering_tool() {
mock = createMockDevTools();
DevToolsShim.register(mock);
checkCalls(mock, "registerTool", 0);
restoreDevToolsInstalled();
}
function test_registering_theme() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
let theme1 = {};
@ -201,13 +182,9 @@ function test_registering_theme() {
mock = createMockDevTools();
DevToolsShim.register(mock);
checkCalls(mock, "registerTheme", 0);
restoreDevToolsInstalled();
}
function test_events() {
mockDevToolsInstalled();
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
let mock = createMockDevTools();
@ -221,11 +198,11 @@ function test_events() {
// Check emit is called once with the devtools-unregistered event.
DevToolsShim.unregister();
checkCalls(mock, "emit", 2, ["devtools-unregistered"]);
restoreDevToolsInstalled();
}
function test_scratchpad_apis() {
mockDevToolsUninstalled();
ok(!DevToolsShim.isInstalled(), "DevTools are not installed");
ok(!DevToolsShim.isInitialized(), "DevTools are not initialized");
@ -262,8 +239,6 @@ function test_scratchpad_apis() {
DevToolsShim.getOpenedScratchpads();
checkCalls(mock, "getOpenedScratchpads", 1, []);
restoreDevToolsInstalled();
}
function run_test() {

View File

@ -29,10 +29,7 @@ def DevToolsModules(*modules):
# locations. Instead of doing this, use this DevToolsModules syntax via
# moz.build files to do the installation so that we can enforce correct
# paths based on source tree location.
base = FINAL_TARGET_FILES.features['devtools@mozilla.org'].chrome.modules
relative = RELATIVEDIR.split('/')
# Remove 'devtools' to got straight to client, shared or server folders
relative.pop(0)
for dir in relative:
base = FINAL_TARGET_FILES.chrome.devtools.modules
for dir in RELATIVEDIR.split('/'):
base = base[dir]
base += [m for m in modules]