зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 8f9a32288d2c (bug 1605329) for dt failures on browser_toolbox_remoteness_change.js.
CLOSED TREE --HG-- extra : rebase_source : 089fcd86febdece7e450d1c03eaeee7dedebf2d8
This commit is contained in:
Родитель
19175da396
Коммит
0d4837b9f2
|
@ -134,12 +134,6 @@ loader.lazyRequireGetter(
|
|||
"devtools/client/framework/toolbox-context-menu",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"getSelectedThread",
|
||||
"devtools/client/framework/reducers/threads",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"remoteClientManager",
|
||||
|
@ -599,15 +593,6 @@ Toolbox.prototype = {
|
|||
return this.hostType === Toolbox.HostType.BROWSERTOOLBOX;
|
||||
},
|
||||
|
||||
getSelectedThreadFront: function() {
|
||||
const thread = getSelectedThread(this.store.getState());
|
||||
if (!thread) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.target.client.getFrontByID(thread.actor);
|
||||
},
|
||||
|
||||
_onPausedState: function(packet, threadFront) {
|
||||
// Suppress interrupted events by default because the thread is
|
||||
// paused/resumed a lot for various actions.
|
||||
|
|
|
@ -21,14 +21,14 @@ const {
|
|||
* @param {Array<String>} expressionVars: Array of the variables defined in the expression.
|
||||
*/
|
||||
function autocompleteUpdate(force, getterPath, expressionVars) {
|
||||
return async ({ dispatch, getState, toolbox, webConsoleUI, hud }) => {
|
||||
return async ({ dispatch, getState, webConsoleUI, hud }) => {
|
||||
if (hud.inputHasSelection()) {
|
||||
return dispatch(autocompleteClear());
|
||||
}
|
||||
|
||||
const inputValue = hud.getInputValue();
|
||||
const frameActorId = await webConsoleUI.getFrameActor();
|
||||
const webconsoleFront = await webConsoleUI.getWebconsoleFront({
|
||||
const webConsoleFront = await webConsoleUI.getWebConsoleFront({
|
||||
frameActorId,
|
||||
});
|
||||
|
||||
|
@ -81,7 +81,7 @@ function autocompleteUpdate(force, getterPath, expressionVars) {
|
|||
autocompleteDataFetch({
|
||||
input,
|
||||
frameActorId,
|
||||
webconsoleFront,
|
||||
webConsoleFront,
|
||||
authorizedEvaluations,
|
||||
force,
|
||||
expressionVars,
|
||||
|
@ -134,16 +134,15 @@ function autocompleteDataFetch({
|
|||
input,
|
||||
frameActorId,
|
||||
force,
|
||||
webconsoleFront,
|
||||
webConsoleFront,
|
||||
authorizedEvaluations,
|
||||
expressionVars,
|
||||
}) {
|
||||
return async ({ dispatch, webConsoleUI }) => {
|
||||
return ({ dispatch, webConsoleUI }) => {
|
||||
const selectedNodeActor = webConsoleUI.getSelectedNodeActor();
|
||||
const id = generateRequestId();
|
||||
dispatch({ type: AUTOCOMPLETE_PENDING_REQUEST, id });
|
||||
|
||||
webconsoleFront
|
||||
webConsoleFront
|
||||
.autocomplete(
|
||||
input,
|
||||
undefined,
|
||||
|
|
|
@ -57,7 +57,7 @@ async function getMappedExpression(hud, expression) {
|
|||
}
|
||||
|
||||
function evaluateExpression(expression) {
|
||||
return async ({ dispatch, toolbox, webConsoleUI, hud, client }) => {
|
||||
return async ({ dispatch, webConsoleUI, hud, client }) => {
|
||||
if (!expression) {
|
||||
expression = hud.getInputSelection() || hud.getInputValue();
|
||||
}
|
||||
|
@ -84,8 +84,10 @@ function evaluateExpression(expression) {
|
|||
let mapped;
|
||||
({ expression, mapped } = await getMappedExpression(hud, expression));
|
||||
|
||||
const frameActor = await webConsoleUI.getFrameActor();
|
||||
const selectedThreadFront = toolbox && toolbox.getSelectedThreadFront();
|
||||
const frameActorId = await webConsoleUI.getFrameActor();
|
||||
const webConsoleFront = await webConsoleUI.getWebConsoleFront({
|
||||
frameActorId,
|
||||
});
|
||||
|
||||
// Even if the evaluation fails,
|
||||
// we still need to pass the error response to onExpressionEvaluated.
|
||||
|
@ -93,9 +95,9 @@ function evaluateExpression(expression) {
|
|||
|
||||
const response = await client
|
||||
.evaluateJSAsync(expression, {
|
||||
selectedThreadFront,
|
||||
frameActor,
|
||||
frameActor: frameActorId,
|
||||
selectedNodeFront: webConsoleUI.getSelectedNodeFront(),
|
||||
webConsoleFront,
|
||||
mapped,
|
||||
})
|
||||
.then(onSettled, onSettled);
|
||||
|
@ -209,7 +211,7 @@ function setInputValue(value) {
|
|||
}
|
||||
|
||||
function terminalInputChanged(expression) {
|
||||
return async ({ dispatch, webConsoleUI, hud, toolbox, client, getState }) => {
|
||||
return async ({ dispatch, webConsoleUI, hud, client, getState }) => {
|
||||
const prefs = getAllPrefs(getState());
|
||||
if (!prefs.eagerEvaluation) {
|
||||
return;
|
||||
|
@ -240,13 +242,15 @@ function terminalInputChanged(expression) {
|
|||
let mapped;
|
||||
({ expression, mapped } = await getMappedExpression(hud, expression));
|
||||
|
||||
const frameActor = await webConsoleUI.getFrameActor();
|
||||
const selectedThreadFront = toolbox && toolbox.getSelectedThreadFront();
|
||||
const frameActorId = await webConsoleUI.getFrameActor();
|
||||
const webConsoleFront = await webConsoleUI.getWebConsoleFront({
|
||||
frameActorId,
|
||||
});
|
||||
|
||||
const response = await client.evaluateJSAsync(expression, {
|
||||
frameActor,
|
||||
selectedThreadFront,
|
||||
frameActor: frameActorId,
|
||||
selectedNodeFront: webConsoleUI.getSelectedNodeFront(),
|
||||
webConsoleFront,
|
||||
mapped,
|
||||
eager: true,
|
||||
});
|
||||
|
|
|
@ -21,9 +21,11 @@ function storeAsGlobal(actor) {
|
|||
"temp" + i;
|
||||
}`;
|
||||
|
||||
const res = await client.evaluateJSAsync(evalString, {
|
||||
const options = {
|
||||
selectedObjectActor: actor,
|
||||
});
|
||||
};
|
||||
|
||||
const res = await client.evaluateJSAsync(evalString, options);
|
||||
hud.focusInput();
|
||||
hud.setInputValue(res.result);
|
||||
};
|
||||
|
|
|
@ -12,39 +12,20 @@ class ConsoleCommands {
|
|||
this.currentTarget = currentTarget;
|
||||
}
|
||||
|
||||
getFrontByID(id) {
|
||||
return this.devToolsClient.getFrontByID(id);
|
||||
}
|
||||
|
||||
async evaluateJSAsync(expression, options = {}) {
|
||||
const {
|
||||
selectedNodeFront,
|
||||
selectedThreadFront,
|
||||
frameActor,
|
||||
selectedObjectActor,
|
||||
} = options;
|
||||
const { selectedNodeFront, webConsoleFront, selectedObjectActor } = options;
|
||||
let front = this.proxy.webConsoleFront;
|
||||
|
||||
// Defer to the selected paused thread front
|
||||
if (frameActor) {
|
||||
const frameFront = this.getFrontByID(frameActor);
|
||||
if (frameFront) {
|
||||
front = await frameFront.targetFront.getFront("console");
|
||||
}
|
||||
if (webConsoleFront) {
|
||||
front = webConsoleFront;
|
||||
}
|
||||
|
||||
// NOTE: once we handle the other tasks in console evaluation,
|
||||
// all of the implicit actions like pausing, selecting a frame in the inspector,
|
||||
// etc will update the selected thread and we will no longer need to support these other
|
||||
// cases.
|
||||
if (selectedThreadFront) {
|
||||
front = await selectedThreadFront.targetFront.getFront("console");
|
||||
|
||||
// If there's a selectedObjectActor option, this means the user intend to do a
|
||||
// given action on a specific object, so it should take precedence over selected
|
||||
// node front.
|
||||
} else if (selectedObjectActor) {
|
||||
const objectFront = this.getFrontByID(selectedObjectActor);
|
||||
// If there's a selectedObjectActor option, this means the user intend to do a
|
||||
// given action on a specific object, so it should take precedence over selected
|
||||
// node front.
|
||||
if (selectedObjectActor) {
|
||||
const objectFront = this.devToolsClient.getFrontByID(selectedObjectActor);
|
||||
if (objectFront) {
|
||||
front = await objectFront.targetFront.getFront("console");
|
||||
}
|
||||
|
|
|
@ -87,8 +87,6 @@ function configureStore(webConsoleUI, options = {}) {
|
|||
}),
|
||||
};
|
||||
|
||||
const toolbox = options.thunkArgs.toolbox;
|
||||
const sessionId = (toolbox && toolbox.sessionId) || -1;
|
||||
const middleware = applyMiddleware(
|
||||
ignore,
|
||||
thunkWithOptions.bind(null, {
|
||||
|
@ -96,7 +94,7 @@ function configureStore(webConsoleUI, options = {}) {
|
|||
...options.thunkArgs,
|
||||
}),
|
||||
historyPersistence,
|
||||
eventTelemetry.bind(null, options.telemetry, sessionId)
|
||||
eventTelemetry.bind(null, options.telemetry, options.sessionId)
|
||||
);
|
||||
|
||||
return createStore(
|
||||
|
|
|
@ -50,7 +50,7 @@ function setupStore(
|
|||
}
|
||||
const store = configureStore(webConsoleUI, {
|
||||
...storeOptions,
|
||||
thunkArgs: { toolbox: { sessionId: -1 } },
|
||||
sessionId: -1,
|
||||
telemetry: new Telemetry(),
|
||||
});
|
||||
|
||||
|
@ -140,9 +140,6 @@ function getWebConsoleUiMock(hud, proxyOverrides) {
|
|||
releaseActor: proxy.releaseActor,
|
||||
getProxy: () => proxy,
|
||||
inspectObjectActor: () => {},
|
||||
toolbox: {
|
||||
sessionId: 1,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -584,22 +584,13 @@ class WebConsoleUI {
|
|||
return frame.actor;
|
||||
}
|
||||
|
||||
getWebconsoleFront({ frameActorId } = {}) {
|
||||
if (frameActorId) {
|
||||
const frameFront = this.hud.getFrontByID(frameActorId);
|
||||
return frameFront.getWebConsoleFront();
|
||||
}
|
||||
|
||||
if (!this.hud.toolbox) {
|
||||
getWebConsoleFront({ frameActorId } = {}) {
|
||||
if (!frameActorId) {
|
||||
return this.webConsoleFront;
|
||||
}
|
||||
|
||||
const threadFront = this.hud.toolbox.getSelectedThreadFront();
|
||||
if (!threadFront) {
|
||||
return this.webConsoleFront;
|
||||
}
|
||||
|
||||
return threadFront.getWebconsoleFront();
|
||||
const frameFront = this.hud.getFrontByID(frameActorId);
|
||||
return frameFront.getWebConsoleFront();
|
||||
}
|
||||
|
||||
getSelectedNodeActor() {
|
||||
|
|
|
@ -95,11 +95,11 @@ class WebConsoleWrapper {
|
|||
return new Promise(resolve => {
|
||||
store = configureStore(this.webConsoleUI, {
|
||||
// We may not have access to the toolbox (e.g. in the browser console).
|
||||
sessionId: (this.toolbox && this.toolbox.sessionId) || -1,
|
||||
telemetry: this.telemetry,
|
||||
thunkArgs: {
|
||||
webConsoleUI,
|
||||
hud: this.hud,
|
||||
toolbox: this.toolbox,
|
||||
client: this.webConsoleUI._commands,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -64,10 +64,6 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
return this.actorID;
|
||||
}
|
||||
|
||||
getWebconsoleFront() {
|
||||
return this.targetFront.getFront("console");
|
||||
}
|
||||
|
||||
_assertPaused(command) {
|
||||
if (!this.paused) {
|
||||
throw Error(
|
||||
|
|
Загрузка…
Ссылка в новой задаче