Bug 1177517 - ESLint cleanup for tests. r=pbro

This commit is contained in:
Jennifer Fong 2015-06-29 11:37:00 -04:00
parent 1fb5714724
commit 6757ce5962
50 changed files with 801 additions and 809 deletions

View File

@ -18,8 +18,8 @@ function test() {
HUDService.toggleBrowserConsole().then(browserConsoleOpened);
});
function browserConsoleOpened(aHud) {
hud = aHud;
function browserConsoleOpened(hudConsole) {
hud = hudConsole;
ok(hud, "browser console opened");
let button = content.document.querySelector("button");

View File

@ -48,7 +48,8 @@ let test = asyncTest(function* () {
'["0","1","2","3","4","5","6","7","8","9"]',
"Third tab has populated history");
// Set input value separately from execute so UP arrow accurately navigates history.
// Set input value separately from execute so UP arrow accurately navigates
// history.
hud3.jsterm.setInputValue('"hello from third tab"');
hud3.jsterm.execute();
@ -72,12 +73,12 @@ let test = asyncTest(function* () {
"Fourth tab has most recent history");
yield hud4.jsterm.clearHistory();
is(JSON.stringify(hud4.jsterm.history), '[]',
is(JSON.stringify(hud4.jsterm.history), "[]",
"Clearing history for a tab works");
yield loadTab(TEST_URI);
let hud5 = yield openConsole();
is(JSON.stringify(hud5.jsterm.history), '[]',
is(JSON.stringify(hud5.jsterm.history), "[]",
"Clearing history carries over to a new tab");
info("Clearing custom input history pref");

View File

@ -6,7 +6,10 @@
// Check that cached messages from nested iframes are displayed in the
// Web/Browser Console.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-consoleiframes.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-consoleiframes.html";
const expectedMessages = [
{
@ -52,16 +55,14 @@ const expectedMessagesAny = [
},
];
function test()
{
function test() {
expectUncaughtException();
loadTab(TEST_URI).then(() => {
openConsole().then(consoleOpened);
});
}
function consoleOpened(hud)
{
function consoleOpened(hud) {
ok(hud, "web console opened");
waitForMessages({
@ -79,14 +80,12 @@ function consoleOpened(hud)
});
}
function onWebConsoleClose()
{
function onWebConsoleClose() {
info("web console closed");
HUDService.toggleBrowserConsole().then(onBrowserConsoleOpen);
}
function onBrowserConsoleOpen(hud)
{
function onBrowserConsoleOpen(hud) {
ok(hud, "browser console opened");
waitForMessages({
webconsole: hud,

View File

@ -8,7 +8,8 @@
"use strict";
let test = asyncTest(function*() {
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
yield loadTab(TEST_URI);
@ -33,11 +34,13 @@ let test = asyncTest(function*() {
let bottom = currentPosition;
EventUtils.synthesizeKey("VK_PAGE_UP", {});
isnot(hud.outputNode.parentNode.scrollTop, currentPosition, "scroll position changed after page up");
isnot(hud.outputNode.parentNode.scrollTop, currentPosition,
"scroll position changed after page up");
currentPosition = hud.outputNode.parentNode.scrollTop;
EventUtils.synthesizeKey("VK_PAGE_DOWN", {});
ok(hud.outputNode.parentNode.scrollTop > currentPosition, "scroll position now at bottom");
ok(hud.outputNode.parentNode.scrollTop > currentPosition,
"scroll position now at bottom");
EventUtils.synthesizeKey("VK_HOME", {});
is(hud.outputNode.parentNode.scrollTop, 0, "scroll position now at top");
@ -49,7 +52,9 @@ let test = asyncTest(function*() {
"scroll position now at bottom");
info("try ctrl-l to clear output");
executeSoon(() => { EventUtils.synthesizeKey("l", { ctrlKey: true }); });
executeSoon(() => {
EventUtils.synthesizeKey("l", { ctrlKey: true });
});
yield hud.jsterm.once("messages-cleared");
is(hud.outputNode.textContent.indexOf("foobarz1"), -1, "output cleared");
@ -69,8 +74,7 @@ let test = asyncTest(function*() {
ok(!hud.ui.getFilterState("network"), "accesskey for Network works");
EventUtils.synthesizeKey("t", { ctrlKey: true });
ok(hud.ui.getFilterState("network"), "accesskey for Network works (again)");
}
else {
} else {
EventUtils.synthesizeKey("N", { altKey: true });
let net = hud.ui.document.querySelector("toolbarbutton[category=net]");
is(hud.ui.document.activeElement, net,

View File

@ -7,7 +7,8 @@
"use strict";
let test = asyncTest(function*() {
yield loadTab("data:text/html;charset=utf8,test for bug 676722 - inspectable objects for window.console");
yield loadTab("data:text/html;charset=utf8,test for bug 676722 - " +
"inspectable objects for window.console");
let hud = yield openConsole();
hud.jsterm.clearOutput(true);

View File

@ -5,8 +5,11 @@
// Check that the navigation marker shows on page reload - bug 793996.
"use strict";
const PREF = "devtools.webconsole.persistlog";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
let hud;
@ -32,8 +35,7 @@ let test = asyncTest(function* () {
hud = null;
});
function consoleOpened()
{
function consoleOpened() {
ok(hud, "Web Console opened");
hud.jsterm.clearOutput();
@ -48,8 +50,7 @@ function consoleOpened()
});
}
function onReload()
{
function onReload() {
content.console.log("foobarz2");
return waitForMessages({
@ -72,4 +73,3 @@ function onReload()
}],
});
}

View File

@ -6,11 +6,12 @@
// Check that nsIConsoleMessages are displayed in the Browser Console.
// See bug 859756.
"use strict";
const TEST_URI = "data:text/html;charset=utf8,<title>bug859756</title>\n" +
"<p>hello world\n<p>nsIConsoleMessages ftw!";
function test()
{
function test() {
const FILTER_PREF = "devtools.browserconsole.filter.jslog";
Services.prefs.setBoolPref(FILTER_PREF, true);
@ -70,7 +71,8 @@ function test()
let msg = [...results[2].matched][0];
ok(msg, "message element for do-not-show-me (nsIConsoleMessage)");
isnot(msg.textContent.indexOf("do-not-show"), -1, "element content is correct");
isnot(msg.textContent.indexOf("do-not-show"), -1,
"element content is correct");
ok(!msg.classList.contains("filtered-by-type"), "element is not filtered");
hud.setFilterState("jslog", false);

View File

@ -6,12 +6,9 @@
// Test that the "browser console" menu item opens or focuses (if already open)
// the console window instead of toggling it open/close.
"use strict";
let test = asyncTest(function* () {
let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
let currWindow, hud, mainWindow;
mainWindow = Services.wm.getMostRecentWindow(null);

View File

@ -4,9 +4,12 @@
// Check that inspecting an optimized out variable works when execution is
// paused.
"use strict";
function test() {
Task.spawn(function* () {
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-closure-optimized-out.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-closure-optimized-out.html";
let {tab} = yield loadTab(TEST_URI);
let hud = yield openConsole(tab);
let { toolbox, panel, panelWin } = yield openDebugger();
@ -25,7 +28,7 @@ function test() {
// this function to return first.
executeSoon(() => button.click());
let packet = yield fetchedScopes;
yield fetchedScopes;
ok(true, "Scopes were fetched");
yield toolbox.selectTool("webconsole");
@ -56,25 +59,25 @@ function ensureThreadClientState(aPanel, aState) {
if (state == aState) {
return promise.resolve(null);
} else {
return waitForThreadEvents(aPanel, aState);
}
return waitForThreadEvents(aPanel, aState);
}
function waitForThreadEvents(aPanel, aEventName, aEventRepeat = 1) {
info("Waiting for thread event: '" + aEventName + "' to fire: " + aEventRepeat + " time(s).");
info("Waiting for thread event: '" + aEventName + "' to fire: " +
aEventRepeat + " time(s).");
let deferred = promise.defer();
let thread = aPanel.panelWin.gThreadClient;
let count = 0;
thread.addListener(aEventName, function onEvent(aEventName, ...aArgs) {
info("Thread event '" + aEventName + "' fired: " + (++count) + " time(s).");
thread.addListener(aEventName, function onEvent(eventName, ...args) {
info("Thread event '" + eventName + "' fired: " + (++count) + " time(s).");
if (count == aEventRepeat) {
ok(true, "Enough '" + aEventName + "' thread events have been fired.");
thread.removeListener(aEventName, onEvent);
deferred.resolve.apply(deferred, aArgs);
ok(true, "Enough '" + eventName + "' thread events have been fired.");
thread.removeListener(eventName, onEvent);
deferred.resolve.apply(deferred, args);
}
});

View File

@ -6,8 +6,9 @@
// Bug 874061: test for how the browser and web consoles display messages coming
// from private windows. See bug for description of expected behavior.
function test()
{
"use strict";
function test() {
const TEST_URI = "data:text/html;charset=utf8,<p>hello world! bug 874061" +
"<button onclick='console.log(\"foobar bug 874061\");" +
"fooBazBaz.yummy()'>click</button>";
@ -22,15 +23,13 @@ function test()
requestLongerTimeout(2);
start();
function start()
{
function start() {
gBrowser.selectedTab = gBrowser.addTab("data:text/html;charset=utf8," +
"<p>hello world! I am not private!");
gBrowser.selectedBrowser.addEventListener("load", onLoadTab, true);
}
function onLoadTab()
{
function onLoadTab() {
gBrowser.selectedBrowser.removeEventListener("load", onLoadTab, true);
info("onLoadTab()");
@ -55,8 +54,7 @@ function test()
whenDelayedStartupFinished(privateWindow, onPrivateWindowReady);
}
function onPrivateWindowReady()
{
function onPrivateWindowReady() {
info("private browser window opened");
privateBrowser = privateWindow.gBrowser;
@ -65,20 +63,19 @@ function test()
info("private tab opened");
privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
privateContent = privateBrowser.selectedBrowser.contentWindow;
ok(PrivateBrowsingUtils.isBrowserPrivate(privateBrowser.selectedBrowser), "tab window is private");
ok(PrivateBrowsingUtils.isBrowserPrivate(privateBrowser.selectedBrowser),
"tab window is private");
openConsole(privateTab).then(consoleOpened);
}, true);
}
function addMessages()
{
function addMessages() {
let button = privateContent.document.querySelector("button");
ok(button, "button in page");
EventUtils.synthesizeMouse(button, 2, 2, {}, privateContent);
}
function consoleOpened(aHud)
{
function consoleOpened(aHud) {
hud = aHud;
ok(hud, "web console opened");
@ -106,8 +103,7 @@ function test()
}).then(testCachedMessages);
}
function testCachedMessages()
{
function testCachedMessages() {
info("testCachedMessages()");
closeConsole(privateTab).then(() => {
info("web console closed");
@ -115,8 +111,7 @@ function test()
});
}
function consoleReopened(aHud)
{
function consoleReopened(aHud) {
hud = aHud;
ok(hud, "web console reopened");
@ -128,8 +123,7 @@ function test()
}).then(testBrowserConsole);
}
function testBrowserConsole()
{
function testBrowserConsole() {
info("testBrowserConsole()");
closeConsole(privateTab).then(() => {
info("web console closed");
@ -139,15 +133,13 @@ function test()
// Make sure that the cached messages from private tabs are not displayed in
// the browser console.
function checkNoPrivateMessages()
{
function checkNoPrivateMessages() {
let text = hud.outputNode.textContent;
is(text.indexOf("fooBazBaz"), -1, "no exception displayed");
is(text.indexOf("bug 874061"), -1, "no console message displayed");
}
function onBrowserConsoleOpen(aHud)
{
function onBrowserConsoleOpen(aHud) {
hud = aHud;
ok(hud, "browser console opened");
@ -163,8 +155,7 @@ function test()
}).then(testPrivateWindowClose);
}
function testPrivateWindowClose()
{
function testPrivateWindowClose() {
info("close the private window and check if the private messages are removed");
hud.jsterm.once("private-messages-cleared", () => {
isnot(hud.outputNode.textContent.indexOf("bug874061-not-private"), -1,
@ -181,8 +172,7 @@ function test()
privateWindow.BrowserTryToCloseWindow();
}
function onBrowserConsoleReopen(aHud)
{
function onBrowserConsoleReopen(aHud) {
hud = aHud;
ok(hud, "browser console reopened");
@ -191,8 +181,8 @@ function test()
webconsole: hud,
messages: [nonPrivateMessage],
}).then(() => {
// Make sure that no private message is displayed after closing the private
// window and reopening the Browser Console.
// Make sure that no private message is displayed after closing the
// private window and reopening the Browser Console.
checkNoPrivateMessages();
executeSoon(finishTest);
});

View File

@ -5,7 +5,8 @@
// Check that variables view works as expected in the web console.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-eval-in-stackframe.html";
let gWebConsole, gJSTerm, gVariablesView;
@ -21,7 +22,8 @@ let test = asyncTest(function* () {
let msg = yield gJSTerm.execute("fooObj");
ok(msg, "output message found");
ok(msg.textContent.includes('{ testProp: "testValue" }'), "message text check");
ok(msg.textContent.includes('{ testProp: "testValue" }'),
"message text check");
let anchor = msg.querySelector("a");
ok(anchor, "object link found");
@ -52,8 +54,7 @@ let test = asyncTest(function* () {
gWebConsole = gJSTerm = gVariablesView = null;
});
function onFooObjFetch(aVar)
{
function onFooObjFetch(aVar) {
gVariablesView = aVar._variablesView;
ok(gVariablesView, "variables view object");
@ -62,8 +63,7 @@ function onFooObjFetch(aVar)
], { webconsole: gWebConsole });
}
function onTestPropFound(aResults)
{
function onTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the |testProp| property in the variables view");
@ -80,19 +80,17 @@ function onTestPropFound(aResults)
});
}
function onFooObjFetchAfterUpdate(aVar)
{
function onFooObjFetchAfterUpdate(aVar) {
info("onFooObjFetchAfterUpdate");
let expectedValue = content.document.title + content.location
+ '[object HTMLParagraphElement]';
let expectedValue = content.document.title + content.location +
"[object HTMLParagraphElement]";
return findVariableViewProperties(aVar, [
{ name: "testProp", value: expectedValue },
], { webconsole: gWebConsole });
}
function onUpdatedTestPropFound(aResults)
{
function onUpdatedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the updated |testProp| property value");
@ -108,8 +106,7 @@ function onUpdatedTestPropFound(aResults)
});
}
function onFooObjFetchAfterPropRename(aVar)
{
function onFooObjFetchAfterPropRename(aVar) {
info("onFooObjFetchAfterPropRename");
let para = content.wrappedJSObject.document.querySelector("p");
@ -121,8 +118,7 @@ function onFooObjFetchAfterPropRename(aVar)
], { webconsole: gWebConsole });
}
function onRenamedTestPropFound(aResults)
{
function onRenamedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the renamed |testProp| property");
@ -141,8 +137,7 @@ function onRenamedTestPropFound(aResults)
});
}
function onPropUpdateError(aVar)
{
function onPropUpdateError(aVar) {
info("onPropUpdateError");
let para = content.wrappedJSObject.document.querySelector("p");
@ -154,13 +149,10 @@ function onPropUpdateError(aVar)
], { webconsole: gWebConsole });
}
function onRenamedTestPropFoundAgain(aResults)
{
function onRenamedTestPropFoundAgain(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the renamed |testProp| property again");
let outputNode = gWebConsole.outputNode;
return waitForMessages({
webconsole: gWebConsole,
messages: [{
@ -172,8 +164,7 @@ function onRenamedTestPropFoundAgain(aResults)
});
}
function testPropDelete(aProp)
{
function testPropDelete(aProp) {
gVariablesView.window.focus();
aProp.focus();

View File

@ -28,29 +28,28 @@ function test() {
Task.spawn(runner).then(finishTest);
function* runner() {
const {tab} = yield loadTab(TEST_URI);
const hud = yield openConsole(tab);
const jsterm = hud.jsterm;
function* runner() {
const {tab} = yield loadTab(TEST_URI);
const hud = yield openConsole(tab);
const jsterm = hud.jsterm;
let deferred = promise.defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(document.querySelectorAll('div'))");
let deferred = promise.defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(document.querySelectorAll('div'))");
let variableScope = yield deferred.promise;
ok(variableScope, "Variables view opened");
let variableScope = yield deferred.promise;
ok(variableScope, "Variables view opened");
yield findVariableViewProperties(variableScope, [
{ name: "0", value: "<div>"},
{ name: "1", value: "<div#testID>"},
{ name: "2", value: "<div.single-class>"},
{ name: "3", value: "<div.multiple-classes.another-class>"},
{ name: "4", value: "<div#class-and-id.class-and-id>"},
{ name: "5", value: "<div#multiple-classes-and-id.multiple-classes-and-id.another-class>"},
{ name: "6", value: "<div.whitespace-start>"},
{ name: "7", value: "<div.whitespace-end>"},
{ name: "8", value: "<div.multiple.spaces>"},
], { webconsole: hud});
}
yield findVariableViewProperties(variableScope, [
{ name: "0", value: "<div>"},
{ name: "1", value: "<div#testID>"},
{ name: "2", value: "<div.single-class>"},
{ name: "3", value: "<div.multiple-classes.another-class>"},
{ name: "4", value: "<div#class-and-id.class-and-id>"},
{ name: "5", value: "<div#multiple-classes-and-id.multiple-classes-and-id.another-class>"},
{ name: "6", value: "<div.whitespace-start>"},
{ name: "7", value: "<div.whitespace-end>"},
{ name: "8", value: "<div.multiple.spaces>"},
], { webconsole: hud});
}
}

View File

@ -2,6 +2,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* Test case that ensures Array and other list types are not sorted in variables
@ -115,8 +116,10 @@ function test() {
let variableScope = yield deferred.promise;
ok(variableScope, "Variables view opened");
// If the properties are sorted: keys = ["1", "4", "10",..., "abc", "hello"] <- correct
// If the properties are not sorted: keys = ["1", "10", "4",...] <- incorrect
// If the properties are sorted:
// keys = ["1", "4", "10",..., "abc", "hello"] <- correct
// If the properties are not sorted:
// keys = ["1", "10", "4",...] <- incorrect
let keyIterator = variableScope._store.keys();
is(keyIterator.next().value, "1", "First key should be 1");
is(keyIterator.next().value, "4", "Second key should be 4");

View File

@ -6,29 +6,27 @@
// Check that variables view is linked to the inspector for highlighting and
// selecting DOM nodes
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-952277-highlight-nodes-in-vview.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-bug-952277-highlight-nodes-in-vview.html";
let gWebConsole, gJSTerm, gVariablesView, gToolbox;
function test()
{
function test() {
loadTab(TEST_URI).then(() => {
openConsole().then(hud => {
consoleOpened(hud);
})
});
});
}
function consoleOpened(hud)
{
function consoleOpened(hud) {
gWebConsole = hud;
gJSTerm = hud.jsterm;
gToolbox = gDevTools.getToolbox(hud.target);
gJSTerm.execute("document.querySelectorAll('p')").then(onQSAexecuted);
}
function onQSAexecuted(msg)
{
function onQSAexecuted(msg) {
ok(msg, "output message found");
let anchor = msg.querySelector("a");
ok(anchor, "object link found");
@ -40,8 +38,7 @@ function onQSAexecuted(msg)
);
}
function onNodeListVviewFetched(aEvent, aVar)
{
function onNodeListVviewFetched(aEvent, aVar) {
gVariablesView = aVar._variablesView;
ok(gVariablesView, "variables view object");
@ -54,7 +51,6 @@ function onNodeListVviewFetched(aEvent, aVar)
function hoverOverDomNodeVariableAndAssertHighlighter(index) {
if (props[index]) {
let prop = props[index][1];
let valueEl = prop._valueLabel;
gToolbox.once("node-highlight", () => {
ok(true, "The highlighter was shown on hover of the DOMNode");
@ -80,7 +76,8 @@ function onNodeListVviewFetched(aEvent, aVar)
// variable's openNodeInInspector function and see if it has the
// desired effect
prop.openNodeInInspector().then(() => {
is(gToolbox.currentToolId, "inspector", "The toolbox switched over the inspector on DOMNode click");
is(gToolbox.currentToolId, "inspector",
"The toolbox switched over the inspector on DOMNode click");
gToolbox.selectTool("webconsole").then(() => {
hoverOverDomNodeVariableAndAssertHighlighter(index + 1);
});

View File

@ -7,20 +7,21 @@
// from the js debugger, when changing the value of a property in the variables
// view.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-eval-in-stackframe.html";
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
gStackframes, gVariablesView;
function test()
{
function test() {
loadTab(TEST_URI).then(() => {
openConsole().then(consoleOpened);
});
}
function consoleOpened(hud)
{
function consoleOpened(hud) {
gWebConsole = hud;
gJSTerm = hud.jsterm;
@ -30,8 +31,7 @@ function consoleOpened(hud)
});
}
function debuggerOpened(aResult)
{
function debuggerOpened(aResult) {
gDebuggerWin = aResult.panelWin;
gDebuggerController = gDebuggerWin.DebuggerController;
gThread = gDebuggerController.activeThread;
@ -45,8 +45,7 @@ function debuggerOpened(aResult)
});
}
function onFramesAdded()
{
function onFramesAdded() {
info("onFramesAdded");
executeSoon(() =>
@ -56,11 +55,10 @@ function onFramesAdded()
);
}
function onExecuteFooObj(msg)
{
function onExecuteFooObj(msg) {
ok(msg, "output message found");
ok(msg.textContent.includes('{ testProp2: "testValue2" }'), "message text check");
ok(msg.textContent.includes('{ testProp2: "testValue2" }'),
"message text check");
let anchor = msg.querySelector("a");
ok(anchor, "object link found");
@ -71,8 +69,7 @@ function onExecuteFooObj(msg)
gWebConsole.iframeWindow));
}
function onFooObjFetch(aEvent, aVar)
{
function onFooObjFetch(aEvent, aVar) {
gVariablesView = aVar._variablesView;
ok(gVariablesView, "variables view object");
@ -82,8 +79,7 @@ function onFooObjFetch(aEvent, aVar)
], { webconsole: gWebConsole }).then(onTestPropFound);
}
function onTestPropFound(aResults)
{
function onTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the |testProp2| property in the variables view");
@ -97,8 +93,7 @@ function onTestPropFound(aResults)
}).then(onFooObjFetchAfterUpdate);
}
function onFooObjFetchAfterUpdate(aVar)
{
function onFooObjFetchAfterUpdate(aVar) {
info("onFooObjFetchAfterUpdate");
let para = content.wrappedJSObject.document.querySelector("p");
let expectedValue = content.document.title + "foo2SecondCall" + para;
@ -108,17 +103,17 @@ function onFooObjFetchAfterUpdate(aVar)
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
}
function onUpdatedTestPropFound(aResults)
{
function onUpdatedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the updated |testProp2| property value");
// Check that testProp2 was updated.
executeSoon(() => gJSTerm.execute("fooObj.testProp2").then(onExecuteFooObjTestProp2));
executeSoon(() => {
gJSTerm.execute("fooObj.testProp2").then(onExecuteFooObjTestProp2);
});
}
function onExecuteFooObjTestProp2()
{
function onExecuteFooObjTestProp2() {
let para = content.wrappedJSObject.document.querySelector("p");
let expected = content.document.title + "foo2SecondCall" + para;

View File

@ -6,20 +6,19 @@
// Test that makes sure web console eval works while the js debugger paused the
// page, and while the inspector is active. See bug 886137.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-eval-in-stackframe.html";
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
gStackframes, gVariablesView;
function test()
{
function test() {
loadTab(TEST_URI).then(() => {
openConsole().then(consoleOpened);
}, true);
}
function consoleOpened(hud)
{
function consoleOpened(hud) {
gWebConsole = hud;
gJSTerm = hud.jsterm;
@ -27,8 +26,7 @@ function consoleOpened(hud)
openDebugger().then(debuggerOpened);
}
function debuggerOpened(aResult)
{
function debuggerOpened(aResult) {
info("debugger opened");
gDebuggerWin = aResult.panelWin;
gDebuggerController = gDebuggerWin.DebuggerController;
@ -38,8 +36,7 @@ function debuggerOpened(aResult)
openInspector().then(inspectorOpened);
}
function inspectorOpened(aPanel)
{
function inspectorOpened(aPanel) {
info("inspector opened");
gThread.addOneTimeListener("framesadded", onFramesAdded);
@ -47,18 +44,16 @@ function inspectorOpened(aPanel)
content.wrappedJSObject.firstCall();
}
function onFramesAdded()
{
function onFramesAdded() {
info("onFramesAdded");
openConsole().then(() => gJSTerm.execute("fooObj").then(onExecuteFooObj));
}
function onExecuteFooObj(msg)
{
function onExecuteFooObj(msg) {
ok(msg, "output message found");
ok(msg.textContent.includes('{ testProp2: "testValue2" }'),
"message text check");
"message text check");
let anchor = msg.querySelector("a");
ok(anchor, "object link found");
@ -68,8 +63,7 @@ function onExecuteFooObj(msg)
EventUtils.synthesizeMouse(anchor, 2, 2, {}, gWebConsole.iframeWindow);
}
function onFooObjFetch(aEvent, aVar)
{
function onFooObjFetch(aEvent, aVar) {
gVariablesView = aVar._variablesView;
ok(gVariablesView, "variables view object");
@ -79,8 +73,7 @@ function onFooObjFetch(aEvent, aVar)
], { webconsole: gWebConsole }).then(onTestPropFound);
}
function onTestPropFound(aResults)
{
function onTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the |testProp2| property in the variables view");
@ -94,8 +87,7 @@ function onTestPropFound(aResults)
}).then(onFooObjFetchAfterUpdate);
}
function onFooObjFetchAfterUpdate(aVar)
{
function onFooObjFetchAfterUpdate(aVar) {
info("onFooObjFetchAfterUpdate");
let para = content.wrappedJSObject.document.querySelector("p");
let expectedValue = content.document.title + "foo2SecondCall" + para;
@ -105,8 +97,7 @@ function onFooObjFetchAfterUpdate(aVar)
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
}
function onUpdatedTestPropFound(aResults)
{
function onUpdatedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the updated |testProp2| property value");
@ -114,8 +105,7 @@ function onUpdatedTestPropFound(aResults)
gJSTerm.execute("fooObj.testProp2").then(onExecuteFooObjTestProp2);
}
function onExecuteFooObjTestProp2()
{
function onExecuteFooObjTestProp2() {
let para = content.wrappedJSObject.document.querySelector("p");
let expected = content.document.title + "foo2SecondCall" + para;

View File

@ -6,26 +6,27 @@
// Test that makes sure web console eval happens in the user-selected stackframe
// from the js debugger.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
"use strict";
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController, gStackframes;
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-eval-in-stackframe.html";
function test()
{
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController;
let gStackframes;
function test() {
loadTab(TEST_URI).then(() => {
openConsole().then(consoleOpened);
});
}
function consoleOpened(hud)
{
function consoleOpened(hud) {
gWebConsole = hud;
gJSTerm = hud.jsterm;
gJSTerm.execute("foo").then(onExecuteFoo);
}
function onExecuteFoo()
{
function onExecuteFoo() {
isnot(gWebConsole.outputNode.textContent.indexOf("globalFooBug783499"), -1,
"|foo| value is correct");
@ -33,11 +34,12 @@ function onExecuteFoo()
// Test for Bug 690529 - Web Console and Scratchpad should evaluate
// expressions in the scope of the content window, not in a sandbox.
executeSoon(() => gJSTerm.execute("foo2 = 'newFoo'; window.foo2").then(onNewFoo2));
executeSoon(() => {
gJSTerm.execute("foo2 = 'newFoo'; window.foo2").then(onNewFoo2);
});
}
function onNewFoo2(msg)
{
function onNewFoo2(msg) {
is(gWebConsole.outputNode.textContent.indexOf("undefined"), -1,
"|undefined| is not displayed after adding |foo2|");
@ -52,8 +54,7 @@ function onNewFoo2(msg)
executeSoon(() => openDebugger().then(debuggerOpened));
}
function debuggerOpened(aResult)
{
function debuggerOpened(aResult) {
gDebuggerWin = aResult.panelWin;
gDebuggerController = gDebuggerWin.DebuggerController;
gThread = gDebuggerController.activeThread;
@ -67,8 +68,7 @@ function debuggerOpened(aResult)
);
}
function onExecuteFooAndFoo2()
{
function onExecuteFooAndFoo2() {
let expected = "globalFooBug783499newFoo";
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
"|foo + foo2| is displayed after starting the debugger");
@ -86,8 +86,7 @@ function onExecuteFooAndFoo2()
});
}
function onFramesAdded()
{
function onFramesAdded() {
info("onFramesAdded, openConsole() now");
executeSoon(() =>
openConsole().then(() =>
@ -96,12 +95,17 @@ function onFramesAdded()
);
}
function onExecuteFooAndFoo2InSecondCall()
{
function onExecuteFooAndFoo2InSecondCall() {
let expected = "globalFooBug783499foo2SecondCall";
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
"|foo + foo2| from |secondCall()|");
function runOpenConsole() {
openConsole().then(() => {
gJSTerm.execute("foo + foo2 + foo3").then(onExecuteFoo23InFirstCall);
});
}
executeSoon(() => {
gJSTerm.clearOutput();
@ -111,17 +115,12 @@ function onExecuteFooAndFoo2InSecondCall()
gStackframes.selectFrame(1);
info("openConsole");
executeSoon(() =>
openConsole().then(() =>
gJSTerm.execute("foo + foo2 + foo3").then(onExecuteFoo23InFirstCall)
)
);
executeSoon(() => runOpenConsole());
});
});
}
function onExecuteFoo23InFirstCall()
{
function onExecuteFoo23InFirstCall() {
let expected = "fooFirstCallnewFoofoo3FirstCall";
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
"|foo + foo2 + foo3| from |firstCall()|");
@ -131,15 +130,16 @@ function onExecuteFoo23InFirstCall()
onExecuteFooAndFoo3ChangesInFirstCall));
}
function onExecuteFooAndFoo3ChangesInFirstCall()
{
function onExecuteFooAndFoo3ChangesInFirstCall() {
let expected = "abbabug783499";
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
"|foo + foo3| updated in |firstCall()|");
is(content.wrappedJSObject.foo, "globalFooBug783499", "|foo| in content window");
is(content.wrappedJSObject.foo, "globalFooBug783499",
"|foo| in content window");
is(content.wrappedJSObject.foo2, "newFoo", "|foo2| in content window");
ok(!content.wrappedJSObject.foo3, "|foo3| was not added to the content window");
ok(!content.wrappedJSObject.foo3,
"|foo3| was not added to the content window");
gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController =
gStackframes = null;

View File

@ -3,13 +3,14 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test to make sure that web console commands can fire while paused at a breakpoint
// that was triggered from a JS call. Relies on asynchronous js evaluation over the
// protocol - see Bug 1088861.
// Test to make sure that web console commands can fire while paused at a
// breakpoint that was triggered from a JS call. Relies on asynchronous js
// evaluation over the protocol - see Bug 1088861.
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-eval-in-stackframe.html";
let test = asyncTest(function*() {
yield loadTab(TEST_URI);
@ -18,46 +19,46 @@ let test = asyncTest(function*() {
let {jsterm} = hud;
info("open the debugger");
let {panel,panelWin} = yield openDebugger();
let {panelWin} = yield openDebugger();
let {DebuggerController} = panelWin;
let {activeThread,StackFrames} = DebuggerController;
let {activeThread} = DebuggerController;
let firstCall = promise.defer();
let frameAdded = promise.defer();
executeSoon(() => {
info ("Executing firstCall");
info("Executing firstCall");
activeThread.addOneTimeListener("framesadded", () => {
executeSoon(frameAdded.resolve);
});
jsterm.execute("firstCall()").then(firstCall.resolve);
});
info ("Waiting for a frame to be added");
info("Waiting for a frame to be added");
yield frameAdded.promise;
info ("Executing basic command while paused");
info("Executing basic command while paused");
yield executeAndConfirm(jsterm, "1 + 2", "3");
info ("Executing command using scoped variables while paused");
yield executeAndConfirm(jsterm, "foo + foo2", '"globalFooBug783499foo2SecondCall"');
info("Executing command using scoped variables while paused");
yield executeAndConfirm(jsterm, "foo + foo2",
'"globalFooBug783499foo2SecondCall"');
info ("Resuming the thread");
info("Resuming the thread");
activeThread.resume();
info ("Checking the first command (which is the last to resolve since it paused");
info("Checking the first command, which is the last to resolve since it " +
"paused");
let node = yield firstCall.promise;
is (node.querySelector(".message-body").textContent,
"undefined",
"firstCall() returned correct value");
is(node.querySelector(".message-body").textContent,
"undefined",
"firstCall() returned correct value");
});
function* executeAndConfirm(jsterm, input, output) {
info ("Executing command `"+input+"`");
info("Executing command `" + input + "`");
let node = yield jsterm.execute(input);
is (node.querySelector(".message-body").textContent,
output,
"Expected result from call to " + input);
is(node.querySelector(".message-body").textContent, output,
"Expected result from call to " + input);
}

View File

@ -5,6 +5,8 @@
// Check that the inspect() jsterm helper function works.
"use strict";
const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
let test = asyncTest(function* () {

View File

@ -4,7 +4,10 @@
// Test that very long strings do not hang the browser.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-bug-859170-longstring-hang.html";
let test = asyncTest(function* () {
yield loadTab(TEST_URI);

View File

@ -3,13 +3,15 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
const TEST_URI = "data:text/html;charset=utf8,Test that the netmonitor " +
"displays requests that have been recorded in the " +
"web console, even if the netmonitor hadn't opened yet.";
const TEST_FILE = "test-network-request.html";
const TEST_PATH = "http://example.com/browser/browser/devtools/webconsole/test/" +
TEST_FILE;
const TEST_PATH = "http://example.com/browser/browser/devtools/webconsole/" +
"test/" + TEST_FILE;
const NET_PREF = "devtools.webconsole.filter.networkinfo";
Services.prefs.setBoolPref(NET_PREF, true);
@ -47,7 +49,6 @@ add_task(function* () {
testNetmonitor(toolbox);
});
function loadDocument(browser) {
let deferred = promise.defer();

View File

@ -5,18 +5,22 @@
// Tests that the network panel works with LongStringActors.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-image.png";
const TEST_IMG_BASE64 =
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
"OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
"FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
"FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
"BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
"BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
"A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
"Dr4AAAAASUVORK5CYII=";
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJ" +
"REFUOI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuF" +
"Djq5dxD8FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNU" +
"yhsKAChRBQcPFVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQE" +
"od+Z5sP1FizDxGgyBqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTs" +
"DizDRMPuIOC+zEeTMZo9BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joRE" +
"N2uqnlBmCwW1hIJagtev4f3zA16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOn" +
"idadmwtwsnMu18q83/kHSou+bFNDDr4AAAAASUVORK5CYII=";
let testDriver;
@ -35,7 +39,8 @@ function checkIsVisible(aPanel, aList) {
for (let id in aList) {
let node = aPanel.document.getElementById(id);
let isVisible = aList[id];
is(node.style.display, (isVisible ? "block" : "none"), id + " isVisible=" + isVisible);
is(node.style.display, (isVisible ? "block" : "none"),
id + " isVisible=" + isVisible);
}
}
@ -43,12 +48,11 @@ function checkNodeContent(aPanel, aId, aContent) {
let node = aPanel.document.getElementById(aId);
if (node == null) {
ok(false, "Tried to access node " + aId + " that doesn't exist!");
}
else if (node.textContent.indexOf(aContent) != -1) {
} else if (node.textContent.indexOf(aContent) != -1) {
ok(true, "checking content of " + aId);
}
else {
ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
} else {
ok(false, "Got false value for " + aId + ": " + node.textContent +
" doesn't have " + aContent);
}
}
@ -163,8 +167,7 @@ function* testGen() {
let expectedGrip = headerValueGrip;
function longStringClientProvider(aLongString)
{
function longStringClientProvider(aLongString) {
is(aLongString, expectedGrip,
"longString grip is correct");
@ -241,7 +244,8 @@ function* testGen() {
requestBodyFetchLink: false,
});
checkNodeContent(networkPanel, "requestBodyContent", expectedGrip._fullString);
checkNodeContent(networkPanel, "requestBodyContent",
expectedGrip._fullString);
webConsoleClient.longString = longStringFn;
@ -295,7 +299,8 @@ function* testGen() {
webConsoleClient.longString = longStringFn;
is(clickable.style.display, "none", "#responseBodyFetchLink is not visible");
checkNodeContent(networkPanel, "responseBodyContent", expectedGrip._fullString);
checkNodeContent(networkPanel, "responseBodyContent",
expectedGrip._fullString);
networkPanel.panel.hidePopup();

View File

@ -5,6 +5,8 @@
// Make sure that the Web Console output does not break after we try to call
// console.dir() for objects that are not inspectable.
"use strict";
const TEST_URI = "data:text/html;charset=utf8,test for bug 773466";
let test = asyncTest(function* () {
@ -29,7 +31,7 @@ let test = asyncTest(function* () {
name: "console.dir output",
consoleDir: "[object Object]",
}],
})
});
content.console.log("fooBug773466b");

View File

@ -4,15 +4,18 @@
// Test that long strings can be expanded in the console output.
const TEST_URI = "data:text/html;charset=utf8,test for bug 787981 - check that long strings can be expanded in the output.";
"use strict";
const TEST_URI = "data:text/html;charset=utf8,test for bug 787981 - check " +
"that long strings can be expanded in the output.";
let test = asyncTest(function* () {
let tempScope = {};
Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
let DebuggerServer = tempScope.DebuggerServer;
let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a") +
"foobar";
let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4))
.join("a") + "foobar";
let initialString =
longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
@ -51,7 +54,7 @@ let test = asyncTest(function* () {
});
hud.jsterm.clearOutput(true);
let msg = yield execute(hud, "'" + longString +"'");
let msg = yield execute(hud, "'" + longString + "'");
isnot(msg.textContent.indexOf(initialString), -1,
"initial string is shown");
@ -73,7 +76,7 @@ let test = asyncTest(function* () {
category: CATEGORY_OUTPUT,
longString: false,
}],
})
});
});
function execute(hud, str) {

View File

@ -10,7 +10,8 @@
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-repeated-messages.html";
const PREF = "devtools.webconsole.persistlog";
let test = asyncTest(function* () {
@ -34,7 +35,8 @@ let test = asyncTest(function* () {
});
function consoleOpened(hud) {
// Check that css warnings are not coalesced if they come from different lines.
// Check that css warnings are not coalesced if they come from different
// lines.
info("waiting for 2 css warnings");
return waitForMessages({
@ -90,7 +92,7 @@ function testCSSRepeatsAfterReload(hud) {
repeats: 1,
},
],
})
});
}
function testConsoleRepeats(hud) {

View File

@ -4,7 +4,8 @@
// Make sure that JS eval result are properly formatted as strings.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-result-format-as-string.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-result-format-as-string.html";
let test = asyncTest(function* () {
yield loadTab(TEST_URI);
@ -33,4 +34,4 @@ function execute(hud, str) {
let deferred = promise.defer();
hud.jsterm.execute(str, deferred.resolve);
return deferred.promise;
}
}

View File

@ -3,8 +3,12 @@
* 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/. */
const TEST_REPLACED_API_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-replaced-api.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/testscript.js";
"use strict";
const TEST_REPLACED_API_URI = "http://example.com/browser/browser/devtools/" +
"webconsole/test/test-console-replaced-api.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/testscript.js";
const PREF = "devtools.webconsole.persistlog";
let test = asyncTest(function* () {
@ -26,8 +30,7 @@ let test = asyncTest(function* () {
Services.prefs.clearUserPref(PREF);
});
function testWarningNotPresent(hud)
{
function testWarningNotPresent(hud) {
let deferred = promise.defer();
is(hud.outputNode.textContent.indexOf("logging API"), -1,
@ -52,8 +55,7 @@ function testWarningNotPresent(hud)
return deferred.promise;
}
function testWarningPresent(hud)
{
function testWarningPresent(hud) {
info("wait for the warning to show");
let deferred = promise.defer();
@ -78,4 +80,3 @@ function testWarningPresent(hud)
return deferred.promise;
}

View File

@ -4,6 +4,8 @@
// Tests that source URLs are abbreviated properly for display on the right-
// hand side of the Web Console.
"use strict";
function test() {
testAbbreviation("http://example.com/x.js", "x.js");
testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js");

View File

@ -9,8 +9,10 @@
// Bug 875456 - Log mixed content messages from the Mixed Content
// Blocker to the Security Pane in the Web Console
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-mixedcontent-securityerrors.html";
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/MixedContent";
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
"test/test-mixedcontent-securityerrors.html";
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
"MixedContent";
let test = asyncTest(function* () {
yield pushPrefEnv();
@ -24,14 +26,17 @@ let test = asyncTest(function* () {
messages: [
{
name: "Logged mixed active content",
text: "Loading mixed (insecure) active content \"http://example.com/\" on a secure page",
text: "Loading mixed (insecure) active content " +
"\"http://example.com/\" on a secure page",
category: CATEGORY_SECURITY,
severity: SEVERITY_WARNING,
objects: true,
},
{
name: "Logged mixed passive content - image",
text: "Loading mixed (insecure) display content \"http://example.com/tests/image/test/mochitest/blue.png\" on a secure page",
text: "Loading mixed (insecure) display content " +
"\"http://example.com/tests/image/test/mochitest/blue.png\" " +
"on a secure page",
category: CATEGORY_SECURITY,
severity: SEVERITY_WARNING,
objects: true,
@ -42,8 +47,7 @@ let test = asyncTest(function* () {
yield testClickOpenNewTab(hud, results);
});
function pushPrefEnv()
{
function pushPrefEnv() {
let deferred = promise.defer();
let options = {"set":
[["security.mixed_content.block_active_content", false],

View File

@ -5,7 +5,10 @@
// Test that console.assert() works as expected (i.e. outputs only on falsy
// asserts). See bug 760193.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-assert.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console-assert.html";
let test = asyncTest(function* () {
yield loadTab(TEST_URI);
@ -46,6 +49,7 @@ function consoleOpened(hud) {
}],
}).then(() => {
let nodes = hud.outputNode.querySelectorAll(".message");
is(nodes.length, 6, "only six messages are displayed, no output from the true assert");
is(nodes.length, 6,
"only six messages are displayed, no output from the true assert");
});
}

View File

@ -9,9 +9,9 @@
// Test that properties starting with underscores or dollars can be
// autocompleted (bug 967468).
let test = asyncTest(function*() {
const TEST_URI = "data:text/html;charset=utf8,test autocompletion with $ or _";
const TEST_URI = "data:text/html;charset=utf8,test autocompletion with " +
"$ or _";
yield loadTab(TEST_URI);
function* autocomplete(term) {

View File

@ -2,6 +2,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615";
XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
@ -55,34 +57,33 @@ function consoleOpened(HUD) {
goDoCommand("cmd_paste");
}
// Self xss prevention tests (bug 994134)
function testSelfXss(){
info("Self-xss paste tests")
function testSelfXss() {
info("Self-xss paste tests");
WebConsoleUtils.usageCount = 0;
is(WebConsoleUtils.usageCount, 0, "Test for usage count getter")
is(WebConsoleUtils.usageCount, 0, "Test for usage count getter");
// Input some commands to check if usage counting is working
for(let i = 0; i <= 3; i++){
for (let i = 0; i <= 3; i++) {
jsterm.setInputValue(i);
jsterm.execute();
}
is(WebConsoleUtils.usageCount, 4, "Usage count incremented")
is(WebConsoleUtils.usageCount, 4, "Usage count incremented");
WebConsoleUtils.usageCount = 0;
updateEditUIVisibility();
let oldVal = jsterm.inputNode.value;
goDoCommand("cmd_paste");
let notificationbox = jsterm.hud.document.getElementById("webconsole-notificationbox");
let notification = notificationbox.getNotificationWithValue('selfxss-notification');
let notification = notificationbox.getNotificationWithValue("selfxss-notification");
ok(notification, "Self-xss notification shown");
is(oldVal, jsterm.inputNode.value, "Paste blocked by self-xss prevention");
// Allow pasting
jsterm.inputNode.value = "allow pasting";
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent ("keyup", true, true, window,
0, 0, 0, 0,
0, " ".charCodeAt(0));
let evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keyup", true, true, window,
0, 0, 0, 0,
0, " ".charCodeAt(0));
jsterm.inputNode.dispatchEvent(evt);
jsterm.inputNode.value = "";
goDoCommand("cmd_paste");
@ -106,7 +107,8 @@ function consoleOpened(HUD) {
info("wait for completion update after clipboard paste (ctrl-v)");
jsterm.once("autocomplete-updated", () => {
ok(!jsterm.completeNode.value, "no completion value after paste (ctrl-v)");
ok(!jsterm.completeNode.value,
"no completion value after paste (ctrl-v)");
// using executeSoon() to get out of the webconsole event loop.
executeSoon(deferred.resolve);

View File

@ -4,16 +4,19 @@
// Test that autocomplete doesn't break when trying to reach into objects from
// a different domain, bug 989025.
"use strict";
function test() {
let hud;
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-989025-iframe-parent.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-bug-989025-iframe-parent.html";
Task.spawn(function*() {
const {tab} = yield loadTab(TEST_URI);
hud = yield openConsole(tab);
hud.jsterm.execute('document.title');
hud.jsterm.execute("document.title");
yield waitForMessages({
webconsole: hud,

View File

@ -3,15 +3,17 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test that makes sure web console autocomplete happens in the user-selected stackframe
// from the js debugger.
// Test that makes sure web console autocomplete happens in the user-selected
// stackframe from the js debugger.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-autocomplete-in-stackframe.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-autocomplete-in-stackframe.html";
let testDriver, gStackframes;
function test()
{
function test() {
requestLongerTimeout(2);
loadTab(TEST_URI).then(() => {
openConsole().then((hud) => {
@ -191,7 +193,8 @@ function* testCompletion(hud) {
return item.label != "prop11";
}), "autocomplete results do contain prop11");
// Test if 'foo2Obj.prop1.prop11.' gives suggestions for a string i.e. 'length'
// Test if 'foo2Obj.prop1.prop11.' gives suggestions for a string
// i.e. 'length'
input.value = "foo2Obj.prop1.prop11.";
input.setSelectionRange(21, 21);
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
@ -216,8 +219,7 @@ function* testCompletion(hud) {
yield undefined;
}
function debuggerOpened(aResult)
{
function debuggerOpened(aResult) {
let debuggerWin = aResult.panelWin;
let debuggerController = debuggerWin.DebuggerController;
let thread = debuggerController.activeThread;
@ -230,8 +232,7 @@ function debuggerOpened(aResult)
});
}
function onFramesAdded()
{
function onFramesAdded() {
info("onFramesAdded, openConsole() now");
executeSoon(() => openConsole().then(testNext));
}

View File

@ -5,7 +5,10 @@
// Test that the autocomplete popup closes on switching tabs. See bug 900448.
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 900448 - autocomplete popup closes on tab switch";
"use strict";
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 900448 - autocomplete " +
"popup closes on tab switch";
let test = asyncTest(function*() {
yield loadTab(TEST_URI);
@ -26,7 +29,8 @@ function onPopupShown(panel) {
panel.addEventListener("popupshown", function popupOpened() {
panel.removeEventListener("popupshown", popupOpened, false);
loadTab("data:text/html;charset=utf-8,<p>testing autocomplete closes").then(finished.resolve);
loadTab("data:text/html;charset=utf-8,<p>testing autocomplete closes")
.then(finished.resolve);
}, false);
return finished.promise;

View File

@ -8,10 +8,13 @@
"use strict";
const TEST_NETWORK_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html" + "?_date=" + Date.now();
const TEST_NETWORK_URI = "http://example.com/browser/browser/devtools/" +
"webconsole/test/test-network.html" + "?_date=" +
Date.now();
let test = asyncTest(function* () {
yield loadTab("data:text/html;charset=utf-8,Web Console basic network logging test");
yield loadTab("data:text/html;charset=utf-8,Web Console basic network " +
"logging test");
let hud = yield openConsole();
content.location = TEST_NETWORK_URI;

View File

@ -12,9 +12,12 @@
// Bug 875456 - Log mixed content messages from the Mixed Content
// Blocker to the Security Pane in the Web Console
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-mixedcontent-securityerrors.html";
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/MixedContent";
"use strict";
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
"test/test-mixedcontent-securityerrors.html";
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
"MixedContent";
let test = asyncTest(function* () {
yield pushPrefEnv();
@ -50,31 +53,30 @@ let test = asyncTest(function* () {
yield testClickOpenNewTab(hud, results2[0]);
});
function pushPrefEnv()
{
function pushPrefEnv() {
let deferred = promise.defer();
let options = {"set": [["security.mixed_content.block_active_content", true],
["security.mixed_content.block_display_content", true]]};
let options = {"set": [
["security.mixed_content.block_active_content", true],
["security.mixed_content.block_display_content", true]
]};
SpecialPowers.pushPrefEnv(options, deferred.resolve);
return deferred.promise;
}
function waitForNotificationShown(notification, callback)
{
function waitForNotificationShown(notification, callback) {
if (PopupNotifications.panel.state == "open") {
executeSoon(callback);
return;
}
PopupNotifications.panel.addEventListener("popupshown", function onShown(e) {
PopupNotifications.panel.addEventListener("popupshown", function onShown() {
PopupNotifications.panel.removeEventListener("popupshown", onShown);
callback();
}, false);
notification.reshow();
}
function mixedContentOverrideTest2(hud, browser)
{
var notification = PopupNotifications.getNotification("bad-content", browser);
function mixedContentOverrideTest2(hud, browser) {
let notification = PopupNotifications.getNotification("bad-content", browser);
ok(notification, "Mixed Content Doorhanger did appear");
let deferred = promise.defer();
waitForNotificationShown(notification, () => {
@ -83,9 +85,9 @@ function mixedContentOverrideTest2(hud, browser)
return deferred.promise;
}
function afterNotificationShown(hud, notification, deferred)
{
ok(PopupNotifications.panel.firstChild.isMixedContentBlocked, "OK: Mixed Content is being blocked");
function afterNotificationShown(hud, notification, deferred) {
ok(PopupNotifications.panel.firstChild.isMixedContentBlocked,
"OK: Mixed Content is being blocked");
// Click on the doorhanger.
PopupNotifications.panel.firstChild.disableMixedContentProtection();
notification.remove();
@ -95,8 +97,8 @@ function afterNotificationShown(hud, notification, deferred)
messages: [
{
name: "Logged blocking mixed active content",
text: "Loading mixed (insecure) active content \"http://example.com/\"" +
" on a secure page",
text: "Loading mixed (insecure) active content " +
"\"http://example.com/\" on a secure page",
category: CATEGORY_SECURITY,
severity: SEVERITY_WARNING,
objects: true,

View File

@ -8,9 +8,9 @@ function test() {
Task.spawn(runner).then(finishTest);
function* runner() {
const {tab} = yield loadTab("data:text/html;charset=utf8,<title>Test for Bug 1006027");
const {tab} = yield loadTab("data:text/html;charset=utf8,<title>Test for " +
"Bug 1006027");
const target = TargetFactory.forTab(tab);
const hud = yield openConsole(tab);
hud.jsterm.execute("console.log('bug1006027')");
@ -25,17 +25,20 @@ function test() {
}],
});
info('hud.outputNode.textContent:\n'+hud.outputNode.textContent);
let timestampNodes = hud.outputNode.querySelectorAll('span.timestamp');
info("hud.outputNode.textContent:\n" + hud.outputNode.textContent);
let timestampNodes = hud.outputNode.querySelectorAll("span.timestamp");
let aTimestampMilliseconds = Array.prototype.map.call(timestampNodes,
function (value) {
// We are parsing timestamps as local time, relative to the begin of the epoch.
// This is not the correct value of the timestamp, but good enough for comparison.
return Date.parse('T'+String.trim(value.textContent));
function(value) {
// We are parsing timestamps as local time, relative to the begin of
// the epoch.
// This is not the correct value of the timestamp, but good enough for
// comparison.
return Date.parse("T" + String.trim(value.textContent));
});
let minTimestamp = Math.min.apply(null, aTimestampMilliseconds);
let maxTimestamp = Math.max.apply(null, aTimestampMilliseconds);
ok(Math.abs(maxTimestamp - minTimestamp) < 1000, "console.log message timestamp spread < 1000ms confirmed");
ok(Math.abs(maxTimestamp - minTimestamp) < 1000,
"console.log message timestamp spread < 1000ms confirmed");
}
}

View File

@ -11,15 +11,25 @@ an image which is allowed by the CSPRO header but not by the CSP header.
So we expect a warning (image has been blocked) and a report
(script should not load and was reported)
The expected console messages in the constants CSP_VIOLATION_MSG and CSP_REPORT_MSG are confirmed to be found in the console messages.
The expected console messages in the constants CSP_VIOLATION_MSG and
CSP_REPORT_MSG are confirmed to be found in the console messages.
*/
"use strict";
const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only test (bug 1010953)";
const TEST_VIOLATION = "http://example.com/browser/browser/devtools/webconsole/test/test_bug_1010953_cspro.html";
const CSP_VIOLATION_MSG = 'Content Security Policy: The page\'s settings blocked the loading of a resource at http://some.example.com/test.png ("img-src http://example.com").';
const CSP_REPORT_MSG = 'Content Security Policy: The page\'s settings observed the loading of a resource at http://some.example.com/test_bug_1010953_cspro.js ("script-src http://example.com"). A CSP report is being sent.';
const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only " +
"test (bug 1010953)";
const TEST_VIOLATION = "http://example.com/browser/browser/devtools/" +
"webconsole/test/test_bug_1010953_cspro.html";
const CSP_VIOLATION_MSG = "Content Security Policy: The page's settings " +
"blocked the loading of a resource at " +
"http://some.example.com/test.png " +
"(\"img-src http://example.com\").";
const CSP_REPORT_MSG = "Content Security Policy: The page\'s settings " +
"observed the loading of a resource at " +
"http://some.example.com/test_bug_1010953_cspro.js " +
"(\"script-src http://example.com\"). A CSP report is " +
"being sent.";
let test = asyncTest(function* () {
let { browser } = yield loadTab(TEST_URI);
@ -32,10 +42,9 @@ let test = asyncTest(function* () {
content.location = TEST_VIOLATION;
yield loaded;
let aOutputNode = hud.outputNode;
yield waitForSuccess({
name: "Confirmed that CSP and CSP-Report-Only log different messages to the console.",
name: "Confirmed that CSP and CSP-Report-Only log different messages to " +
"the console.",
validator: function() {
console.log(hud.outputNode.textContent);
let success = false;

View File

@ -7,7 +7,8 @@
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug_1050691_click_function_to_source.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-bug_1050691_click_function_to_source.html";
let test = asyncTest(function*() {
yield loadTab(TEST_URI);

View File

@ -4,7 +4,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Tests that the console object still exists after a page reload.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
let browser;
@ -21,7 +25,6 @@ function test() {
}
function testPageReload() {
browser.removeEventListener("DOMContentLoaded", testPageReload, false);
let console = browser.contentWindow.wrappedJSObject.console;
@ -36,4 +39,3 @@ function testPageReload() {
browser = null;
finishTest();
}

View File

@ -7,7 +7,8 @@
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
let test = asyncTest(function*() {
yield loadTab(TEST_URI);

View File

@ -6,8 +6,8 @@
// Tests to ensure that errors don't appear when the console is closed while a
// completion is being performed.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
let test = asyncTest(function* () {
let { browser } = yield loadTab(TEST_URI);
@ -22,7 +22,7 @@ function testClosingAfterCompletion(hud, browser) {
let inputNode = hud.jsterm.inputNode;
let errorWhileClosing = false;
function errorListener(evt) {
function errorListener() {
errorWhileClosing = true;
}

View File

@ -7,7 +7,10 @@
// See bug 580030: the error handler fails silently after page reload.
// https://bugzilla.mozilla.org/show_bug.cgi?id=580030
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-error.html";
function test() {
Task.spawn(function*() {

View File

@ -12,13 +12,14 @@
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
let test = asyncTest(function*() {
yield loadTab(TEST_URI);
const TEST_TIMESTAMP = 12345678;
let date = new Date(TEST_TIMESTAMP);
let localizedString = WCU_l10n.timestampString(TEST_TIMESTAMP);
let localizedString = WCUL10n.timestampString(TEST_TIMESTAMP);
isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
"timestamp contains the hours");
isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +

View File

@ -9,7 +9,8 @@
"use strict";
const INIT_URI = "data:text/html;charset=utf8,hello world";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-duplicate-error.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-duplicate-error.html";
let test = asyncTest(function* () {
yield loadTab(INIT_URI);

View File

@ -3,7 +3,10 @@
* 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/. */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/browser/test-console.html";
let test = asyncTest(function* () {
yield loadTab(TEST_URI);
@ -13,19 +16,20 @@ let test = asyncTest(function* () {
});
function testCompletion(hud) {
var jsterm = hud.jsterm;
var input = jsterm.inputNode;
let jsterm = hud.jsterm;
let input = jsterm.inputNode;
jsterm.setInputValue("");
EventUtils.synthesizeKey("VK_TAB", {});
is(jsterm.completeNode.value, "<- no result", "<- no result - matched");
is(input.value, "", "inputnode is empty - matched")
is(input.value, "", "inputnode is empty - matched");
is(input.getAttribute("focused"), "true", "input is still focused");
//Any thing which is not in property autocompleter
// Any thing which is not in property autocompleter
jsterm.setInputValue("window.Bug583816");
EventUtils.synthesizeKey("VK_TAB", {});
is(jsterm.completeNode.value, " <- no result", "completenode content - matched");
is(jsterm.completeNode.value, " <- no result",
"completenode content - matched");
is(input.value, "window.Bug583816", "inputnode content - matched");
is(input.getAttribute("focused"), "true", "input is still focused");
}

View File

@ -12,6 +12,8 @@
// Tests that the Web Console limits the number of lines displayed according to
// the user's preferences.
"use strict";
const TEST_URI = "data:text/html;charset=utf8,test for bug 585237";
let outputNode;

View File

@ -5,19 +5,25 @@
// Tests that the network panel works.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
const TEST_ENCODING_ISO_8859_1 = "http://example.com/browser/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html";
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-console.html";
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/" +
"test/test-image.png";
const TEST_ENCODING_ISO_8859_1 = "http://example.com/browser/browser/" +
"devtools/webconsole/test/" +
"test-encoding-ISO-8859-1.html";
const TEST_IMG_BASE64 =
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
"OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
"FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
"FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
"BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
"BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
"A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
"Dr4AAAAASUVORK5CYII=";
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJ" +
"REFUOI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuF" +
"Djq5dxD8FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNU" +
"yhsKAChRBQcPFVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQE" +
"od+Z5sP1FizDxGgyBqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTs" +
"DizDRMPuIOC+zEeTMZo9BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joRE" +
"N2uqnlBmCwW1hIJagtev4f3zA16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOn" +
"idadmwtwsnMu18q83/kHSou+bFNDDr4AAAAASUVORK5CYII=";
let testDriver, hud;
@ -37,7 +43,8 @@ function checkIsVisible(aPanel, aList) {
for (let id in aList) {
let node = aPanel.document.getElementById(id);
let isVisible = aList[id];
is(node.style.display, (isVisible ? "block" : "none"), id + " isVisible=" + isVisible);
is(node.style.display, (isVisible ? "block" : "none"),
id + " isVisible=" + isVisible);
}
}
@ -45,12 +52,11 @@ function checkNodeContent(aPanel, aId, aContent) {
let node = aPanel.document.getElementById(aId);
if (node == null) {
ok(false, "Tried to access node " + aId + " that doesn't exist!");
}
else if (node.textContent.indexOf(aContent) != -1) {
} else if (node.textContent.indexOf(aContent) != -1) {
ok(true, "checking content of " + aId);
}
else {
ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
} else {
ok(false, "Got false value for " + aId + ": " + node.textContent +
" doesn't have " + aContent);
}
}
@ -168,7 +174,8 @@ function* testGen() {
});
checkNodeContent(networkPanel, "header", "HTTP/3.14 999 earthquake win");
checkNodeKeyValue(networkPanel, "responseHeadersContent", "leaveHouses", "true");
checkNodeKeyValue(networkPanel, "responseHeadersContent", "leaveHouses",
"true");
checkNodeContent(networkPanel, "responseHeadersInfo", "10ms");
info("test 4");
@ -399,7 +406,8 @@ function* testGen() {
// Test no space after Content-Type:
info("test 10: no space after Content-Type header in post data");
httpActivity.request.postData.text = "Content-Type:application/x-www-form-urlencoded\n";
httpActivity.request.postData.text = "Content-Type:application/x-www-" +
"form-urlencoded\n";
networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
networkPanel._onUpdate = function() {
@ -490,9 +498,11 @@ function* testGen() {
});
let responseString =
WCU_l10n.getFormatStr("NetworkPanel.responseBodyUnableToDisplay.content",
WCUL10n.getFormatStr("NetworkPanel.responseBodyUnableToDisplay.content",
["application/x-shockwave-flash"]);
checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString);
checkNodeContent(networkPanel,
"responseBodyUnknownTypeContent",
responseString);
networkPanel.panel.hidePopup();
/*

File diff suppressed because it is too large Load Diff