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

This commit is contained in:
Bogdan Tara 2019-04-13 01:08:32 +03:00
Родитель 4ac9a7a0eb a4db304253
Коммит 41c61c6fe8
352 изменённых файлов: 5137 добавлений и 1845 удалений

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

@ -310,14 +310,15 @@ dbus_done:
// check GSettings
#define GSETINGS_A11Y_INTERFACE "org.gnome.desktop.interface"
#define GSETINGS_A11Y_KEY "toolkit-accessibility"
#define GSETINGS_A11Y_KEY "toolkit-accessibility"
nsCOMPtr<nsIGSettingsService> gsettings =
do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
nsCOMPtr<nsIGSettingsCollection> a11y_settings;
if (gsettings) {
gsettings->GetCollectionForSchema(NS_LITERAL_CSTRING(GSETINGS_A11Y_INTERFACE),
getter_AddRefs(a11y_settings));
gsettings->GetCollectionForSchema(
NS_LITERAL_CSTRING(GSETINGS_A11Y_INTERFACE),
getter_AddRefs(a11y_settings));
if (a11y_settings) {
a11y_settings->GetBoolean(NS_LITERAL_CSTRING(GSETINGS_A11Y_KEY),
&sShouldEnable);

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

@ -1295,7 +1295,7 @@ pref("browser.newtabpage.activity-stream.fxaccounts.endpoint", "https://accounts
pref("browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts", true);
// ASRouter provider configuration
pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "{\"id\":\"cfr-remote\",\"enabled\":true,\"type\":\"remote-settings\",\"bucket\":\"cfr\",\"frequency\":{\"custom\":[{\"period\":\"daily\",\"cap\":1}]},\"categories\":[\"cfrAddons\",\"cfrFeatures\"],\"updateCycleInMs\":3600000}");
pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "{\"id\":\"cfr\",\"enabled\":true,\"type\":\"remote-settings\",\"bucket\":\"cfr\",\"frequency\":{\"custom\":[{\"period\":\"daily\",\"cap\":1}]},\"categories\":[\"cfrAddons\",\"cfrFeatures\"],\"updateCycleInMs\":3600000}");
pref("browser.newtabpage.activity-stream.asrouter.providers.snippets", "{\"id\":\"snippets\",\"enabled\":true,\"type\":\"remote\",\"url\":\"https://snippets.cdn.mozilla.net/%STARTPAGE_VERSION%/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/\",\"updateCycleInMs\":14400000}");
// The pref controls if search hand-off is enabled for Activity Stream.

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

@ -180,10 +180,10 @@ static mozilla::Maybe<bool> RunAsLauncherProcess(int& argc, wchar_t** argv) {
#endif // defined(MOZ_LAUNCHER_PROCESS)
// We must check for force-launcher *after* we do LauncherRegistryInfo checks
runAsLauncher |= mozilla::CheckArg(argc, argv, L"force-launcher",
static_cast<const wchar_t**>(nullptr),
mozilla::CheckArgFlag::RemoveArg) ==
mozilla::ARG_FOUND;
runAsLauncher |=
mozilla::CheckArg(argc, argv, L"force-launcher",
static_cast<const wchar_t**>(nullptr),
mozilla::CheckArgFlag::RemoveArg) == mozilla::ARG_FOUND;
if (!runAsLauncher) {
// In this case, we will be proceeding to run as the browser.

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

@ -194,13 +194,16 @@ XPCOMUtils.defineLazyGetter(this, "gURLBar", () => gURLBarHandler.urlbar);
* customization or when the quantumbar pref changes.
*/
var gURLBarHandler = {
toggleQuantumBarAttribute() {
this.textbox = document.getElementById("urlbar");
this.textbox.setAttribute("quantumbar", this.quantumbar);
},
/**
* The urlbar binding or object.
*/
get urlbar() {
if (!this._urlbar) {
this.textbox = document.getElementById("urlbar");
this._updateBinding();
if (this.quantumbar) {
this._urlbar = new UrlbarInput({textbox: this.textbox});
if (this._lastValue) {
@ -215,6 +218,18 @@ var gURLBarHandler = {
return this._urlbar;
},
/**
* Forwards to gURLBar.formatValue(), if the binding has been applied already.
* This is necessary until the Quantum Bar is not the default and we allow
* to dynamically switch between it and the legacy implementation, because the
* binding is only applied before the initial xul layout.
*/
formatValue() {
if (typeof this.textbox.formatValue == "function") {
this.textbox.formatValue();
}
},
/**
* Invoked when the quantumbar pref changes.
*/
@ -1349,6 +1364,9 @@ var gBrowserInit = {
},
onBeforeInitialXULLayout() {
// Dynamically switch on-off the Quantum Bar based on prefs.
gURLBarHandler.toggleQuantumBarAttribute();
// Set a sane starting width/height for all resolutions on new profiles.
if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
// When the fingerprinting resistance is enabled, making sure that we don't
@ -5183,7 +5201,7 @@ var XULBrowserWindow = {
// Make sure the "https" part of the URL is striked out or not,
// depending on the current mixed active content blocking state.
gURLBar.formatValue();
gURLBarHandler.formatValue();
try {
uri = Services.uriFixup.createExposableURI(uri);

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

@ -841,7 +841,6 @@
defaultPlaceholder="&urlbar.placeholder2;"
focused="true"
type="autocomplete"
quantumbar="false"
autocompletesearch="unifiedcomplete"
autocompletesearchparam="enable-actions"
autocompletepopup="PopupAutoCompleteRichResult"

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

@ -582,7 +582,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<method name="formatValue">
<body><![CDATA[
this.valueFormatter.update();
// The editor may not exist if the toolbar is not visible.
if (this.editor) {
this.valueFormatter.update();
}
]]></body>
</method>

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

@ -136,6 +136,13 @@ class UrlbarInput {
return new UrlbarValueFormatter(this);
});
// If the toolbar is not visible in this window or the urlbar is readonly,
// we'll stop here, so that most properties of the input object are valid,
// but we won't handle events.
if (!this.window.toolbar.visible || this.hasAttribute("readonly")) {
return;
}
// The event bufferer can be used to defer events that may affect users
// muscle memory; for example quickly pressing DOWN+ENTER should end up
// on a predictable result, regardless of the search status. The event
@ -208,7 +215,10 @@ class UrlbarInput {
* Applies styling to the text in the urlbar input, depending on the text.
*/
formatValue() {
this.valueFormatter.update();
// The editor may not exist if the toolbar is not visible.
if (this.editor) {
this.valueFormatter.update();
}
}
/**

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

@ -126,26 +126,45 @@ with only_when(target_is_osx):
# MacOS SDK
# =========
option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
help='Location of platform SDK to use')
js_option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
help='Location of platform SDK to use')
@depends_if('--with-macos-sdk')
@depends('--with-macos-sdk')
@imports(_from='os.path', _import='isdir')
@imports(_from='plistlib', _import='readPlist')
@imports(_from='biplist', _import='readPlist')
@imports('subprocess')
@imports('which')
def macos_sdk(value):
sdk_min_version = Version('10.11')
sdk_max_version = Version('10.13')
if not isdir(value[0]):
sdk_path = None
if value:
sdk_path = value[0]
else:
try:
xcrun = which.which('xcrun')
args = [xcrun, '--sdk', 'macosx', '--show-sdk-path']
sdk_path = subprocess.check_output(args).strip()
except which.WhichError:
# On a Linux cross-compile, we don't have xcrun, so just leave
# the SDK unset if --with-macos-sdk isn't specified.
pass
if not sdk_path:
return
if not isdir(sdk_path):
die('SDK not found in %s. When using --with-macos-sdk, you must specify a '
'valid SDK. SDKs are installed when the optional cross-development '
'tools are selected during the Xcode/Developer Tools installation.'
% value[0])
obj = readPlist(os.path.join(value[0], 'SDKSettings.plist'))
% sdk_path)
obj = readPlist(os.path.join(sdk_path, 'SDKSettings.plist'))
if not obj:
die('Error parsing SDKSettings.plist in the SDK directory: %s' % value[0])
die('Error parsing SDKSettings.plist in the SDK directory: %s' % sdk_path)
if 'Version' not in obj:
die('Error finding Version information in SDKSettings.plist from the SDK: %s' % value[0])
die('Error finding Version information in SDKSettings.plist from the '
'SDK: %s' % sdk_path)
version = Version(obj['Version'])
if version < sdk_min_version:
die('SDK version "%s" is too old. Please upgrade to at least %s. '
@ -157,7 +176,7 @@ with only_when(target_is_osx):
'%s. You may need to point to it using --with-macos-sdk=<path> in '
'your mozconfig. Various SDK versions are available from '
'https://github.com/phracker/MacOSX-SDKs' % (version, sdk_max_version))
return value[0]
return sdk_path
set_config('MACOS_SDK_DIR', macos_sdk)

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

@ -8,6 +8,7 @@ mozilla.pth:python/mozversioncontrol
mozilla.pth:python/l10n
mozilla.pth:third_party/python/atomicwrites
mozilla.pth:third_party/python/attrs/src
mozilla.pth:third_party/python/biplist
mozilla.pth:third_party/python/blessings
mozilla.pth:third_party/python/Click
mozilla.pth:third_party/python/compare-locales

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

@ -119,7 +119,7 @@
"eslint-plugin-babel": "^5.0.0",
"eslint-plugin-file-header": "0.0.1",
"eslint-plugin-flowtype": "^3.0.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^21.15.1",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-mozilla": "1.1.3",

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

@ -54,9 +54,9 @@ async function findNewLocation(
const symbols: LoadedSymbols = await thunkArgs.dispatch(
setSymbols({ cx, source })
);
const func = findFunctionByName(symbols, name, index);
const func = symbols ? findFunctionByName(symbols, name, index) : null;
// Fallback onto the location line, if we do not find a function is not found
// Fallback onto the location line, if we do not find a function.
let line = location.line;
if (func) {
line = func.location.start.line + offset.line;

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

@ -14,7 +14,8 @@ import {
getSelectedScopeMappings,
getSelectedFrameBindings,
getCurrentThread,
getIsPaused
getIsPaused,
isMapScopesEnabled
} from "../selectors";
import { PROMISE } from "./utils/middleware/promise";
import { wrapExpression } from "../utils/expressions";
@ -177,10 +178,9 @@ function evaluateExpression(cx: ThreadContext, expression: Expression) {
*/
export function getMappedExpression(expression: string) {
return async function({ dispatch, getState, client, sourceMaps }: ThunkArgs) {
const state = getState();
const thread = getCurrentThread(getState());
const mappings = getSelectedScopeMappings(state, thread);
const bindings = getSelectedFrameBindings(state, thread);
const mappings = getSelectedScopeMappings(getState(), thread);
const bindings = getSelectedFrameBindings(getState(), thread);
// We bail early if we do not need to map the expression. This is important
// because mapping an expression can be slow if the parser worker is
@ -189,7 +189,8 @@ export function getMappedExpression(expression: string) {
// 1. there are no mappings - we do not need to map original expressions
// 2. does not contain `await` - we do not need to map top level awaits
// 3. does not contain `=` - we do not need to map assignments
if (!mappings && !expression.match(/(await|=)/)) {
const shouldMapScopes = isMapScopesEnabled(getState()) && mappings;
if (!shouldMapScopes && !expression.match(/(await|=)/)) {
return null;
}
@ -197,7 +198,7 @@ export function getMappedExpression(expression: string) {
expression,
mappings,
bindings || [],
features.mapExpressionBindings && getIsPaused(state, thread),
features.mapExpressionBindings && getIsPaused(getState(), thread),
features.mapAwaitExpression
);
};

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

@ -6,7 +6,7 @@
import {
getSource,
getMapScopes,
isMapScopesEnabled,
getSelectedFrame,
getSelectedGeneratedScope,
getSelectedOriginalScope,
@ -16,7 +16,6 @@ import { loadSourceText } from "../sources/loadSourceText";
import { PROMISE } from "../utils/middleware/promise";
import assert from "../../utils/assert";
import { features } from "../../utils/prefs";
import { log } from "../../utils/log";
import { isGenerated, isOriginal } from "../../utils/source";
import type { Frame, Scope, ThreadContext } from "../../types";
@ -27,7 +26,7 @@ import { buildMappedScopes } from "../../utils/pause/mapScopes";
export function toggleMapScopes() {
return async function({ dispatch, getState, client, sourceMaps }: ThunkArgs) {
if (getMapScopes(getState())) {
if (isMapScopesEnabled(getState())) {
return dispatch({ type: "TOGGLE_MAP_SCOPES", mapScopes: false });
}
@ -71,7 +70,7 @@ export function mapScopes(
frame,
[PROMISE]: (async function() {
if (
!features.mapScopes ||
!isMapScopesEnabled(getState()) ||
!source ||
!generatedSource ||
generatedSource.isWasm ||

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

@ -100,7 +100,6 @@ function createPauseInfo(
function resumedPacket() {
return { from: "FakeThread", type: "resumed" };
}
describe("pause", () => {
describe("stepping", () => {
it("should set and clear the command", async () => {

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

@ -15,7 +15,7 @@ import {
getOriginalFrameScope,
getIsPaused,
getPauseReason,
getMapScopes,
isMapScopesEnabled,
getCurrentThread
} from "../../selectors";
import { getScopes } from "../../utils/pause/scopes";
@ -36,7 +36,7 @@ type Props = {
originalFrameScopes: Object | null,
isLoading: boolean,
why: Why,
shouldMapScopes: boolean,
mapScopesEnabled: boolean,
openLink: typeof actions.openLink,
openElementInInspector: typeof actions.openElementInInspectorCommand,
highlightDomElement: typeof actions.highlightDomElement,
@ -115,12 +115,12 @@ class Scopes extends PureComponent<Props, State> {
openElementInInspector,
highlightDomElement,
unHighlightDomElement,
shouldMapScopes
mapScopesEnabled
} = this.props;
const { originalScopes, generatedScopes, showOriginal } = this.state;
const scopes =
(showOriginal && shouldMapScopes && originalScopes) || generatedScopes;
(showOriginal && mapScopesEnabled && originalScopes) || generatedScopes;
if (scopes && !isLoading) {
return (
@ -192,7 +192,7 @@ const mapStateToProps = state => {
return {
selectedFrame,
shouldMapScopes: getMapScopes(state),
mapScopesEnabled: isMapScopesEnabled(state),
isPaused: getIsPaused(state, thread),
isLoading: generatedPending || originalPending,
why: getPauseReason(state, thread),

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

@ -16,7 +16,7 @@ import {
getBreakpointsDisabled,
getExpressions,
getIsWaitingOnBreak,
getMapScopes,
isMapScopesEnabled,
getSelectedFrame,
getShouldPauseOnExceptions,
getShouldPauseOnCaughtExceptions,
@ -81,7 +81,7 @@ type Props = {
selectedFrame: ?Frame,
breakpointsDisabled: boolean,
isWaitingOnBreak: boolean,
shouldMapScopes: boolean,
mapScopesEnabled: boolean,
shouldPauseOnExceptions: boolean,
shouldPauseOnCaughtExceptions: boolean,
workers: WorkerList,
@ -225,13 +225,9 @@ class SecondaryPanes extends Component<Props, State> {
}
getScopesButtons() {
const { selectedFrame, shouldMapScopes } = this.props;
const { selectedFrame, mapScopesEnabled } = this.props;
if (
!features.mapScopes ||
!selectedFrame ||
isGeneratedId(selectedFrame.location.sourceId)
) {
if (!selectedFrame || isGeneratedId(selectedFrame.location.sourceId)) {
return null;
}
@ -244,7 +240,7 @@ class SecondaryPanes extends Component<Props, State> {
>
<input
type="checkbox"
checked={shouldMapScopes ? "checked" : ""}
checked={mapScopesEnabled ? "checked" : ""}
onChange={e => this.props.toggleMapScopes()}
/>
{L10N.getStr("scopes.map.label")}
@ -472,7 +468,7 @@ const mapStateToProps = state => {
breakpointsDisabled: getBreakpointsDisabled(state),
isWaitingOnBreak: getIsWaitingOnBreak(state, thread),
selectedFrame: getSelectedFrame(state, thread),
shouldMapScopes: getMapScopes(state),
mapScopesEnabled: isMapScopesEnabled(state),
shouldPauseOnExceptions: getShouldPauseOnExceptions(state),
shouldPauseOnCaughtExceptions: getShouldPauseOnCaughtExceptions(state),
workers: getWorkers(state)

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

@ -623,7 +623,7 @@ export function getSkipPausing(state: OuterState) {
return state.pause.skipPausing;
}
export function getMapScopes(state: OuterState) {
export function isMapScopesEnabled(state: OuterState) {
return state.pause.mapScopes;
}

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

@ -21,6 +21,7 @@
"is": false,
"isnot": false,
"ok": false,
"once": false,
"registerCleanupFunction": false,
"requestLongerTimeout": false,
"SimpleTest": false,
@ -32,6 +33,7 @@
"waitForClipboard": false,
"waitForExplicitFinish": false,
"waitForFocus": false,
"waitUntil": false,
"selectSource": false,
"prettyPrint": false,
"closeTab": false,
@ -39,6 +41,7 @@
"waitFor": false,
// Globals introduced in debugger-specific head.js
"getContext": false,
"getCM": false,
"getDebuggerSplitConsole": false,
"hasConsoleMessage": false,
@ -68,20 +71,24 @@
"assertNotPaused": false,
"assertSourceCount": false,
"assertPausedAtSourceAndLine": false,
"assertPreviewTextValue": false,
"assertEditorBreakpoint": false,
"assertBreakpointSnippet": false,
"assertEmptyLines": false,
"assertPaused": false,
"assertPausedLocation": false,
"assertPreviewTextValue": false,
"assertHighlightLocation": false,
"assertScopes": false,
"createDebuggerContext": false,
"initDebugger": false,
"invokeInTab": false,
"invokeWithBreakpoint": false,
"findBreakpoint": false,
"findSource": false,
"findElement": false,
"findElementWithSelector": false,
"findAllElements": false,
"getContext": false,
"getIsPaused": false,
"getThreadContext": false,
"getWorkers": false,
@ -100,6 +107,7 @@
"toggleScopes": false,
"isVisibleWithin": false,
"isPaused": false,
"hoverAtPos": false,
"clickElement": false,
"clickElementWithSelector": false,
"clickDOMElement": false,
@ -112,9 +120,9 @@
"selectContextMenuItem": false,
"togglePauseOnExceptions": false,
"type": false,
"tryHovering": false,
"pressKey": false,
"synthesizeContextMenuEvent": false,
"EXAMPLE_URL": false,
"waitUntil": false
"EXAMPLE_URL": false
}
}

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

@ -677,6 +677,7 @@ skip-if = (os == "win" && ccov) # Bug 1453549
skip-if = ccov || debug || (verify && debug && (os == 'linux')) # Bug 1441545, 1536253 - very slow on debug
[browser_dbg-sourcemapped-stepping.js]
skip-if = true # original stepping is currently disabled
[browser_dbg-sourcemapped-toggle.js]
[browser_dbg-sourcemapped-preview.js]
skip-if = os == "win" # Bug 1448523, Bug 1448450
[browser_dbg-breaking.js]

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

@ -4,9 +4,9 @@
// This source map does not have source contents, so it's fetched separately
add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemaps3.html");
dbg.actions.toggleMapScopes();
const {
selectors: { getBreakpoint, getBreakpointCount },
getState
@ -28,7 +28,6 @@ add_task(async function() {
// should not pause
is(isPaused(dbg), false);
// unblackbox
await clickElement(dbg, "blackbox");
await waitForDispatch(dbg, "BLACKBOX");
@ -38,5 +37,5 @@ add_task(async function() {
// should pause
await waitForPaused(dbg);
ok(true, "blackbox works")
ok(true, "blackbox works");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests the breakpoints are hit in various situations.
@ -25,12 +26,12 @@ add_task(async function() {
assertPausedLocation(dbg);
await resume(dbg);
info('Create an eval script that pauses itself.')
info("Create an eval script that pauses itself.");
invokeInTab("doEval");
await waitForPaused(dbg);
await resume(dbg);
const source = getSelectedSource(getState())
const source = getSelectedSource();
ok(!source.url, "It is an eval source");
await addBreakpoint(dbg, source, 5);

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

@ -1,9 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
function skipPausing(dbg) {
clickElementWithSelector(dbg, ".command-bar-skip-pausing");
return waitForState(dbg, state => dbg.selectors.getSkipPausing(state))
return waitForState(dbg, state => dbg.selectors.getSkipPausing());
}
/*
@ -12,8 +13,8 @@ function skipPausing(dbg) {
*/
add_task(async function() {
let dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple3")
const dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple3");
await addBreakpoint(dbg, "simple3", 2);
await skipPausing(dbg);

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

@ -18,10 +18,7 @@ add_task(async function() {
// select "Remove breakpoint"
selectContextMenuItem(dbg, selectors.breakpointContextMenu.remove);
await waitForState(
dbg,
state => dbg.selectors.getBreakpointCount(state) === 0
);
await waitForState(dbg, state => dbg.selectors.getBreakpointCount() === 0);
ok("successfully removed the breakpoint");
});
@ -46,7 +43,7 @@ add_task(async function() {
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableOthers);
await waitForState(dbg, state =>
dbg.selectors
.getBreakpointsList(state)
.getBreakpointsList()
.every(bp => (bp.location.line !== 4) === bp.disabled)
);
await dispatched;
@ -57,7 +54,7 @@ add_task(async function() {
dispatched = waitForDispatch(dbg, "SET_BREAKPOINT");
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableAll);
await waitForState(dbg, state =>
dbg.selectors.getBreakpointsList(state).every(bp => bp.disabled)
dbg.selectors.getBreakpointsList().every(bp => bp.disabled)
);
await dispatched;
ok("all breakpoints are disabled");
@ -68,7 +65,7 @@ add_task(async function() {
selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableOthers);
await waitForState(dbg, state =>
dbg.selectors
.getBreakpointsList(state)
.getBreakpointsList()
.every(bp => (bp.location.line === 4) === bp.disabled)
);
await dispatched;
@ -81,8 +78,8 @@ add_task(async function() {
await waitForState(
dbg,
state =>
dbg.selectors.getBreakpointsList(state).length === 1 &&
dbg.selectors.getBreakpointsList(state)[0].location.line === 4
dbg.selectors.getBreakpointsList().length === 1 &&
dbg.selectors.getBreakpointsList()[0].location.line === 4
);
await dispatched;
ok("remaining breakpoint should be on line 4");

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

@ -51,7 +51,7 @@ async function disableBreakpoint(dbg, index) {
selectContextMenuItem(dbg, selectors.disableItem);
await waitForState(dbg, state => {
const bp = dbg.selectors.getBreakpointsList(state)[index];
const bp = dbg.selectors.getBreakpointsList()[index];
return bp.disabled;
});

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

@ -1,20 +1,24 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
function firstBreakpoint(dbg) {
return dbg.selectors.getBreakpointsList(dbg.getState())[0];
return dbg.selectors.getBreakpointsList()[0];
}
// tests to make sure we do not accidentally slide the breakpoint up to the first
// function with the same name in the file.
add_task(async function() {
const dbg = await initDebugger("doc-duplicate-functions.html", "doc-duplicate-functions");
const dbg = await initDebugger(
"doc-duplicate-functions.html",
"doc-duplicate-functions"
);
const source = findSource(dbg, "doc-duplicate-functions");
await selectSource(dbg, source.url);
await addBreakpoint(dbg, source.url, 19);
await reload(dbg, source.url);
await waitForState(dbg, state => dbg.selectors.getBreakpointCount(state) == 1);
await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
is(firstBreakpoint(dbg).location.line, 19, "Breakpoint is on line 19");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// checks to see if the frame is selected and the title is correct
function isFrameSelected(dbg, index, title) {
@ -7,10 +8,10 @@ function isFrameSelected(dbg, index, title) {
const {
selectors: { getSelectedFrame, getCurrentThread },
getState,
getState
} = dbg;
const frame = getSelectedFrame(getState(), getCurrentThread(getState()));
const frame = getSelectedFrame(getCurrentThread());
const elSelected = $frame.classList.contains("selected");
const titleSelected = frame.displayName == title;
@ -31,17 +32,18 @@ function createMockAngularPage() {
httpServer.registerContentType("html", "text/html");
httpServer.registerContentType("js", "application/javascript");
const htmlFilename = "angular-mock.html"
httpServer.registerPathHandler(`/${htmlFilename}`, function(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(`
const htmlFilename = "angular-mock.html";
httpServer.registerPathHandler(`/${htmlFilename}`, function(
request,
response
) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(`
<html>
<button class="pause">Click me</button>
<script type="text/javascript" src="angular.js"></script>
</html>`
);
}
);
</html>`);
});
// Register an angular.js file in order to create a Group with anonymous functions in
// the callstack panel.
@ -70,7 +72,7 @@ add_task(async function() {
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "secondCall"), "the first frame is selected");
let button = toggleButton(dbg);
const button = toggleButton(dbg);
ok(!button, "toggle button shouldn't be there");
});
@ -96,7 +98,6 @@ add_task(async function() {
await waitForSelectedSource(dbg, "frames.js");
});
add_task(async function() {
const url = createMockAngularPage();
const tab = await addTab(url);
@ -113,7 +114,14 @@ add_task(async function() {
await waitForPaused(dbg);
const $group = findElementWithSelector(dbg, ".frames .frames-group");
is($group.querySelector(".badge").textContent, "2", "Group has expected badge");
is($group.querySelector(".group-description-name").textContent, "Angular",
"Group has expected location");
is(
$group.querySelector(".badge").textContent,
"2",
"Group has expected badge"
);
is(
$group.querySelector(".group-description-name").textContent,
"Angular",
"Group has expected location"
);
});

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

@ -27,12 +27,12 @@ add_task(async function() {
// Make sure that clicking the gutter creates a breakpoint icon.
clickGutter(dbg, 4);
await waitForDispatch(dbg, "SET_BREAKPOINT");
is(dbg.selectors.getBreakpointCount(getState()), 1, "One breakpoint exists");
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
await assertEditorBreakpoint(dbg, 4, true);
// Make sure clicking at the same place removes the icon.
clickGutter(dbg, 4);
await waitForDispatch(dbg, "REMOVE_BREAKPOINT");
is(dbg.selectors.getBreakpointCount(getState()), 0, "No breakpoints exist");
is(dbg.selectors.getBreakpointCount(), 0, "No breakpoints exist");
await assertEditorBreakpoint(dbg, 4, false);
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests that the editor will always highight the right line, no
// matter if the source text doesn't exist yet or even if the source
@ -11,7 +12,7 @@ add_task(async function() {
selectors: { getSource },
getState
} = dbg;
const sourceUrl = EXAMPLE_URL + "long.js";
const sourceUrl = `${EXAMPLE_URL}long.js`;
// The source itself doesn't even exist yet, and using
// `selectSourceURL` will set a pending request to load this source
@ -22,27 +23,27 @@ add_task(async function() {
// TODO: revisit highlighting lines when the debugger opens
// assertHighlightLocation(dbg, "long.js", 66);
log(`Select line 16 and make sure the editor scrolled.`);
log("Select line 16 and make sure the editor scrolled.");
await selectSource(dbg, "long.js", 16);
await waitForElementWithSelector(dbg, ".CodeMirror-code > .highlight-line");
assertHighlightLocation(dbg, "long.js", 16);
log(`Select several locations and check that we have one highlight`);
log("Select several locations and check that we have one highlight");
await selectSource(dbg, "long.js", 17);
await selectSource(dbg, "long.js", 18);
assertHighlightLocation(dbg, "long.js", 18);
// Test jumping to a line in a source that exists but hasn't been
// loaded yet.
log(`Select an unloaded source`);
log("Select an unloaded source");
selectSource(dbg, "simple1.js", 6);
// Make sure the source is in the loading state, wait for it to be
// fully loaded, and check the highlighted line.
const simple1 = findSource(dbg, "simple1.js");
is(getSource(getState(), simple1.id).loadedState, "loading");
is(getSource(simple1.id).loadedState, "loading");
await waitForSelectedSource(dbg, "simple1.js");
ok(getSource(getState(), simple1.id).text);
ok(getSource(simple1.id).text);
assertHighlightLocation(dbg, "simple1.js", 6);
});

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

@ -1,7 +1,10 @@
add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true);
/* 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/>. */
add_task(async function() {
const dbg = await initDebugger("ember/quickstart/dist/");
dbg.actions.toggleMapScopes();
await invokeWithBreakpoint(
dbg,

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Test that exceptions thrown while evaluating code will pause at the point the
// exception was generated when pausing on uncaught exceptions.
@ -8,10 +9,7 @@ add_task(async function() {
await togglePauseOnExceptions(dbg, true, true);
invokeInTab("evaluateException");
await waitForPaused(dbg);
const state = dbg.store.getState();
const source = dbg.selectors.getSelectedSource(state);
const source = dbg.selectors.getSelectedSource();
ok(!source.url, "Selected source should not have a URL");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Test that pausing within an event handler on an element does *not* show the
// HTML page containing that element. It should show a sources tab containing
@ -8,10 +9,7 @@ add_task(async function() {
const dbg = await initDebugger("doc-event-handler.html");
invokeInTab("synthesizeClick");
await waitForPaused(dbg);
const state = dbg.store.getState();
const source = dbg.selectors.getSelectedSource(state);
const source = dbg.selectors.getSelectedSource();
ok(!source.url, "Selected source should not have a URL");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
/**
* This if the debugger's layout is correctly modified when the toolbox's
@ -29,14 +30,13 @@ add_task(async function() {
});
async function testLayout(dbg, orientation, host) {
const { panel, toolbox } = dbg;
info(`Switching to ${host} ${orientation}.`);
await switchHost(dbg, host);
await resizeToolboxWindow(dbg, host);
return waitForState(
dbg,
state => dbg.selectors.getOrientation(state) == orientation
state => dbg.selectors.getOrientation() == orientation
);
}

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

@ -12,9 +12,8 @@ function getScopeNodeValue(dbg, index) {
}
add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-minified2.html", "sum.js");
dbg.actions.toggleMapScopes();
await selectSource(dbg, "sum.js");
await addBreakpoint(dbg, "sum.js", 2);

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

@ -3,7 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function countSources(dbg) {
return dbg.selectors.getSourceCount(dbg.getState());
return dbg.selectors.getSourceCount();
}
const sources = [
@ -41,7 +41,7 @@ add_task(async function() {
await navigate(dbg, "doc-scripts.html", ...sources);
is(countSources(dbg), 5, "5 sources are loaded.");
ok(!getIsPaused(getState(), getCurrentThread(getState())), "Is not paused");
ok(!getIsPaused(getCurrentThread()), "Is not paused");
await navigate(dbg, "doc-scripts.html", ...sources);
is(countSources(dbg), 5, "5 sources are loaded.");
@ -51,8 +51,5 @@ add_task(async function() {
await reload(dbg, "long.js");
await waitForSelectedSource(dbg, "long.js");
ok(
getSelectedSource(getState()).url.includes("long.js"),
"Selected source is long.js"
);
ok(getSelectedSource().url.includes("long.js"), "Selected source is long.js");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests that when pause on next is selected, we pause on the next execution
@ -10,7 +11,7 @@ add_task(async function() {
} = dbg;
clickElement(dbg, "pause");
await waitForState(dbg, state => getIsWaitingOnBreak(state, getCurrentThread(state)));
await waitForState(dbg, state => getIsWaitingOnBreak(getCurrentThread()));
invokeInTab("simple");
await waitForPaused(dbg, "simple3");

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
requestLongerTimeout(2);
@ -7,23 +8,23 @@ async function stepOvers(dbg, count, onStep = () => {}) {
for (let i = 0; i < count; i++) {
await dbg.actions.stepOver(getThreadContext(dbg));
await waitForPaused(dbg);
onStep(dbg.getState());
onStep();
}
}
function formatSteps(steps) {
return steps.map(loc => `(${loc.join(",")})`).join(", ")
return steps.map(loc => `(${loc.join(",")})`).join(", ");
}
async function testCase(dbg, { name, steps }) {
invokeInTab(name);
let locations = [];
const locations = [];
const {
selectors: { getTopFrame, getCurrentThread }
} = dbg;
await stepOvers(dbg, steps.length, state => {
const {line, column} = getTopFrame(state, getCurrentThread(state)).location
const { line, column } = getTopFrame(getCurrentThread()).location;
locations.push([line, column]);
});
@ -34,20 +35,29 @@ async function testCase(dbg, { name, steps }) {
add_task(async function test() {
const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
await selectSource(dbg, "pause-points.js")
await selectSource(dbg, "pause-points.js");
await testCase(dbg, {
name: "statements",
steps: [[9,2], [10,4], [10,13], [11,2], [11,21], [12,2], [12,12], [13,0]]
steps: [
[9, 2],
[10, 4],
[10, 13],
[11, 2],
[11, 21],
[12, 2],
[12, 12],
[13, 0]
]
});
await testCase(dbg, {
name: "expressions",
steps: [[40,2], [41,2], [42,12], [43,0]]
steps: [[40, 2], [41, 2], [42, 12], [43, 0]]
});
await testCase(dbg, {
name: "sequences",
steps: [[23,2], [25,12], [29,12], [34,2], [37,0]]
steps: [[23, 2], [25, 12], [29, 12], [34, 2], [37, 0]]
});
await testCase(dbg, {

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
function getScrollTop(dbg) {
return getCM(dbg).doc.scrollTop;
@ -9,7 +10,7 @@ async function waitForMatch(dbg, { matchIndex, count }) {
await waitForState(
dbg,
state => {
const result = dbg.selectors.getFileSearchResults(state);
const result = dbg.selectors.getFileSearchResults();
return result.matchIndex == matchIndex && result.count == count;
},
"wait for match"
@ -21,20 +22,20 @@ add_task(async function() {
// Make sure that we can set a breakpoint on a line out of the
// viewport, and that pausing there scrolls the editor to it.
let longSrc = findSource(dbg, "long.js");
await selectSource(dbg, "long.js")
const longSrc = findSource(dbg, "long.js");
await selectSource(dbg, "long.js");
await addBreakpoint(dbg, longSrc, 66);
invokeInTab("testModel");
await waitForPaused(dbg, "long.js");
const pauseScrollTop = getScrollTop(dbg);
log("1. adding a breakpoint should not scroll the editor");
info("1. adding a breakpoint should not scroll the editor");
getCM(dbg).scrollTo(0, 0);
await addBreakpoint(dbg, longSrc, 11);
is(getScrollTop(dbg), 0, "scroll position");
log("2. searching should jump to the match");
info("2. searching should jump to the match");
pressKey(dbg, "fileSearch");
type(dbg, "check");
await waitForMatch(dbg, { matchIndex: 0, count: 2 });

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

@ -6,7 +6,7 @@
add_task(async function() {
const dbg = await initDebugger("doc-minified.html", "math.min.js");
const thread = dbg.selectors.getCurrentThread(dbg.getState());
const thread = dbg.selectors.getCurrentThread();
await selectSource(dbg, "math.min.js");
await addBreakpoint(dbg, "math.min.js", 2);
@ -19,9 +19,10 @@ add_task(async function() {
await waitForSelectedSource(dbg, "math.min.js:formatted");
await waitForState(
dbg,
state => dbg.selectors.getSelectedFrame(state, thread).location.line == 18
state => dbg.selectors.getSelectedFrame(thread).location.line == 18
);
assertPausedLocation(dbg);
await waitForBreakpoint(dbg, "math.min.js:formatted", 18);
await assertEditorBreakpoint(dbg, 18, true);
await resume(dbg);

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

@ -6,10 +6,6 @@
// and doesn't have functions.
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
const {
selectors: { getSelectedSource },
getState
} = dbg;
navigate(dbg, "doc-on-load.html");

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
async function assertNoTooltip(dbg) {
await waitForTime(200);
@ -11,7 +12,7 @@ function assertPreviewTooltip(dbg, { result, expression }) {
const previewEl = findElement(dbg, "tooltip");
is(previewEl.innerText, result, "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
const preview = dbg.selectors.getPreview();
is(`${preview.result}`, result, "Preview.result");
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
@ -21,7 +22,7 @@ function assertPreviewPopup(dbg, { field, value, expression }) {
const previewEl = findElement(dbg, "popup");
is(previewEl.innerText, "", "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
const preview = dbg.selectors.getPreview();
is(
`${preview.result.preview.ownProperties[field].value}`,
@ -33,7 +34,13 @@ function assertPreviewPopup(dbg, { field, value, expression }) {
}
add_task(async function() {
const dbg = await initDebugger("doc-sourcemaps.html", "entry.js", "output.js", "times2.js", "opts.js");
const dbg = await initDebugger(
"doc-sourcemaps.html",
"entry.js",
"output.js",
"times2.js",
"opts.js"
);
const {
selectors: { getSelectedSource },
getState
@ -46,19 +53,19 @@ add_task(async function() {
await waitForPaused(dbg);
await waitForSelectedSource(dbg, "times2");
info(`Test previewing in the original location`);
info("Test previewing in the original location");
await assertPreviews(dbg, [
{ line: 2, column: 10, result: 4, expression: "x" }
]);
info(`Test previewing in the generated location`);
info("Test previewing in the generated location");
await dbg.actions.jumpToMappedSelectedLocation(getContext(dbg));
await waitForSelectedSource(dbg, "bundle.js");
await assertPreviews(dbg, [
{ line: 70, column: 11, result: 4, expression: "x" }
]);
info(`Test that you can not preview in another original file`);
info("Test that you can not preview in another original file");
await selectSource(dbg, "output");
await hoverAtPos(dbg, { line: 2, ch: 16 });
await assertNoTooltip(dbg);

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

@ -1,25 +1,18 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
function assertEnabled(dbg) {
is(
dbg.selectors.getQuickOpenEnabled(dbg.getState()),
true,
"quickOpen enabled"
);
is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
}
function assertDisabled(dbg) {
is(
dbg.selectors.getQuickOpenEnabled(dbg.getState()),
false,
"quickOpen disabled"
);
is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
}
function assertLine(dbg, lineNumber) {
is(
dbg.selectors.getSelectedLocation(dbg.getState()).line,
dbg.selectors.getSelectedLocation().line,
lineNumber,
`goto line is ${lineNumber}`
);
@ -27,7 +20,7 @@ function assertLine(dbg, lineNumber) {
function assertColumn(dbg, columnNumber) {
is(
dbg.selectors.getSelectedLocation(dbg.getState()).column,
dbg.selectors.getSelectedLocation().column,
columnNumber,
`goto column is ${columnNumber}`
);
@ -57,9 +50,12 @@ function findResultEl(dbg, index = 1) {
return waitForElementWithSelector(dbg, `.result-item:nth-child(${index})`);
}
async function assertResultIsTab(dbg, index) {
async function assertResultIsTab(dbg, index) {
const el = await findResultEl(dbg, index);
ok(el && !!el.querySelector('.tab.result-item-icon'), 'Result should be a tab');
ok(
el && !!el.querySelector(".tab.result-item-icon"),
"Result should be a tab"
);
}
// Testing quick open
@ -88,7 +84,9 @@ add_task(async function() {
await assertResultIsTab(dbg, 1);
pressKey(dbg, "Tab");
info("Testing arrow keys in source search and check to see if source is selected");
info(
"Testing arrow keys in source search and check to see if source is selected"
);
quickOpen(dbg, "sw2");
is(resultCount(dbg), 1, "one file results");
pressKey(dbg, "Down");

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

@ -1,20 +1,20 @@
/* 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/>. */
add_task(async function() {
const dbg = await initDebugger("doc-react.html", "App.js");
dbg.actions.toggleMapScopes();
await selectSource(dbg, "App.js");
await addBreakpoint(dbg, "App.js", 11);
info('Test previewing an immutable Map inside of a react component')
info("Test previewing an immutable Map inside of a react component");
invokeInTab("clickButton");
await waitForPaused(dbg);
const {
selectors: { getSelectedScopeMappings, getCurrentThread }
} = dbg;
await waitForState(
dbg,
state => getSelectedScopeMappings(state, getCurrentThread(state))
await waitForState(dbg, state =>
dbg.selectors.getSelectedScopeMappings(dbg.selectors.getCurrentThread())
);
await assertPreviewTextValue(dbg, 10, 22, {

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.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/>. */
/*
* Test reloading:
@ -11,7 +12,7 @@ async function waitForBreakpoint(dbg, location) {
return waitForState(
dbg,
state => {
return dbg.selectors.getBreakpoint(dbg.getState(), location);
return dbg.selectors.getBreakpoint(location);
},
"Waiting for breakpoint"
);
@ -32,7 +33,7 @@ add_task(async function() {
await waitForBreakpoint(dbg, location);
const breakpointList = dbg.selectors.getBreakpointsList(dbg.getState());
const breakpointList = dbg.selectors.getBreakpointsList();
const breakpoint = breakpointList[0];
is(breakpointList.length, 1);

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.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/>. */
/*
* Test reloading:
@ -11,31 +12,35 @@ async function waitForBreakpoint(dbg, location) {
return waitForState(
dbg,
state => {
return dbg.selectors.getBreakpoint(dbg.getState(), location);
return dbg.selectors.getBreakpoint(location);
},
"Waiting for breakpoint"
);
}
add_task(async function() {
const dbg = await initDebugger("ember/quickstart/dist/", "ember-application/index.js");
const dbg = await initDebugger(
"ember/quickstart/dist/",
"ember-application/index.js"
);
await selectSource(dbg, "ember-application/index.js");
info("1. reload and hit breakpoint")
info("1. reload and hit breakpoint");
await addBreakpoint(dbg, "ember-application/index.js", 4);
reload(dbg, "ember/quickstart/dist/");
info("2. Wait for sources to appear and then reload")
await waitForDispatch(dbg, "ADD_SOURCES")
reload(dbg, "ember/quickstart/dist/");
info("3. Wait for sources to appear and then reload mid source-maps")
info("2. Wait for sources to appear and then reload");
await waitForDispatch(dbg, "ADD_SOURCES");
reload(dbg, "ember/quickstart/dist/");
info("4. wait for the debugger to pause and show that we're in the correct location")
await waitForPaused(dbg)
info("3. Wait for sources to appear and then reload mid source-maps");
await waitForDispatch(dbg, "ADD_SOURCES");
reload(dbg, "ember/quickstart/dist/");
info(
"4. wait for the debugger to pause and show that we're in the correct location"
);
await waitForPaused(dbg);
assertPausedLocation(dbg, "ember-application/index.js", 4);
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests the search bar correctly responds to queries, enter, shift enter
@ -8,7 +9,7 @@ function waitForSearchState(dbg) {
}
function getFocusedEl(dbg) {
let doc = dbg.win.document;
const doc = dbg.win.document;
return doc.activeElement;
}
@ -24,11 +25,11 @@ add_task(async function() {
const cm = getCM(dbg);
pressKey(dbg, "fileSearch");
is(dbg.selectors.getActiveSearch(dbg.getState()), "file");
is(dbg.selectors.getActiveSearch(), "file");
// test closing and re-opening
pressKey(dbg, "Escape");
is(dbg.selectors.getActiveSearch(dbg.getState()), null);
is(dbg.selectors.getActiveSearch(), null);
pressKey(dbg, "fileSearch");

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

@ -6,20 +6,17 @@ function openProjectSearch(dbg) {
synthesizeKeyShortcut("CmdOrCtrl+Shift+F");
return waitForState(
dbg,
state => dbg.selectors.getActiveSearch(state) === "project"
state => dbg.selectors.getActiveSearch() === "project"
);
}
function closeProjectSearch(dbg) {
pressKey(dbg, "Escape");
return waitForState(dbg, state => !dbg.selectors.getActiveSearch(state));
return waitForState(dbg, state => !dbg.selectors.getActiveSearch());
}
async function selectResult(dbg) {
const select = waitForState(
dbg,
() => !dbg.selectors.getActiveSearch(dbg.getState())
);
const select = waitForState(dbg, () => !dbg.selectors.getActiveSearch());
await clickElement(dbg, "fileMatch");
return select;
}
@ -30,7 +27,7 @@ function getExpandedResultsCount(dbg) {
function getResultsFiles(dbg) {
const matches = dbg.selectors
.getTextSearchResults(dbg.getState())
.getTextSearchResults()
.map(file => file.matches);
return [...matches].length;
@ -54,9 +51,9 @@ add_task(async function() {
await selectResult(dbg);
is(dbg.selectors.getActiveSearch(dbg.getState()), null);
is(dbg.selectors.getActiveSearch(), null);
const selectedSource = dbg.selectors.getSelectedSource(dbg.getState());
const selectedSource = dbg.selectors.getSelectedSource();
ok(selectedSource.url.includes("switching-01"));
await waitForLoadedSource(dbg, "switching-01");
});

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

@ -12,7 +12,9 @@ async function evalInConsoleAtPoint(
statements
) {
const filename = `${target}://./${fixture}/input.`;
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) => c.toUpperCase());
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
c.toUpperCase()
);
await invokeWithBreakpoint(
dbg,
@ -44,14 +46,16 @@ async function assertConsoleEval(dbg, statements) {
}
add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemapped.html");
await evalInConsoleAtPoint(dbg, "webpack3-babel6", "eval-maps", { line: 14, column: 4 }, [
"one === 1",
"two === 4",
"three === 5"
]);
dbg.actions.toggleMapScopes();
await evalInConsoleAtPoint(
dbg,
"webpack3-babel6",
"eval-maps",
{ line: 14, column: 4 },
["one === 1", "two === 4", "three === 5"]
);
await evalInConsoleAtPoint(
dbg,
@ -79,8 +83,11 @@ add_task(async function() {
[`aVar === "var3"`, `aLet === "let3"`, `aConst === "const3"`]
);
await evalInConsoleAtPoint(dbg, "webpack3-babel6", "babel-classes", { line: 8, column: 16 }, [
`this.hasOwnProperty("bound")`,
]);
await evalInConsoleAtPoint(
dbg,
"webpack3-babel6",
"babel-classes",
{ line: 8, column: 16 },
[`this.hasOwnProperty("bound")`]
);
});

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

@ -4,9 +4,17 @@
// Tests for preview through Babel's compile output.
requestLongerTimeout(3);
async function breakpointPreviews(dbg, target, fixture, { line, column }, previews) {
async function breakpointPreviews(
dbg,
target,
fixture,
{ line, column },
previews
) {
const filename = `${target}://./${fixture}/input.`;
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) => c.toUpperCase());
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
c.toUpperCase()
);
log(`Starting ${fixture} tests`);
@ -24,26 +32,32 @@ async function breakpointPreviews(dbg, target, fixture, { line, column }, previe
}
function testForOf(dbg) {
return breakpointPreviews(dbg, "webpack3-babel6", "for-of", { line: 5, column: 4 }, [
{
line: 5,
column: 7,
expression: "doThing",
result: "doThing(arg)"
},
{
line: 5,
column: 13,
expression: "x",
result: "1"
},
{
line: 8,
column: 16,
expression: "doThing",
result: "doThing(arg)"
}
]);
return breakpointPreviews(
dbg,
"webpack3-babel6",
"for-of",
{ line: 5, column: 4 },
[
{
line: 5,
column: 7,
expression: "doThing",
result: "doThing(arg)"
},
{
line: 5,
column: 13,
expression: "x",
result: "1"
},
{
line: 8,
column: 16,
expression: "doThing",
result: "doThing(arg)"
}
]
);
}
function testShadowing(dbg) {
@ -118,67 +132,73 @@ function testShadowing(dbg) {
}
function testImportedBindings(dbg) {
return breakpointPreviews(dbg, "webpack3-babel6", "esmodules-cjs", { line: 20, column: 2 }, [
{
line: 20,
column: 16,
expression: "_mod2.default;",
result: '"a-default"'
},
{
line: 21,
column: 16,
expression: "_mod4.original;",
result: '"an-original"'
},
{
line: 22,
column: 16,
expression: "_mod3.aNamed;",
result: '"a-named"'
},
{
line: 23,
column: 16,
expression: "_mod3.aNamed;",
result: '"a-named"'
},
{
line: 24,
column: 16,
expression: "aNamespace",
fields: [["aNamed", "a-named"], ["default", "a-default"]]
},
{
line: 29,
column: 20,
expression: "_mod7.default;",
result: '"a-default2"'
},
{
line: 30,
column: 20,
expression: "_mod9.original;",
result: '"an-original2"'
},
{
line: 31,
column: 20,
expression: "_mod8.aNamed2;",
result: '"a-named2"'
},
{
line: 32,
column: 20,
expression: "_mod8.aNamed2;",
result: '"a-named2"'
}
]);
return breakpointPreviews(
dbg,
"webpack3-babel6",
"esmodules-cjs",
{ line: 20, column: 2 },
[
{
line: 20,
column: 16,
expression: "_mod2.default;",
result: '"a-default"'
},
{
line: 21,
column: 16,
expression: "_mod4.original;",
result: '"an-original"'
},
{
line: 22,
column: 16,
expression: "_mod3.aNamed;",
result: '"a-named"'
},
{
line: 23,
column: 16,
expression: "_mod3.aNamed;",
result: '"a-named"'
},
{
line: 24,
column: 16,
expression: "aNamespace",
fields: [["aNamed", "a-named"], ["default", "a-default"]]
},
{
line: 29,
column: 20,
expression: "_mod7.default;",
result: '"a-default2"'
},
{
line: 30,
column: 20,
expression: "_mod9.original;",
result: '"an-original2"'
},
{
line: 31,
column: 20,
expression: "_mod8.aNamed2;",
result: '"a-named2"'
},
{
line: 32,
column: 20,
expression: "_mod8.aNamed2;",
result: '"a-named2"'
}
]
);
}
add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemapped.html");
dbg.actions.toggleMapScopes();
await testForOf(dbg);
await testShadowing(dbg);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,12 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests for stepping through Babel's compile output.
requestLongerTimeout(4);
async function breakpointSteps(dbg, target, fixture, { line, column }, steps) {
const filename = `${target}://./${fixture}/input.`;
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) => c.toUpperCase());
const fnName = `${target}-${fixture}`.replace(/-([a-z])/g, (s, c) =>
c.toUpperCase()
);
await invokeWithBreakpoint(
dbg,
@ -39,7 +42,7 @@ async function runSteps(dbg, source, steps) {
throw new Error("Unknown stepping type");
}
const { location } = getVisibleSelectedFrame(getState());
const { location } = getVisibleSelectedFrame();
is(location.sourceId, source.id, `Step ${i} has correct sourceId`);
is(location.line, position.line, `Step ${i} has correct line`);

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

@ -0,0 +1,46 @@
/* 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/>. */
// Tests for preview through Babel's compile output.
requestLongerTimeout(3);
function getOriginalScope(dbg) {
return dbg.selectors.getSelectedOriginalScope(
dbg.selectors.getCurrentThread()
);
}
async function previewToken(dbg, line, column, value) {
const previewEl = await tryHovering(dbg, line, column, "previewPopup");
is(previewEl.innerText, value);
dbg.actions.clearPreview(getContext(dbg));
}
// Test pausing with mapScopes enabled and disabled
add_task(async function() {
const dbg = await initDebugger("doc-sourcemapped.html");
dbg.actions.toggleMapScopes();
info("1. Pause on line 20");
const filename = "webpack3-babel6://./esmodules-cjs/input.";
await waitForSources(dbg, filename);
const source = findSource(dbg, filename);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 20, 2);
invokeInTab("webpack3Babel6EsmodulesCjs");
await waitForPaused(dbg);
info("2. Hover on a token with mapScopes enabled");
await previewToken(dbg, 20, 16, '"a-default"');
ok(getOriginalScope(dbg) != null, "Scopes are mapped");
info("3. Hover on a token with mapScopes disabled");
clickElement(dbg, "mapScopesCheckbox");
await previewToken(dbg, 21, 16, "undefined");
info("4. StepOver with mapScopes disabled");
await stepOver(dbg);
await previewToken(dbg, 20, 16, "undefined");
ok(getOriginalScope(dbg) == null, "Scopes are not mapped");
});

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Test that an error while loading a sourcemap does not break
// debugging.
@ -20,5 +21,5 @@ add_task(async function() {
// Make sure that only the single generated source exists. The
// sourcemap failed to download.
is(dbg.selectors.getSourceCount(dbg.getState()), 1, "Only 1 source exists");
is(dbg.selectors.getSourceCount(), 1, "Only 1 source exists");
});

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

@ -12,18 +12,18 @@ async function waitForBreakpoint(dbg, location) {
return waitForState(
dbg,
state => {
return dbg.selectors.getBreakpoint(dbg.getState(), location);
return dbg.selectors.getBreakpoint(location);
},
"Waiting for breakpoint"
);
}
function getBreakpoints(dbg) {
return dbg.selectors.getBreakpointsList(dbg.getState());
return dbg.selectors.getBreakpointsList();
}
function getBreakpointCount(dbg) {
return dbg.selectors.getBreakpointCount(dbg.getState());
return dbg.selectors.getBreakpointCount();
}
add_task(async function() {
@ -39,7 +39,7 @@ add_task(async function() {
is(breakpoint.location.line, 6);
info("Reload with a new version of the file");
let syncBp = waitForDispatch(dbg, "SET_BREAKPOINT");
const syncBp = waitForDispatch(dbg, "SET_BREAKPOINT");
await navigate(dbg, "doc-sourcemaps-reload2.html", "v1.js");
await syncBp;

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

@ -6,7 +6,7 @@ requestLongerTimeout(2);
async function waitForBreakpointCount(dbg, count) {
return waitForState(
dbg,
state => dbg.selectors.getBreakpointCount(state) === count
state => dbg.selectors.getBreakpointCount() === count
);
}
@ -14,8 +14,7 @@ add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
const dbg = await initDebugger("doc-sourcemaps.html");
const {
selectors: { getBreakpoint, getBreakpointCount },
getState
selectors: { getBreakpoint, getBreakpointCount }
} = dbg;
await waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
@ -42,15 +41,15 @@ add_task(async function() {
assertPausedLocation(dbg);
await waitForBreakpointCount(dbg, 2);
is(getBreakpointCount(getState()), 2, "Three breakpoints exist");
is(getBreakpointCount(), 2, "Three breakpoints exist");
ok(
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15, column: 0 }),
getBreakpoint({ sourceId: entrySrc.id, line: 15, column: 0 }),
"Breakpoint has correct line"
);
ok(
getBreakpoint(getState(), {
getBreakpoint({
sourceId: entrySrc.id,
line: 15,
column: 0,

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

@ -13,7 +13,7 @@ function assertBreakpointExists(dbg, source, line) {
} = dbg;
ok(
getBreakpoint(getState(), { sourceId: source.id, line }),
getBreakpoint({ sourceId: source.id, line }),
"Breakpoint has correct line"
);
}
@ -45,7 +45,7 @@ async function waitForBreakpointCount(dbg, count) {
selectors: { getBreakpointCount },
getState
} = dbg;
await waitForState(dbg, state => getBreakpointCount(getState()) == count);
await waitForState(dbg, state => getBreakpointCount() == count);
}
add_task(async function() {
@ -77,7 +77,7 @@ add_task(async function() {
await clickGutter(dbg, 70);
await waitForBreakpointCount(dbg, 0);
is(dbg.selectors.getBreakpointCount(getState()), 0, "No breakpoints exists");
is(dbg.selectors.getBreakpointCount(), 0, "No breakpoints exists");
const entrySrc = findSource(dbg, "entry.js");
@ -91,7 +91,7 @@ add_task(async function() {
// Test breaking on a breakpoint
await addBreakpoint(dbg, "entry.js", 15);
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
is(getBreakpointCount(), 1, "One breakpoint exists");
assertBreakpointExists(dbg, entrySrc, 15);
invokeInTab("keepMeAlive");

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
requestLongerTimeout(2);
function assertBpInGutter(dbg, lineNumber) {
@ -18,7 +19,11 @@ function assertBpInGutter(dbg, lineNumber) {
// This source map does not have source contents, so it's fetched separately
add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
const dbg = await initDebugger("doc-sourcemaps2.html", "main.js", "main.min.js");
const dbg = await initDebugger(
"doc-sourcemaps2.html",
"main.js",
"main.min.js"
);
const {
selectors: { getBreakpoint, getBreakpointCount },
getState
@ -31,9 +36,9 @@ add_task(async function() {
// Test that breakpoint is not off by a line.
await addBreakpoint(dbg, mainSrc, 4, 2);
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
is(getBreakpointCount(), 1, "One breakpoint exists");
ok(
getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4, column: 2 }),
getBreakpoint({ sourceId: mainSrc.id, line: 4, column: 2 }),
"Breakpoint has correct line"
);

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
// Tests loading sourcemapped sources, setting breakpoints, and
// inspecting restored scopes.
@ -8,13 +9,13 @@ requestLongerTimeout(2);
// This source map does not have source contents, so it's fetched separately
add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemaps3.html", "bundle.js", "sorted.js", "test.js");
const {
selectors: { getBreakpoint, getBreakpointCount },
getState
} = dbg;
const dbg = await initDebugger(
"doc-sourcemaps3.html",
"bundle.js",
"sorted.js",
"test.js"
);
dbg.actions.toggleMapScopes();
ok(true, "Original sources exist");
const sortedSrc = findSource(dbg, "sorted.js");
@ -23,9 +24,9 @@ add_task(async function() {
// Test that breakpoint is not off by a line.
await addBreakpoint(dbg, sortedSrc, 9, 4);
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
ok(
getBreakpoint(getState(), { sourceId: sortedSrc.id, line: 9, column: 4 }),
dbg.selectors.getBreakpoint({ sourceId: sortedSrc.id, line: 9, column: 4 }),
"Breakpoint has correct line"
);

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

@ -5,7 +5,13 @@
// Tests that the source tree works.
add_task(async function() {
const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
const dbg = await initDebugger(
"doc-sources.html",
"simple1",
"simple2",
"nested-source",
"long.js"
);
const {
selectors: { getSelectedSource },
getState
@ -29,7 +35,7 @@ add_task(async function() {
const focusedNode = findElementWithSelector(dbg, ".sources-list .focused");
const fourthNode = findElement(dbg, "sourceNode", 4);
const selectedSource = getSelectedSource(getState()).url;
const selectedSource = getSelectedSource().url;
ok(fourthNode.classList.contains("focused"), "4th node is focused");
ok(selectedSource.includes("nested-source.js"), "nested-source is selected");

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

@ -121,7 +121,7 @@ function waitForThreadEvents(dbg, eventName) {
}
/**
* Waits for `predicate(state)` to be true. `state` is the redux app state.
* Waits for `predicate()` to be true. `state` is the redux app state.
*
* @memberof mochitest/waits
* @param {Object} dbg
@ -224,7 +224,7 @@ function assertClass(el, className, exists = true) {
function waitForSelectedLocation(dbg, line) {
return waitForState(dbg, state => {
const location = dbg.selectors.getSelectedLocation(state);
const location = dbg.selectors.getSelectedLocation();
return location && location.line == line;
});
}
@ -239,7 +239,7 @@ function waitForSelectedSource(dbg, url) {
return waitForState(
dbg,
state => {
const source = getSelectedSource(state);
const source = getSelectedSource();
const isLoaded = source && sourceUtils.isLoaded(source);
if (!isLoaded) {
return false;
@ -254,9 +254,7 @@ function waitForSelectedSource(dbg, url) {
return false;
}
return (
hasSymbols(state, source) && hasBreakpointPositions(state, source.id)
);
return hasSymbols(source) && hasBreakpointPositions(source.id);
},
"selected source"
);
@ -289,20 +287,16 @@ function assertEmptyLines(dbg, lines) {
return every(subArray, subItem => superArray.includes(subItem));
}
const sourceId = dbg.selectors.getSelectedSourceId(dbg.store.getState());
const emptyLines = dbg.selectors.getEmptyLines(
dbg.store.getState(),
sourceId
);
const sourceId = dbg.selectors.getSelectedSourceId();
const emptyLines = dbg.selectors.getEmptyLines(sourceId);
ok(subset(lines, emptyLines), "empty lines should match");
}
function getVisibleSelectedFrameLine(dbg) {
const {
selectors: { getVisibleSelectedFrame },
getState
selectors: { getVisibleSelectedFrame }
} = dbg;
const frame = getVisibleSelectedFrame(getState());
const frame = getVisibleSelectedFrame();
return frame && frame.location.line;
}
@ -316,15 +310,7 @@ function getVisibleSelectedFrameLine(dbg) {
* @static
*/
function assertPausedLocation(dbg) {
const {
selectors: { getSelectedSource },
getState
} = dbg;
ok(
isSelectedFrameSelected(dbg, getState()),
"top frame's source is selected"
);
ok(isSelectedFrameSelected(dbg), "top frame's source is selected");
// Check the pause location
const pauseLine = getVisibleSelectedFrameLine(dbg);
@ -336,7 +322,7 @@ function assertPausedLocation(dbg) {
function assertDebugLine(dbg, line) {
// Check the debug line
const lineInfo = getCM(dbg).lineInfo(line - 1);
const source = dbg.selectors.getSelectedSource(dbg.getState());
const source = dbg.selectors.getSelectedSource();
if (source && source.loadedState == "loading") {
const url = source.url;
ok(
@ -392,14 +378,14 @@ function assertDebugLine(dbg, line) {
* @static
*/
function assertHighlightLocation(dbg, source, line) {
const {
selectors: { getSelectedSource },
getState
} = dbg;
source = findSource(dbg, source);
// Check the selected source
is(getSelectedSource(getState()).url, source.url, "source url is correct");
is(
dbg.selectors.getSelectedSource().url,
source.url,
"source url is correct"
);
// Check the highlight line
const lineEl = findElement(dbg, "highlightLine");
@ -426,23 +412,14 @@ function assertHighlightLocation(dbg, source, line) {
* @static
*/
function isPaused(dbg) {
const {
selectors: { getIsPaused, getCurrentThread },
getState
} = dbg;
return getIsPaused(getState(), getCurrentThread(getState()));
return dbg.selectors.getIsPaused(dbg.selectors.getCurrentThread());
}
// Make sure the debugger is paused at a certain source ID and line.
function assertPausedAtSourceAndLine(dbg, expectedSourceId, expectedLine) {
assertPaused(dbg);
const {
selectors: { getCurrentThreadFrames },
getState
} = dbg;
const frames = getCurrentThreadFrames(getState());
const frames = dbg.selectors.getCurrentThreadFrames();
ok(frames.length >= 1, "Got at least one frame");
const { sourceId, line } = frames[0].location;
ok(sourceId == expectedSourceId, "Frame has correct source");
@ -452,13 +429,7 @@ function assertPausedAtSourceAndLine(dbg, expectedSourceId, expectedLine) {
// Get any workers associated with the debugger.
async function getWorkers(dbg) {
await dbg.actions.updateWorkers();
const {
selectors: { getWorkers },
getState
} = dbg;
return getWorkers(getState());
return dbg.selectors.getWorkers();
}
async function waitForLoadedScopes(dbg) {
@ -471,7 +442,7 @@ async function waitForLoadedScopes(dbg) {
function waitForBreakpointCount(dbg, count) {
return waitForState(
dbg,
state => dbg.selectors.getBreakpointCount(state) == count
state => dbg.selectors.getBreakpointCount() == count
);
}
@ -491,8 +462,7 @@ async function waitForPaused(dbg, url) {
await waitForState(
dbg,
state =>
isPaused(dbg) && !!getSelectedScope(state, getCurrentThread(state)),
state => isPaused(dbg) && !!getSelectedScope(getCurrentThread()),
"paused"
);
@ -503,7 +473,7 @@ async function waitForPaused(dbg, url) {
function waitForCondition(dbg, condition) {
return waitForState(dbg, state =>
dbg.selectors
.getBreakpointsList(state)
.getBreakpointsList()
.find(bp => bp.options.condition == condition)
);
}
@ -511,13 +481,13 @@ function waitForCondition(dbg, condition) {
function waitForLog(dbg, logValue) {
return waitForState(dbg, state =>
dbg.selectors
.getBreakpointsList(state)
.getBreakpointsList()
.find(bp => bp.options.logValue == logValue)
);
}
async function waitForPausedThread(dbg, thread) {
return waitForState(dbg, state => dbg.selectors.getIsPaused(state, thread));
return waitForState(dbg, state => dbg.selectors.getIsPaused(thread));
}
/*
@ -539,12 +509,12 @@ function waitForTime(ms) {
}
function isSelectedFrameSelected(dbg, state) {
const frame = dbg.selectors.getVisibleSelectedFrame(state);
const frame = dbg.selectors.getVisibleSelectedFrame();
// Make sure the source text is completely loaded for the
// source we are paused in.
const sourceId = frame.location.sourceId;
const source = dbg.selectors.getSelectedSource(state);
const source = dbg.selectors.getSelectedSource();
if (!source) {
return false;
@ -572,7 +542,7 @@ function clearDebuggerPreferences() {
Services.prefs.clearUserPref("devtools.debugger.call-stack-visible");
Services.prefs.clearUserPref("devtools.debugger.scopes-visible");
Services.prefs.clearUserPref("devtools.debugger.skip-pausing");
pushPref("devtools.debugger.map-scopes-enabled", true);
Services.prefs.clearUserPref("devtools.debugger.map-scopes-enabled");
}
/**
@ -633,7 +603,7 @@ function findSource(dbg, url, { silent } = { silent: false }) {
return source;
}
const sources = Object.values(dbg.selectors.getSources(dbg.getState()));
const sources = Object.values(dbg.selectors.getSources());
const source = sources.find(s => (s.url || "").includes(url));
if (!source) {
@ -663,7 +633,7 @@ function waitForLoadedSources(dbg) {
return waitForState(
dbg,
state => {
const sources = Object.values(dbg.selectors.getSources(state));
const sources = Object.values(dbg.selectors.getSources());
return !sources.some(source => source.loadedState == "loading");
},
"loaded source"
@ -671,11 +641,11 @@ function waitForLoadedSources(dbg) {
}
function getContext(dbg) {
return dbg.selectors.getContext(dbg.getState());
return dbg.selectors.getContext();
}
function getThreadContext(dbg) {
return dbg.selectors.getThreadContext(dbg.getState());
return dbg.selectors.getThreadContext();
}
/**
@ -806,8 +776,8 @@ async function navigate(dbg, url, ...sources) {
function getFirstBreakpointColumn(dbg, { line, sourceId }) {
const { getSource, getFirstBreakpointPosition } = dbg.selectors;
const source = getSource(dbg.getState(), sourceId);
const position = getFirstBreakpointPosition(dbg.getState(), {
const source = getSource(sourceId);
const position = getFirstBreakpointPosition({
line,
sourceId
});
@ -829,14 +799,14 @@ function getFirstBreakpointColumn(dbg, { line, sourceId }) {
async function addBreakpoint(dbg, source, line, column, options) {
source = findSource(dbg, source);
const sourceId = source.id;
const bpCount = dbg.selectors.getBreakpointCount(dbg.getState());
const bpCount = dbg.selectors.getBreakpointCount();
await dbg.actions.addBreakpoint(
getContext(dbg),
{ sourceId, line, column },
options
);
is(
dbg.selectors.getBreakpointCount(dbg.getState()),
dbg.selectors.getBreakpointCount(),
bpCount + 1,
"a new breakpoint was created"
);
@ -846,7 +816,7 @@ function disableBreakpoint(dbg, source, line, column) {
column =
column || getFirstBreakpointColumn(dbg, { line, sourceId: source.id });
const location = { sourceId: source.id, sourceUrl: source.url, line, column };
const bp = dbg.selectors.getBreakpointForLocation(dbg.getState(), location);
const bp = dbg.selectors.getBreakpointForLocation(location);
return dbg.actions.disableBreakpoint(getContext(dbg), bp);
}
@ -862,19 +832,14 @@ function setBreakpointOptions(dbg, source, line, column, options) {
}
function findBreakpoint(dbg, url, line) {
const {
selectors: { getBreakpoint, getBreakpointsList },
getState
} = dbg;
const source = findSource(dbg, url);
const column = getFirstBreakpointColumn(dbg, { line, sourceId: source.id });
return getBreakpoint(getState(), { sourceId: source.id, line, column });
return dbg.selectors.getBreakpoint({ sourceId: source.id, line, column });
}
async function loadAndAddBreakpoint(dbg, filename, line, column) {
const {
selectors: { getBreakpoint, getBreakpointCount, getBreakpointsMap },
getState
selectors: { getBreakpoint, getBreakpointCount, getBreakpointsMap }
} = dbg;
await waitForSources(dbg, filename);
@ -887,9 +852,9 @@ async function loadAndAddBreakpoint(dbg, filename, line, column) {
// Test that breakpoint is not off by a line.
await addBreakpoint(dbg, source, line, column);
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
if (!getBreakpoint(getState(), { sourceId: source.id, line, column })) {
const breakpoints = getBreakpointsMap(getState());
is(getBreakpointCount(), 1, "One breakpoint exists");
if (!getBreakpoint({ sourceId: source.id, line, column })) {
const breakpoints = getBreakpointsMap();
const id = Object.keys(breakpoints).pop();
const loc = breakpoints[id].location;
ok(
@ -910,11 +875,6 @@ async function invokeWithBreakpoint(
{ line, column },
handler
) {
const {
selectors: { getBreakpointCount },
getState
} = dbg;
const source = await loadAndAddBreakpoint(dbg, filename, line, column);
const invokeResult = invokeInTab(fnName);
@ -932,18 +892,19 @@ async function invokeWithBreakpoint(
await removeBreakpoint(dbg, source.id, line, column);
is(getBreakpointCount(getState()), 0, "Breakpoint reverted");
is(dbg.selectors.getBreakpointCount(), 0, "Breakpoint reverted");
await handler(source);
await resume(dbg);
// eslint-disable-next-line max-len
// If the invoke errored later somehow, capture here so the error is reported nicely.
await invokeResult;
}
function prettyPrint(dbg) {
const sourceId = dbg.selectors.getSelectedSourceId(dbg.store.getState());
const sourceId = dbg.selectors.getSelectedSourceId();
return dbg.actions.togglePrettyPrint(getContext(dbg), sourceId);
}
@ -992,10 +953,10 @@ async function assertScopes(dbg, items) {
* @static
*/
function removeBreakpoint(dbg, sourceId, line, column) {
const source = dbg.selectors.getSource(dbg.getState(), sourceId);
const source = dbg.selectors.getSource(sourceId);
column = column || getFirstBreakpointColumn(dbg, { line, sourceId });
const location = { sourceId, sourceUrl: source.url, line, column };
const bp = dbg.selectors.getBreakpointForLocation(dbg.getState(), location);
const bp = dbg.selectors.getBreakpointForLocation(location);
return dbg.actions.removeBreakpoint(getContext(dbg), bp);
}
@ -1024,11 +985,7 @@ function waitForActive(dbg) {
const {
selectors: { getIsPaused, getCurrentThread }
} = dbg;
return waitForState(
dbg,
state => !getIsPaused(state, getCurrentThread(state)),
"active"
);
return waitForState(dbg, state => !getIsPaused(getCurrentThread()), "active");
}
// Helpers
@ -1050,7 +1007,7 @@ function invokeInTab(fnc, ...args) {
fnc,
args
}) {
return content.wrappedJSObject[fnc](...args); // max-len
return content.wrappedJSObject[fnc](...args);
});
}
@ -1203,6 +1160,7 @@ const selectors = {
expressionNode: i =>
`.expressions-list .expression-container:nth-child(${i}) .object-label`,
expressionValue: i =>
// eslint-disable-next-line max-len
`.expressions-list .expression-container:nth-child(${i}) .object-delimiter + *`,
expressionClose: i =>
`.expressions-list .expression-container:nth-child(${i}) .close`,
@ -1228,6 +1186,7 @@ const selectors = {
scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`,
scopeValue: i =>
`.scopes-list .tree-node:nth-child(${i}) .object-delimiter + *`,
mapScopesCheckbox: ".map-scopes-header input",
frame: i => `.frames [role="list"] [role="listitem"]:nth-child(${i})`,
frames: '.frames [role="list"] [role="listitem"]',
gutter: i => `.CodeMirror-code *:nth-child(${i}) .CodeMirror-linenumber`,
@ -1559,7 +1518,7 @@ async function assertPreviewTextValue(dbg, line, column, { text, expression }) {
ok(previewEl.innerText.includes(text), "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
const preview = dbg.selectors.getPreview();
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
}
@ -1569,28 +1528,33 @@ async function assertPreviewTooltip(dbg, line, column, { result, expression }) {
is(previewEl.innerText, result, "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
const preview = dbg.selectors.getPreview();
is(`${preview.result}`, result, "Preview.result");
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
}
async function hoverOnToken(dbg, line, column, selector) {
await tryHovering(dbg, line, column, selector);
return dbg.selectors.getPreview();
}
function getPreviewProperty(preview, field) {
const properties =
preview.result.preview.ownProperties || preview.result.preview.items;
const property = properties[field];
return property.value || property;
}
async function assertPreviewPopup(
dbg,
line,
column,
{ field, value, expression }
) {
await tryHovering(dbg, line, column, "popup");
const preview = await hoverOnToken(dbg, line, column, "popup");
is(`${getPreviewProperty(preview, field)}`, value, "Preview.result");
const preview = dbg.selectors.getPreview(dbg.getState());
const properties =
preview.result.preview.ownProperties || preview.result.preview.items;
const property = properties[field];
const propertyValue = property.value || property;
is(`${propertyValue}`, value, "Preview.result");
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
}
@ -1627,7 +1591,7 @@ async function waitForBreakableLine(dbg, source, lineNumber) {
const currentSource = findSource(dbg, source);
const emptyLines =
currentSource && dbg.selectors.getEmptyLines(state, currentSource.id);
currentSource && dbg.selectors.getEmptyLines(currentSource.id);
return emptyLines && !emptyLines.includes(lineNumber);
},

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

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.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/>. */
/**
* Helper method to create a "dbg" context for other tools to use
@ -8,14 +9,9 @@
function createDebuggerContext(toolbox) {
const panel = toolbox.getPanel("jsdebugger");
const win = panel.panelWin;
const { store, client, selectors, actions } = panel.getVarsForTests();
return {
actions: actions,
selectors: selectors,
getState: store.getState,
store: store,
client: client,
...win.dbg,
toolbox: toolbox,
win: win,
panel: panel

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

@ -3930,19 +3930,21 @@ eslint-config-prettier@^4.0.0:
dependencies:
get-stdin "^6.0.0"
eslint-import-resolver-node@^0.3.1:
eslint-import-resolver-node@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==
dependencies:
debug "^2.6.9"
resolve "^1.5.0"
eslint-module-utils@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746"
eslint-module-utils@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz#546178dab5e046c8b562bbb50705e2456d7bda49"
integrity sha512-lmDJgeOOjk8hObTysjqH7wyMi+nsHwwvfBykwfhjR1LNdd7C2uFJBvx4OpWYpXOw4df1yE1cDEVd1yLHitk34w==
dependencies:
debug "^2.6.8"
pkg-dir "^1.0.0"
pkg-dir "^2.0.0"
eslint-plugin-babel@^5.0.0:
version "5.1.0"
@ -3960,20 +3962,21 @@ eslint-plugin-flowtype@^3.0.0:
dependencies:
lodash "^4.17.10"
eslint-plugin-import@^2.8.0:
version "2.13.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.13.0.tgz#df24f241175e312d91662dc91ca84064caec14ed"
eslint-plugin-import@^2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.16.0.tgz#97ac3e75d0791c4fac0e15ef388510217be7f66f"
integrity sha512-z6oqWlf1x5GkHIFgrSvtmudnqM6Q60KM4KvpWi5ubonMjycLjndvd5+8VAZIsTlHC03djdgJuyKG6XO577px6A==
dependencies:
contains-path "^0.1.0"
debug "^2.6.8"
debug "^2.6.9"
doctrine "1.5.0"
eslint-import-resolver-node "^0.3.1"
eslint-module-utils "^2.2.0"
has "^1.0.1"
lodash "^4.17.4"
minimatch "^3.0.3"
eslint-import-resolver-node "^0.3.2"
eslint-module-utils "^2.3.0"
has "^1.0.3"
lodash "^4.17.11"
minimatch "^3.0.4"
read-pkg-up "^2.0.0"
resolve "^1.6.0"
resolve "^1.9.0"
eslint-plugin-jest@^21.15.1:
version "21.18.0"
@ -8304,6 +8307,11 @@ path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
path-to-regexp@0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
@ -8366,12 +8374,6 @@ pinkie@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
pkg-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4"
dependencies:
find-up "^1.0.0"
pkg-dir@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"
@ -10157,12 +10159,19 @@ resolve@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
resolve@^1.1.6, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.6.0:
resolve@^1.1.6, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0:
version "1.8.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
dependencies:
path-parse "^1.0.5"
resolve@^1.9.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba"
integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==
dependencies:
path-parse "^1.0.6"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"

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

@ -45,6 +45,7 @@ support-files =
shared-head.js
!/devtools/client/shared/test/shared-head.js
!/devtools/client/shared/test/telemetry-test-helpers.js
!/devtools/client/debugger/test/mochitest/helpers/context.js
!/devtools/client/shared/test/test-actor.js
!/devtools/client/shared/test/test-actor-registry.js

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

@ -6,11 +6,7 @@
// Test that the highlighter works when the debugger is paused.
function debuggerIsPaused(dbg) {
const {
selectors: { getIsPaused, getCurrentThread },
getState,
} = dbg;
return !!getIsPaused(getState(), getCurrentThread(getState()));
return !!dbg.selectors.getIsPaused(dbg.selectors.getCurrentThread());
}
function waitForPaused(dbg) {
@ -29,23 +25,6 @@ function waitForPaused(dbg) {
});
}
async function createDebuggerContext(toolbox) {
const panel = await toolbox.getPanelWhenReady("jsdebugger");
const win = panel.panelWin;
const { store, client, selectors, actions } = panel.getVarsForTests();
return {
actions: actions,
selectors: selectors,
getState: store.getState,
store: store,
client: client,
toolbox: toolbox,
win: win,
panel: panel,
};
}
const IFRAME_SRC = "<style>" +
"body {" +
"margin:0;" +

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

@ -22,6 +22,12 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/inspector/test/shared-head.js",
this);
// Import helpers for the new debugger
/* import-globals-from ../../debugger/test/mochitest/helpers/context.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/helpers/context.js",
this);
const {LocalizationHelper} = require("devtools/shared/l10n");
const INSPECTOR_L10N =
new LocalizationHelper("devtools/client/locales/inspector.properties");

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

@ -9,8 +9,9 @@
"use strict";
/* import-globals-from head.js*/
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-autocomplete-in-stackframe.html";
const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-autocomplete-in-stackframe.html";
requestLongerTimeout(20);
@ -26,9 +27,7 @@ add_task(async function() {
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const {
autocompletePopup: popup,
} = jsterm;
const { autocompletePopup: popup } = jsterm;
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = gDevTools.getToolbox(target);
@ -46,19 +45,27 @@ async function performTests() {
// Test if 'foo' gives 'foo1' but not 'foo2' or 'foo3'
await jstermComplete("foo");
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj",
`"foo" gave the expected suggestions`);
is(
getPopupLabels(popup).join("-"),
"foo1-foo1Obj",
`"foo" gave the expected suggestions`
);
// Test if 'foo1Obj.' gives 'prop1' and 'prop2'
await jstermComplete("foo1Obj.");
checkInputCompletionValue(hud, " prop1", "foo1Obj completion");
is(getPopupLabels(popup).join("-"), "prop1-prop2",
`"foo1Obj." gave the expected suggestions`);
is(
getPopupLabels(popup).join("-"),
"prop1-prop2",
`"foo1Obj." gave the expected suggestions`
);
// Test if 'foo1Obj.prop2.' gives 'prop21'
await jstermComplete("foo1Obj.prop2.");
ok(getPopupLabels(popup).includes("prop21"),
`"foo1Obj.prop2." gave the expected suggestions`);
ok(
getPopupLabels(popup).includes("prop21"),
`"foo1Obj.prop2." gave the expected suggestions`
);
info("Opening Debugger");
await openDebugger();
@ -66,7 +73,7 @@ async function performTests() {
info("Waiting for pause");
await pauseDebugger(dbg);
const stackFrames = dbg.selectors.getCallStackFrames(dbg.getState());
const stackFrames = dbg.selectors.getCallStackFrames();
info("Opening Console again");
await toolbox.selectTool("webconsole");
@ -74,8 +81,11 @@ async function performTests() {
// Test if 'foo' gives 'foo3' and 'foo1' but not 'foo2', since we are paused in
// the `secondCall` function (called by `firstCall`, which we call in `pauseDebugger`).
await jstermComplete("foo");
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj-foo3-foo3Obj",
`"foo" gave the expected suggestions`);
is(
getPopupLabels(popup).join("-"),
"foo1-foo1Obj-foo3-foo3Obj",
`"foo" gave the expected suggestions`
);
await openDebugger();
@ -88,8 +98,11 @@ async function performTests() {
// Test if 'foo' gives 'foo2' and 'foo1' but not 'foo3', since we are now in the
// `firstCall` frame.
await jstermComplete("foo");
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj-foo2-foo2Obj",
`"foo" gave the expected suggestions`);
is(
getPopupLabels(popup).join("-"),
"foo1-foo1Obj-foo2-foo2Obj",
`"foo" gave the expected suggestions`
);
// Test if 'foo2Obj.' gives 'prop1'
await jstermComplete("foo2Obj.");

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

@ -9,13 +9,15 @@
requestLongerTimeout(5);
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" +
"test-click-function-to-source.html";
const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" +
"test-click-function-to-source.html";
const TEST_SCRIPT_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" +
"test-click-function-to-source.js";
const TEST_SCRIPT_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" +
"test-click-function-to-source.js";
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
@ -31,7 +33,7 @@ add_task(async function() {
ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
content.wrappedJSObject.foo();
});
const {node} = await onLoggedFunction;
const { node } = await onLoggedFunction;
const jumpIcon = node.querySelector(".jump-definition");
ok(jumpIcon, "A jump to definition button is rendered, as expected");
@ -42,7 +44,7 @@ add_task(async function() {
const dbg = createDebuggerContext(toolbox);
await waitForSelectedSource(dbg, TEST_SCRIPT_URI);
const pendingLocation = dbg.selectors.getPendingSelectedLocation(dbg.getState());
const {line} = pendingLocation;
const pendingLocation = dbg.selectors.getPendingSelectedLocation();
const { line } = pendingLocation;
is(line, 9, "Debugger is open at the expected line");
});

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

@ -9,13 +9,14 @@
"use strict";
/* import-globals-from head.js*/
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-eval-in-stackframe.html";
const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-eval-in-stackframe.html";
add_task(async function() {
info("open the console");
const hud = await openNewTabAndConsole(TEST_URI);
const {jsterm} = hud;
const { jsterm } = hud;
info("Check `foo` value");
let onResultMessage = waitForMessage(hud, "globalFooBug783499");
@ -45,7 +46,7 @@ add_task(async function() {
await openDebugger();
await pauseDebugger(dbg);
const stackFrames = dbg.selectors.getCallStackFrames(dbg.getState());
const stackFrames = dbg.selectors.getCallStackFrames();
info("frames added, select the console again");
await openConsole();

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

@ -9,13 +9,14 @@
"use strict";
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-eval-in-stackframe.html";
const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-eval-in-stackframe.html";
add_task(async function() {
info("open the console");
const hud = await openNewTabAndConsole(TEST_URI);
const {jsterm} = hud;
const { jsterm } = hud;
info("open the debugger");
await openDebugger();
@ -55,9 +56,11 @@ add_task(async function() {
ok(firstCallEvaluationResult === unresolvedSymbol, "firstCall was not evaluated yet");
info("Resuming the thread");
dbg.actions.resume(dbg.selectors.getThreadContext(dbg.getState()));
dbg.actions.resume(dbg.selectors.getThreadContext());
message = await onFirstCallMessageReceived;
ok(firstCallEvaluationResult !== unresolvedSymbol,
"firstCall() returned correct value");
ok(
firstCallEvaluationResult !== unresolvedSymbol,
"firstCall() returned correct value"
);
});

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

@ -1203,7 +1203,7 @@ function isConfirmDialogOpened(toolbox) {
async function selectFrame(dbg, frame) {
const onScopes = waitForDispatch(dbg, "ADD_SCOPES");
await dbg.actions.selectFrame(dbg.selectors.getThreadContext(dbg.getState()), frame);
await dbg.actions.selectFrame(dbg.selectors.getThreadContext(), frame);
await onScopes;
}

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

@ -598,9 +598,7 @@ nsSHistory::AddEntry(nsISHEntry* aSHEntry, bool aPersist) {
}
NS_IMETHODIMP_(void)
nsSHistory::ClearRootDocShell() {
mRootDocShell = nullptr;
}
nsSHistory::ClearRootDocShell() { mRootDocShell = nullptr; }
/* Get size of the history list */
NS_IMETHODIMP

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

@ -287,9 +287,9 @@ nsresult ImageEncoder::GetInputStream(int32_t aWidth, int32_t aHeight,
imgIEncoder* aEncoder,
const nsAString& aEncoderOptions,
nsIInputStream** aStream) {
nsresult rv = aEncoder->InitFromData(aImageBuffer, aWidth * aHeight * 4,
aWidth, aHeight, aWidth * 4, aFormat,
aEncoderOptions);
nsresult rv =
aEncoder->InitFromData(aImageBuffer, aWidth * aHeight * 4, aWidth,
aHeight, aWidth * 4, aFormat, aEncoderOptions);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<imgIEncoder> encoder(aEncoder);
@ -317,9 +317,9 @@ nsresult ImageEncoder::ExtractDataInternal(
return NS_ERROR_INVALID_ARG;
}
rv = ImageEncoder::GetInputStream(
aSize.width, aSize.height, aImageBuffer, aFormat, aEncoder,
aOptions, getter_AddRefs(imgStream));
rv = ImageEncoder::GetInputStream(aSize.width, aSize.height, aImageBuffer,
aFormat, aEncoder, aOptions,
getter_AddRefs(imgStream));
} else if (aContext && !aUsePlaceholder) {
NS_ConvertUTF16toUTF8 encoderType(aType);
rv = aContext->GetInputStream(encoderType.get(), aOptions,

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

@ -435,9 +435,9 @@ bool MaybeCrossOriginObject<Base>::defineProperty(
}
template <typename Base>
bool MaybeCrossOriginObject<Base>::enumerate(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const {
bool MaybeCrossOriginObject<Base>::enumerate(
JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const {
// Just get the property keys from ourselves, in whatever Realm we happen to
// be in. It's important to not enter the Realm of "proxy" here, because that
// would affect the list of keys we claim to have. We wrap the proxy in the

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

@ -45,8 +45,9 @@ class RemoteOuterWindowProxy
JS::MutableHandleVector<jsid> aProps) const final;
// SpiderMonkey extensions
bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const final;
bool getOwnEnumerablePropertyKeys(
JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const final;
void NoteChildren(JSObject* aProxy,
nsCycleCollectionTraversalCallback& aCb) const override {
@ -140,9 +141,9 @@ bool AppendIndexedPropertyNames(JSContext* aCx, BrowsingContext* aContext,
return true;
}
bool RemoteOuterWindowProxy::ownPropertyKeys(JSContext* aCx,
JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const {
bool RemoteOuterWindowProxy::ownPropertyKeys(
JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const {
BrowsingContext* bc = GetBrowsingContext(aProxy);
// https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-ownpropertykeys:crossoriginownpropertykeys-(-o-)

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

@ -24,9 +24,9 @@ class WindowNamedPropertiesHandler : public BaseDOMProxyHandler {
JS::Handle<jsid> aId,
JS::Handle<JS::PropertyDescriptor> aDesc,
JS::ObjectOpResult& result) const override;
virtual bool ownPropNames(JSContext* aCx, JS::Handle<JSObject*> aProxy,
unsigned flags,
JS::MutableHandleVector<jsid> aProps) const override;
virtual bool ownPropNames(
JSContext* aCx, JS::Handle<JSObject*> aProxy, unsigned flags,
JS::MutableHandleVector<jsid> aProps) const override;
virtual bool delete_(JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::Handle<jsid> aId,
JS::ObjectOpResult& aResult) const override;

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

@ -499,8 +499,8 @@ void DispatchScriptErrorEvent(nsPIDOMWindowInner* win,
xpc::ErrorReport* xpcReport,
JS::Handle<JS::Value> exception,
JS::Handle<JSObject*> exceptionStack) {
nsContentUtils::AddScriptRunner(
new ScriptErrorEvent(win, rootingCx, xpcReport, exception, exceptionStack));
nsContentUtils::AddScriptRunner(new ScriptErrorEvent(
win, rootingCx, xpcReport, exception, exceptionStack));
}
} /* namespace xpc */

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

@ -3508,10 +3508,9 @@ bool nsObjectLoadingContent::MayResolve(jsid aId) {
return true;
}
void nsObjectLoadingContent::GetOwnPropertyNames(JSContext* aCx,
JS::MutableHandleVector<jsid> /* unused */,
bool /* unused */,
ErrorResult& aRv) {
void nsObjectLoadingContent::GetOwnPropertyNames(
JSContext* aCx, JS::MutableHandleVector<jsid> /* unused */,
bool /* unused */, ErrorResult& aRv) {
// Just like DoResolve, just make sure we're instantiated. That will do
// the work our Enumerate hook needs to do. This purposefully does not fire
// for xray resolves, see bug 967694

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

@ -189,7 +189,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
static bool MayResolve(jsid aId);
// Helper for WebIDL enumeration
void GetOwnPropertyNames(JSContext* aCx, JS::MutableHandleVector<jsid> /* unused */,
void GetOwnPropertyNames(JSContext* aCx,
JS::MutableHandleVector<jsid> /* unused */,
bool /* unused */, mozilla::ErrorResult& aRv);
// WebIDL API

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

@ -1870,7 +1870,8 @@ bool XrayAppendPropertyKeys<ConstantSpec>(
bool XrayOwnPropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
JS::Handle<JSObject*> obj, unsigned flags,
JS::MutableHandleVector<jsid> props, DOMObjectType type,
JS::MutableHandleVector<jsid> props,
DOMObjectType type,
const NativeProperties* nativeProperties) {
MOZ_ASSERT(type != eNamedPropertiesObject);
@ -1902,7 +1903,8 @@ bool XrayOwnPropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
bool XrayOwnNativePropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
const NativePropertyHooks* nativePropertyHooks,
DOMObjectType type, JS::Handle<JSObject*> obj,
unsigned flags, JS::MutableHandleVector<jsid> props) {
unsigned flags,
JS::MutableHandleVector<jsid> props) {
MOZ_ASSERT(type != eNamedPropertiesObject);
if (type == eInterface &&
@ -2739,7 +2741,8 @@ bool MayResolveGlobal(const JSAtomState& aNames, jsid aId,
}
bool EnumerateGlobal(JSContext* aCx, JS::HandleObject aObj,
JS::MutableHandleVector<jsid> aProperties, bool aEnumerableOnly) {
JS::MutableHandleVector<jsid> aProperties,
bool aEnumerableOnly) {
MOZ_ASSERT(JS_IsGlobalObject(aObj),
"Should have a global here, since we plan to enumerate standard "
"classes!");

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

@ -2192,7 +2192,8 @@ inline bool IdEquals(jsid id, const char* string) {
JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), string);
}
inline bool AddStringToIDVector(JSContext* cx, JS::MutableHandleVector<jsid> vector,
inline bool AddStringToIDVector(JSContext* cx,
JS::MutableHandleVector<jsid> vector,
const char* name) {
return vector.growBy(1) &&
AtomizeAndPinJSString(cx, *(vector[vector.length() - 1]).address(),
@ -2778,7 +2779,8 @@ bool ResolveGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
bool MayResolveGlobal(const JSAtomState& aNames, jsid aId, JSObject* aMaybeObj);
bool EnumerateGlobal(JSContext* aCx, JS::HandleObject aObj,
JS::MutableHandleVector<jsid> aProperties, bool aEnumerableOnly);
JS::MutableHandleVector<jsid> aProperties,
bool aEnumerableOnly);
struct CreateGlobalOptionsGeneric {
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj) {

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

@ -253,9 +253,9 @@ bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
return result.succeed();
}
bool BaseDOMProxyHandler::ownPropertyKeys(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const {
bool BaseDOMProxyHandler::ownPropertyKeys(
JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const {
return ownPropNames(cx, proxy,
JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
}
@ -269,7 +269,8 @@ bool BaseDOMProxyHandler::getPrototypeIfOrdinary(
}
bool BaseDOMProxyHandler::getOwnEnumerablePropertyKeys(
JSContext* cx, JS::Handle<JSObject*> proxy, JS::MutableHandleVector<jsid> props) const {
JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const {
return ownPropNames(cx, proxy, JSITER_OWNONLY, props);
}

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

@ -52,8 +52,9 @@ class BaseDOMProxyHandler : public js::BaseProxyHandler {
bool getOwnPropertyDescriptor(
JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
virtual bool ownPropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const override;
virtual bool ownPropertyKeys(
JSContext* cx, JS::Handle<JSObject*> proxy,
JS::MutableHandleVector<jsid> props) const override;
virtual bool getPrototypeIfOrdinary(
JSContext* cx, JS::Handle<JSObject*> proxy, bool* isOrdinary,
@ -73,7 +74,8 @@ class BaseDOMProxyHandler : public js::BaseProxyHandler {
// or JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS (for
// ownPropertyKeys()).
virtual bool ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy,
unsigned flags, JS::MutableHandleVector<jsid> props) const = 0;
unsigned flags,
JS::MutableHandleVector<jsid> props) const = 0;
// Hook for subclasses to allow set() to ignore named props while other things
// that look at property descriptors see them. This is intentionally not

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

@ -33,9 +33,9 @@ bool RemoteObjectProxyBase::defineProperty(
return ReportCrossOriginDenial(aCx, aId, NS_LITERAL_CSTRING("define"));
}
bool RemoteObjectProxyBase::ownPropertyKeys(JSContext* aCx,
JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const {
bool RemoteObjectProxyBase::ownPropertyKeys(
JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const {
// https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-)
// step 2 and
// https://html.spec.whatwg.org/multipage/browsers.html#crossoriginproperties-(-o-)

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

@ -67,9 +67,9 @@ class RemoteObjectProxyBase : public js::BaseProxyHandler,
// SpiderMonkey extensions
bool hasOwn(JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::Handle<jsid> aId, bool* aBp) const override;
bool getOwnEnumerablePropertyKeys(JSContext* aCx,
JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const override;
bool getOwnEnumerablePropertyKeys(
JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::MutableHandleVector<jsid> aProps) const override;
const char* className(JSContext* aCx,
JS::Handle<JSObject*> aProxy) const final;

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

@ -243,8 +243,8 @@ bool WebIDLGlobalNameHash::ResolveForSystemGlobal(JSContext* aCx,
/* static */
bool WebIDLGlobalNameHash::NewEnumerateSystemGlobal(
JSContext* aCx, JS::Handle<JSObject*> aObj, JS::MutableHandleVector<jsid> aProperties,
bool aEnumerableOnly) {
JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::MutableHandleVector<jsid> aProperties, bool aEnumerableOnly) {
MOZ_ASSERT(JS_IsGlobalObject(aObj));
if (!JS_NewEnumerateStandardClasses(aCx, aObj, aProperties,

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

@ -59,7 +59,8 @@ class WebIDLGlobalNameHash {
};
// Returns false if an exception has been thrown on aCx.
static bool GetNames(JSContext* aCx, JS::Handle<JSObject*> aObj,
NameType aNameType, JS::MutableHandleVector<jsid> aNames);
NameType aNameType,
JS::MutableHandleVector<jsid> aNames);
// Helpers for resolving & enumerating names on the system global.
// NOTE: These are distinct as it currently lacks a ProtoAndIfaceCache, and is
@ -67,10 +68,9 @@ class WebIDLGlobalNameHash {
static bool ResolveForSystemGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId, bool* aResolvedp);
static bool NewEnumerateSystemGlobal(JSContext* aCx,
JS::Handle<JSObject*> aObj,
JS::MutableHandleVector<jsid> aProperties,
bool aEnumerableOnly);
static bool NewEnumerateSystemGlobal(
JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::MutableHandleVector<jsid> aProperties, bool aEnumerableOnly);
private:
friend struct WebIDLNameTableEntry;

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

@ -77,46 +77,42 @@ void FetchDpadFromAxis(uint32_t aIndex, double dir) {
}
class DefaultRemapper final : public GamepadRemapper {
public:
virtual uint32_t GetAxisCount() const override {
return numAxes;
}
public:
virtual uint32_t GetAxisCount() const override { return numAxes; }
virtual uint32_t GetButtonCount() const override {
return numButtons;
}
virtual uint32_t GetButtonCount() const override { return numButtons; }
virtual void SetAxisCount(uint32_t aAxisCount) override {
numAxes = aAxisCount;
}
virtual void SetAxisCount(uint32_t aAxisCount) override {
numAxes = aAxisCount;
}
virtual void SetButtonCount(uint32_t aButtonCount) override {
numButtons = aButtonCount;
}
virtual void SetButtonCount(uint32_t aButtonCount) override {
numButtons = aButtonCount;
}
virtual void RemapAxisMoveEvent(uint32_t aIndex, uint32_t aAxis,
virtual void RemapAxisMoveEvent(uint32_t aIndex, uint32_t aAxis,
double aValue) const override {
RefPtr<GamepadPlatformService> service =
GamepadPlatformService::GetParentService();
if (!service) {
return;
}
service->NewAxisMoveEvent(aIndex, aAxis, aValue);
RefPtr<GamepadPlatformService> service =
GamepadPlatformService::GetParentService();
if (!service) {
return;
}
service->NewAxisMoveEvent(aIndex, aAxis, aValue);
}
virtual void RemapButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed) const override {
RefPtr<GamepadPlatformService> service =
GamepadPlatformService::GetParentService();
if (!service) {
return;
}
service->NewButtonEvent(aIndex, aButton, aPressed);
virtual void RemapButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed) const override {
RefPtr<GamepadPlatformService> service =
GamepadPlatformService::GetParentService();
if (!service) {
return;
}
service->NewButtonEvent(aIndex, aButton, aPressed);
}
private:
uint32_t numAxes;
uint32_t numButtons;
private:
uint32_t numAxes;
uint32_t numButtons;
};
class Dualshock4Remapper final : public GamepadRemapper {
@ -180,29 +176,26 @@ class Dualshock4Remapper final : public GamepadRemapper {
return;
}
const std::vector<uint32_t> buttonMapping = {
BUTTON_INDEX_TERTIARY,
BUTTON_INDEX_PRIMARY,
BUTTON_INDEX_SECONDARY,
BUTTON_INDEX_QUATERNARY,
BUTTON_INDEX_LEFT_SHOULDER,
BUTTON_INDEX_RIGHT_SHOULDER,
BUTTON_INDEX_LEFT_TRIGGER,
BUTTON_INDEX_RIGHT_TRIGGER,
BUTTON_INDEX_BACK_SELECT,
BUTTON_INDEX_START,
BUTTON_INDEX_LEFT_THUMBSTICK,
BUTTON_INDEX_RIGHT_THUMBSTICK,
BUTTON_INDEX_META,
DUALSHOCK_BUTTON_TOUCHPAD
};
const std::vector<uint32_t> buttonMapping = {BUTTON_INDEX_TERTIARY,
BUTTON_INDEX_PRIMARY,
BUTTON_INDEX_SECONDARY,
BUTTON_INDEX_QUATERNARY,
BUTTON_INDEX_LEFT_SHOULDER,
BUTTON_INDEX_RIGHT_SHOULDER,
BUTTON_INDEX_LEFT_TRIGGER,
BUTTON_INDEX_RIGHT_TRIGGER,
BUTTON_INDEX_BACK_SELECT,
BUTTON_INDEX_START,
BUTTON_INDEX_LEFT_THUMBSTICK,
BUTTON_INDEX_RIGHT_THUMBSTICK,
BUTTON_INDEX_META,
DUALSHOCK_BUTTON_TOUCHPAD};
if (buttonMapping.size() <= aIndex) {
NS_WARNING(
nsPrintfCString(
"Button idx '%d' doesn't support in Dualshock4Remapper().",
aButton)
.get());
NS_WARNING(nsPrintfCString(
"Button idx '%d' doesn't support in Dualshock4Remapper().",
aButton)
.get());
return;
}
@ -216,13 +209,12 @@ class Dualshock4Remapper final : public GamepadRemapper {
};
};
already_AddRefed<GamepadRemapper> GetGamepadRemapper(const uint16_t aVendorId,
const uint16_t aProductId) {
already_AddRefed<GamepadRemapper> GetGamepadRemapper(
const uint16_t aVendorId, const uint16_t aProductId) {
const std::vector<GamepadRemappingData> remappingRules = {
{GamepadId::kSonyDualshock4, new Dualshock4Remapper()},
{GamepadId::kSonyDualshock4Slim, new Dualshock4Remapper()},
{GamepadId::kSonyDualshock4USBReceiver, new Dualshock4Remapper()}
};
{GamepadId::kSonyDualshock4USBReceiver, new Dualshock4Remapper()}};
const GamepadId id = static_cast<GamepadId>((aVendorId << 16) | aProductId);
for (uint32_t i = 0; i < remappingRules.size(); ++i) {

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

@ -32,7 +32,7 @@ class GamepadRemapper {
double aValue) const = 0;
virtual void RemapButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed) const = 0;
protected:
GamepadRemapper() = default;
virtual ~GamepadRemapper() = default;

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

@ -135,10 +135,7 @@ class Gamepad {
bool present;
Gamepad(uint32_t aNumAxes, uint32_t aNumButtons, GamepadType aType)
: type(aType),
numAxes(aNumAxes),
numButtons(aNumButtons),
present(true) {
: type(aType), numAxes(aNumAxes), numButtons(aNumButtons), present(true) {
buttons.SetLength(numButtons);
axes.SetLength(numAxes);
}
@ -431,7 +428,8 @@ bool WindowsGamepadService::ScanForXInputDevices() {
}
// Not already present, add it.
Gamepad gamepad(kStandardGamepadAxes, kStandardGamepadButtons, kXInputGamepad);
Gamepad gamepad(kStandardGamepadAxes, kStandardGamepadButtons,
kXInputGamepad);
gamepad.userIndex = i;
gamepad.state = state;
gamepad.id = service->AddGamepad(
@ -688,7 +686,8 @@ bool WindowsGamepadService::GetRawGamepad(HANDLE handle) {
size_t numAxes = 0;
nsTArray<Gamepad::axisValue> axes(kAxesLengthCap);
// We store these value caps and handle the dpad info in GamepadRemapper later.
// We store these value caps and handle the dpad info in GamepadRemapper
// later.
axes.SetLength(kAxesLengthCap);
// Looking for the exisiting ramapping rule.
@ -697,7 +696,8 @@ bool WindowsGamepadService::GetRawGamepad(HANDLE handle) {
MOZ_ASSERT(remapper);
for (size_t i = 0; i < count; i++) {
const size_t axisIndex = axisCaps[i].Range.UsageMin - kAxisMinimumUsageNumber;
const size_t axisIndex =
axisCaps[i].Range.UsageMin - kAxisMinimumUsageNumber;
if (axisIndex < kAxesLengthCap && !axes[axisIndex].active) {
axes[axisIndex].caps = axisCaps[i];
axes[axisIndex].active = true;
@ -717,10 +717,9 @@ bool WindowsGamepadService::GetRawGamepad(HANDLE handle) {
}
gamepad.remapper = remapper.forget();
gamepad.id =
service->AddGamepad(gamepad_id, gamepad.remapper->GetMappingType(),
GamepadHand::_empty, gamepad.remapper->GetButtonCount(),
gamepad.remapper->GetAxisCount(), 0);
gamepad.id = service->AddGamepad(
gamepad_id, gamepad.remapper->GetMappingType(), GamepadHand::_empty,
gamepad.remapper->GetButtonCount(), gamepad.remapper->GetAxisCount(), 0);
mGamepads.AppendElement(gamepad);
return true;
}

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

@ -1622,8 +1622,7 @@ bool HTMLFormElement::IsLastActiveElement(
for (auto* element : Reversed(mControls->mElements)) {
// XXX How about date/time control?
if (element->IsTextOrNumberControl(false) &&
!element->IsDisabled()) {
if (element->IsTextOrNumberControl(false) && !element->IsDisabled()) {
return element == aControl;
}
}

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

@ -1463,7 +1463,8 @@ void TabChild::ProcessPendingCoalescedMouseDataAndDispatchEvents() {
}
}
LayoutDeviceToLayoutDeviceMatrix4x4 TabChild::GetChildToParentConversionMatrix() const {
LayoutDeviceToLayoutDeviceMatrix4x4 TabChild::GetChildToParentConversionMatrix()
const {
if (mChildToParentConversionMatrix) {
return *mChildToParentConversionMatrix;
}

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

@ -642,7 +642,8 @@ class TabChild final : public TabChildBase,
// The transform from the coordinate space of this TabChild to the coordinate
// space of the native window its TabParent is in.
mozilla::LayoutDeviceToLayoutDeviceMatrix4x4 GetChildToParentConversionMatrix() const;
mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
GetChildToParentConversionMatrix() const;
// Prepare to dispatch all coalesced mousemove events. We'll move all data
// in mCoalescedMouseData to a nsDeque; then we start processing them. We

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

@ -1041,7 +1041,8 @@ IPCResult TabParent::RecvPBrowserBridgeConstructor(
const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
const uint32_t& aChromeFlags) {
static_cast<BrowserBridgeParent*>(aActor)->Init(
aName, aRemoteType, CanonicalBrowsingContext::Cast(aBrowsingContext), aChromeFlags);
aName, aRemoteType, CanonicalBrowsingContext::Cast(aBrowsingContext),
aChromeFlags);
return IPC_OK();
}
@ -1360,9 +1361,10 @@ class SynthesizedEventObserver : public nsIObserver {
if (mTabParent->IsDestroyed()) {
// If this happens it's probably a bug in the test that's triggering this.
NS_WARNING("TabParent was unexpectedly destroyed during event synthesization!");
NS_WARNING(
"TabParent was unexpectedly destroyed during event synthesization!");
} else if (!mTabParent->SendNativeSynthesisResponse(mObserverId,
nsCString(aTopic))) {
nsCString(aTopic))) {
NS_WARNING("Unable to send native event synthesization response!");
}
// Null out tabparent to indicate we already sent the response

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

@ -362,6 +362,7 @@ AmbientLightEventWarning=Use of the ambient light sensor is deprecated.
IDBOpenDBOptions_StorageTypeWarning=The storage attribute in options passed to indexedDB.open is deprecated and will soon be removed. To get persistent storage, please use navigator.storage.persist() instead.
DOMQuadBoundsAttrWarning=DOMQuad.bounds is deprecated in favor of DOMQuad.getBounds()
UnsupportedEntryTypesIgnored=Ignoring unsupported entryTypes: %S.
AllEntryTypesIgnored=No valid entryTypes; aborting registration.
#LOCALIZATION NOTE(DeprecatedTestingInterfaceWarning): Do not translate this message. It's just testing only.
DeprecatedTestingInterfaceWarning=TestingDeprecatedInterface is a testing-only interface and this is its testing deprecation message.

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

@ -17,7 +17,7 @@ namespace mozilla {
namespace ipc {
class SharedPreferenceSerializer;
}
}
} // namespace mozilla
class nsITimer;
namespace mozilla {

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

@ -249,8 +249,8 @@ class AudioContext final : public DOMEventTargetHelper,
already_AddRefed<MediaStreamAudioSourceNode> CreateMediaStreamSource(
DOMMediaStream& aMediaStream, ErrorResult& aRv);
already_AddRefed<MediaStreamTrackAudioSourceNode>
CreateMediaStreamTrackSource(MediaStreamTrack& aMediaStreamTrack,
ErrorResult& aRv);
CreateMediaStreamTrackSource(MediaStreamTrack& aMediaStreamTrack,
ErrorResult& aRv);
already_AddRefed<DelayNode> CreateDelay(double aMaxDelayTime,
ErrorResult& aRv);

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

@ -52,6 +52,8 @@ void TCPServerSocketParent::Init() {
}
nsresult TCPServerSocketParent::SendCallbackAccept(TCPSocketParent* socket) {
socket->AddIPDLReference();
nsresult rv;
nsString host;
@ -70,10 +72,6 @@ nsresult TCPServerSocketParent::SendCallbackAccept(TCPSocketParent* socket) {
if (mNeckoParent) {
if (mNeckoParent->SendPTCPSocketConstructor(socket, host, port)) {
// Call |AddIPDLReference| after the consructor message is sent
// successfully, otherwise |socket| could be leaked.
socket->AddIPDLReference();
mozilla::Unused << PTCPServerSocketParent::SendCallbackAccept(socket);
} else {
NS_ERROR("Sending data from PTCPSocketParent was failed.");

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

@ -386,7 +386,7 @@ void TCPSocket::NotifyCopyComplete(nsresult aStatus) {
}
mBufferedAmount = bufferedAmount;
if (mSocketBridgeParent && mSocketBridgeParent->IPCOpen()) {
if (mSocketBridgeParent) {
mozilla::Unused << mSocketBridgeParent->SendUpdateBufferedAmount(
BufferedAmount(), mTrackingNumber);
}
@ -446,7 +446,7 @@ void TCPSocket::ActivateTLS() {
NS_IMETHODIMP
TCPSocket::FireErrorEvent(const nsAString& aName, const nsAString& aType) {
if (mSocketBridgeParent && mSocketBridgeParent->IPCOpen()) {
if (mSocketBridgeParent) {
mSocketBridgeParent->FireErrorEvent(aName, aType, mReadyState);
return NS_OK;
}
@ -467,7 +467,7 @@ TCPSocket::FireErrorEvent(const nsAString& aName, const nsAString& aType) {
NS_IMETHODIMP
TCPSocket::FireEvent(const nsAString& aType) {
if (mSocketBridgeParent && mSocketBridgeParent->IPCOpen()) {
if (mSocketBridgeParent) {
mSocketBridgeParent->FireEvent(aType, mReadyState);
return NS_OK;
}
@ -944,7 +944,7 @@ TCPSocket::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aStream,
MOZ_ASSERT(actual == aCount);
buffer.SetLength(actual);
if (mSocketBridgeParent && mSocketBridgeParent->IPCOpen()) {
if (mSocketBridgeParent) {
mSocketBridgeParent->FireArrayBufferDataEvent(buffer, mReadyState);
return NS_OK;
}
@ -967,7 +967,7 @@ TCPSocket::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aStream,
nsresult rv = mInputStreamScriptable->ReadBytes(aCount, data);
NS_ENSURE_SUCCESS(rv, rv);
if (mSocketBridgeParent && mSocketBridgeParent->IPCOpen()) {
if (mSocketBridgeParent) {
mSocketBridgeParent->FireStringDataEvent(data, mReadyState);
return NS_OK;
}
@ -1006,8 +1006,6 @@ TCPSocket::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
}
void TCPSocket::SetSocketBridgeParent(TCPSocketParent* aBridgeParent) {
MOZ_ASSERT(NS_IsMainThread());
mSocketBridgeParent = aBridgeParent;
}

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

@ -330,7 +330,6 @@ nsresult TCPSocketParent::GetPort(uint16_t* aPort) {
void TCPSocketParent::ActorDestroy(ActorDestroyReason why) {
if (mSocket) {
mSocket->SetSocketBridgeParent(nullptr);
mSocket->Close();
}
mSocket = nullptr;

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

@ -34,8 +34,6 @@ class TCPSocketParentBase : public nsISupports {
void AddIPDLReference();
void ReleaseIPDLReference();
bool IPCOpen() const { return mIPCOpen; }
protected:
TCPSocketParentBase();
virtual ~TCPSocketParentBase();

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

@ -596,8 +596,23 @@ void Performance::QueueEntry(PerformanceEntry* aEntry) {
if (mObservers.IsEmpty()) {
return;
}
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(mObservers, PerformanceObserver,
QueueEntry, (aEntry));
nsTObserverArray<PerformanceObserver*> interestedObservers;
nsTObserverArray<PerformanceObserver*>::ForwardIterator observerIt(
mObservers);
while (observerIt.HasMore()) {
PerformanceObserver* observer = observerIt.GetNext();
if (observer->ObservesTypeOfEntry(aEntry)) {
interestedObservers.AppendElement(observer);
}
}
if (interestedObservers.IsEmpty()) {
return;
}
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(
interestedObservers, PerformanceObserver, QueueEntry, (aEntry));
if (!mPendingNotificationObserversTask) {
RunNotificationObserversTask();

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