Bug 663778 - Changes to tests for box model highlighter r=jwalker

This commit is contained in:
Michael Ratcliffe 2014-03-12 14:01:31 +00:00
Родитель 0612d9e455
Коммит d102dd3937
22 изменённых файлов: 229 добавлений и 170 удалений

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

@ -207,4 +207,5 @@ registerCleanupFunction(function() {
gDebuggee = null; gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gVariables = null;
}); });

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

@ -24,8 +24,8 @@ function test() {
openInspector((aInspector, aToolbox) => { openInspector((aInspector, aToolbox) => {
toolbox = aToolbox; toolbox = aToolbox;
inspector = aInspector; inspector = aInspector;
inspector.selection.setNode(doc.querySelector("h2"), null); inspector.selection.setNode(doc.querySelector("span"), "test");
inspector.once("inspector-updated", runTests); inspector.toolbox.once("highlighter-ready", runTests);
}); });
} }
@ -33,8 +33,6 @@ function test() {
Task.spawn(function() { Task.spawn(function() {
yield hoverH1InMarkupView(); yield hoverH1InMarkupView();
yield assertH1Highlighted(); yield assertH1Highlighted();
yield mouseLeaveMarkupView();
yield assertNoNodeHighlighted();
finishUp(); finishUp();
}).then(null, Cu.reportError); }).then(null, Cu.reportError);
@ -42,11 +40,11 @@ function test() {
function hoverH1InMarkupView() { function hoverH1InMarkupView() {
let deferred = promise.defer(); let deferred = promise.defer();
let container = getContainerForRawNode(inspector.markup, doc.querySelector("h1")); let container = getContainerForRawNode(inspector.markup, doc.querySelector("h1"));
EventUtils.synthesizeMouse(container.tagLine, 2, 2, {type: "mousemove"},
inspector.markup.doc.defaultView); inspector.toolbox.once("highlighter-ready", deferred.resolve);
inspector.toolbox.once("node-highlight", deferred.resolve); EventUtils.synthesizeMouseAtCenter(container.tagLine, {type: "mousemove"},
inspector.markup.doc.defaultView);
return deferred.promise; return deferred.promise;
} }
@ -54,25 +52,6 @@ function test() {
function assertH1Highlighted() { function assertH1Highlighted() {
ok(isHighlighting(), "The highlighter is shown on a markup container hover"); ok(isHighlighting(), "The highlighter is shown on a markup container hover");
is(getHighlitNode(), doc.querySelector("h1"), "The highlighter highlights the right node"); is(getHighlitNode(), doc.querySelector("h1"), "The highlighter highlights the right node");
return promise.resolve();
}
function mouseLeaveMarkupView() {
let deferred = promise.defer();
// Find another element to mouseover over in order to leave the markup-view
let btn = toolbox.doc.querySelector(".toolbox-dock-button");
EventUtils.synthesizeMouse(btn, 2, 2, {type: "mousemove"},
toolbox.doc.defaultView);
executeSoon(deferred.resolve);
return deferred.promise;
}
function assertNoNodeHighlighted() {
ok(!isHighlighting(), "After the mouse left the markup view, the highlighter is hidden");
return promise.resolve();
} }
function finishUp() { function finishUp() {

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

@ -91,7 +91,7 @@ function test()
} }
function finishUp() { function finishUp() {
doc = nodes = null; doc = nodes = inspector = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
finish(); finish();
} }

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

@ -64,12 +64,17 @@ function test()
function isTheIframeHighlighted() function isTheIframeHighlighted()
{ {
let outlineRect = getHighlighterOutlineRect(); let {p1, p2, p3, p4} = getBoxModelStatus().border.points;
let iframeRect = iframeNode.getBoundingClientRect(); let {top, right, bottom, left} = iframeNode.getBoundingClientRect();
for (let dim of ["width", "height", "top", "left"]) {
is(Math.floor(outlineRect[dim]), Math.floor(iframeRect[dim]), is(top, p1.y, "iframeRect.top === boxModelStatus.p1.y");
"Outline dimension is correct " + outlineRect[dim]); is(top, p2.y, "iframeRect.top === boxModelStatus.p2.y");
} is(right, p2.x, "iframeRect.right === boxModelStatus.p2.x");
is(right, p3.x, "iframeRect.right === boxModelStatus.p3.x");
is(bottom, p3.y, "iframeRect.bottom === boxModelStatus.p3.y");
is(bottom, p4.y, "iframeRect.bottom === boxModelStatus.p4.y");
is(left, p1.x, "iframeRect.left === boxModelStatus.p1.x");
is(left, p4.x, "iframeRect.left === boxModelStatus.p4.x");
iframeNode.style.marginBottom = doc.defaultView.innerHeight + "px"; iframeNode.style.marginBottom = doc.defaultView.innerHeight + "px";
doc.defaultView.scrollBy(0, 40); doc.defaultView.scrollBy(0, 40);
@ -81,9 +86,8 @@ function test()
{ {
is(getHighlitNode(), iframeBodyNode, "highlighter shows the right node"); is(getHighlitNode(), iframeBodyNode, "highlighter shows the right node");
// 184 == 200 + 11(border) + 13(padding) - 40(scroll) let outlineRect = getSimpleBorderRect();
let outlineRect = getHighlighterOutlineRect(); is(outlineRect.height, 200, "highlighter height");
is(outlineRect.height, 184, "highlighter height");
inspector.toolbox.highlighterUtils.stopPicker().then(() => { inspector.toolbox.highlighterUtils.stopPicker().then(() => {
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);

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

@ -18,12 +18,7 @@ function test() {
inspector.toolbox.highlighterUtils.startPicker().then(() => { inspector.toolbox.highlighterUtils.startPicker().then(() => {
EventUtils.synthesizeMouse(content.document.body, 1, 1, EventUtils.synthesizeMouse(content.document.body, 1, 1,
{type: "mousemove"}, content); {type: "mousemove"}, content);
inspector.toolbox.once("picker-node-hovered", () => { inspector.toolbox.once("highlighter-ready", cb);
executeSoon(() => {
getHighlighterOutline().setAttribute("disable-transitions", "true");
cb();
});
});
}); });
} }
@ -35,8 +30,7 @@ function test() {
ok(isHighlighting(), "Inspector is highlighting"); ok(isHighlighting(), "Inspector is highlighting");
iframe.addEventListener("load", onIframeLoad, false); iframe.addEventListener("load", onIframeLoad, false);
executeSoon(() => {
executeSoon(function() {
iframe.contentWindow.location = "javascript:location.reload()"; iframe.contentWindow.location = "javascript:location.reload()";
}); });
}); });
@ -51,6 +45,7 @@ function test() {
} }
iframe.removeEventListener("load", onIframeLoad, false); iframe.removeEventListener("load", onIframeLoad, false);
info("Finished reloading iframe and inspector updated");
ok(isHighlighting(), "Inspector is highlighting after iframe nav"); ok(isHighlighting(), "Inspector is highlighting after iframe nav");

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

@ -57,23 +57,23 @@ function createDocument() {
} }
function testMouseOverH1Highlights() { function testMouseOverH1Highlights() {
inspector.toolbox.once("picker-node-hovered", () => { inspector.toolbox.once("highlighter-ready", () => {
ok(isHighlighting(), "Highlighter is shown"); ok(isHighlighting(), "Highlighter is shown");
is(getHighlitNode(), h1, "Highlighter's outline correspond to the selected node"); is(getHighlitNode(), h1, "Highlighter's outline correspond to the selected node");
testOutlineDimensions(); testBoxModelDimensions();
}); });
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content); EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
} }
function testOutlineDimensions() { function testBoxModelDimensions() {
let h1Dims = h1.getBoundingClientRect(); let h1Dims = h1.getBoundingClientRect();
let h1Width = h1Dims.width; let h1Width = Math.ceil(h1Dims.width);
let h1Height = h1Dims.height; let h1Height = Math.ceil(h1Dims.height);
let outlineDims = getHighlighterOutlineRect(); let outlineDims = getSimpleBorderRect();
let outlineWidth = outlineDims.width; let outlineWidth = Math.ceil(outlineDims.width);
let outlineHeight = outlineDims.height; let outlineHeight = Math.ceil(outlineDims.height);
// Disabled due to bug 716245 // Disabled due to bug 716245
is(outlineWidth, h1Width, "outline width matches dimensions of element (no zoom)"); is(outlineWidth, h1Width, "outline width matches dimensions of element (no zoom)");
@ -84,27 +84,22 @@ function testOutlineDimensions() {
.QueryInterface(Ci.nsIMarkupDocumentViewer); .QueryInterface(Ci.nsIMarkupDocumentViewer);
contentViewer.fullZoom = 2; contentViewer.fullZoom = 2;
// We wait at least 500ms to make sure the highlighter is not "mutting" the // simulate the zoomed dimensions of the div element
// resize event let h1Dims = h1.getBoundingClientRect();
// There seems to be some very minor differences in the floats, so let's
// floor the values
let h1Width = Math.floor(h1Dims.width * contentViewer.fullZoom);
let h1Height = Math.floor(h1Dims.height * contentViewer.fullZoom);
window.setTimeout(function() { let outlineDims = getSimpleBorderRect();
// simulate the zoomed dimensions of the div element let outlineWidth = Math.floor(outlineDims.width);
let h1Dims = h1.getBoundingClientRect(); let outlineHeight = Math.floor(outlineDims.height);
// There seems to be some very minor differences in the floats, so let's
// floor the values
let h1Width = Math.floor(h1Dims.width * contentViewer.fullZoom);
let h1Height = Math.floor(h1Dims.height * contentViewer.fullZoom);
let outlineDims = getHighlighterOutlineRect(); is(outlineWidth, h1Width, "outline width matches dimensions of element (zoomed)");
let outlineWidth = Math.floor(outlineDims.width);
let outlineHeight = Math.floor(outlineDims.height);
// Disabled due to bug 716245 is(outlineHeight, h1Height, "outline height matches dimensions of element (zoomed)");
is(outlineWidth, h1Width, "outline width matches dimensions of element (zoomed)");
is(outlineHeight, h1Height, "outline height matches dimensions of element (zoomed)");
executeSoon(finishUp); executeSoon(finishUp);
}, 500);
} }
function finishUp() { function finishUp() {

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

@ -35,7 +35,9 @@ function createDocument() {
// Open the inspector, start the picker mode, and start the tests // Open the inspector, start the picker mode, and start the tests
openInspector(aInspector => { openInspector(aInspector => {
inspector = aInspector; inspector = aInspector;
inspector.toolbox.highlighterUtils.startPicker().then(runTests); inspector.once("inspector-updated", () => {
inspector.toolbox.highlighterUtils.startPicker().then(runTests);
});
}); });
}, false); }, false);
@ -48,9 +50,7 @@ function createDocument() {
} }
function moveMouseOver(aElement, cb) { function moveMouseOver(aElement, cb) {
inspector.toolbox.once("picker-node-hovered", () => { inspector.toolbox.once("picker-node-hovered", cb);
executeSoon(cb);
});
EventUtils.synthesizeMouseAtCenter(aElement, {type: "mousemove"}, EventUtils.synthesizeMouseAtCenter(aElement, {type: "mousemove"},
aElement.ownerDocument.defaultView); aElement.ownerDocument.defaultView);
} }
@ -61,15 +61,14 @@ function runTests() {
function testDiv1Highlighter() { function testDiv1Highlighter() {
moveMouseOver(div1, () => { moveMouseOver(div1, () => {
getHighlighterOutline().setAttribute("disable-transitions", "true"); is(getHighlitNode(), div1, "highlighter matches selection of div1");
is(getHighlitNode(), div1, "highlighter matches selection");
testDiv2Highlighter(); testDiv2Highlighter();
}); });
} }
function testDiv2Highlighter() { function testDiv2Highlighter() {
moveMouseOver(div2, () => { moveMouseOver(div2, () => {
is(getHighlitNode(), div2, "highlighter matches selection"); is(getHighlitNode(), div2, "highlighter matches selection of div2");
selectRoot(); selectRoot();
}); });
} }

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

@ -13,24 +13,24 @@ function test() {
openInspector(aInspector => { openInspector(aInspector => {
inspector = aInspector; inspector = aInspector;
inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest); inspector.once("inspector-updated", () => {
inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest);
});
}); });
} }
function runTest() { function runTest() {
let outline = getHighlighterOutline(); let rect = getSimpleBorderRect();
is(outline.style.width, "100px", "outline has the right width"); is(rect.width, 100, "outline has the right width");
div.style.width = "200px"; div.style.width = "200px";
function pollTest() { inspector.toolbox.once("highlighter-ready", testRectWidth);
if (outline.style.width == "100px") { }
setTimeout(pollTest, 10);
return; function testRectWidth() {
} let rect = getSimpleBorderRect();
is(outline.style.width, "200px", "outline updated"); is(rect.width, 200, "outline updated");
finishUp(); finishUp();
}
setTimeout(pollTest, 10);
} }
function finishUp() { function finishUp() {

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

@ -33,34 +33,34 @@ function inspectNode(aInspector)
{ {
inspector = aInspector; inspector = aInspector;
inspector.once("inspector-updated", performScrollingTest); let highlighter = inspector.toolbox.highlighter;
executeSoon(function() { highlighter.showBoxModel(getNodeFront(div)).then(performScrollingTest);
inspector.selection.setNode(div, "");
});
} }
function performScrollingTest() function performScrollingTest()
{ {
executeSoon(function() {
// FIXME: this will fail on retina displays. EventUtils will only scroll
// 25px down instead of 50.
EventUtils.synthesizeWheel(div, 10, 10,
{ deltaY: 50.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL },
iframe.contentWindow);
});
gBrowser.selectedBrowser.addEventListener("scroll", function() { gBrowser.selectedBrowser.addEventListener("scroll", function() {
gBrowser.selectedBrowser.removeEventListener("scroll", arguments.callee, gBrowser.selectedBrowser.removeEventListener("scroll", arguments.callee,
false); false);
let isRetina = devicePixelRatio === 2;
is(iframe.contentDocument.body.scrollTop,
isRetina ? 25 : 50, "inspected iframe scrolled");
is(iframe.contentDocument.body.scrollTop, 50, "inspected iframe scrolled"); finishUp();
inspector = div = iframe = doc = null;
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
finish();
}, false); }, false);
EventUtils.synthesizeWheel(div, 10, 10,
{ deltaY: 50.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL },
iframe.contentWindow);
}
function finishUp()
{
inspector = div = iframe = doc = null;
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
finish();
} }
function test() function test()

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

@ -25,18 +25,19 @@ function inspectorRuleViewOpened()
gDevTools.once("toolbox-destroyed", inspectorClosed); gDevTools.once("toolbox-destroyed", inspectorClosed);
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.getToolbox(target).destroy(); gDevTools.closeToolbox(target);
} }
function inspectorClosed() function inspectorClosed()
{ {
openInspector(function(panel) { openInspector(function(panel) {
inspector = panel; inspector = panel;
if (inspector.sidebar.getCurrentTabID()) { if (inspector.sidebar.getCurrentTabID()) {
// Default sidebar already selected. info("Default sidebar already selected.")
testNewDefaultTab(); testNewDefaultTab();
} else { } else {
// Default sidebar still to be selected. info("Default sidebar still to be selected, adding select listener.");
inspector.sidebar.once("select", testNewDefaultTab); inspector.sidebar.once("select", testNewDefaultTab);
} }
}); });

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

@ -33,6 +33,7 @@ SimpleTest.registerCleanupFunction(() => {
console.error("DebuggerServer open connections: " + Object.getOwnPropertyNames(DebuggerServer._connections).length); console.error("DebuggerServer open connections: " + Object.getOwnPropertyNames(DebuggerServer._connections).length);
Services.prefs.clearUserPref("devtools.dump.emit"); Services.prefs.clearUserPref("devtools.dump.emit");
Services.prefs.clearUserPref("devtools.inspector.activeSidebar");
}); });
function openInspector(callback) function openInspector(callback)
@ -60,63 +61,118 @@ function getHighlighter()
return gBrowser.selectedBrowser.parentNode.querySelector(".highlighter-container"); return gBrowser.selectedBrowser.parentNode.querySelector(".highlighter-container");
} }
function getHighlighterOutline() function getSimpleBorderRect() {
{ let {p1, p2, p3, p4} = getBoxModelStatus().border.points;
let h = getHighlighter();
if (h) { return {
return h.querySelector(".highlighter-outline"); top: p1.y,
} left: p1.x,
width: p2.x - p1.x,
height: p4.y - p1.y
};
} }
function getHighlighterOutlineRect() { function getBoxModelRoot() {
let helper = new LayoutHelpers(window.content); let highlighter = getHighlighter();
let outline = getHighlighterOutline(); return highlighter.querySelector(".box-model-root");
}
if (outline) { function getBoxModelStatus() {
let browserOffsetRect = helper.getDirtyRect(gBrowser.selectedBrowser); let root = getBoxModelRoot();
let outlineRect = helper.getDirtyRect(outline); let inspector = getActiveInspector();
outlineRect.top -= browserOffsetRect.top;
outlineRect.left -= browserOffsetRect.left;
return outlineRect; return {
} visible: !root.hasAttribute("hidden"),
currentNode: inspector.walker.currentNode,
margin: {
points: getPointsForRegion("margin"),
visible: isRegionHidden("margin")
},
border: {
points: getPointsForRegion("border"),
visible: isRegionHidden("border")
},
padding: {
points: getPointsForRegion("padding"),
visible: isRegionHidden("padding")
},
content: {
points: getPointsForRegion("content"),
visible: isRegionHidden("content")
},
guides: {
top: getGuideStatus("top"),
right: getGuideStatus("right"),
bottom: getGuideStatus("bottom"),
left: getGuideStatus("left")
}
};
}
function getGuideStatus(location) {
let root = getBoxModelRoot();
let guide = root.querySelector(".box-model-guide-" + location);
return {
visible: !guide.hasAttribute("hidden"),
x1: guide.getAttribute("x1"),
y1: guide.getAttribute("y1"),
x2: guide.getAttribute("x2"),
y2: guide.getAttribute("y2")
};
}
function getPointsForRegion(region) {
let root = getBoxModelRoot();
let box = root.querySelector(".box-model-" + region);
let points = box.getAttribute("points").split(/[, ]/);
// We multiply each value by 1 to cast it into a number
return {
p1: {
x: parseFloat(points[0]),
y: parseFloat(points[1])
},
p2: {
x: parseFloat(points[2]),
y: parseFloat(points[3])
},
p3: {
x: parseFloat(points[4]),
y: parseFloat(points[5])
},
p4: {
x: parseFloat(points[6]),
y: parseFloat(points[7])
}
};
}
function isRegionHidden(region) {
let root = getBoxModelRoot();
let box = root.querySelector(".box-model-" + region);
return !box.hasAttribute("hidden");
} }
function isHighlighting() function isHighlighting()
{ {
let outline = getHighlighterOutline(); let root = getBoxModelRoot();
return outline && !outline.hasAttribute("hidden"); return !root.hasAttribute("hidden");
} }
function getHighlitNode() function getHighlitNode()
{ {
if (isHighlighting()) { if (isHighlighting()) {
let helper = new LayoutHelpers(window.content); let helper = new LayoutHelpers(window.content);
let outlineRect = getHighlighterOutlineRect(); let points = getBoxModelStatus().content.points;
let x = (points.p1.x + points.p2.x + points.p3.x + points.p4.x) / 4;
let y = (points.p1.y + points.p2.y + points.p3.y + points.p4.y) / 4;
let a = {
x: outlineRect.left,
y: outlineRect.top
};
let b = {
x: a.x + outlineRect.width,
y: a.y + outlineRect.height
};
let {x, y} = getMidPoint(a, b);
return helper.getElementFromPoint(window.content.document, x, y); return helper.getElementFromPoint(window.content.document, x, y);
} }
} }
function getMidPoint(aPointA, aPointB)
{
let pointC = {};
pointC.x = (aPointB.x - aPointA.x) / 2 + aPointA.x;
pointC.y = (aPointB.y - aPointA.y) / 2 + aPointA.y;
return pointC;
}
function computedView() function computedView()
{ {
let sidebar = getActiveInspector().sidebar; let sidebar = getActiveInspector().sidebar;

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

@ -125,7 +125,7 @@ function test() {
break; break;
} }
inspector.markup._waitForChildren().then(() => executeSoon(function BIMNT_newNode() { inspector.markup._waitForChildren().then(() => executeSoon(() => {
let node = inspector.selection.node; let node = inspector.selection.node;
if (className == "*comment*") { if (className == "*comment*") {

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

@ -120,7 +120,7 @@ function hoverContainer(nodeOrSelector, inspector) {
info("Hovering over the markup-container for node " + nodeOrSelector); info("Hovering over the markup-container for node " + nodeOrSelector);
let highlit = inspector.toolbox.once("node-highlight"); let highlit = inspector.toolbox.once("node-highlight");
let container = getContainerForRawNode(inspector.markup, getNode(nodeOrSelector)); let container = getContainerForRawNode(inspector.markup, getNode(nodeOrSelector));
EventUtils.synthesizeMouse(container.tagLine, 2, 2, {type: "mousemove"}, EventUtils.synthesizeMouseAtCenter(container.tagLine, {type: "mousemove"},
inspector.markup.doc.defaultView); inspector.markup.doc.defaultView);
return highlit; return highlit;
} }
@ -148,8 +148,9 @@ function clickContainer(nodeOrSelector, inspector) {
* @return {Boolean} * @return {Boolean}
*/ */
function isHighlighterVisible() { function isHighlighterVisible() {
let outline = gBrowser.selectedBrowser.parentNode.querySelector(".highlighter-container .highlighter-outline"); let highlighter = gBrowser.selectedBrowser.parentNode
return outline && !outline.hasAttribute("hidden"); .querySelector(".highlighter-container .box-model-root");
return highlighter && !highlighter.hasAttribute("hidden");
} }
/** /**
@ -164,7 +165,7 @@ function mouseLeaveMarkupView(inspector) {
// Find another element to mouseover over in order to leave the markup-view // Find another element to mouseover over in order to leave the markup-view
let btn = inspector.toolbox.doc.querySelector(".toolbox-dock-button"); let btn = inspector.toolbox.doc.querySelector(".toolbox-dock-button");
EventUtils.synthesizeMouse(btn, 2, 2, {type: "mousemove"}, EventUtils.synthesizeMouseAtCenter(btn, {type: "mousemove"},
inspector.toolbox.doc.defaultView); inspector.toolbox.doc.defaultView);
executeSoon(def.resolve); executeSoon(def.resolve);

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

@ -90,8 +90,7 @@ function testAfterSecondRevert() {
ok(menu.hasAttribute("disabled"), ok(menu.hasAttribute("disabled"),
"Revert menu entry is disabled after reverting to changed saved state."); "Revert menu entry is disabled after reverting to changed saved state.");
gFile.remove(false); gFile.remove(false);
gFile = null; gFile = gScratchpad = menu = null;
gScratchpad = null;
finish(); finish();
} }

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

@ -66,7 +66,7 @@ function onNodeListVviewFetched(aEvent, aVar)
// variable's highlightDomNode and see if it has the desired effect // variable's highlightDomNode and see if it has the desired effect
prop.highlightDomNode(); prop.highlightDomNode();
} else { } else {
finishTest(); finishUp();
} }
} }
@ -89,3 +89,9 @@ function onNodeListVviewFetched(aEvent, aVar)
hoverOverDomNodeVariableAndAssertHighlighter(0); hoverOverDomNodeVariableAndAssertHighlighter(0);
} }
function finishUp() {
gWebConsole = gJSTerm = gVariablesView = gToolbox = null;
finishTest();
}

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

@ -214,7 +214,7 @@ function testCompletion(hud) {
is(newItems.length, 0, "no items for foo2Obj[0]"); is(newItems.length, 0, "no items for foo2Obj[0]");
testDriver = null; testDriver = null;
executeSoon(finishTest); executeSoon(finishUp);
yield undefined; yield undefined;
} }
@ -237,3 +237,8 @@ function onFramesAdded()
info("onFramesAdded, openConsole() now"); info("onFramesAdded, openConsole() now");
executeSoon(() => openConsole(null, testNext)); executeSoon(() => openConsole(null, testNext));
} }
function finishUp() {
testDriver = gStackframes = null;
finishTest();
}

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

@ -332,5 +332,10 @@ function popupHideAfterCompletionInText()
is(inputNode.selectionStart, inputNode.selectionEnd, "cursor location (confirmed)"); is(inputNode.selectionStart, inputNode.selectionEnd, "cursor location (confirmed)");
ok(!completeNode.value, "completeNode is empty"); ok(!completeNode.value, "completeNode is empty");
finishUp();
}
function finishUp() {
HUD = popup = jsterm = inputNode = completeNode = null;
finishTest(); finishTest();
} }

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

@ -84,5 +84,10 @@ function onVariablesViewReady(aEvent, aView)
{ {
findVariableViewProperties(aView, [ findVariableViewProperties(aView, [
{ name: "body", value: "<body>" }, { name: "body", value: "<body>" },
], { webconsole: gHUD }).then(finishTest); ], { webconsole: gHUD }).then(finishUp);
}
function finishUp() {
gHUD = null;
finishTest();
} }

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

@ -89,5 +89,10 @@ function test() {
let {tab} = yield loadTab(TEST_URI); let {tab} = yield loadTab(TEST_URI);
let hud = yield openConsole(tab); let hud = yield openConsole(tab);
return checkOutputForInputs(hud, inputTests); return checkOutputForInputs(hud, inputTests);
}).then(finishTest); }).then(finishUp);
}
function finishUp() {
inputTests = null;
finishTest();
} }

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

@ -158,6 +158,12 @@ function test() {
browser.removeEventListener("load", onLoad, true); browser.removeEventListener("load", onLoad, true);
openConsole().then((hud) => { openConsole().then((hud) => {
return checkOutputForInputs(hud, inputTests); return checkOutputForInputs(hud, inputTests);
}).then(finishTest); }).then(finishUp);
}, true); }, true);
} }
function finishUp() {
inputTests = null;
finishTest();
}

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

@ -71,14 +71,11 @@ let observer = {
ok(true, "the view source window was opened in response to clicking " + ok(true, "the view source window was opened in response to clicking " +
"the location node"); "the location node");
// executeSoon() is necessary to avoid crashing Firefox. See bug 611543. aSubject.close();
executeSoon(function() { ok(containsValueInvoked, "custom containsValue() was invoked");
aSubject.close(); Sources.containsValue = containsValue;
ok(containsValueInvoked, "custom containsValue() was invoked"); Sources = containsValue = null;
Sources.containsValue = containsValue; finishTest();
Sources = containsValue = null;
finishTest();
});
} }
}; };

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

@ -298,7 +298,7 @@ function dumpMessageElement(aMessage)
function finishTest() function finishTest()
{ {
browser = hudId = hud = filterBox = outputNode = cs = null; browser = hudId = hud = filterBox = outputNode = cs = hudBox = null;
dumpConsoles(); dumpConsoles();