Merge mozilla-central to mozilla-inbound. r=merge a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2017-11-24 00:38:13 +02:00
Родитель 09d19b6c47 da0a72a9d7
Коммит 21905d169e
258 изменённых файлов: 4601 добавлений и 3098 удалений

Просмотреть файл

@ -1716,6 +1716,8 @@ pref("extensions.formautofill.firstTimeUse", true);
pref("extensions.formautofill.heuristics.enabled", true);
pref("extensions.formautofill.section.enabled", true);
pref("extensions.formautofill.loglevel", "Warn");
// Comma separated list of countries Form Autofill supports
pref("extensions.formautofill.supportedCountries", "US");
// Whether or not to restore a session with lazy-browser tabs.
pref("browser.sessionstore.restore_tabs_lazily", true);

Просмотреть файл

@ -12,9 +12,6 @@ const ADDRESS_METADATA_PATH = "resource://formautofill/addressmetadata/";
const ADDRESS_REFERENCES = "addressReferences.js";
const ADDRESS_REFERENCES_EXT = "addressReferencesExt.js";
// TODO: This list should become a pref in Bug 1413494
const SUPPORTED_COUNTRY_LIST = ["US"];
const ADDRESSES_COLLECTION_NAME = "addresses";
const CREDITCARDS_COLLECTION_NAME = "creditCards";
const ADDRESSES_FIRST_TIME_USE_PREF = "extensions.formautofill.firstTimeUse";
@ -22,6 +19,7 @@ const ENABLED_AUTOFILL_ADDRESSES_PREF = "extensions.formautofill.addresses.enabl
const CREDITCARDS_USED_STATUS_PREF = "extensions.formautofill.creditCards.used";
const AUTOFILL_CREDITCARDS_AVAILABLE_PREF = "extensions.formautofill.creditCards.available";
const ENABLED_AUTOFILL_CREDITCARDS_PREF = "extensions.formautofill.creditCards.enabled";
const SUPPORTED_COUNTRIES_PREF = "extensions.formautofill.supportedCountries";
const MANAGE_ADDRESSES_KEYWORDS = ["manageAddressesTitle", "addNewAddressTitle"];
const EDIT_ADDRESS_KEYWORDS = [
"givenName", "additionalName", "familyName", "organization2", "streetAddress",
@ -378,7 +376,7 @@ this.FormAutofillUtils = {
* @returns {string} The matching country code.
*/
identifyCountryCode(countryName, countrySpecified) {
let countries = countrySpecified ? [countrySpecified] : SUPPORTED_COUNTRY_LIST;
let countries = countrySpecified ? [countrySpecified] : this.supportedCountries;
for (let country of countries) {
let collators = this.getCollators(country);
@ -696,3 +694,6 @@ XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
"isAutofillAddressesFirstTimeUse", ADDRESSES_FIRST_TIME_USE_PREF);
XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
"AutofillCreditCardsUsedStatus", CREDITCARDS_USED_STATUS_PREF);
XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
"supportedCountries", SUPPORTED_COUNTRIES_PREF, null, null,
val => val.split(","));

Просмотреть файл

@ -1216,9 +1216,7 @@ class Addresses extends AutofillRecords {
}
_recordReadProcessor(address) {
// TODO: We only support US in MVP so hide the field if it's not. We
// are going to support more countries in bug 1370193.
if (address.country && address.country != "US") {
if (address.country && !FormAutofillUtils.supportedCountries.includes(address.country)) {
delete address.country;
delete address["country-name"];
}

Просмотреть файл

@ -59,7 +59,9 @@ function isAvailable() {
} else if (availablePref == "detect") {
let locale = Services.locale.getRequestedLocale();
let region = Services.prefs.getCharPref("browser.search.region", "");
return locale == "en-US" && region == "US";
let supportedCountries = Services.prefs.getCharPref("extensions.formautofill.supportedCountries")
.split(",");
return locale == "en-US" && supportedCountries.includes(region);
}
return false;
}

Просмотреть файл

@ -49,10 +49,9 @@
<span data-localization="country"/>
<select id="country">
<option/>
<option value="US" data-localization="us"/>
</select>
</label>
<p id="country-warning-message" data-localization="countryWarningMessage"/>
<p id="country-warning-message" data-localization="countryWarningMessage2"/>
<label id="email-container">
<span data-localization="email"/>
<input id="email" type="email"/>

Просмотреть файл

@ -205,6 +205,14 @@ class EditAddress extends EditDialog {
if (this._record) {
this._elements.title.dataset.localization = "editAddressTitle";
}
let fragment = document.createDocumentFragment();
for (let country of FormAutofillUtils.supportedCountries) {
let option = new Option();
option.value = country;
option.dataset.localization = country.toLowerCase();
fragment.appendChild(option);
}
this._elements.country.appendChild(fragment);
FormAutofillUtils.localizeMarkup(REGIONS_BUNDLE_URI, this._elements.country);
}

Просмотреть файл

@ -126,7 +126,7 @@ tel = Phone
email = Email
cancelBtnLabel = Cancel
saveBtnLabel = Save
countryWarningMessage = Form Autofill is currently available only for US addresses
countryWarningMessage2 = Form Autofill is currently available only for certain countries.
# LOCALIZATION NOTE (addNewCreditCardTitle, editCreditCardTitle): The dialog title for creating or editing
# credit cards in browser preferences.

Просмотреть файл

@ -376,6 +376,8 @@
@RESPATH@/browser/components/aboutdebugging.manifest
@RESPATH@/browser/components/aboutdevtools-registration.js
@RESPATH@/browser/components/aboutdevtools.manifest
@RESPATH@/browser/components/aboutdevtoolstoolbox-registration.js
@RESPATH@/browser/components/aboutdevtoolstoolbox.manifest
@RESPATH@/browser/components/Experiments.manifest
@RESPATH@/browser/components/ExperimentsService.js
@RESPATH@/browser/components/browser-newtab.xpt

Просмотреть файл

@ -14,28 +14,17 @@ option('--enable-jemalloc', env='MOZ_MEMORY',
help='Replace memory allocator with jemalloc')
@depends('--enable-jemalloc', target, build_project, c_compiler)
def jemalloc(value, target, build_project, c_compiler):
@depends('--enable-jemalloc', target, c_compiler)
def jemalloc(value, target, c_compiler):
if value.origin != 'default':
return bool(value) or None
if build_project == 'js':
return True
if target.kernel == 'Darwin' and target.cpu == 'x86_64':
# Don't enable by default on 32-bits OSX. See bug 702250.
if target.kernel in ('Darwin', 'Linux'):
return True
if target.kernel == 'WINNT' and c_compiler.type in ('msvc', 'clang-cl'):
return True
if target.kernel == 'Linux':
return True
if value and target.kernel not in ('WINNT', 'Linux', 'Darwin', 'kFreeBSD',
'FreeBSD', 'NetBSD'):
die('--enable-jemalloc is not supported on %s', target.kernel)
set_config('MOZ_MEMORY', jemalloc)
set_define('MOZ_MEMORY', jemalloc)

Просмотреть файл

@ -39,13 +39,11 @@ var AboutDebugging = {
return;
}
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
DebuggerServer.init();
DebuggerServer.allowChromeProcess = true;
// We want a full featured server for about:debugging. Especially the
// "browser actors" like addons.
DebuggerServer.registerActors({ root: true, browser: true, tab: true });
DebuggerServer.registerAllActors();
this.client = new DebuggerClient(DebuggerServer.connectPipe());

Просмотреть файл

@ -6,7 +6,7 @@
"use strict";
const {Task} = require("devtools/shared/task");
const { Task } = require("devtools/shared/task");
const EventEmitter = require("devtools/shared/event-emitter");
const {
createNode,
@ -15,9 +15,9 @@ const {
TimeScale,
getCssPropertyName
} = require("devtools/client/animationinspector/utils");
const {AnimationDetails} = require("devtools/client/animationinspector/components/animation-details");
const {AnimationTargetNode} = require("devtools/client/animationinspector/components/animation-target-node");
const {AnimationTimeBlock} = require("devtools/client/animationinspector/components/animation-time-block");
const { AnimationDetails } = require("devtools/client/animationinspector/components/animation-details");
const { AnimationTargetNode } = require("devtools/client/animationinspector/components/animation-target-node");
const { AnimationTimeBlock } = require("devtools/client/animationinspector/components/animation-time-block");
const { LocalizationHelper } = require("devtools/shared/l10n");
const L10N =
@ -85,10 +85,11 @@ AnimationsTimeline.prototype = {
useOnlyShared: true
}).require;
const React = browserRequire("devtools/client/shared/vendor/react");
const { createFactory } = browserRequire("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
const SplitBox = React.createFactory(
const SplitBox = createFactory(
browserRequire("devtools/client/shared/components/splitter/SplitBox"));
const splitter = SplitBox({
@ -96,10 +97,10 @@ AnimationsTimeline.prototype = {
splitterSize: 1,
initialHeight: "50%",
endPanelControl: true,
startPanel: React.DOM.div({
startPanel: dom.div({
className: "animation-timeline"
}),
endPanel: React.DOM.div({
endPanel: dom.div({
className: "animation-detail"
}),
vert: false

Просмотреть файл

@ -191,10 +191,8 @@ function reload(aTarget, aWaitForTargetEvent = "navigate") {
}
function initServer() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
}
function initCallWatcherBackend(aUrl) {

Просмотреть файл

@ -18,10 +18,8 @@ var { DebuggerServer } = customLoader.require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
function initDebuggerClient() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();

Просмотреть файл

@ -11,7 +11,7 @@ function test() {
SpecialPowers.setIntPref(MAX_TOTAL_VIEWERS, 10);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client);

Просмотреть файл

@ -4,7 +4,7 @@ var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
function test() {
Task.spawn(function* () {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let client1 = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client1);

Просмотреть файл

@ -12,10 +12,8 @@ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-01.html";
var gClient, gThreadClient, gInput, gButton;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -13,10 +13,8 @@ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-03.html";
var gClient, gThreadClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -20,10 +20,8 @@ customLoader.invisibleToDebugger = true;
var { DebuggerServer } = customLoader.require("devtools/server/main");
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();

Просмотреть файл

@ -13,10 +13,8 @@ var gClient;
var gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -13,10 +13,8 @@ var gClient;
var gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -14,10 +14,8 @@ var gClient;
var gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -14,10 +14,8 @@ var gClient;
var gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -12,10 +12,8 @@ const ACTORS_URL = CHROME_URL + "testactors.js";
function test() {
let gClient;
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.addActors(ACTORS_URL);

Просмотреть файл

@ -14,10 +14,8 @@ const ADDON2_PATH = "addon2.xpi";
var gAddon1, gAddon1Actor, gAddon2, gAddon2Actor, gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -13,10 +13,8 @@ const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -25,10 +25,8 @@ function onListChangedHandler() {
}
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
gTabList = new BrowserTabList("fake DebuggerServerConnection");
gTabList._testing = true;

Просмотреть файл

@ -12,10 +12,8 @@ const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -5,7 +5,7 @@ var WORKER2_URL = "code_listworkers-worker2.js";
function test() {
Task.spawn(function* () {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client);

Просмотреть файл

@ -15,10 +15,8 @@ var gNewTab, gNewWindow;
var gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -13,10 +13,8 @@ const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
var gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);

Просмотреть файл

@ -16,7 +16,7 @@ var EventEmitter = require("devtools/shared/event-emitter");
function test() {
Task.spawn(function* () {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let options = {
source: TAB_URL,

Просмотреть файл

@ -24,7 +24,7 @@ function test() {
requestLongerTimeout(10);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());

Просмотреть файл

@ -34,7 +34,7 @@ const TEST_DATA = [
function test() {
Task.spawn(function* () {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let options = {
source: TAB_URL,

Просмотреть файл

@ -41,7 +41,7 @@ const TEST_DATA = [
function test() {
Task.spawn(function* () {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let options = {
source: TAB_URL,

Просмотреть файл

@ -13,10 +13,8 @@ const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
var gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.addActors(ACTORS_URL);

Просмотреть файл

@ -13,10 +13,8 @@ const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
var gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.addActors(ACTORS_URL);

Просмотреть файл

@ -15,7 +15,7 @@ add_task(function* () {
yield pushPrefs(["devtools.scratchpad.enabled", true]);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client);

Просмотреть файл

@ -627,10 +627,8 @@ AddonDebugger.prototype = {
init: Task.async(function* (aAddonId) {
info("Initializing an addon debugger panel.");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
this.frame = document.createElement("iframe");
@ -1324,10 +1322,8 @@ function waitForDispatch(panel, type, eventRepeat = 1) {
}
function* initWorkerDebugger(TAB_URL, WORKER_URL) {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client);

Просмотреть файл

@ -145,7 +145,7 @@ BrowserToolboxProcess.prototype = {
// We mainly need a root actor and tab actors for opening a toolbox, even
// against chrome/content/addon. But the "no auto hide" button uses the
// preference actor, so also register the browser actors.
this.debuggerServer.registerActors({ root: true, browser: true, tab: true });
this.debuggerServer.registerAllActors();
this.debuggerServer.allowChromeProcess = true;
dumpn("initialized and added the browser actors for the DebuggerServer.");

Просмотреть файл

@ -1,63 +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";
// Register about:devtools-toolbox which allows to open a devtools toolbox
// in a Firefox tab or a custom html iframe in browser.html
const { Ci, Cu, Cm, components } = require("chrome");
const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
const Services = require("Services");
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
const { nsIAboutModule } = Ci;
function AboutURL() {}
AboutURL.prototype = {
uri: Services.io.newURI("chrome://devtools/content/framework/toolbox.xul"),
classDescription: "about:devtools-toolbox",
classID: components.ID("11342911-3135-45a8-8d71-737a2b0ad469"),
contractID: "@mozilla.org/network/protocol/about;1?what=devtools-toolbox",
QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]),
newChannel: function (aURI, aLoadInfo) {
let chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, aLoadInfo);
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
chan.originalURI = aURI;
return chan;
},
getURIFlags: function (aURI) {
return nsIAboutModule.ALLOW_SCRIPT |
nsIAboutModule.ENABLE_INDEXED_DB |
nsIAboutModule.HIDE_FROM_ABOUTABOUT;
}
};
AboutURL.createInstance = function (outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return new AboutURL();
};
exports.register = function () {
if (registrar.isCIDRegistered(AboutURL.prototype.classID)) {
console.error("Trying to register " + AboutURL.prototype.classDescription +
" more than once.");
} else {
registrar.registerFactory(AboutURL.prototype.classID,
AboutURL.prototype.classDescription,
AboutURL.prototype.contractID,
AboutURL);
}
};
exports.unregister = function () {
if (registrar.isCIDRegistered(AboutURL.prototype.classID)) {
registrar.unregisterFactory(AboutURL.prototype.classID, AboutURL);
}
};

Просмотреть файл

@ -60,13 +60,6 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
*/
_toolbars: new WeakMap(),
_tabStats: {
peakOpen: 0,
peakPinned: 0,
histOpen: [],
histPinned: []
},
/**
* This function is for the benefit of Tools:DevToolbox in
* browser/base/content/browser-sets.inc and should not be used outside
@ -328,10 +321,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
_getContentProcessTarget(processId) {
// Create a DebuggerServer in order to connect locally to it
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();
@ -476,10 +467,6 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
let tabContainer = win.gBrowser.tabContainer;
tabContainer.addEventListener("TabSelect", this);
tabContainer.addEventListener("TabOpen", this);
tabContainer.addEventListener("TabClose", this);
tabContainer.addEventListener("TabPinned", this);
tabContainer.addEventListener("TabUnpinned", this);
},
/**
@ -711,35 +698,10 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
let tabContainer = win.gBrowser.tabContainer;
tabContainer.removeEventListener("TabSelect", this);
tabContainer.removeEventListener("TabOpen", this);
tabContainer.removeEventListener("TabClose", this);
tabContainer.removeEventListener("TabPinned", this);
tabContainer.removeEventListener("TabUnpinned", this);
},
handleEvent(event) {
switch (event.type) {
case "TabOpen":
case "TabClose":
case "TabPinned":
case "TabUnpinned":
let open = 0;
let pinned = 0;
for (let win of this._trackedBrowserWindows) {
let tabContainer = win.gBrowser.tabContainer;
let numPinnedTabs = win.gBrowser._numPinnedTabs || 0;
let numTabs = tabContainer.itemCount - numPinnedTabs;
open += numTabs;
pinned += numPinnedTabs;
}
this._tabStats.histOpen.push(open);
this._tabStats.histPinned.push(pinned);
this._tabStats.peakOpen = Math.max(open, this._tabStats.peakOpen);
this._tabStats.peakPinned = Math.max(pinned, this._tabStats.peakPinned);
break;
case "TabSelect":
gDevToolsBrowser._updateMenuCheckbox();
break;

Просмотреть файл

@ -24,7 +24,6 @@ loader.lazyRequireGetter(this, "WebExtensionInspectedWindowFront",
const {defaultTools: DefaultTools, defaultThemes: DefaultThemes} =
require("devtools/client/definitions");
const EventEmitter = require("devtools/shared/old-event-emitter");
const AboutDevTools = require("devtools/client/framework/about-devtools-toolbox");
const {Task} = require("devtools/shared/task");
const {getTheme, setTheme, addThemeObserver, removeThemeObserver} =
require("devtools/client/shared/theme");
@ -43,8 +42,6 @@ function DevTools() {
// List of toolboxes that are still in process of creation
this._creatingToolboxes = new Map(); // Map<target, toolbox Promise>
AboutDevTools.register();
EventEmitter.decorate(this);
// Listen for changes to the theme pref.
@ -668,7 +665,6 @@ DevTools.prototype = {
for (let [, toolbox] of this._toolboxes) {
toolbox.destroy();
}
AboutDevTools.unregister();
}
for (let [key, ] of this.getToolDefinitionMap()) {

Просмотреть файл

@ -14,7 +14,6 @@ DIRS += [
]
DevToolsModules(
'about-devtools-toolbox.js',
'attach-thread.js',
'browser-menus.js',
'devtools-browser.js',
@ -35,5 +34,5 @@ DevToolsModules(
'ToolboxProcess.jsm',
)
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Framework')
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Framework')

Просмотреть файл

@ -132,10 +132,8 @@ function* createClient(params) {
transport = yield DebuggerClient.socketConnect({ host, port, webSocket });
} else {
// Setup a server if we don't have one already running
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
transport = DebuggerServer.connectPipe();
}
return new DebuggerClient(transport);

Просмотреть файл

@ -404,15 +404,15 @@ TabTarget.prototype = {
if (this.isLocalTab) {
// Since a remote protocol connection will be made, let's start the
// DebuggerServer here, once and for all tools.
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
DebuggerServer.init();
// When connecting to a local tab, we only need the root actor.
// Then we are going to call DebuggerServer.connectToChild and talk
// directly with actors living in the child process.
// We also need browser actors for actor registry which enabled addons
// to register custom actors.
DebuggerServer.registerActors({ root: true, browser: true, tab: false });
// TODO: the comment and implementation are out of sync here. See Bug 1420134.
DebuggerServer.registerAllActors();
this._client = new DebuggerClient(DebuggerServer.connectPipe());
// A local TabTarget will never perform chrome debugging.

Просмотреть файл

@ -81,7 +81,7 @@ function* setupDebuggerServer(websocket) {
let { DebuggerServer } = loader.require("devtools/server/main");
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let listener = DebuggerServer.createListener();

Просмотреть файл

@ -63,10 +63,8 @@ function runTools(target) {
function getClient() {
let deferred = defer();
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
let client = new DebuggerClient(transport);

Просмотреть файл

@ -20,10 +20,8 @@ var gTabActor1, gTabActor2;
function test() {
waitForExplicitFinish();
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
openTabs();
}

Просмотреть файл

@ -28,10 +28,8 @@ function getChromeActors(callback)
let { DebuggerServer } = require("devtools/server/main");
let { DebuggerClient } = require("devtools/shared/client/debugger-client");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());

Просмотреть файл

@ -70,10 +70,8 @@ if (url.search.length > 1) {
// linkedBrowser is the only one attribute being queried by client.getTab
let tab = { linkedBrowser: iframe };
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield client.connect();

Просмотреть файл

@ -4,8 +4,10 @@
"use strict";
const { createFactory, DOM: dom, PropTypes, PureComponent } =
const { createFactory, PureComponent } =
require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const AnimationList = createFactory(require("./AnimationList"));
const AnimationListHeader = createFactory(require("./AnimationListHeader"));

Просмотреть файл

@ -4,8 +4,10 @@
"use strict";
const { createFactory, DOM: dom, PropTypes, PureComponent } =
const { createFactory, PureComponent } =
require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const AnimationTimelineTickList = createFactory(require("./AnimationTimelineTickList"));

Просмотреть файл

@ -4,8 +4,9 @@
"use strict";
const { DOM: dom, PropTypes, PureComponent } =
require("devtools/client/shared/vendor/react");
const { PureComponent } = require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
class AnimationTimeTickItem extends PureComponent {
static get propTypes() {

Просмотреть файл

@ -4,8 +4,10 @@
"use strict";
const { createFactory, DOM: dom, PropTypes, PureComponent } =
const { createFactory, PureComponent } =
require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const ReactDOM = require("devtools/client/shared/vendor/react-dom");

Просмотреть файл

@ -4,10 +4,8 @@
"use strict";
const {
DOM: dom,
PureComponent,
} = require("devtools/client/shared/vendor/react");
const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const { connect } = require("devtools/client/shared/vendor/react-redux");
class ChangesApp extends PureComponent {

Просмотреть файл

@ -4,10 +4,8 @@
"use strict";
const {
DOM: dom,
PureComponent,
} = require("devtools/client/shared/vendor/react");
const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const { connect } = require("devtools/client/shared/vendor/react-redux");
class EventsApp extends PureComponent {

Просмотреть файл

@ -15,23 +15,23 @@ const CONTENT_TEXT = "Hello World!";
add_task(function* () {
let { inspector } = yield openInspectorForURL(TEST_URI);
const React = inspector.React;
const { Component, createFactory } = inspector.React;
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const { div } = dom;
info("Adding custom panel.");
// Define custom side-panel.
let tabPanel = React.createFactory(React.createClass({
displayName: "myTabPanel",
render: function () {
class myTabPanel extends Component {
render() {
return (
div({className: "my-tab-panel"},
CONTENT_TEXT
)
);
}
}));
}
let tabPanel = createFactory(myTabPanel);
// Append custom panel (tab) into the Inspector panel and
// make sure it's selected by default (the last arg = true).
@ -40,16 +40,16 @@ add_task(function* () {
"My Panel is selected by default");
// Define another custom side-panel.
tabPanel = React.createFactory(React.createClass({
displayName: "myTabPanel2",
render: function () {
class myTabPanel2 extends Component {
render() {
return (
div({className: "my-tab-panel2"},
"Another Content"
)
);
}
}));
}
tabPanel = createFactory(myTabPanel2);
// Append second panel, but don't select it by default.
inspector.addSidebarTab("myPanel", "My Panel", tabPanel, false);

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
const { createFactory } = require("devtools/client/shared/vendor/react");
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
@ -17,35 +17,75 @@ const StackTrace = createFactory(require("devtools/client/shared/components/Stac
* This component represents a side panel responsible for
* rendering stack-trace info for selected request.
*/
function StackTracePanel({
connector,
openLink,
request,
sourceMapService,
}) {
let { stacktrace } = request.cause;
class StackTracePanel extends Component {
static get propTypes() {
return {
connector: PropTypes.object.isRequired,
request: PropTypes.object.isRequired,
sourceMapService: PropTypes.object,
openLink: PropTypes.func,
};
}
return (
div({ className: "panel-container" },
StackTrace({
stacktrace,
onViewSourceInDebugger: ({ url, line }) => {
return connector.viewSourceInDebugger(url, line);
},
sourceMapService,
openLink,
}),
)
);
/**
* `componentDidMount` is called when opening the StackTracePanel
* for the first time
*/
componentDidMount() {
this.maybeFetchStackTrace(this.props);
}
/**
* `componentWillReceiveProps` is the only method called when
* switching between two requests while this panel is displayed.
*/
componentWillReceiveProps(nextProps) {
this.maybeFetchStackTrace(nextProps);
}
/**
* When switching to another request, lazily fetch stack-trace
* from the backend. This Panel will first be empty and then
* display the content.
*/
maybeFetchStackTrace(props) {
// Fetch stack trace only if it's available and not yet
// on the client.
if (!props.request.stacktrace &&
props.request.cause.stacktraceAvailable) {
// This method will set `props.request.stacktrace`
// asynchronously and force another render.
props.connector.requestData(props.request.id, "stackTrace");
}
}
// Rendering
render() {
let {
connector,
openLink,
request,
sourceMapService,
} = this.props;
let {
stacktrace = []
} = request;
return (
div({ className: "panel-container" },
StackTrace({
stacktrace,
onViewSourceInDebugger: ({ url, line }) => {
return connector.viewSourceInDebugger(url, line);
},
sourceMapService,
openLink,
}),
)
);
}
}
StackTracePanel.displayName = "StackTracePanel";
StackTracePanel.propTypes = {
connector: PropTypes.object.isRequired,
request: PropTypes.object.isRequired,
sourceMapService: PropTypes.object,
openLink: PropTypes.func,
};
module.exports = StackTracePanel;

Просмотреть файл

@ -84,7 +84,7 @@ function TabboxPanel({
},
TimingsPanel({ request }),
),
request.cause && request.cause.stacktrace && request.cause.stacktrace.length > 0 &&
request.cause && request.cause.stacktraceAvailable &&
TabPanel({
id: PANELS.STACK_TRACE,
title: STACK_TRACE_TITLE,

Просмотреть файл

@ -83,6 +83,7 @@ class FirefoxConnector {
this.webConsoleClient = null;
this.timelineFront = null;
this.dataProvider = null;
this.panel = null;
}
pause() {
@ -129,11 +130,15 @@ class FirefoxConnector {
return;
}
let listener = () => {
if (!this.dataProvider.isPayloadQueueEmpty()) {
if (this.dataProvider && !this.dataProvider.isPayloadQueueEmpty()) {
return;
}
window.off(EVENTS.PAYLOAD_READY, listener);
this.onReloaded();
// Netmonitor may already be destroyed,
// so do not try to notify the listeners
if (this.dataProvider) {
this.onReloaded();
}
};
window.on(EVENTS.PAYLOAD_READY, listener);
}

Просмотреть файл

@ -66,6 +66,12 @@ class FirefoxDataProvider {
url,
isXHR,
cause,
// Compatibility code to support Firefox 58 and earlier that always
// send stack-trace immediately on networkEvent message.
// FF59+ supports fetching the traces lazily via requestData.
stacktrace: cause.stacktrace,
fromCache,
fromServiceWorker},
true,
@ -661,6 +667,19 @@ class FirefoxDataProvider {
emit(EVENTS.RECEIVED_EVENT_TIMINGS, response.from);
});
}
/**
* Handles information received for a "stackTrace" packet.
*
* @param {object} response the message received from the server.
*/
async onStackTrace(response) {
let payload = await this.updateRequest(response.from, {
stacktrace: response.stacktrace
});
emit(EVENTS.RECEIVED_EVENT_STACKTRACE, response.from);
return payload.stacktrace;
}
}
/**

Просмотреть файл

@ -93,6 +93,9 @@ const EVENTS = {
UPDATING_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdating:ResponseContent",
RECEIVED_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdated:ResponseContent",
// When stack-trace finishes receiving.
RECEIVED_EVENT_STACKTRACE: "NetMonitor:NetworkEventUpdated:StackTrace",
// Fired once the connection is established
CONNECTED: "connected",
@ -126,6 +129,7 @@ const UPDATE_PROPS = [
"responseContent",
"responseContentAvailable",
"formDataSections",
"stacktrace",
];
const PANELS = {

Просмотреть файл

@ -89,7 +89,7 @@ add_task(function* () {
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
let { document, store, windowRequire } = monitor.panelWin;
let { document, store, windowRequire, connector } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -102,6 +102,12 @@ add_task(function* () {
tab.linkedBrowser.loadURI(CAUSE_URL);
yield wait;
// Fetch stack-trace data from the backend and wait till
// all packets are received.
let requests = getSortedRequests(store.getState());
yield Promise.all(requests.map(requestItem =>
connector.requestData(requestItem.id, "stackTrace")));
is(store.getState().requests.requests.size, EXPECTED_REQUESTS.length,
"All the page events should be recorded.");
@ -118,7 +124,7 @@ add_task(function* () {
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);
let { stacktrace } = requestItem.cause;
let stacktrace = requestItem.stacktrace;
let stackLen = stacktrace ? stacktrace.length : 0;
if (stack) {

Просмотреть файл

@ -19,7 +19,7 @@ add_task(function* () {
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { store, windowRequire } = monitor.panelWin;
let { store, windowRequire, connector } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
@ -31,12 +31,18 @@ add_task(function* () {
yield performRequests(2, HSTS_SJS);
yield wait;
// Fetch stack-trace data from the backend and wait till
// all packets are received.
let requests = getSortedRequests(store.getState());
yield Promise.all(requests.map(requestItem =>
connector.requestData(requestItem.id, "stackTrace")));
EXPECTED_REQUESTS.forEach(({status, hasStack}, i) => {
let item = getSortedRequests(store.getState()).get(i);
is(item.status, status, `Request #${i} has the expected status`);
let { stacktrace } = item.cause;
let { stacktrace } = item;
let stackLen = stacktrace ? stacktrace.length : 0;
if (hasStack) {

Просмотреть файл

@ -158,7 +158,7 @@ add_task(function* () {
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
let { document, store, windowRequire } = monitor.panelWin;
let { document, store, windowRequire, connector } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -174,6 +174,12 @@ add_task(function* () {
is(store.getState().requests.requests.size, REQUEST_COUNT,
"All the page events should be recorded.");
// Fetch stack-trace data from the backend and wait till
// all packets are received.
let requests = getSortedRequests(store.getState());
yield Promise.all(requests.map(requestItem =>
connector.requestData(requestItem.id, "stackTrace")));
// While there is a defined order for requests in each document separately, the requests
// from different documents may interleave in various ways that change per test run, so
// there is not a single order when considering all the requests together.
@ -201,7 +207,7 @@ add_task(function* () {
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);
let { stacktrace } = requestItem.cause;
let { stacktrace } = requestItem;
let stackLen = stacktrace ? stacktrace.length : 0;
if (stack) {

Просмотреть файл

@ -16,7 +16,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(TEST_URL, true);
info("Starting test... ");
let { document, store, windowRequire } = monitor.panelWin;
let { document, store, windowRequire, connector } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -52,6 +52,12 @@ add_task(function* () {
});
yield wait;
// Fetch stack-trace data from the backend and wait till
// all packets are received.
let requests = getSortedRequests(store.getState());
yield Promise.all(requests.map(requestItem =>
connector.requestData(requestItem.id, "stackTrace")));
let requestItems = document.querySelectorAll(".request-list-item");
for (let requestItem of requestItems) {
requestItem.scrollIntoView();
@ -74,7 +80,7 @@ add_task(function* () {
request.details
);
let { stacktrace } = item.cause;
let { stacktrace } = item;
let stackLen = stacktrace ? stacktrace.length : 0;
ok(stacktrace, `Request #${index} has a stacktrace`);

Просмотреть файл

@ -23,7 +23,7 @@ add_task(async function () {
await waitForContentRequests;
info("Clicking stack-trace tab and waiting for stack-trace panel to open");
let wait = waitForDOM(document, "#stack-trace-panel");
let wait = waitForDOM(document, "#stack-trace-panel .frame-link", 4);
// Click on the first request
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelector(".request-list-item"));

Просмотреть файл

@ -430,10 +430,8 @@ ResponsiveUI.prototype = {
}),
connectToServer: Task.async(function* () {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
this.client = new DebuggerClient(DebuggerServer.connectPipe());
yield this.client.connect();
let { tab } = yield this.client.getTab();

Просмотреть файл

@ -2186,10 +2186,8 @@ ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, {
*/
_attach: function SW__attach()
{
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());

Просмотреть файл

@ -226,10 +226,8 @@ function reload(aTarget, aWaitForTargetEvent = "navigate") {
function initBackend(aUrl) {
info("Initializing a shader editor front.");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
return Task.spawn(function* () {
let tab = yield addTab(aUrl);

Просмотреть файл

@ -54,13 +54,13 @@ const NUMBER_OF_OFFSCREEN_ITEMS = 1;
*
* Here is how we could render that data with this component:
*
* const MyTree = createClass({
* displayName: "MyTree",
*
* propTypes: {
* class MyTree extends Component {
* static get propTypes() {
* // The root item of the tree, with the form described above.
* root: PropTypes.object.isRequired
* },
* return {
* root: PropTypes.object.isRequired
* };
* }
*
* render() {
* return Tree({
@ -96,7 +96,7 @@ const NUMBER_OF_OFFSCREEN_ITEMS = 1;
* onCollapse: item => dispatchCollapseActionToRedux(item),
* });
* }
* });
* }
*/
class Tree extends Component {
static get propTypes() {

Просмотреть файл

@ -66,10 +66,8 @@
// We need to spawn a client instance,
// but for that we have to first ensure a server is running
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield client.connect();

Просмотреть файл

@ -161,10 +161,8 @@ function loadFrameScripts() {
function initBackend(aUrl) {
info("Initializing a web audio editor front.");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
return Task.spawn(function* () {
let tab = yield addTab(aUrl);

Просмотреть файл

@ -188,14 +188,11 @@ HUD_SERVICE.prototype =
{
let deferred = defer();
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
// Ensure that the root actor and the tab actors have been registered on the DebuggerServer,
// so that the Browser Console can retrieve the console actors.
// (See Bug 1416105 for rationale).
DebuggerServer.registerActors({ root: true, browser: false, tab: true });
DebuggerServer.init();
DebuggerServer.registerActors({ root: true, tab: true });
DebuggerServer.allowChromeProcess = true;

Просмотреть файл

@ -25,7 +25,7 @@ function filterBarToggle(show) {
type: FILTER_BAR_TOGGLE,
});
const uiState = getAllUi(getState());
Services.prefs.setBoolPref(PREFS.UI.FILTER_BAR, uiState.get("filterBarVisible"));
Services.prefs.setBoolPref(PREFS.UI.FILTER_BAR, uiState.filterBarVisible);
};
}
@ -35,7 +35,7 @@ function persistToggle(show) {
type: PERSIST_TOGGLE,
});
const uiState = getAllUi(getState());
Services.prefs.setBoolPref(PREFS.UI.PERSIST, uiState.get("persistLogs"));
Services.prefs.setBoolPref(PREFS.UI.PERSIST, uiState.persistLogs);
};
}

Просмотреть файл

@ -37,6 +37,7 @@ GripMessageBody.propTypes = {
serviceContainer: PropTypes.shape({
createElement: PropTypes.func.isRequired,
hudProxy: PropTypes.object.isRequired,
onViewSourceInDebugger: PropTypes.func.isRequired,
}),
userProvidedStyle: PropTypes.string,
useQuotes: PropTypes.bool,
@ -102,6 +103,7 @@ function GripMessageBody(props) {
}
serviceContainer.hudProxy.releaseActor(actor);
},
onViewSourceInDebugger: serviceContainer.onViewSourceInDebugger,
openLink: serviceContainer.openLink,
};

Просмотреть файл

@ -13,35 +13,34 @@ const {
SIDEBAR_TOGGLE,
TIMESTAMPS_TOGGLE,
} = require("devtools/client/webconsole/new-console-output/constants");
const Immutable = require("devtools/client/shared/vendor/immutable");
const {
PANELS,
} = require("devtools/client/netmonitor/src/constants");
const UiState = Immutable.Record({
const UiState = (overrides) => Object.freeze(Object.assign({
filterBarVisible: false,
initialized: false,
networkMessageActiveTabId: PANELS.HEADERS,
persistLogs: false,
sidebarVisible: false,
timestampsVisible: true,
});
}, overrides));
function ui(state = new UiState(), action) {
function ui(state = UiState(), action) {
switch (action.type) {
case FILTER_BAR_TOGGLE:
return state.set("filterBarVisible", !state.filterBarVisible);
return Object.assign({}, state, {filterBarVisible: !state.filterBarVisible});
case PERSIST_TOGGLE:
return state.set("persistLogs", !state.persistLogs);
return Object.assign({}, state, {persistLogs: !state.persistLogs});
case TIMESTAMPS_TOGGLE:
return state.set("timestampsVisible", action.visible);
return Object.assign({}, state, {timestampsVisible: action.visible});
case SELECT_NETWORK_MESSAGE_TAB:
return state.set("networkMessageActiveTabId", action.id);
return Object.assign({}, state, {networkMessageActiveTabId: action.id});
case SIDEBAR_TOGGLE:
return state.set("sidebarVisible", !state.sidebarVisible);
return Object.assign({}, state, {sidebarVisible: !state.sidebarVisible});
case INITIALIZE:
return state.set("initialized", true);
return Object.assign({}, state, {initialized: true});
}
return state;

Просмотреть файл

@ -56,7 +56,7 @@ function configureStore(hud, options = {}) {
net: Services.prefs.getBoolPref(PREFS.FILTER.NET),
netxhr: Services.prefs.getBoolPref(PREFS.FILTER.NETXHR),
}),
ui: new UiState({
ui: UiState({
filterBarVisible: Services.prefs.getBoolPref(PREFS.UI.FILTER_BAR),
networkMessageActiveTabId: "headers",
persistLogs: Services.prefs.getBoolPref(PREFS.UI.PERSIST),

Просмотреть файл

@ -45,29 +45,7 @@ stubPreparedMessages.set("GET request", new NetworkEventMessage({
"cause": {
"type": "img",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 3,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
}
}));
@ -145,29 +123,7 @@ stubPreparedMessages.set("XHR GET request", new NetworkEventMessage({
"cause": {
"type": "xhr",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 4,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
}
}));
@ -245,29 +201,7 @@ stubPreparedMessages.set("XHR POST request", new NetworkEventMessage({
"cause": {
"type": "xhr",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 4,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
}
}));
@ -329,29 +263,7 @@ stubPackets.set("GET request", {
"cause": {
"type": "img",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 3,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
},
"response": {},
"timings": {},
@ -402,29 +314,7 @@ stubPackets.set("XHR GET request", {
"cause": {
"type": "xhr",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 4,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
},
"response": {},
"timings": {},
@ -475,29 +365,7 @@ stubPackets.set("XHR POST request", {
"cause": {
"type": "xhr",
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"stacktrace": [
{
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
"lineNumber": 4,
"columnNumber": 1,
"functionName": "triggerPacket",
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js line 52 > eval",
"lineNumber": 8,
"columnNumber": 9,
"functionName": null,
"asyncCause": null
},
{
"filename": "resource://testing-common/content-task.js",
"lineNumber": 53,
"columnNumber": 20,
"functionName": null,
"asyncCause": null
}
]
"stacktraceAvailable": true
},
"response": {},
"timings": {},

Просмотреть файл

@ -15,8 +15,8 @@ support-files =
test_bug_1247459_violation.html
test_bug_770099_violation.html
test_bug_770099_violation.html^headers^
test_bug1045902_console_csp_ignore_reflected_xss_message.html
test_bug1045902_console_csp_ignore_reflected_xss_message.html^headers^
test_console_csp_ignore_reflected_xss_message.html
test_console_csp_ignore_reflected_xss_message.html^headers^
test_bug1092055_shouldwarn.html
test_bug1092055_shouldwarn.js
test_bug1092055_shouldwarn.js^headers^
@ -256,8 +256,7 @@ subsuite = clipboard
[browser_webconsole_copy_link_location.js]
skip-if = true # Bug 1401944
[browser_webconsole_csp_ignore_reflected_xss_message.js]
skip-if = true # Bug 1408931
# old console skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows
skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows
[browser_webconsole_cspro.js]
skip-if = true # Bug 1408932
# old console skip-if = e10s && (os == 'win' || os == 'mac') # Bug 1243967

Просмотреть файл

@ -4,49 +4,28 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that a file with an unsupported CSP directive ('reflected-xss filter')
// displays the appropriate message to the console.
// displays the appropriate message to the console. See Bug 1045902.
"use strict";
const EXPECTED_RESULT = "Not supporting directive \u2018reflected-xss\u2019. " +
"Directive and values will be ignored.";
const TEST_FILE = "http://example.com/browser/devtools/client/webconsole/" +
"test/test_bug1045902_console_csp_ignore_reflected_xss_" +
"message.html";
const TEST_FILE =
"http://example.com/browser/devtools/client/webconsole/new-console-output/test/" +
"mochitest/test_console_csp_ignore_reflected_xss_message.html";
var hud = undefined;
const TEST_URI =
"data:text/html;charset=utf8,Web Console CSP ignoring reflected XSS (bug 1045902)";
var TEST_URI = "data:text/html;charset=utf8,Web Console CSP ignoring " +
"reflected XSS (bug 1045902)";
const cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
add_task(function* () {
let { browser } = yield loadTab(TEST_URI);
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
await loadDocument(TEST_FILE);
hud = yield openConsole();
await waitFor(() => findMessage(hud, EXPECTED_RESULT, ".message.warn"));
ok(true, `CSP logs displayed in console when using "reflected-xss" directive`);
yield loadDocument(browser);
yield testViolationMessage();
hud = null;
cache.clear();
});
function loadDocument(browser) {
hud.jsterm.clearOutput();
browser.loadURI(TEST_FILE);
return BrowserTestUtils.browserLoaded(browser);
}
function testViolationMessage() {
let aOutputNode = hud.outputNode;
return waitForSuccess({
name: "Confirming that CSP logs messages to the console when " +
"\u2018reflected-xss\u2019 directive is used!",
validator: function () {
console.log(aOutputNode.textContent);
let success = false;
success = aOutputNode.textContent.indexOf(EXPECTED_RESULT) > -1;
return success;
}
});
}

Просмотреть файл

@ -437,10 +437,8 @@ exports._WiFiRuntime = WiFiRuntime;
var gLocalRuntime = {
type: RuntimeTypes.LOCAL,
connect: function (connection) {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
connection.host = null; // Force Pipe transport
connection.port = null;

Просмотреть файл

@ -13,7 +13,7 @@ function test() {
// was left open.
DebuggerServer.destroy();
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
let tab = yield addTab(TEST_URI);

Просмотреть файл

@ -19,10 +19,8 @@
SimpleTest.waitForExplicitFinish();
Task.spawn(function*() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = yield openWebIDE();
let docRuntime = getRuntimeDocument(win);

Просмотреть файл

@ -19,10 +19,8 @@
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = yield openWebIDE();
let docRuntime = getRuntimeDocument(win);

Просмотреть файл

@ -19,10 +19,8 @@
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = yield openWebIDE();

Просмотреть файл

@ -19,10 +19,8 @@
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = yield openWebIDE();

Просмотреть файл

@ -39,10 +39,8 @@
return !win.document.querySelector("#cmd_stop").hasAttribute("disabled");
}
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
win = yield openWebIDE();
let docRuntime = getRuntimeDocument(win);

Просмотреть файл

@ -31,10 +31,8 @@
});
Task.spawn(function*() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
win = yield openWebIDE();
let docRuntime = getRuntimeDocument(win);

Просмотреть файл

@ -30,7 +30,7 @@ DebuggerServer.registerModule("devtools/server/actors/addons", {
});
```
If you are adding a new built-in devtools actor, you should be registering it using `DebuggerServer.registerModule` in `addBrowserActors` or `addTabActors` in `/devtools/server/main.js`.
If you are adding a new built-in devtools actor, you should be registering it using `DebuggerServer.registerModule` in `_addBrowserActors` or `addTabActors` in `/devtools/server/main.js`.
If you are adding a new actor from an add-on, you should call `DebuggerServer.registerModule` directly from your add-on code.

Просмотреть файл

@ -12,10 +12,8 @@ Components.utils.import("resource://gre/modules/devtools/dbg-client.jsm");
function start() {
// Start the server.
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
// Listen to an nsIPipe
let transport = DebuggerServer.connectPipe();
@ -41,10 +39,8 @@ Components.utils.import("resource://gre/modules/devtools/dbg-client.jsm");
function startServer() {
// Start the server.
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
// For an nsIServerSocket we do this:
DebuggerServer.openListener(2929); // A connection on port 2929.
@ -166,10 +162,8 @@ let threadClient;
function startDebugger() {
// Start the server.
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
// Listen to an nsIPipe
let transport = DebuggerServer.connectPipe();
// For an nsIServerSocket we do this:

Просмотреть файл

@ -51,7 +51,7 @@ The actor implementation would go somewhere like
// You also need to export the actor class in your module for discovery.
exports.HelloActor = HelloActor;
To activate your actor, register it in the `addBrowserActors` method in `server/main.js`.
To activate your actor, register it in the `_addBrowserActors` method in `server/main.js`.
The registration code would look something like this:
this.registerModule("devtools/server/actors/hello-world", {

Просмотреть файл

@ -1936,6 +1936,7 @@ function NetworkEventActor(webConsoleActor) {
};
this._timings = {};
this._stackTrace = {};
// Keep track of LongStringActors owned by this NetworkEventActor.
this._longStringActors = new Set();
@ -2008,6 +2009,14 @@ NetworkEventActor.prototype =
this._fromCache = networkEvent.fromCache;
this._fromServiceWorker = networkEvent.fromServiceWorker;
// Stack trace info isn't sent automatically. The client
// needs to request it explicitly using getStackTrace
// packet.
this._stackTrace = networkEvent.cause.stacktrace;
delete networkEvent.cause.stacktrace;
networkEvent.cause.stacktraceAvailable =
!!(this._stackTrace && this._stackTrace.length);
for (let prop of ["method", "url", "httpVersion", "headersSize"]) {
this._request[prop] = networkEvent[prop];
}
@ -2129,6 +2138,19 @@ NetworkEventActor.prototype =
};
},
/**
* The "getStackTrace" packet type handler.
*
* @return object
* The response packet - stack trace.
*/
onGetStackTrace: function () {
return {
from: this.actorID,
stacktrace: this._stackTrace,
};
},
/** ****************************************************************
* Listeners for new network event data coming from NetworkMonitor.
******************************************************************/
@ -2377,4 +2399,5 @@ NetworkEventActor.prototype.requestTypes =
"getResponseContent": NetworkEventActor.prototype.onGetResponseContent,
"getEventTimings": NetworkEventActor.prototype.onGetEventTimings,
"getSecurityInfo": NetworkEventActor.prototype.onGetSecurityInfo,
"getStackTrace": NetworkEventActor.prototype.onGetStackTrace,
};

Просмотреть файл

@ -18,13 +18,11 @@ try {
const { dumpn } = DevToolsUtils;
const { DebuggerServer, ActorPool } = require("devtools/server/main");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
DebuggerServer.init();
// We want a special server without any root actor and only tab actors.
// We are going to spawn a ContentActor instance in the next few lines,
// it is going to act like a root actor without being one.
DebuggerServer.registerActors({ root: false, browser: false, tab: true });
DebuggerServer.registerActors({ tab: true });
let connections = new Map();

Просмотреть файл

@ -29,13 +29,11 @@ function setupServer(mm) {
gLoader.invisibleToDebugger = true;
let { DebuggerServer } = gLoader.require("devtools/server/main");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
DebuggerServer.init();
// For browser content toolbox, we do need a regular root actor and all tab
// actors, but don't need all the "browser actors" that are only useful when
// debugging the parent process via the browser toolbox.
DebuggerServer.registerActors({ browser: false, root: true, tab: true });
DebuggerServer.registerActors({ root: true, tab: true });
// Clean up things when the client disconnects
mm.addMessageListener("debug:content-process-destroy", function onDestroy() {

Просмотреть файл

@ -249,7 +249,7 @@ var DebuggerServer = {
},
/**
* Register all type of actors. Only register the one that are not already
* Register different type of actors. Only register the one that are not already
* registered.
*
* @param root boolean
@ -261,18 +261,10 @@ var DebuggerServer = {
* @param tab boolean
* Registers all the tab actors like console, script, ... all useful
* for debugging a target context.
* @param windowType string
* "windowtype" attribute of the main chrome windows. Used by some
* actors to retrieve them.
*/
registerActors({ root = true, browser = true, tab = true,
windowType = null }) {
if (windowType) {
this.chromeWindowType = windowType;
}
registerActors({ root, browser, tab }) {
if (browser) {
this.addBrowserActors(this.chromeWindowType);
this._addBrowserActors();
}
if (root) {
@ -280,10 +272,17 @@ var DebuggerServer = {
}
if (tab) {
this.addTabActors();
this._addTabActors();
}
},
/**
* Register all possible actors for this DebuggerServer.
*/
registerAllActors() {
this.registerActors({ root: true, browser: true, tab: true });
},
/**
* Load a subscript into the debugging global.
*
@ -417,30 +416,18 @@ var DebuggerServer = {
*
* /!\ Be careful when adding a new actor, especially global actors.
* Any new global actor will be exposed and returned by the root actor.
*
* That's the reason why tab actors aren't loaded on demand via
* restrictPrivileges=true, to prevent exposing them on b2g parent process's
* root actor.
*/
addBrowserActors(windowType = null, restrictPrivileges = false) {
if (windowType) {
this.chromeWindowType = windowType;
}
this.registerModule("devtools/server/actors/webbrowser");
if (!restrictPrivileges) {
this.addTabActors();
this.registerModule("devtools/server/actors/preference", {
prefix: "preference",
constructor: "PreferenceActor",
type: { global: true }
});
this.registerModule("devtools/server/actors/actor-registry", {
prefix: "actorRegistry",
constructor: "ActorRegistryActor",
type: { global: true }
});
}
_addBrowserActors() {
this.registerModule("devtools/server/actors/preference", {
prefix: "preference",
constructor: "PreferenceActor",
type: { global: true }
});
this.registerModule("devtools/server/actors/actor-registry", {
prefix: "actorRegistry",
constructor: "ActorRegistryActor",
type: { global: true }
});
this.registerModule("devtools/server/actors/addons", {
prefix: "addons",
constructor: "AddonsActor",
@ -461,7 +448,7 @@ var DebuggerServer = {
/**
* Install tab actors.
*/
addTabActors() {
_addTabActors() {
this.registerModule("devtools/server/actors/webconsole", {
prefix: "console",
constructor: "WebConsoleActor",

Просмотреть файл

@ -7,10 +7,8 @@ function test() {
let {ActorRegistryFront} = require("devtools/shared/fronts/actor-registry");
let actorURL = "chrome://mochitests/content/chrome/devtools/server/tests/mochitest/hello-actor.js";
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.init();
DebuggerServer.registerAllActors();
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect()

Просмотреть файл

@ -105,7 +105,7 @@ function initDebuggerServer() {
info(`DebuggerServer destroy error: ${e}\n${e.stack}`);
}
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerAllActors();
}
/**

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше