author | Sebastian Hengst <archaeopteryx@coole-files.de> |
Fri, 07 Apr 2017 18:56:15 +0200 | |
changeset 351888 | 67565a13d1a3abea5b4bed4405e647b6a4cbe7f7 |
parent 351887 | 22a0a8aff69d7e9d8faa24cea5b9761f27816d81 |
child 351889 | 69f2aef9c4530adaaff2c8b6a58e646b9ce16989 |
push id | 31623 |
push user | archaeopteryx@coole-files.de |
push date | Sat, 08 Apr 2017 20:46:02 +0000 |
treeherder | mozilla-central@21c4aca1ae60 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1352699 |
milestone | 55.0a1 |
backs out | ebf51fe3e26679392c7a4466de9c0b83fbfb8837 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/netmonitor/index.html +++ b/devtools/client/netmonitor/index.html @@ -18,37 +18,35 @@ const require = window.windowRequire = BrowserLoader({ baseURI: "resource://devtools/client/netmonitor/", window, }).require; const EventEmitter = require("devtools/shared/event-emitter"); const { createFactory } = require("devtools/client/shared/vendor/react"); const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom"); - const { bindActionCreators } = require("devtools/client/shared/vendor/redux"); const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider); const { configureStore } = require("./src/utils/create-store"); const store = window.gStore = configureStore(); - const actions = bindActionCreators(require("./src/actions/index"), store.dispatch); const { NetMonitorController } = require("./src/netmonitor-controller"); // Inject EventEmitter into global window. EventEmitter.decorate(window); window.Netmonitor = { bootstrap({ toolbox }) { this.mount = document.querySelector("#mount"); const App = createFactory(require("./src/components/app")); render(Provider({ store }, App()), this.mount); return NetMonitorController.startupNetMonitor({ tabConnection: { tabTarget: toolbox.target, }, toolbox, - }, actions); + }); }, destroy() { unmountComponentAtNode(this.mount); return NetMonitorController.shutdownNetMonitor(); } }; </script>
--- a/devtools/client/netmonitor/index.js +++ b/devtools/client/netmonitor/index.js @@ -6,17 +6,16 @@ /** * This script is the entry point of devtools-launchpad. Make netmonitor possible * to run on standalone browser tab without chrome privilege. * See README.md for more information. */ const React = require("react"); const ReactDOM = require("react-dom"); -const { bindActionCreators } = require("redux"); const { bootstrap, renderRoot } = require("devtools-launchpad"); const { EventEmitter } = require("devtools-modules"); const { Services: { appinfo, pref }} = require("devtools-modules"); const { configureStore } = require("./src/utils/create-store"); require("./src/assets/styles/netmonitor.css"); EventEmitter.decorate(window); @@ -34,17 +33,16 @@ pref("devtools.netmonitor.har.includeRes pref("devtools.netmonitor.har.compress", false); pref("devtools.netmonitor.har.forceExport", false); pref("devtools.netmonitor.har.pageLoadedTimeout", 1500); pref("devtools.netmonitor.har.enableAutoExportToFile", false); pref("devtools.webconsole.persistlog", false); const App = require("./src/components/app"); const store = window.gStore = configureStore(); -const actions = bindActionCreators(require("./src/actions"), store.dispatch); const { NetMonitorController } = require("./src/netmonitor-controller"); /** * Stylesheet links in devtools xhtml files are using chrome or resource URLs. * Rewrite the href attribute to remove the protocol. web-server.js contains redirects * to map CSS urls to the proper file. Supports urls using: * - devtools/client/ * - devtools/content/ @@ -66,10 +64,10 @@ window.addEventListener("DOMContentLoade } }); bootstrap(React, ReactDOM).then(connection => { if (!connection) { return; } renderRoot(React, ReactDOM, App, store); - NetMonitorController.startupNetMonitor(connection, actions); + NetMonitorController.startupNetMonitor(connection); });
--- a/devtools/client/netmonitor/src/netmonitor-controller.js +++ b/devtools/client/netmonitor/src/netmonitor-controller.js @@ -2,46 +2,46 @@ * 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 { TimelineFront } = require("devtools/shared/fronts/timeline"); const { CurlUtils } = require("devtools/client/shared/curl"); const { ACTIVITY_TYPE, EVENTS } = require("./constants"); -const { - getDisplayedRequestById, - getRequestById, -} = require("./selectors/index"); +const Actions = require("./actions/index"); const { fetchHeaders, formDataURI, } = require("./utils/request-utils"); const { getLongString, getWebConsoleClient, onFirefoxConnect, onFirefoxDisconnect, } = require("./utils/client"); +const { + getRequestById, + getDisplayedRequestById, +} = require("./selectors/index"); /** * Object defining the network monitor controller components. */ var NetMonitorController = { /** * Initializes the view and connects the monitor client. * * @param {Object} connection connection data wrapper * @return {Object} A promise that is resolved when the monitor finishes startup. */ - startupNetMonitor(connection, actions) { + startupNetMonitor(connection) { if (this._startup) { return this._startup; } - this.actions = actions; this._startup = new Promise(async (resolve) => { await this.connect(connection); resolve(); }); return this._startup; }, /** @@ -50,17 +50,17 @@ var NetMonitorController = { * @return object * A promise that is resolved when the monitor finishes shutdown. */ shutdownNetMonitor() { if (this._shutdown) { return this._shutdown; } this._shutdown = new Promise(async (resolve) => { - this.actions.batchReset(); + window.gStore.dispatch(Actions.batchReset()); onFirefoxDisconnect(this._target); this._target.off("close", this._onTabDetached); this.NetworkEventsHandler.disconnect(); await this.disconnect(); resolve(); }); return this._shutdown; @@ -100,17 +100,17 @@ var NetMonitorController = { }; await connectTimeline(); onFirefoxConnect(this._target); this._target.on("close", this._onTabDetached); this.webConsoleClient = getWebConsoleClient(); this.NetworkEventsHandler = new NetworkEventsHandler(); - this.NetworkEventsHandler.connect(this.actions); + this.NetworkEventsHandler.connect(); window.emit(EVENTS.CONNECTED); resolve(); this._connected = true; }); return this._connection; }, @@ -255,25 +255,25 @@ var NetMonitorController = { // Look for the request in the existing ones or wait for it to appear, if // the network monitor is still loading. return new Promise((resolve) => { let request = null; let inspector = () => { request = getDisplayedRequestById(window.gStore.getState(), requestId); if (!request) { // Reset filters so that the request is visible. - this.actions.toggleRequestFilterType("all"); + window.gStore.dispatch(Actions.toggleRequestFilterType("all")); request = getDisplayedRequestById(window.gStore.getState(), requestId); } // If the request was found, select it. Otherwise this function will be // called again once new requests arrive. if (request) { window.off(EVENTS.REQUEST_ADDED, inspector); - this.actions.selectRequest(request.id); + window.gStore.dispatch(Actions.selectRequest(request.id)); resolve(); } }; inspector(); if (!request) { window.on(EVENTS.REQUEST_ADDED, inspector); } @@ -397,18 +397,17 @@ NetworkEventsHandler.prototype = { get timelineFront() { return NetMonitorController.timelineFront; }, /** * Connect to the current target client. */ - connect: function (actions) { - this.actions = actions; + connect: function () { this.webConsoleClient.on("networkEvent", this._onNetworkEvent); this.webConsoleClient.on("networkEventUpdate", this._onNetworkEventUpdate); if (this.timelineFront) { this.timelineFront.on("doc-loading", this._onDocLoadingMarker); } this._displayCachedEvents(); @@ -449,17 +448,17 @@ NetworkEventsHandler.prototype = { }, /** * The "DOMContentLoaded" and "Load" events sent by the timeline actor. * @param object marker */ _onDocLoadingMarker: function (marker) { window.emit(EVENTS.TIMELINE_EVENT, marker); - this.actions.addTimingMarker(marker); + window.gStore.dispatch(Actions.addTimingMarker(marker)); }, /** * The "networkEvent" message type handler. * * @param string type * Message type. * @param object networkInfo @@ -480,81 +479,82 @@ NetworkEventsHandler.prototype = { ); window.emit(EVENTS.NETWORK_EVENT, actor); }, addRequest(id, data) { let { method, url, isXHR, cause, startedDateTime, fromCache, fromServiceWorker } = data; - this.actions.addRequest( + window.gStore.dispatch(Actions.addRequest( id, { // Convert the received date/time string to a unix timestamp. startedMillis: Date.parse(startedDateTime), method, url, isXHR, cause, fromCache, fromServiceWorker, }, true - ) + )) .then(() => window.emit(EVENTS.REQUEST_ADDED, id)); }, async updateRequest(id, data) { - await this.actions.updateRequest(id, data, true); + const action = Actions.updateRequest(id, data, true); + await window.gStore.dispatch(action); let { responseContent, responseCookies, responseHeaders, requestCookies, requestHeaders, requestPostData, - } = data; - let request = getRequestById(window.gStore.getState(), id); + } = action.data; + let request = getRequestById(window.gStore.getState(), action.id); if (requestHeaders && requestHeaders.headers && requestHeaders.headers.length) { let headers = await fetchHeaders(requestHeaders, getLongString); if (headers) { - await this.actions.updateRequest( - id, + await window.gStore.dispatch(Actions.updateRequest( + action.id, { requestHeaders: headers }, true, - ); + )); } } if (responseHeaders && responseHeaders.headers && responseHeaders.headers.length) { let headers = await fetchHeaders(responseHeaders, getLongString); if (headers) { - await this.actions.updateRequest( - id, + await window.gStore.dispatch(Actions.updateRequest( + action.id, { responseHeaders: headers }, true, - ); + )); } } if (request && responseContent && responseContent.content) { let { mimeType } = request; let { text, encoding } = responseContent.content; let response = await getLongString(text); let payload = {}; if (mimeType.includes("image/")) { payload.responseContentDataUri = formDataURI(mimeType, encoding, response); } responseContent.content.text = response; payload.responseContent = responseContent; - await this.actions.updateRequest(id, payload, true); + await window.gStore.dispatch(Actions.updateRequest(action.id, payload, true)); if (mimeType.includes("image/")) { window.emit(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED); } } // Search the POST data upload stream for request headers and add // them as a separate property, different from the classic headers. @@ -565,17 +565,17 @@ NetworkEventsHandler.prototype = { const headersSize = headers.reduce((acc, { name, value }) => { return acc + name.length + value.length + 2; }, 0); let payload = {}; requestPostData.postData.text = postData; payload.requestPostData = Object.assign({}, requestPostData); payload.requestHeadersFromUploadStream = { headers, headersSize }; - await this.actions.updateRequest(id, payload, true); + await window.gStore.dispatch(Actions.updateRequest(action.id, payload, true)); } // Fetch request and response cookies long value. // Actor does not provide full sized cookie value when the value is too long // To display values correctly, we need fetch them in each request. if (requestCookies) { let reqCookies = []; // request store cookies in requestCookies or requestCookies.cookies @@ -584,20 +584,20 @@ NetworkEventsHandler.prototype = { // make sure cookies is iterable if (typeof cookies[Symbol.iterator] === "function") { for (let cookie of cookies) { reqCookies.push(Object.assign({}, cookie, { value: await getLongString(cookie.value), })); } if (reqCookies.length) { - await this.actions.updateRequest( - id, + await window.gStore.dispatch(Actions.updateRequest( + action.id, { requestCookies: reqCookies }, - true); + true)); } } } if (responseCookies) { let resCookies = []; // response store cookies in responseCookies or responseCookies.cookies let cookies = responseCookies.cookies ? @@ -605,20 +605,20 @@ NetworkEventsHandler.prototype = { // make sure cookies is iterable if (typeof cookies[Symbol.iterator] === "function") { for (let cookie of cookies) { resCookies.push(Object.assign({}, cookie, { value: await getLongString(cookie.value), })); } if (resCookies.length) { - await this.actions.updateRequest( - id, + await window.gStore.dispatch(Actions.updateRequest( + action.id, { responseCookies: resCookies }, - true); + true)); } } } }, /** * The "networkEventUpdate" message type handler. *
--- a/devtools/client/netmonitor/src/utils/create-store.js +++ b/devtools/client/netmonitor/src/utils/create-store.js @@ -1,16 +1,16 @@ /* 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 Services = require("Services"); -const { applyMiddleware, createStore } = require("devtools/client/shared/vendor/redux"); +const { createStore, applyMiddleware } = require("devtools/client/shared/vendor/redux"); const batching = require("../middleware/batching"); const prefs = require("../middleware/prefs"); const thunk = require("../middleware/thunk"); const rootReducer = require("../reducers/index"); const { FilterTypes, Filters } = require("../reducers/filters"); const { Requests } = require("../reducers/requests"); const { Sort } = require("../reducers/sort"); const { TimingMarkers } = require("../reducers/timing-markers");
--- a/devtools/client/netmonitor/webpack.config.js +++ b/devtools/client/netmonitor/webpack.config.js @@ -50,17 +50,17 @@ let webpackConfig = { alias: { "react": path.join(__dirname, "node_modules/react"), "devtools/client/framework/devtools": "devtools-modules", "devtools/client/framework/menu": "devtools-modules", "devtools/client/framework/menu-item": "devtools-modules", "devtools/client/locales": path.join(__dirname, "../locales/en-US"), "devtools/client/shared/components/reps/reps": "devtools-reps", "devtools/client/shared/components/search-box": "devtools-modules/client/shared/components/search-box", - "devtools/client/shared/components/splitter/split-box": "devtools-splitter", + "devtools/client/shared/components/splitter/split-box": "devtools-modules/client/shared/components/splitter/SplitBox", "devtools/client/shared/components/stack-trace": "devtools-modules/client/shared/components/stack-trace", "devtools/client/shared/components/tabs/tabbar": "devtools-modules/client/shared/components/tabs/tabbar", "devtools/client/shared/components/tabs/tabs": "devtools-modules/client/shared/components/tabs/tabs", "devtools/client/shared/components/tree/tree-view": "devtools-modules/client/shared/components/tree/tree-view", "devtools/client/shared/components/tree/tree-row": "devtools-modules/client/shared/components/tree/tree-row", "devtools/client/shared/curl": "devtools-modules", "devtools/client/shared/file-saver": "devtools-modules", "devtools/client/shared/prefs": "devtools-modules", @@ -71,17 +71,17 @@ let webpackConfig = { "devtools/client/shared/vendor/redux": "redux", "devtools/client/shared/vendor/reselect": "reselect", "devtools/client/shared/vendor/jszip": "jszip", "devtools/client/shared/widgets/tooltip/HTMLTooltip": "devtools-modules", "devtools/client/shared/widgets/tooltip/ImageTooltipHelper": "devtools-modules", "devtools/client/shared/widgets/Chart": "devtools-modules", "devtools/client/sourceeditor/editor": "devtools-modules", "devtools/shared/fronts/timeline": "devtools-modules", - "devtools/shared/l10n": "devtools-modules/shared/l10n", + "devtools/shared/l10n": "devtools-modules", "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"), "devtools/shared/platform/clipboard": "devtools-modules", "devtools/shared/plural-form": "devtools-modules", "toolkit/locales": path.join(__dirname, "../../../toolkit/locales/en-US"), "Services": "devtools-modules/client/shared/shim/Services", }, }, };