Bug 1336198 - part10: fix race condition in boxmodel tests;r=gl
MozReview-Commit-ID: IDBgbnlMX2c
--- a/devtools/client/inspector/boxmodel/test/head.js
+++ b/devtools/client/inspector/boxmodel/test/head.js
@@ -88,11 +88,12 @@ function setStyle(testActor, selector, p
/**
* The box model doesn't participate in the inspector's update mechanism, so simply
* calling the default selectNode isn't enough to guarantee that the box model view has
* finished updating. We also need to wait for the "boxmodel-view-updated" event.
*/
var _selectNode = selectNode;
selectNode = function* (node, inspector, reason) {
+ let onUpdate = waitForUpdate(inspector);
yield _selectNode(node, inspector, reason);
- yield waitForUpdate(inspector);
+ yield onUpdate;
};
--- a/devtools/client/inspector/test/shared-head.js
+++ b/devtools/client/inspector/test/shared-head.js
@@ -47,17 +47,25 @@ var openInspector = Task.async(function*
* The ID of the sidebar tab to be opened
* @return a promise that resolves when the inspector is ready and the tab is
* visible and ready
*/
var openInspectorSidebarTab = Task.async(function* (id) {
let {toolbox, inspector, testActor} = yield openInspector();
info("Selecting the " + id + " sidebar");
- inspector.sidebar.select(id);
+
+ if (id === "computedview" || id === "layoutview") {
+ // The layout and computed viewS should wait until the box-model widget is ready.
+ let onBoxModelViewReady = inspector.once("boxmodel-view-updated");
+ inspector.sidebar.select(id);
+ yield onBoxModelViewReady;
+ } else {
+ inspector.sidebar.select(id);
+ }
return {
toolbox,
inspector,
testActor
};
});