зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1469959 - Don't use relatedTarget to check if the ObjectInspector was focused by tabbing; r=bgrins.
Basically this rolls back the changes made to the reps bundle in Bug 1463415. This change will be backported in Github later so the fix can ride the train. A test is added to make sure we don't regress again. MozReview-Commit-ID: Csak2pPyTOR --HG-- extra : rebase_source : a3f24dab9e062f0743cdbc4e9cec9d1ce62c86d1
This commit is contained in:
Родитель
4d61fa3588
Коммит
b9474d997c
|
@ -4445,12 +4445,12 @@ class Tree extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
const { relatedTarget } = nativeEvent;
|
||||
const { explicitOriginalTarget } = nativeEvent;
|
||||
|
||||
// Only set default focus to the first tree node if the focus came
|
||||
// from outside the tree (e.g. by tabbing to the tree from other
|
||||
// external elements).
|
||||
if (relatedTarget !== this.treeRef && !this.treeRef.contains(relatedTarget)) {
|
||||
if (explicitOriginalTarget !== this.treeRef && !this.treeRef.contains(explicitOriginalTarget)) {
|
||||
this._focus(traversal[0].item);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -321,6 +321,7 @@ skip-if = (os == 'linux') || (os == 'win' && os_version == '10.0' && debug && bi
|
|||
[browser_webconsole_object_inspector_key_sorting.js]
|
||||
[browser_webconsole_object_inspector_local_session_storage.js]
|
||||
[browser_webconsole_object_inspector_selected_text.js]
|
||||
[browser_webconsole_object_inspector_scroll.js]
|
||||
[browser_webconsole_object_inspector_while_debugging_and_inspecting.js]
|
||||
[browser_webconsole_observer_notifications.js]
|
||||
[browser_webconsole_optimized_out_vars.js]
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Check that expanding an objectInspector node doesn't alter the output scroll position.
|
||||
const TEST_URI = "data:text/html;charset=utf8,test Object Inspector";
|
||||
|
||||
add_task(async function() {
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
|
||||
content.wrappedJSObject.console.log("oi-test", content.wrappedJSObject.Math);
|
||||
});
|
||||
|
||||
const node = await waitFor(() => findMessage(hud, "oi-test"));
|
||||
const objectInspector = node.querySelector(".tree");
|
||||
|
||||
let onOiMutation = waitForNodeMutation(objectInspector, {
|
||||
childList: true
|
||||
});
|
||||
|
||||
info("Expanding the object inspector");
|
||||
objectInspector.querySelector(".arrow").click();
|
||||
await onOiMutation;
|
||||
|
||||
const nodes = objectInspector.querySelectorAll(".node");
|
||||
const lastNode = nodes[nodes.length - 1];
|
||||
|
||||
info("Scroll the last node of the ObjectInspector into view");
|
||||
lastNode.scrollIntoView();
|
||||
|
||||
const outputContainer = hud.ui.outputNode.querySelector(".webconsole-output");
|
||||
ok(hasVerticalOverflow(outputContainer), "There is a vertical overflow");
|
||||
const scrollTop = outputContainer.scrollTop;
|
||||
|
||||
onOiMutation = waitForNodeMutation(objectInspector, {
|
||||
childList: true
|
||||
});
|
||||
|
||||
info("Expand the last node");
|
||||
const view = lastNode.ownerDocument.defaultView;
|
||||
EventUtils.synthesizeMouseAtCenter(lastNode, {}, view);
|
||||
|
||||
await onOiMutation;
|
||||
|
||||
is(scrollTop, outputContainer.scrollTop,
|
||||
"Scroll position did not changed when expanding a node");
|
||||
});
|
||||
|
||||
function hasVerticalOverflow(container) {
|
||||
return container.scrollHeight > container.clientHeight;
|
||||
}
|
Загрузка…
Ссылка в новой задаче