Commit 813cd66e authored by Noemi Erli's avatar Noemi Erli
Browse files

Backed out 6 changesets (bug 1597373, bug 1598320, bug 1597376) for causing...

Backed out 6 changesets (bug 1597373, bug 1598320, bug 1597376) for causing assertion failure in nsContentSecurityUtils.cpp CLOSED TREE

Backed out changeset abb73036e3ae (bug 1597376)
Backed out changeset a0076bbce8f9 (bug 1597376)
Backed out changeset 76055c79cada (bug 1597376)
Backed out changeset 145bc8015c6c (bug 1597376)
Backed out changeset fa0278f155ef (bug 1598320)
Backed out changeset 32711edf1baf (bug 1597373)

--HG--
rename : devtools/client/performance-new/components/DevToolsAndPopup.js => devtools/client/performance-new/components/Perf.js
parent 7809758d
......@@ -69,13 +69,6 @@ static const RedirEntry kRedirMap[] = {
{"privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT},
#if !defined(ANDROID) && defined(NIGHTLY_BUILD)
// about:profiling is Nightly-only while it is in active development. Once
// the feature matures, it will be released across all desktop channels.
{"profiling",
"chrome://devtools/content/performance-new/aboutprofiling/index.xhtml",
nsIAboutModule::ALLOW_SCRIPT},
#endif
{"rights", "chrome://global/content/aboutRights.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT},
......
......@@ -21,7 +21,6 @@ pages = [
'preferences',
'privatebrowsing',
'protections',
'profiling',
'reader',
'restartrequired',
'rights',
......
......@@ -401,7 +401,6 @@ var Policies = {
blockAboutPage(manager, "about:devtools");
blockAboutPage(manager, "about:debugging");
blockAboutPage(manager, "about:devtools-toolbox");
blockAboutPage(manager, "about:profiling");
}
},
},
......
......@@ -27,8 +27,6 @@ devtools.jar:
content/performance-new/frame-script.js (performance-new/frame-script.js)
content/performance-new/popup/initializer.js (performance-new/popup/initializer.js)
content/performance-new/popup/popup.xhtml (performance-new/popup/popup.xhtml)
content/performance-new/aboutprofiling/initializer.js (performance-new/aboutprofiling/initializer.js)
content/performance-new/aboutprofiling/index.xhtml (performance-new/aboutprofiling/index.xhtml)
content/memory/index.xhtml (memory/index.xhtml)
content/framework/toolbox-window.xhtml (framework/toolbox-window.xhtml)
content/framework/toolbox-options.xhtml (framework/toolbox-options.xhtml)
......@@ -130,7 +128,6 @@ devtools.jar:
skin/images/webconsole/run.svg (themes/images/webconsole/run.svg)
skin/images/breadcrumbs-scrollbutton.svg (themes/images/breadcrumbs-scrollbutton.svg)
skin/animation.css (themes/animation.css)
skin/aboutprofiling.css (themes/aboutprofiling.css)
skin/perf.css (themes/perf.css)
skin/performance.css (themes/performance.css)
skin/memory.css (themes/memory.css)
......
"use strict";
module.exports = {
rules: {
// Props are checked by TypeScript, so we don't need dynamic type checking here.
"react/prop-types": "off"
}
};
......@@ -16,7 +16,6 @@ export interface PanelWindow {
gTarget?: any;
gInit(perfFront: any, preferenceFront: any): void;
gDestroy(): void;
gReportReady?(): void
}
/**
......@@ -56,8 +55,6 @@ export interface PerfFront {
isActive: () => MaybePromise<boolean>;
isSupportedPlatform: () => MaybePromise<boolean>;
isLockedForPrivateBrowsing: () => MaybePromise<boolean>;
on: (type: string, listener: () => void) => void;
off: (type: string, listener: () => void) => void;
/**
* This method was was added in Firefox 72.
*/
......@@ -96,11 +93,6 @@ export type RecordingState =
// Profiling is not available when in private browsing mode.
| "locked-by-private-browsing";
// We are currently migrating to a new UX workflow with about:profiling.
// This type provides an easy way to change the implementation based
// on context.
export type PageContext = "popup" | "devtools" | "aboutprofiling";
export interface State {
recordingState: RecordingState;
recordingUnexpectedlyStopped: boolean;
......@@ -210,8 +202,9 @@ export interface InitializedValues {
receiveProfile: ReceiveProfile;
// A function to set the recording settings.
setRecordingPreferences: SetRecordingPreferences;
// Determine the current page context.
pageContext: PageContext;
// A boolean value that sets lets the UI know if it is in the popup window
// or inside of devtools.
isPopup: boolean;
// The popup and devtools panel use different codepaths for getting symbol tables.
getSymbolTableGetter: (profile: object) => GetSymbolTableCallback;
// The list of profiler features that the current target supports. Note that
......@@ -264,7 +257,7 @@ export type Action =
perfFront: PerfFront;
receiveProfile: ReceiveProfile;
setRecordingPreferences: SetRecordingPreferences;
pageContext: PageContext;
isPopup: boolean;
recordingSettingsFromPreferences: RecordingStateFromPreferences;
getSymbolTableGetter: (profile: object) => GetSymbolTableCallback;
supportedFeatures: string[] | null;
......@@ -274,7 +267,7 @@ export interface InitializeStoreValues {
perfFront: PerfFront;
receiveProfile: ReceiveProfile;
setRecordingPreferences: SetRecordingPreferences;
pageContext: PageContext;
isPopup: boolean;
recordingPreferences: RecordingStateFromPreferences;
supportedFeatures: string[] | null;
getSymbolTableGetter: (profile: object) => GetSymbolTableCallback;
......@@ -363,17 +356,3 @@ export interface PerformancePref {
export interface PopupWindow extends Window {
gResizePopup?: (height: number) => void;
}
/**
* Scale a number value.
*/
export type NumberScaler = (value: number) => number;
/**
* A collection of functions to scale numbers.
*/
export interface ScaleFunctions {
fromFractionToValue: NumberScaler,
fromValueToFraction: NumberScaler,
fromFractionToSingleDigitValue: NumberScaler,
}
<!-- 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/. -->
<html xmlns="http://www.w3.org/1999/xhtml" dir="">
<head>
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; style-src chrome: resource:; img-src chrome: resource:; script-src chrome: resource:" />
<link rel="icon" type="image/png" href="chrome://devtools/skin/images/profiler-stopwatch.svg" />
<link rel="stylesheet" href="chrome://global/skin/global.css" type="text/css"/>
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" type="text/css"/>
<link rel="stylesheet" href="chrome://devtools/skin/aboutprofiling.css" type="text/css"/>
</head>
<body class="theme-body">
<div id="root"></div>
<script src="chrome://devtools/content/performance-new/aboutprofiling/initializer.js"></script>
</body>
</html>
/* 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/. */
// @ts-check
/**
* @typedef {import("../@types/perf").InitializeStoreValues} InitializeStoreValues
* @typedef {import("../@types/perf").PopupWindow} PopupWindow
*/
"use strict";
/**
* This file initializes the about:profiling page, which can be used to tweak the
* profiler's settings.
*/
{
// Create the browser loader, but take care not to conflict with
// TypeScript. See devtools/client/performance-new/typescript.md and
// the section on "Do not overload require" for more information.
const { BrowserLoader } = ChromeUtils.import(
"resource://devtools/client/shared/browser-loader.js"
);
const browserLoader = BrowserLoader({
baseURI: "resource://devtools/client/performance-new/aboutprofiling",
window,
});
/**
* @type {any} - Coerce the current scope into an `any`, and assign the
* loaders to the scope. They can then be used freely below.
*/
const scope = this;
scope.require = browserLoader.require;
scope.loader = browserLoader.loader;
}
/**
* The background.jsm.js manages the profiler state, and can be loaded multiple time
* for various components. This page needs a copy, and it is also used by the
* profiler shortcuts. In order to do this, the background code needs to live in a
* JSM module, that can be shared with the DevTools keyboard shortcut manager.
*/
const {
getRecordingPreferencesFromBrowser,
setRecordingPreferencesOnBrowser,
getSymbolsFromThisBrowser,
} = ChromeUtils.import(
"resource://devtools/client/performance-new/popup/background.jsm.js"
);
const { receiveProfile } = require("devtools/client/performance-new/browser");
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
const React = require("devtools/client/shared/vendor/react");
const AboutProfiling = React.createFactory(
require("devtools/client/performance-new/components/AboutProfiling")
);
const ProfilerEventHandling = React.createFactory(
require("devtools/client/performance-new/components/ProfilerEventHandling")
);
const createStore = require("devtools/client/shared/redux/create-store");
const reducers = require("devtools/client/performance-new/store/reducers");
const actions = require("devtools/client/performance-new/store/actions");
const { Provider } = require("devtools/client/shared/vendor/react-redux");
const {
ActorReadyGeckoProfilerInterface,
} = require("devtools/shared/performance-new/gecko-profiler-interface");
/**
* Initialize the panel by creating a redux store, and render the root component.
*/
document.addEventListener("DOMContentLoaded", async () => {
const store = createStore(reducers);
const perfFrontInterface = new ActorReadyGeckoProfilerInterface();
const supportedFeatures = await perfFrontInterface.getSupportedFeatures();
// Do some initialization, especially with privileged things that are part of the
// the browser.
store.dispatch(
actions.initializeStore({
perfFront: perfFrontInterface,
receiveProfile,
supportedFeatures,
// Get the preferences from the current browser
recordingPreferences: getRecordingPreferencesFromBrowser(),
// In the popup, the preferences are stored directly on the current browser.
setRecordingPreferences: setRecordingPreferencesOnBrowser,
// The popup doesn't need to support remote symbol tables from the debuggee.
// Only get the symbols from this browser.
getSymbolTableGetter: () => getSymbolsFromThisBrowser,
pageContext: "aboutprofiling",
})
);
ReactDOM.render(
React.createElement(
Provider,
{ store },
React.createElement(
React.Fragment,
null,
ProfilerEventHandling(),
AboutProfiling()
)
),
document.querySelector("#root")
);
window.addEventListener("unload", function() {
// The perf front interface needs to be unloaded in order to remove event handlers.
// Not doing so leads to leaks.
perfFrontInterface.destroy();
});
});
# 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/.
with Files('**'):
BUG_COMPONENT = ('DevTools', 'Performance Tools (Profiler/Timeline)')
/* 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/. */
// @ts-check
/**
* @template P
* @typedef {import("react-redux").ResolveThunks<P>} ResolveThunks<P>
*/
/**
* @typedef {Object} StateProps
* @property {boolean?} isSupportedPlatform
* @property {PageContext} pageContext
* @property {string | null} promptEnvRestart
*/
/**
* @typedef {StateProps} Props
* @typedef {import("../@types/perf").State} StoreState
* @typedef {import("../@types/perf").PanelWindow} PanelWindow
*@typedef {import("../@types/perf").PageContext} PageContext
*/
"use strict";
const {
PureComponent,
createFactory,
} = require("devtools/client/shared/vendor/react");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const {
div,
h1,
button,
} = require("devtools/client/shared/vendor/react-dom-factories");
const Settings = createFactory(
require("devtools/client/performance-new/components/Settings.js")
);
const selectors = require("devtools/client/performance-new/store/selectors");
const {
restartBrowserWithEnvironmentVariable,
} = require("devtools/client/performance-new/browser");
/**
* This is the top level component for the about:profiling page. It shares components
* with the popup and DevTools page.
*
* @extends {React.PureComponent<Props>}
*/
class AboutProfiling extends PureComponent {
/** @param {Props} props */
constructor(props) {
super(props);
this.handleRestart = this.handleRestart.bind(this);
}
handleRestart() {
const { promptEnvRestart } = this.props;
if (!promptEnvRestart) {
throw new Error(
"handleRestart() should only be called when promptEnvRestart exists."
);
}
restartBrowserWithEnvironmentVariable(promptEnvRestart, "1");
}
render() {
const { isSupportedPlatform, pageContext, promptEnvRestart } = this.props;
if (isSupportedPlatform === null) {
// We don't know yet if this is a supported platform, wait for a response.
return null;
}
return div(
{ className: `perf perf-${pageContext}` },
promptEnvRestart
? div(
{ className: "perf-env-restart" },
div(
{
className:
"perf-photon-message-bar perf-photon-message-bar-warning perf-env-restart-fixed",
},
div({ className: "perf-photon-message-bar-warning-icon" }),
"The browser must be restarted to enable this feature.",
button(
{
className: "perf-photon-button perf-photon-button-micro",
type: "button",
onClick: this.handleRestart,
},
"Restart"
)
)
)
: null,
div(
{ className: "perf-intro" },
h1({ className: "perf-intro-title" }, "Profiler Settings"),
div(
{ className: "perf-intro-row" },
div({}, div({ className: "perf-intro-icon" })),
div(
{ className: "perf-intro-text" },
"Recordings launch profiler.firefox.com in a new tab. All data is stored " +
"locally, but you can choose to upload it for sharing."
)
)
),
// The presets aren't built yet, but this div serves as a place to put the
// visual divider that is in the UX mock-up.
div({ className: "perf-presets" }),
Settings()
);
}
}
/**
* @param {StoreState} state
* @returns {StateProps}
*/
function mapStateToProps(state) {
return {
isSupportedPlatform: selectors.getIsSupportedPlatform(state),
pageContext: selectors.getPageContext(state),
promptEnvRestart: selectors.getPromptEnvRestart(state),
};
}
module.exports = connect(mapStateToProps)(AboutProfiling);
/* 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/. */
// @ts-check
/**
* @typedef {{}} Props - This is an empty object.
*/
"use strict";
const { PureComponent } = require("devtools/client/shared/vendor/react");
......@@ -19,34 +13,25 @@ const {
/**
* This component provides a helpful description for what is going on in the component
* and provides some external links.
* @extends {React.PureComponent<Props>}
*/
class Description extends PureComponent {
/**
* @param {Props} props
*/
static get propTypes() {
return {};
}
constructor(props) {
super(props);
this.handleLinkClick = this.handleLinkClick.bind(this);
}
/**
* @param {React.MouseEvent<HTMLButtonElement>} event
*/
handleLinkClick(event) {
const { openDocLink } = require("devtools/client/shared/link");
/** @type HTMLButtonElement */
const target = /** @type {any} */ (event.target);
openDocLink(target.value, {});
openDocLink(event.target.value);
}
/**
* Implement links as buttons to avoid any risk of loading the link in the
* the panel.
* @param {string} href
* @param {string} text
*/
renderLink(href, text) {
return button(
......
/* 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/. */
// @ts-check
/**
* @template P
* @typedef {import("react-redux").ResolveThunks<P>} ResolveThunks<P>
*/
/**
* @typedef {Object} StateProps
* @property {boolean?} isSupportedPlatform
* @property {PageContext} pageContext
* @property {string | null} promptEnvRestart
*/
/**
* @typedef {StateProps} Props
* @typedef {import("../@types/perf").State} StoreState
* @typedef {import("../@types/perf").PanelWindow} PanelWindow
* @typedef {import("../@types/perf").PageContext} PageContext
*/
"use strict";
const {
PureComponent,
createFactory,
} = require("devtools/client/shared/vendor/react");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const {
div,
button,
} = require("devtools/client/shared/vendor/react-dom-factories");
const RecordingButton = createFactory(
require("devtools/client/performance-new/components/RecordingButton.js")
);
const Settings = createFactory(
require("devtools/client/performance-new/components/Settings.js")
);
const Description = createFactory(
require("devtools/client/performance-new/components/Description.js")
);
const selectors = require("devtools/client/performance-new/store/selectors");
const {
restartBrowserWithEnvironmentVariable,
} = require("devtools/client/performance-new/browser");
/**
* This is the top level component for the DevTools panel and the profiler popup, but
* not the about:profiling page. Eventually the profiler popup will use a different
* implementation. See Bug 1597371 for more information about the migration plan.
*
* @extends {React.PureComponent<Props>}
*/
class DevToolsAndPopup extends PureComponent {
/** @param {Props} props */
constructor(props) {
super(props);
this.handleRestart = this.handleRestart.bind(this);
}
handleRestart() {
const { promptEnvRestart } = this.props;
if (!promptEnvRestart) {
throw new Error(
"handleRestart() should only be called when promptEnvRestart exists."
);
}
restartBrowserWithEnvironmentVariable(promptEnvRestart, "1");
}
render() {
const { isSupportedPlatform, pageContext, promptEnvRestart } = this.props;
if (isSupportedPlatform === null) {
// We don't know yet if this is a supported platform, wait for a response.
return null;
}
return div(
{ className: `perf perf-${pageContext}` },
promptEnvRestart
? div(
{ className: "perf-env-restart" },
div(
{
className:
"perf-photon-message-bar perf-photon-message-bar-warning perf-env-restart-fixed",
},
div({ className: "perf-photon-message-bar-warning-icon" }),
"The browser must be restarted to enable this feature.",
button(
{
className: "perf-photon-button perf-photon-button-micro",
type: "button",
onClick: this.handleRestart,
},
"Restart"
)
)
)
: null,
RecordingButton(),
Settings(),
pageContext === "devtools" ? Description() : null
);
}
}
/**
* @param {StoreState} state
* @returns {StateProps}
*/
function mapStateToProps(state) {
return {
isSupportedPlatform: selectors.getIsSupportedPlatform(state),
pageContext: selectors.getPageContext(state),
promptEnvRestart: selectors.getPromptEnvRestart(state),
};
}
module.exports = connect(mapStateToProps)(DevToolsAndPopup);
/* 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/. */
// @ts-check
/**
* @typedef {Object} Props