mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 1177517 - ESLint cleanup for tests. r=pbro
This commit is contained in:
parent
1fb5714724
commit
6757ce5962
@ -18,8 +18,8 @@ function test() {
|
|||||||
HUDService.toggleBrowserConsole().then(browserConsoleOpened);
|
HUDService.toggleBrowserConsole().then(browserConsoleOpened);
|
||||||
});
|
});
|
||||||
|
|
||||||
function browserConsoleOpened(aHud) {
|
function browserConsoleOpened(hudConsole) {
|
||||||
hud = aHud;
|
hud = hudConsole;
|
||||||
ok(hud, "browser console opened");
|
ok(hud, "browser console opened");
|
||||||
|
|
||||||
let button = content.document.querySelector("button");
|
let button = content.document.querySelector("button");
|
||||||
|
@ -48,7 +48,8 @@ let test = asyncTest(function* () {
|
|||||||
'["0","1","2","3","4","5","6","7","8","9"]',
|
'["0","1","2","3","4","5","6","7","8","9"]',
|
||||||
"Third tab has populated history");
|
"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.setInputValue('"hello from third tab"');
|
||||||
hud3.jsterm.execute();
|
hud3.jsterm.execute();
|
||||||
|
|
||||||
@ -72,12 +73,12 @@ let test = asyncTest(function* () {
|
|||||||
"Fourth tab has most recent history");
|
"Fourth tab has most recent history");
|
||||||
|
|
||||||
yield hud4.jsterm.clearHistory();
|
yield hud4.jsterm.clearHistory();
|
||||||
is(JSON.stringify(hud4.jsterm.history), '[]',
|
is(JSON.stringify(hud4.jsterm.history), "[]",
|
||||||
"Clearing history for a tab works");
|
"Clearing history for a tab works");
|
||||||
|
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
let hud5 = yield openConsole();
|
let hud5 = yield openConsole();
|
||||||
is(JSON.stringify(hud5.jsterm.history), '[]',
|
is(JSON.stringify(hud5.jsterm.history), "[]",
|
||||||
"Clearing history carries over to a new tab");
|
"Clearing history carries over to a new tab");
|
||||||
|
|
||||||
info("Clearing custom input history pref");
|
info("Clearing custom input history pref");
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
// Check that cached messages from nested iframes are displayed in the
|
// Check that cached messages from nested iframes are displayed in the
|
||||||
// Web/Browser Console.
|
// 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 = [
|
const expectedMessages = [
|
||||||
{
|
{
|
||||||
@ -52,16 +55,14 @@ const expectedMessagesAny = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
expectUncaughtException();
|
expectUncaughtException();
|
||||||
loadTab(TEST_URI).then(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then(consoleOpened);
|
openConsole().then(consoleOpened);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(hud)
|
function consoleOpened(hud) {
|
||||||
{
|
|
||||||
ok(hud, "web console opened");
|
ok(hud, "web console opened");
|
||||||
|
|
||||||
waitForMessages({
|
waitForMessages({
|
||||||
@ -79,14 +80,12 @@ function consoleOpened(hud)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWebConsoleClose()
|
function onWebConsoleClose() {
|
||||||
{
|
|
||||||
info("web console closed");
|
info("web console closed");
|
||||||
HUDService.toggleBrowserConsole().then(onBrowserConsoleOpen);
|
HUDService.toggleBrowserConsole().then(onBrowserConsoleOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBrowserConsoleOpen(hud)
|
function onBrowserConsoleOpen(hud) {
|
||||||
{
|
|
||||||
ok(hud, "browser console opened");
|
ok(hud, "browser console opened");
|
||||||
waitForMessages({
|
waitForMessages({
|
||||||
webconsole: hud,
|
webconsole: hud,
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let test = asyncTest(function*() {
|
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);
|
yield loadTab(TEST_URI);
|
||||||
|
|
||||||
@ -33,11 +34,13 @@ let test = asyncTest(function*() {
|
|||||||
let bottom = currentPosition;
|
let bottom = currentPosition;
|
||||||
|
|
||||||
EventUtils.synthesizeKey("VK_PAGE_UP", {});
|
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;
|
currentPosition = hud.outputNode.parentNode.scrollTop;
|
||||||
EventUtils.synthesizeKey("VK_PAGE_DOWN", {});
|
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", {});
|
EventUtils.synthesizeKey("VK_HOME", {});
|
||||||
is(hud.outputNode.parentNode.scrollTop, 0, "scroll position now at top");
|
is(hud.outputNode.parentNode.scrollTop, 0, "scroll position now at top");
|
||||||
@ -49,7 +52,9 @@ let test = asyncTest(function*() {
|
|||||||
"scroll position now at bottom");
|
"scroll position now at bottom");
|
||||||
|
|
||||||
info("try ctrl-l to clear output");
|
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");
|
yield hud.jsterm.once("messages-cleared");
|
||||||
|
|
||||||
is(hud.outputNode.textContent.indexOf("foobarz1"), -1, "output 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");
|
ok(!hud.ui.getFilterState("network"), "accesskey for Network works");
|
||||||
EventUtils.synthesizeKey("t", { ctrlKey: true });
|
EventUtils.synthesizeKey("t", { ctrlKey: true });
|
||||||
ok(hud.ui.getFilterState("network"), "accesskey for Network works (again)");
|
ok(hud.ui.getFilterState("network"), "accesskey for Network works (again)");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
EventUtils.synthesizeKey("N", { altKey: true });
|
EventUtils.synthesizeKey("N", { altKey: true });
|
||||||
let net = hud.ui.document.querySelector("toolbarbutton[category=net]");
|
let net = hud.ui.document.querySelector("toolbarbutton[category=net]");
|
||||||
is(hud.ui.document.activeElement, net,
|
is(hud.ui.document.activeElement, net,
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let test = asyncTest(function*() {
|
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();
|
let hud = yield openConsole();
|
||||||
hud.jsterm.clearOutput(true);
|
hud.jsterm.clearOutput(true);
|
||||||
|
@ -5,8 +5,11 @@
|
|||||||
|
|
||||||
// Check that the navigation marker shows on page reload - bug 793996.
|
// Check that the navigation marker shows on page reload - bug 793996.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const PREF = "devtools.webconsole.persistlog";
|
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;
|
let hud;
|
||||||
|
|
||||||
@ -32,8 +35,7 @@ let test = asyncTest(function* () {
|
|||||||
hud = null;
|
hud = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
function consoleOpened()
|
function consoleOpened() {
|
||||||
{
|
|
||||||
ok(hud, "Web Console opened");
|
ok(hud, "Web Console opened");
|
||||||
|
|
||||||
hud.jsterm.clearOutput();
|
hud.jsterm.clearOutput();
|
||||||
@ -48,8 +50,7 @@ function consoleOpened()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onReload()
|
function onReload() {
|
||||||
{
|
|
||||||
content.console.log("foobarz2");
|
content.console.log("foobarz2");
|
||||||
|
|
||||||
return waitForMessages({
|
return waitForMessages({
|
||||||
@ -72,4 +73,3 @@ function onReload()
|
|||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,12 @@
|
|||||||
// Check that nsIConsoleMessages are displayed in the Browser Console.
|
// Check that nsIConsoleMessages are displayed in the Browser Console.
|
||||||
// See bug 859756.
|
// See bug 859756.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,<title>bug859756</title>\n" +
|
const TEST_URI = "data:text/html;charset=utf8,<title>bug859756</title>\n" +
|
||||||
"<p>hello world\n<p>nsIConsoleMessages ftw!";
|
"<p>hello world\n<p>nsIConsoleMessages ftw!";
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
const FILTER_PREF = "devtools.browserconsole.filter.jslog";
|
const FILTER_PREF = "devtools.browserconsole.filter.jslog";
|
||||||
Services.prefs.setBoolPref(FILTER_PREF, true);
|
Services.prefs.setBoolPref(FILTER_PREF, true);
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ function test()
|
|||||||
|
|
||||||
let msg = [...results[2].matched][0];
|
let msg = [...results[2].matched][0];
|
||||||
ok(msg, "message element for do-not-show-me (nsIConsoleMessage)");
|
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");
|
ok(!msg.classList.contains("filtered-by-type"), "element is not filtered");
|
||||||
|
|
||||||
hud.setFilterState("jslog", false);
|
hud.setFilterState("jslog", false);
|
||||||
|
@ -6,12 +6,9 @@
|
|||||||
// Test that the "browser console" menu item opens or focuses (if already open)
|
// Test that the "browser console" menu item opens or focuses (if already open)
|
||||||
// the console window instead of toggling it open/close.
|
// the console window instead of toggling it open/close.
|
||||||
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
|
||||||
.getService(Components.interfaces.nsIWindowMediator);
|
|
||||||
let currWindow, hud, mainWindow;
|
let currWindow, hud, mainWindow;
|
||||||
|
|
||||||
mainWindow = Services.wm.getMostRecentWindow(null);
|
mainWindow = Services.wm.getMostRecentWindow(null);
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
// Check that inspecting an optimized out variable works when execution is
|
// Check that inspecting an optimized out variable works when execution is
|
||||||
// paused.
|
// paused.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
Task.spawn(function* () {
|
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 {tab} = yield loadTab(TEST_URI);
|
||||||
let hud = yield openConsole(tab);
|
let hud = yield openConsole(tab);
|
||||||
let { toolbox, panel, panelWin } = yield openDebugger();
|
let { toolbox, panel, panelWin } = yield openDebugger();
|
||||||
@ -25,7 +28,7 @@ function test() {
|
|||||||
// this function to return first.
|
// this function to return first.
|
||||||
executeSoon(() => button.click());
|
executeSoon(() => button.click());
|
||||||
|
|
||||||
let packet = yield fetchedScopes;
|
yield fetchedScopes;
|
||||||
ok(true, "Scopes were fetched");
|
ok(true, "Scopes were fetched");
|
||||||
|
|
||||||
yield toolbox.selectTool("webconsole");
|
yield toolbox.selectTool("webconsole");
|
||||||
@ -56,25 +59,25 @@ function ensureThreadClientState(aPanel, aState) {
|
|||||||
|
|
||||||
if (state == aState) {
|
if (state == aState) {
|
||||||
return promise.resolve(null);
|
return promise.resolve(null);
|
||||||
} else {
|
|
||||||
return waitForThreadEvents(aPanel, aState);
|
|
||||||
}
|
}
|
||||||
|
return waitForThreadEvents(aPanel, aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForThreadEvents(aPanel, aEventName, aEventRepeat = 1) {
|
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 deferred = promise.defer();
|
||||||
let thread = aPanel.panelWin.gThreadClient;
|
let thread = aPanel.panelWin.gThreadClient;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
thread.addListener(aEventName, function onEvent(aEventName, ...aArgs) {
|
thread.addListener(aEventName, function onEvent(eventName, ...args) {
|
||||||
info("Thread event '" + aEventName + "' fired: " + (++count) + " time(s).");
|
info("Thread event '" + eventName + "' fired: " + (++count) + " time(s).");
|
||||||
|
|
||||||
if (count == aEventRepeat) {
|
if (count == aEventRepeat) {
|
||||||
ok(true, "Enough '" + aEventName + "' thread events have been fired.");
|
ok(true, "Enough '" + eventName + "' thread events have been fired.");
|
||||||
thread.removeListener(aEventName, onEvent);
|
thread.removeListener(eventName, onEvent);
|
||||||
deferred.resolve.apply(deferred, aArgs);
|
deferred.resolve.apply(deferred, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
// Bug 874061: test for how the browser and web consoles display messages coming
|
// Bug 874061: test for how the browser and web consoles display messages coming
|
||||||
// from private windows. See bug for description of expected behavior.
|
// 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" +
|
const TEST_URI = "data:text/html;charset=utf8,<p>hello world! bug 874061" +
|
||||||
"<button onclick='console.log(\"foobar bug 874061\");" +
|
"<button onclick='console.log(\"foobar bug 874061\");" +
|
||||||
"fooBazBaz.yummy()'>click</button>";
|
"fooBazBaz.yummy()'>click</button>";
|
||||||
@ -22,15 +23,13 @@ function test()
|
|||||||
requestLongerTimeout(2);
|
requestLongerTimeout(2);
|
||||||
start();
|
start();
|
||||||
|
|
||||||
function start()
|
function start() {
|
||||||
{
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab("data:text/html;charset=utf8," +
|
gBrowser.selectedTab = gBrowser.addTab("data:text/html;charset=utf8," +
|
||||||
"<p>hello world! I am not private!");
|
"<p>hello world! I am not private!");
|
||||||
gBrowser.selectedBrowser.addEventListener("load", onLoadTab, true);
|
gBrowser.selectedBrowser.addEventListener("load", onLoadTab, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadTab()
|
function onLoadTab() {
|
||||||
{
|
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", onLoadTab, true);
|
gBrowser.selectedBrowser.removeEventListener("load", onLoadTab, true);
|
||||||
info("onLoadTab()");
|
info("onLoadTab()");
|
||||||
|
|
||||||
@ -55,8 +54,7 @@ function test()
|
|||||||
whenDelayedStartupFinished(privateWindow, onPrivateWindowReady);
|
whenDelayedStartupFinished(privateWindow, onPrivateWindowReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPrivateWindowReady()
|
function onPrivateWindowReady() {
|
||||||
{
|
|
||||||
info("private browser window opened");
|
info("private browser window opened");
|
||||||
privateBrowser = privateWindow.gBrowser;
|
privateBrowser = privateWindow.gBrowser;
|
||||||
|
|
||||||
@ -65,20 +63,19 @@ function test()
|
|||||||
info("private tab opened");
|
info("private tab opened");
|
||||||
privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
||||||
privateContent = privateBrowser.selectedBrowser.contentWindow;
|
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);
|
openConsole(privateTab).then(consoleOpened);
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMessages()
|
function addMessages() {
|
||||||
{
|
|
||||||
let button = privateContent.document.querySelector("button");
|
let button = privateContent.document.querySelector("button");
|
||||||
ok(button, "button in page");
|
ok(button, "button in page");
|
||||||
EventUtils.synthesizeMouse(button, 2, 2, {}, privateContent);
|
EventUtils.synthesizeMouse(button, 2, 2, {}, privateContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(aHud)
|
function consoleOpened(aHud) {
|
||||||
{
|
|
||||||
hud = aHud;
|
hud = aHud;
|
||||||
ok(hud, "web console opened");
|
ok(hud, "web console opened");
|
||||||
|
|
||||||
@ -106,8 +103,7 @@ function test()
|
|||||||
}).then(testCachedMessages);
|
}).then(testCachedMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCachedMessages()
|
function testCachedMessages() {
|
||||||
{
|
|
||||||
info("testCachedMessages()");
|
info("testCachedMessages()");
|
||||||
closeConsole(privateTab).then(() => {
|
closeConsole(privateTab).then(() => {
|
||||||
info("web console closed");
|
info("web console closed");
|
||||||
@ -115,8 +111,7 @@ function test()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleReopened(aHud)
|
function consoleReopened(aHud) {
|
||||||
{
|
|
||||||
hud = aHud;
|
hud = aHud;
|
||||||
ok(hud, "web console reopened");
|
ok(hud, "web console reopened");
|
||||||
|
|
||||||
@ -128,8 +123,7 @@ function test()
|
|||||||
}).then(testBrowserConsole);
|
}).then(testBrowserConsole);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrowserConsole()
|
function testBrowserConsole() {
|
||||||
{
|
|
||||||
info("testBrowserConsole()");
|
info("testBrowserConsole()");
|
||||||
closeConsole(privateTab).then(() => {
|
closeConsole(privateTab).then(() => {
|
||||||
info("web console closed");
|
info("web console closed");
|
||||||
@ -139,15 +133,13 @@ function test()
|
|||||||
|
|
||||||
// Make sure that the cached messages from private tabs are not displayed in
|
// Make sure that the cached messages from private tabs are not displayed in
|
||||||
// the browser console.
|
// the browser console.
|
||||||
function checkNoPrivateMessages()
|
function checkNoPrivateMessages() {
|
||||||
{
|
|
||||||
let text = hud.outputNode.textContent;
|
let text = hud.outputNode.textContent;
|
||||||
is(text.indexOf("fooBazBaz"), -1, "no exception displayed");
|
is(text.indexOf("fooBazBaz"), -1, "no exception displayed");
|
||||||
is(text.indexOf("bug 874061"), -1, "no console message displayed");
|
is(text.indexOf("bug 874061"), -1, "no console message displayed");
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBrowserConsoleOpen(aHud)
|
function onBrowserConsoleOpen(aHud) {
|
||||||
{
|
|
||||||
hud = aHud;
|
hud = aHud;
|
||||||
ok(hud, "browser console opened");
|
ok(hud, "browser console opened");
|
||||||
|
|
||||||
@ -163,8 +155,7 @@ function test()
|
|||||||
}).then(testPrivateWindowClose);
|
}).then(testPrivateWindowClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPrivateWindowClose()
|
function testPrivateWindowClose() {
|
||||||
{
|
|
||||||
info("close the private window and check if the private messages are removed");
|
info("close the private window and check if the private messages are removed");
|
||||||
hud.jsterm.once("private-messages-cleared", () => {
|
hud.jsterm.once("private-messages-cleared", () => {
|
||||||
isnot(hud.outputNode.textContent.indexOf("bug874061-not-private"), -1,
|
isnot(hud.outputNode.textContent.indexOf("bug874061-not-private"), -1,
|
||||||
@ -181,8 +172,7 @@ function test()
|
|||||||
privateWindow.BrowserTryToCloseWindow();
|
privateWindow.BrowserTryToCloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBrowserConsoleReopen(aHud)
|
function onBrowserConsoleReopen(aHud) {
|
||||||
{
|
|
||||||
hud = aHud;
|
hud = aHud;
|
||||||
ok(hud, "browser console reopened");
|
ok(hud, "browser console reopened");
|
||||||
|
|
||||||
@ -191,8 +181,8 @@ function test()
|
|||||||
webconsole: hud,
|
webconsole: hud,
|
||||||
messages: [nonPrivateMessage],
|
messages: [nonPrivateMessage],
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// Make sure that no private message is displayed after closing the private
|
// Make sure that no private message is displayed after closing the
|
||||||
// window and reopening the Browser Console.
|
// private window and reopening the Browser Console.
|
||||||
checkNoPrivateMessages();
|
checkNoPrivateMessages();
|
||||||
executeSoon(finishTest);
|
executeSoon(finishTest);
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
// Check that variables view works as expected in the web console.
|
// 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;
|
let gWebConsole, gJSTerm, gVariablesView;
|
||||||
|
|
||||||
@ -21,7 +22,8 @@ let test = asyncTest(function* () {
|
|||||||
let msg = yield gJSTerm.execute("fooObj");
|
let msg = yield gJSTerm.execute("fooObj");
|
||||||
|
|
||||||
ok(msg, "output message found");
|
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");
|
let anchor = msg.querySelector("a");
|
||||||
ok(anchor, "object link found");
|
ok(anchor, "object link found");
|
||||||
@ -52,8 +54,7 @@ let test = asyncTest(function* () {
|
|||||||
gWebConsole = gJSTerm = gVariablesView = null;
|
gWebConsole = gJSTerm = gVariablesView = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
function onFooObjFetch(aVar)
|
function onFooObjFetch(aVar) {
|
||||||
{
|
|
||||||
gVariablesView = aVar._variablesView;
|
gVariablesView = aVar._variablesView;
|
||||||
ok(gVariablesView, "variables view object");
|
ok(gVariablesView, "variables view object");
|
||||||
|
|
||||||
@ -62,8 +63,7 @@ function onFooObjFetch(aVar)
|
|||||||
], { webconsole: gWebConsole });
|
], { webconsole: gWebConsole });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTestPropFound(aResults)
|
function onTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the |testProp| property in the variables view");
|
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");
|
info("onFooObjFetchAfterUpdate");
|
||||||
let expectedValue = content.document.title + content.location
|
let expectedValue = content.document.title + content.location +
|
||||||
+ '[object HTMLParagraphElement]';
|
"[object HTMLParagraphElement]";
|
||||||
|
|
||||||
return findVariableViewProperties(aVar, [
|
return findVariableViewProperties(aVar, [
|
||||||
{ name: "testProp", value: expectedValue },
|
{ name: "testProp", value: expectedValue },
|
||||||
], { webconsole: gWebConsole });
|
], { webconsole: gWebConsole });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdatedTestPropFound(aResults)
|
function onUpdatedTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the updated |testProp| property value");
|
ok(prop, "matched the updated |testProp| property value");
|
||||||
|
|
||||||
@ -108,8 +106,7 @@ function onUpdatedTestPropFound(aResults)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFooObjFetchAfterPropRename(aVar)
|
function onFooObjFetchAfterPropRename(aVar) {
|
||||||
{
|
|
||||||
info("onFooObjFetchAfterPropRename");
|
info("onFooObjFetchAfterPropRename");
|
||||||
|
|
||||||
let para = content.wrappedJSObject.document.querySelector("p");
|
let para = content.wrappedJSObject.document.querySelector("p");
|
||||||
@ -121,8 +118,7 @@ function onFooObjFetchAfterPropRename(aVar)
|
|||||||
], { webconsole: gWebConsole });
|
], { webconsole: gWebConsole });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRenamedTestPropFound(aResults)
|
function onRenamedTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the renamed |testProp| property");
|
ok(prop, "matched the renamed |testProp| property");
|
||||||
|
|
||||||
@ -141,8 +137,7 @@ function onRenamedTestPropFound(aResults)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPropUpdateError(aVar)
|
function onPropUpdateError(aVar) {
|
||||||
{
|
|
||||||
info("onPropUpdateError");
|
info("onPropUpdateError");
|
||||||
|
|
||||||
let para = content.wrappedJSObject.document.querySelector("p");
|
let para = content.wrappedJSObject.document.querySelector("p");
|
||||||
@ -154,13 +149,10 @@ function onPropUpdateError(aVar)
|
|||||||
], { webconsole: gWebConsole });
|
], { webconsole: gWebConsole });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRenamedTestPropFoundAgain(aResults)
|
function onRenamedTestPropFoundAgain(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the renamed |testProp| property again");
|
ok(prop, "matched the renamed |testProp| property again");
|
||||||
|
|
||||||
let outputNode = gWebConsole.outputNode;
|
|
||||||
|
|
||||||
return waitForMessages({
|
return waitForMessages({
|
||||||
webconsole: gWebConsole,
|
webconsole: gWebConsole,
|
||||||
messages: [{
|
messages: [{
|
||||||
@ -172,8 +164,7 @@ function onRenamedTestPropFoundAgain(aResults)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPropDelete(aProp)
|
function testPropDelete(aProp) {
|
||||||
{
|
|
||||||
gVariablesView.window.focus();
|
gVariablesView.window.focus();
|
||||||
aProp.focus();
|
aProp.focus();
|
||||||
|
|
||||||
|
@ -28,29 +28,28 @@ function test() {
|
|||||||
|
|
||||||
Task.spawn(runner).then(finishTest);
|
Task.spawn(runner).then(finishTest);
|
||||||
|
|
||||||
function* runner() {
|
function* runner() {
|
||||||
const {tab} = yield loadTab(TEST_URI);
|
const {tab} = yield loadTab(TEST_URI);
|
||||||
const hud = yield openConsole(tab);
|
const hud = yield openConsole(tab);
|
||||||
const jsterm = hud.jsterm;
|
const jsterm = hud.jsterm;
|
||||||
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
|
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
|
||||||
jsterm.execute("inspect(document.querySelectorAll('div'))");
|
jsterm.execute("inspect(document.querySelectorAll('div'))");
|
||||||
|
|
||||||
let variableScope = yield deferred.promise;
|
let variableScope = yield deferred.promise;
|
||||||
ok(variableScope, "Variables view opened");
|
ok(variableScope, "Variables view opened");
|
||||||
|
|
||||||
yield findVariableViewProperties(variableScope, [
|
yield findVariableViewProperties(variableScope, [
|
||||||
{ name: "0", value: "<div>"},
|
{ name: "0", value: "<div>"},
|
||||||
{ name: "1", value: "<div#testID>"},
|
{ name: "1", value: "<div#testID>"},
|
||||||
{ name: "2", value: "<div.single-class>"},
|
{ name: "2", value: "<div.single-class>"},
|
||||||
{ name: "3", value: "<div.multiple-classes.another-class>"},
|
{ name: "3", value: "<div.multiple-classes.another-class>"},
|
||||||
{ name: "4", value: "<div#class-and-id.class-and-id>"},
|
{ 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: "5", value: "<div#multiple-classes-and-id.multiple-classes-and-id.another-class>"},
|
||||||
{ name: "6", value: "<div.whitespace-start>"},
|
{ name: "6", value: "<div.whitespace-start>"},
|
||||||
{ name: "7", value: "<div.whitespace-end>"},
|
{ name: "7", value: "<div.whitespace-end>"},
|
||||||
{ name: "8", value: "<div.multiple.spaces>"},
|
{ name: "8", value: "<div.multiple.spaces>"},
|
||||||
], { webconsole: hud});
|
], { webconsole: hud});
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/* vim: set ts=2 et sw=2 tw=80: */
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* Test case that ensures Array and other list types are not sorted in variables
|
/* 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;
|
let variableScope = yield deferred.promise;
|
||||||
ok(variableScope, "Variables view opened");
|
ok(variableScope, "Variables view opened");
|
||||||
|
|
||||||
// If the properties are sorted: keys = ["1", "4", "10",..., "abc", "hello"] <- correct
|
// If the properties are sorted:
|
||||||
// If the properties are not sorted: keys = ["1", "10", "4",...] <- incorrect
|
// keys = ["1", "4", "10",..., "abc", "hello"] <- correct
|
||||||
|
// If the properties are not sorted:
|
||||||
|
// keys = ["1", "10", "4",...] <- incorrect
|
||||||
let keyIterator = variableScope._store.keys();
|
let keyIterator = variableScope._store.keys();
|
||||||
is(keyIterator.next().value, "1", "First key should be 1");
|
is(keyIterator.next().value, "1", "First key should be 1");
|
||||||
is(keyIterator.next().value, "4", "Second key should be 4");
|
is(keyIterator.next().value, "4", "Second key should be 4");
|
||||||
|
@ -6,29 +6,27 @@
|
|||||||
// Check that variables view is linked to the inspector for highlighting and
|
// Check that variables view is linked to the inspector for highlighting and
|
||||||
// selecting DOM nodes
|
// 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;
|
let gWebConsole, gJSTerm, gVariablesView, gToolbox;
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
loadTab(TEST_URI).then(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then(hud => {
|
openConsole().then(hud => {
|
||||||
consoleOpened(hud);
|
consoleOpened(hud);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(hud)
|
function consoleOpened(hud) {
|
||||||
{
|
|
||||||
gWebConsole = hud;
|
gWebConsole = hud;
|
||||||
gJSTerm = hud.jsterm;
|
gJSTerm = hud.jsterm;
|
||||||
gToolbox = gDevTools.getToolbox(hud.target);
|
gToolbox = gDevTools.getToolbox(hud.target);
|
||||||
gJSTerm.execute("document.querySelectorAll('p')").then(onQSAexecuted);
|
gJSTerm.execute("document.querySelectorAll('p')").then(onQSAexecuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onQSAexecuted(msg)
|
function onQSAexecuted(msg) {
|
||||||
{
|
|
||||||
ok(msg, "output message found");
|
ok(msg, "output message found");
|
||||||
let anchor = msg.querySelector("a");
|
let anchor = msg.querySelector("a");
|
||||||
ok(anchor, "object link found");
|
ok(anchor, "object link found");
|
||||||
@ -40,8 +38,7 @@ function onQSAexecuted(msg)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNodeListVviewFetched(aEvent, aVar)
|
function onNodeListVviewFetched(aEvent, aVar) {
|
||||||
{
|
|
||||||
gVariablesView = aVar._variablesView;
|
gVariablesView = aVar._variablesView;
|
||||||
ok(gVariablesView, "variables view object");
|
ok(gVariablesView, "variables view object");
|
||||||
|
|
||||||
@ -54,7 +51,6 @@ function onNodeListVviewFetched(aEvent, aVar)
|
|||||||
function hoverOverDomNodeVariableAndAssertHighlighter(index) {
|
function hoverOverDomNodeVariableAndAssertHighlighter(index) {
|
||||||
if (props[index]) {
|
if (props[index]) {
|
||||||
let prop = props[index][1];
|
let prop = props[index][1];
|
||||||
let valueEl = prop._valueLabel;
|
|
||||||
|
|
||||||
gToolbox.once("node-highlight", () => {
|
gToolbox.once("node-highlight", () => {
|
||||||
ok(true, "The highlighter was shown on hover of the DOMNode");
|
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
|
// variable's openNodeInInspector function and see if it has the
|
||||||
// desired effect
|
// desired effect
|
||||||
prop.openNodeInInspector().then(() => {
|
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(() => {
|
gToolbox.selectTool("webconsole").then(() => {
|
||||||
hoverOverDomNodeVariableAndAssertHighlighter(index + 1);
|
hoverOverDomNodeVariableAndAssertHighlighter(index + 1);
|
||||||
});
|
});
|
||||||
|
@ -7,20 +7,21 @@
|
|||||||
// from the js debugger, when changing the value of a property in the variables
|
// from the js debugger, when changing the value of a property in the variables
|
||||||
// view.
|
// 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,
|
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
|
||||||
gStackframes, gVariablesView;
|
gStackframes, gVariablesView;
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
loadTab(TEST_URI).then(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then(consoleOpened);
|
openConsole().then(consoleOpened);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(hud)
|
function consoleOpened(hud) {
|
||||||
{
|
|
||||||
gWebConsole = hud;
|
gWebConsole = hud;
|
||||||
gJSTerm = hud.jsterm;
|
gJSTerm = hud.jsterm;
|
||||||
|
|
||||||
@ -30,8 +31,7 @@ function consoleOpened(hud)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function debuggerOpened(aResult)
|
function debuggerOpened(aResult) {
|
||||||
{
|
|
||||||
gDebuggerWin = aResult.panelWin;
|
gDebuggerWin = aResult.panelWin;
|
||||||
gDebuggerController = gDebuggerWin.DebuggerController;
|
gDebuggerController = gDebuggerWin.DebuggerController;
|
||||||
gThread = gDebuggerController.activeThread;
|
gThread = gDebuggerController.activeThread;
|
||||||
@ -45,8 +45,7 @@ function debuggerOpened(aResult)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFramesAdded()
|
function onFramesAdded() {
|
||||||
{
|
|
||||||
info("onFramesAdded");
|
info("onFramesAdded");
|
||||||
|
|
||||||
executeSoon(() =>
|
executeSoon(() =>
|
||||||
@ -56,11 +55,10 @@ function onFramesAdded()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onExecuteFooObj(msg) {
|
||||||
function onExecuteFooObj(msg)
|
|
||||||
{
|
|
||||||
ok(msg, "output message found");
|
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");
|
let anchor = msg.querySelector("a");
|
||||||
ok(anchor, "object link found");
|
ok(anchor, "object link found");
|
||||||
@ -71,8 +69,7 @@ function onExecuteFooObj(msg)
|
|||||||
gWebConsole.iframeWindow));
|
gWebConsole.iframeWindow));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFooObjFetch(aEvent, aVar)
|
function onFooObjFetch(aEvent, aVar) {
|
||||||
{
|
|
||||||
gVariablesView = aVar._variablesView;
|
gVariablesView = aVar._variablesView;
|
||||||
ok(gVariablesView, "variables view object");
|
ok(gVariablesView, "variables view object");
|
||||||
|
|
||||||
@ -82,8 +79,7 @@ function onFooObjFetch(aEvent, aVar)
|
|||||||
], { webconsole: gWebConsole }).then(onTestPropFound);
|
], { webconsole: gWebConsole }).then(onTestPropFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTestPropFound(aResults)
|
function onTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the |testProp2| property in the variables view");
|
ok(prop, "matched the |testProp2| property in the variables view");
|
||||||
|
|
||||||
@ -97,8 +93,7 @@ function onTestPropFound(aResults)
|
|||||||
}).then(onFooObjFetchAfterUpdate);
|
}).then(onFooObjFetchAfterUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFooObjFetchAfterUpdate(aVar)
|
function onFooObjFetchAfterUpdate(aVar) {
|
||||||
{
|
|
||||||
info("onFooObjFetchAfterUpdate");
|
info("onFooObjFetchAfterUpdate");
|
||||||
let para = content.wrappedJSObject.document.querySelector("p");
|
let para = content.wrappedJSObject.document.querySelector("p");
|
||||||
let expectedValue = content.document.title + "foo2SecondCall" + para;
|
let expectedValue = content.document.title + "foo2SecondCall" + para;
|
||||||
@ -108,17 +103,17 @@ function onFooObjFetchAfterUpdate(aVar)
|
|||||||
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
|
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdatedTestPropFound(aResults)
|
function onUpdatedTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the updated |testProp2| property value");
|
ok(prop, "matched the updated |testProp2| property value");
|
||||||
|
|
||||||
// Check that testProp2 was updated.
|
// 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 para = content.wrappedJSObject.document.querySelector("p");
|
||||||
let expected = content.document.title + "foo2SecondCall" + para;
|
let expected = content.document.title + "foo2SecondCall" + para;
|
||||||
|
|
||||||
|
@ -6,20 +6,19 @@
|
|||||||
// Test that makes sure web console eval works while the js debugger paused the
|
// Test that makes sure web console eval works while the js debugger paused the
|
||||||
// page, and while the inspector is active. See bug 886137.
|
// 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,
|
let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
|
||||||
gStackframes, gVariablesView;
|
gStackframes, gVariablesView;
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
loadTab(TEST_URI).then(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then(consoleOpened);
|
openConsole().then(consoleOpened);
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(hud)
|
function consoleOpened(hud) {
|
||||||
{
|
|
||||||
gWebConsole = hud;
|
gWebConsole = hud;
|
||||||
gJSTerm = hud.jsterm;
|
gJSTerm = hud.jsterm;
|
||||||
|
|
||||||
@ -27,8 +26,7 @@ function consoleOpened(hud)
|
|||||||
openDebugger().then(debuggerOpened);
|
openDebugger().then(debuggerOpened);
|
||||||
}
|
}
|
||||||
|
|
||||||
function debuggerOpened(aResult)
|
function debuggerOpened(aResult) {
|
||||||
{
|
|
||||||
info("debugger opened");
|
info("debugger opened");
|
||||||
gDebuggerWin = aResult.panelWin;
|
gDebuggerWin = aResult.panelWin;
|
||||||
gDebuggerController = gDebuggerWin.DebuggerController;
|
gDebuggerController = gDebuggerWin.DebuggerController;
|
||||||
@ -38,8 +36,7 @@ function debuggerOpened(aResult)
|
|||||||
openInspector().then(inspectorOpened);
|
openInspector().then(inspectorOpened);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inspectorOpened(aPanel)
|
function inspectorOpened(aPanel) {
|
||||||
{
|
|
||||||
info("inspector opened");
|
info("inspector opened");
|
||||||
gThread.addOneTimeListener("framesadded", onFramesAdded);
|
gThread.addOneTimeListener("framesadded", onFramesAdded);
|
||||||
|
|
||||||
@ -47,18 +44,16 @@ function inspectorOpened(aPanel)
|
|||||||
content.wrappedJSObject.firstCall();
|
content.wrappedJSObject.firstCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFramesAdded()
|
function onFramesAdded() {
|
||||||
{
|
|
||||||
info("onFramesAdded");
|
info("onFramesAdded");
|
||||||
|
|
||||||
openConsole().then(() => gJSTerm.execute("fooObj").then(onExecuteFooObj));
|
openConsole().then(() => gJSTerm.execute("fooObj").then(onExecuteFooObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFooObj(msg)
|
function onExecuteFooObj(msg) {
|
||||||
{
|
|
||||||
ok(msg, "output message found");
|
ok(msg, "output message found");
|
||||||
ok(msg.textContent.includes('{ testProp2: "testValue2" }'),
|
ok(msg.textContent.includes('{ testProp2: "testValue2" }'),
|
||||||
"message text check");
|
"message text check");
|
||||||
|
|
||||||
let anchor = msg.querySelector("a");
|
let anchor = msg.querySelector("a");
|
||||||
ok(anchor, "object link found");
|
ok(anchor, "object link found");
|
||||||
@ -68,8 +63,7 @@ function onExecuteFooObj(msg)
|
|||||||
EventUtils.synthesizeMouse(anchor, 2, 2, {}, gWebConsole.iframeWindow);
|
EventUtils.synthesizeMouse(anchor, 2, 2, {}, gWebConsole.iframeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFooObjFetch(aEvent, aVar)
|
function onFooObjFetch(aEvent, aVar) {
|
||||||
{
|
|
||||||
gVariablesView = aVar._variablesView;
|
gVariablesView = aVar._variablesView;
|
||||||
ok(gVariablesView, "variables view object");
|
ok(gVariablesView, "variables view object");
|
||||||
|
|
||||||
@ -79,8 +73,7 @@ function onFooObjFetch(aEvent, aVar)
|
|||||||
], { webconsole: gWebConsole }).then(onTestPropFound);
|
], { webconsole: gWebConsole }).then(onTestPropFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTestPropFound(aResults)
|
function onTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the |testProp2| property in the variables view");
|
ok(prop, "matched the |testProp2| property in the variables view");
|
||||||
|
|
||||||
@ -94,8 +87,7 @@ function onTestPropFound(aResults)
|
|||||||
}).then(onFooObjFetchAfterUpdate);
|
}).then(onFooObjFetchAfterUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFooObjFetchAfterUpdate(aVar)
|
function onFooObjFetchAfterUpdate(aVar) {
|
||||||
{
|
|
||||||
info("onFooObjFetchAfterUpdate");
|
info("onFooObjFetchAfterUpdate");
|
||||||
let para = content.wrappedJSObject.document.querySelector("p");
|
let para = content.wrappedJSObject.document.querySelector("p");
|
||||||
let expectedValue = content.document.title + "foo2SecondCall" + para;
|
let expectedValue = content.document.title + "foo2SecondCall" + para;
|
||||||
@ -105,8 +97,7 @@ function onFooObjFetchAfterUpdate(aVar)
|
|||||||
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
|
], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdatedTestPropFound(aResults)
|
function onUpdatedTestPropFound(aResults) {
|
||||||
{
|
|
||||||
let prop = aResults[0].matchedProp;
|
let prop = aResults[0].matchedProp;
|
||||||
ok(prop, "matched the updated |testProp2| property value");
|
ok(prop, "matched the updated |testProp2| property value");
|
||||||
|
|
||||||
@ -114,8 +105,7 @@ function onUpdatedTestPropFound(aResults)
|
|||||||
gJSTerm.execute("fooObj.testProp2").then(onExecuteFooObjTestProp2);
|
gJSTerm.execute("fooObj.testProp2").then(onExecuteFooObjTestProp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFooObjTestProp2()
|
function onExecuteFooObjTestProp2() {
|
||||||
{
|
|
||||||
let para = content.wrappedJSObject.document.querySelector("p");
|
let para = content.wrappedJSObject.document.querySelector("p");
|
||||||
let expected = content.document.title + "foo2SecondCall" + para;
|
let expected = content.document.title + "foo2SecondCall" + para;
|
||||||
|
|
||||||
|
@ -6,26 +6,27 @@
|
|||||||
// Test that makes sure web console eval happens in the user-selected stackframe
|
// Test that makes sure web console eval happens in the user-selected stackframe
|
||||||
// from the js debugger.
|
// 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(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then(consoleOpened);
|
openConsole().then(consoleOpened);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoleOpened(hud)
|
function consoleOpened(hud) {
|
||||||
{
|
|
||||||
gWebConsole = hud;
|
gWebConsole = hud;
|
||||||
gJSTerm = hud.jsterm;
|
gJSTerm = hud.jsterm;
|
||||||
gJSTerm.execute("foo").then(onExecuteFoo);
|
gJSTerm.execute("foo").then(onExecuteFoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFoo()
|
function onExecuteFoo() {
|
||||||
{
|
|
||||||
isnot(gWebConsole.outputNode.textContent.indexOf("globalFooBug783499"), -1,
|
isnot(gWebConsole.outputNode.textContent.indexOf("globalFooBug783499"), -1,
|
||||||
"|foo| value is correct");
|
"|foo| value is correct");
|
||||||
|
|
||||||
@ -33,11 +34,12 @@ function onExecuteFoo()
|
|||||||
|
|
||||||
// Test for Bug 690529 - Web Console and Scratchpad should evaluate
|
// Test for Bug 690529 - Web Console and Scratchpad should evaluate
|
||||||
// expressions in the scope of the content window, not in a sandbox.
|
// 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,
|
is(gWebConsole.outputNode.textContent.indexOf("undefined"), -1,
|
||||||
"|undefined| is not displayed after adding |foo2|");
|
"|undefined| is not displayed after adding |foo2|");
|
||||||
|
|
||||||
@ -52,8 +54,7 @@ function onNewFoo2(msg)
|
|||||||
executeSoon(() => openDebugger().then(debuggerOpened));
|
executeSoon(() => openDebugger().then(debuggerOpened));
|
||||||
}
|
}
|
||||||
|
|
||||||
function debuggerOpened(aResult)
|
function debuggerOpened(aResult) {
|
||||||
{
|
|
||||||
gDebuggerWin = aResult.panelWin;
|
gDebuggerWin = aResult.panelWin;
|
||||||
gDebuggerController = gDebuggerWin.DebuggerController;
|
gDebuggerController = gDebuggerWin.DebuggerController;
|
||||||
gThread = gDebuggerController.activeThread;
|
gThread = gDebuggerController.activeThread;
|
||||||
@ -67,8 +68,7 @@ function debuggerOpened(aResult)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFooAndFoo2()
|
function onExecuteFooAndFoo2() {
|
||||||
{
|
|
||||||
let expected = "globalFooBug783499newFoo";
|
let expected = "globalFooBug783499newFoo";
|
||||||
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
||||||
"|foo + foo2| is displayed after starting the debugger");
|
"|foo + foo2| is displayed after starting the debugger");
|
||||||
@ -86,8 +86,7 @@ function onExecuteFooAndFoo2()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFramesAdded()
|
function onFramesAdded() {
|
||||||
{
|
|
||||||
info("onFramesAdded, openConsole() now");
|
info("onFramesAdded, openConsole() now");
|
||||||
executeSoon(() =>
|
executeSoon(() =>
|
||||||
openConsole().then(() =>
|
openConsole().then(() =>
|
||||||
@ -96,12 +95,17 @@ function onFramesAdded()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFooAndFoo2InSecondCall()
|
function onExecuteFooAndFoo2InSecondCall() {
|
||||||
{
|
|
||||||
let expected = "globalFooBug783499foo2SecondCall";
|
let expected = "globalFooBug783499foo2SecondCall";
|
||||||
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
||||||
"|foo + foo2| from |secondCall()|");
|
"|foo + foo2| from |secondCall()|");
|
||||||
|
|
||||||
|
function runOpenConsole() {
|
||||||
|
openConsole().then(() => {
|
||||||
|
gJSTerm.execute("foo + foo2 + foo3").then(onExecuteFoo23InFirstCall);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
executeSoon(() => {
|
executeSoon(() => {
|
||||||
gJSTerm.clearOutput();
|
gJSTerm.clearOutput();
|
||||||
|
|
||||||
@ -111,17 +115,12 @@ function onExecuteFooAndFoo2InSecondCall()
|
|||||||
gStackframes.selectFrame(1);
|
gStackframes.selectFrame(1);
|
||||||
|
|
||||||
info("openConsole");
|
info("openConsole");
|
||||||
executeSoon(() =>
|
executeSoon(() => runOpenConsole());
|
||||||
openConsole().then(() =>
|
|
||||||
gJSTerm.execute("foo + foo2 + foo3").then(onExecuteFoo23InFirstCall)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFoo23InFirstCall()
|
function onExecuteFoo23InFirstCall() {
|
||||||
{
|
|
||||||
let expected = "fooFirstCallnewFoofoo3FirstCall";
|
let expected = "fooFirstCallnewFoofoo3FirstCall";
|
||||||
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
||||||
"|foo + foo2 + foo3| from |firstCall()|");
|
"|foo + foo2 + foo3| from |firstCall()|");
|
||||||
@ -131,15 +130,16 @@ function onExecuteFoo23InFirstCall()
|
|||||||
onExecuteFooAndFoo3ChangesInFirstCall));
|
onExecuteFooAndFoo3ChangesInFirstCall));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExecuteFooAndFoo3ChangesInFirstCall()
|
function onExecuteFooAndFoo3ChangesInFirstCall() {
|
||||||
{
|
|
||||||
let expected = "abbabug783499";
|
let expected = "abbabug783499";
|
||||||
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
|
||||||
"|foo + foo3| updated in |firstCall()|");
|
"|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");
|
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 =
|
gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController =
|
||||||
gStackframes = null;
|
gStackframes = null;
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test to make sure that web console commands can fire while paused at a breakpoint
|
// Test to make sure that web console commands can fire while paused at a
|
||||||
// that was triggered from a JS call. Relies on asynchronous js evaluation over the
|
// breakpoint that was triggered from a JS call. Relies on asynchronous js
|
||||||
// protocol - see Bug 1088861.
|
// evaluation over the protocol - see Bug 1088861.
|
||||||
|
|
||||||
"use strict";
|
"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*() {
|
let test = asyncTest(function*() {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
|
||||||
@ -18,46 +19,46 @@ let test = asyncTest(function*() {
|
|||||||
let {jsterm} = hud;
|
let {jsterm} = hud;
|
||||||
|
|
||||||
info("open the debugger");
|
info("open the debugger");
|
||||||
let {panel,panelWin} = yield openDebugger();
|
let {panelWin} = yield openDebugger();
|
||||||
let {DebuggerController} = panelWin;
|
let {DebuggerController} = panelWin;
|
||||||
let {activeThread,StackFrames} = DebuggerController;
|
let {activeThread} = DebuggerController;
|
||||||
|
|
||||||
let firstCall = promise.defer();
|
let firstCall = promise.defer();
|
||||||
let frameAdded = promise.defer();
|
let frameAdded = promise.defer();
|
||||||
executeSoon(() => {
|
executeSoon(() => {
|
||||||
info ("Executing firstCall");
|
info("Executing firstCall");
|
||||||
activeThread.addOneTimeListener("framesadded", () => {
|
activeThread.addOneTimeListener("framesadded", () => {
|
||||||
executeSoon(frameAdded.resolve);
|
executeSoon(frameAdded.resolve);
|
||||||
});
|
});
|
||||||
jsterm.execute("firstCall()").then(firstCall.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;
|
yield frameAdded.promise;
|
||||||
|
|
||||||
info ("Executing basic command while paused");
|
info("Executing basic command while paused");
|
||||||
yield executeAndConfirm(jsterm, "1 + 2", "3");
|
yield executeAndConfirm(jsterm, "1 + 2", "3");
|
||||||
|
|
||||||
info ("Executing command using scoped variables while paused");
|
info("Executing command using scoped variables while paused");
|
||||||
yield executeAndConfirm(jsterm, "foo + foo2", '"globalFooBug783499foo2SecondCall"');
|
yield executeAndConfirm(jsterm, "foo + foo2",
|
||||||
|
'"globalFooBug783499foo2SecondCall"');
|
||||||
|
|
||||||
info ("Resuming the thread");
|
info("Resuming the thread");
|
||||||
activeThread.resume();
|
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;
|
let node = yield firstCall.promise;
|
||||||
is (node.querySelector(".message-body").textContent,
|
is(node.querySelector(".message-body").textContent,
|
||||||
"undefined",
|
"undefined",
|
||||||
"firstCall() returned correct value");
|
"firstCall() returned correct value");
|
||||||
});
|
});
|
||||||
|
|
||||||
function* executeAndConfirm(jsterm, input, output) {
|
function* executeAndConfirm(jsterm, input, output) {
|
||||||
info ("Executing command `"+input+"`");
|
info("Executing command `" + input + "`");
|
||||||
|
|
||||||
let node = yield jsterm.execute(input);
|
let node = yield jsterm.execute(input);
|
||||||
|
|
||||||
is (node.querySelector(".message-body").textContent,
|
is(node.querySelector(".message-body").textContent, output,
|
||||||
output,
|
"Expected result from call to " + input);
|
||||||
"Expected result from call to " + input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
// Check that the inspect() jsterm helper function works.
|
// Check that the inspect() jsterm helper function works.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
|
const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
|
|
||||||
// Test that very long strings do not hang the browser.
|
// 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* () {
|
let test = asyncTest(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,Test that the netmonitor " +
|
const TEST_URI = "data:text/html;charset=utf8,Test that the netmonitor " +
|
||||||
"displays requests that have been recorded in the " +
|
"displays requests that have been recorded in the " +
|
||||||
"web console, even if the netmonitor hadn't opened yet.";
|
"web console, even if the netmonitor hadn't opened yet.";
|
||||||
|
|
||||||
const TEST_FILE = "test-network-request.html";
|
const TEST_FILE = "test-network-request.html";
|
||||||
const TEST_PATH = "http://example.com/browser/browser/devtools/webconsole/test/" +
|
const TEST_PATH = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||||
TEST_FILE;
|
"test/" + TEST_FILE;
|
||||||
|
|
||||||
const NET_PREF = "devtools.webconsole.filter.networkinfo";
|
const NET_PREF = "devtools.webconsole.filter.networkinfo";
|
||||||
Services.prefs.setBoolPref(NET_PREF, true);
|
Services.prefs.setBoolPref(NET_PREF, true);
|
||||||
@ -47,7 +49,6 @@ add_task(function* () {
|
|||||||
testNetmonitor(toolbox);
|
testNetmonitor(toolbox);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function loadDocument(browser) {
|
function loadDocument(browser) {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
|
||||||
|
@ -5,18 +5,22 @@
|
|||||||
|
|
||||||
// Tests that the network panel works with LongStringActors.
|
// Tests that the network panel works with LongStringActors.
|
||||||
|
|
||||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
"use strict";
|
||||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
|
|
||||||
|
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 =
|
const TEST_IMG_BASE64 =
|
||||||
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
|
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJ" +
|
||||||
"OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
|
"REFUOI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuF" +
|
||||||
"FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
|
"Djq5dxD8FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNU" +
|
||||||
"FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
|
"yhsKAChRBQcPFVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQE" +
|
||||||
"BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
|
"od+Z5sP1FizDxGgyBqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTs" +
|
||||||
"BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
|
"DizDRMPuIOC+zEeTMZo9BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joRE" +
|
||||||
"A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
|
"N2uqnlBmCwW1hIJagtev4f3zA16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOn" +
|
||||||
"Dr4AAAAASUVORK5CYII=";
|
"idadmwtwsnMu18q83/kHSou+bFNDDr4AAAAASUVORK5CYII=";
|
||||||
|
|
||||||
let testDriver;
|
let testDriver;
|
||||||
|
|
||||||
@ -35,7 +39,8 @@ function checkIsVisible(aPanel, aList) {
|
|||||||
for (let id in aList) {
|
for (let id in aList) {
|
||||||
let node = aPanel.document.getElementById(id);
|
let node = aPanel.document.getElementById(id);
|
||||||
let isVisible = aList[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);
|
let node = aPanel.document.getElementById(aId);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
ok(false, "Tried to access node " + aId + " that doesn't exist!");
|
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);
|
ok(true, "checking content of " + aId);
|
||||||
}
|
} else {
|
||||||
else {
|
ok(false, "Got false value for " + aId + ": " + node.textContent +
|
||||||
ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
|
" doesn't have " + aContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,8 +167,7 @@ function* testGen() {
|
|||||||
|
|
||||||
let expectedGrip = headerValueGrip;
|
let expectedGrip = headerValueGrip;
|
||||||
|
|
||||||
function longStringClientProvider(aLongString)
|
function longStringClientProvider(aLongString) {
|
||||||
{
|
|
||||||
is(aLongString, expectedGrip,
|
is(aLongString, expectedGrip,
|
||||||
"longString grip is correct");
|
"longString grip is correct");
|
||||||
|
|
||||||
@ -241,7 +244,8 @@ function* testGen() {
|
|||||||
requestBodyFetchLink: false,
|
requestBodyFetchLink: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
checkNodeContent(networkPanel, "requestBodyContent", expectedGrip._fullString);
|
checkNodeContent(networkPanel, "requestBodyContent",
|
||||||
|
expectedGrip._fullString);
|
||||||
|
|
||||||
webConsoleClient.longString = longStringFn;
|
webConsoleClient.longString = longStringFn;
|
||||||
|
|
||||||
@ -295,7 +299,8 @@ function* testGen() {
|
|||||||
|
|
||||||
webConsoleClient.longString = longStringFn;
|
webConsoleClient.longString = longStringFn;
|
||||||
is(clickable.style.display, "none", "#responseBodyFetchLink is not visible");
|
is(clickable.style.display, "none", "#responseBodyFetchLink is not visible");
|
||||||
checkNodeContent(networkPanel, "responseBodyContent", expectedGrip._fullString);
|
checkNodeContent(networkPanel, "responseBodyContent",
|
||||||
|
expectedGrip._fullString);
|
||||||
|
|
||||||
networkPanel.panel.hidePopup();
|
networkPanel.panel.hidePopup();
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Make sure that the Web Console output does not break after we try to call
|
// Make sure that the Web Console output does not break after we try to call
|
||||||
// console.dir() for objects that are not inspectable.
|
// console.dir() for objects that are not inspectable.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,test for bug 773466";
|
const TEST_URI = "data:text/html;charset=utf8,test for bug 773466";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
@ -29,7 +31,7 @@ let test = asyncTest(function* () {
|
|||||||
name: "console.dir output",
|
name: "console.dir output",
|
||||||
consoleDir: "[object Object]",
|
consoleDir: "[object Object]",
|
||||||
}],
|
}],
|
||||||
})
|
});
|
||||||
|
|
||||||
content.console.log("fooBug773466b");
|
content.console.log("fooBug773466b");
|
||||||
|
|
||||||
|
@ -4,15 +4,18 @@
|
|||||||
|
|
||||||
// Test that long strings can be expanded in the console output.
|
// 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 test = asyncTest(function* () {
|
||||||
let tempScope = {};
|
let tempScope = {};
|
||||||
Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
|
Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
|
||||||
let DebuggerServer = tempScope.DebuggerServer;
|
let DebuggerServer = tempScope.DebuggerServer;
|
||||||
|
|
||||||
let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a") +
|
let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4))
|
||||||
"foobar";
|
.join("a") + "foobar";
|
||||||
let initialString =
|
let initialString =
|
||||||
longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
|
longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ let test = asyncTest(function* () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
hud.jsterm.clearOutput(true);
|
hud.jsterm.clearOutput(true);
|
||||||
let msg = yield execute(hud, "'" + longString +"'");
|
let msg = yield execute(hud, "'" + longString + "'");
|
||||||
|
|
||||||
isnot(msg.textContent.indexOf(initialString), -1,
|
isnot(msg.textContent.indexOf(initialString), -1,
|
||||||
"initial string is shown");
|
"initial string is shown");
|
||||||
@ -73,7 +76,7 @@ let test = asyncTest(function* () {
|
|||||||
category: CATEGORY_OUTPUT,
|
category: CATEGORY_OUTPUT,
|
||||||
longString: false,
|
longString: false,
|
||||||
}],
|
}],
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function execute(hud, str) {
|
function execute(hud, str) {
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"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";
|
const PREF = "devtools.webconsole.persistlog";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
@ -34,7 +35,8 @@ let test = asyncTest(function* () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function consoleOpened(hud) {
|
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");
|
info("waiting for 2 css warnings");
|
||||||
|
|
||||||
return waitForMessages({
|
return waitForMessages({
|
||||||
@ -90,7 +92,7 @@ function testCSSRepeatsAfterReload(hud) {
|
|||||||
repeats: 1,
|
repeats: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function testConsoleRepeats(hud) {
|
function testConsoleRepeats(hud) {
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
// Make sure that JS eval result are properly formatted as strings.
|
// 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* () {
|
let test = asyncTest(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
@ -33,4 +34,4 @@ function execute(hud, str) {
|
|||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
hud.jsterm.execute(str, deferred.resolve);
|
hud.jsterm.execute(str, deferred.resolve);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,12 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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";
|
"use strict";
|
||||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/testscript.js";
|
|
||||||
|
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";
|
const PREF = "devtools.webconsole.persistlog";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
@ -26,8 +30,7 @@ let test = asyncTest(function* () {
|
|||||||
Services.prefs.clearUserPref(PREF);
|
Services.prefs.clearUserPref(PREF);
|
||||||
});
|
});
|
||||||
|
|
||||||
function testWarningNotPresent(hud)
|
function testWarningNotPresent(hud) {
|
||||||
{
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
|
||||||
is(hud.outputNode.textContent.indexOf("logging API"), -1,
|
is(hud.outputNode.textContent.indexOf("logging API"), -1,
|
||||||
@ -52,8 +55,7 @@ function testWarningNotPresent(hud)
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function testWarningPresent(hud)
|
function testWarningPresent(hud) {
|
||||||
{
|
|
||||||
info("wait for the warning to show");
|
info("wait for the warning to show");
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
|
||||||
@ -78,4 +80,3 @@ function testWarningPresent(hud)
|
|||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Tests that source URLs are abbreviated properly for display on the right-
|
// Tests that source URLs are abbreviated properly for display on the right-
|
||||||
// hand side of the Web Console.
|
// hand side of the Web Console.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
testAbbreviation("http://example.com/x.js", "x.js");
|
testAbbreviation("http://example.com/x.js", "x.js");
|
||||||
testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js");
|
testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js");
|
||||||
|
@ -9,8 +9,10 @@
|
|||||||
// Bug 875456 - Log mixed content messages from the Mixed Content
|
// Bug 875456 - Log mixed content messages from the Mixed Content
|
||||||
// Blocker to the Security Pane in the Web Console
|
// 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 TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/MixedContent";
|
"test/test-mixedcontent-securityerrors.html";
|
||||||
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
||||||
|
"MixedContent";
|
||||||
|
|
||||||
let test = asyncTest(function* () {
|
let test = asyncTest(function* () {
|
||||||
yield pushPrefEnv();
|
yield pushPrefEnv();
|
||||||
@ -24,14 +26,17 @@ let test = asyncTest(function* () {
|
|||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
name: "Logged mixed active content",
|
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,
|
category: CATEGORY_SECURITY,
|
||||||
severity: SEVERITY_WARNING,
|
severity: SEVERITY_WARNING,
|
||||||
objects: true,
|
objects: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Logged mixed passive content - image",
|
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,
|
category: CATEGORY_SECURITY,
|
||||||
severity: SEVERITY_WARNING,
|
severity: SEVERITY_WARNING,
|
||||||
objects: true,
|
objects: true,
|
||||||
@ -42,8 +47,7 @@ let test = asyncTest(function* () {
|
|||||||
yield testClickOpenNewTab(hud, results);
|
yield testClickOpenNewTab(hud, results);
|
||||||
});
|
});
|
||||||
|
|
||||||
function pushPrefEnv()
|
function pushPrefEnv() {
|
||||||
{
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
let options = {"set":
|
let options = {"set":
|
||||||
[["security.mixed_content.block_active_content", false],
|
[["security.mixed_content.block_active_content", false],
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
// Test that console.assert() works as expected (i.e. outputs only on falsy
|
// Test that console.assert() works as expected (i.e. outputs only on falsy
|
||||||
// asserts). See bug 760193.
|
// 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* () {
|
let test = asyncTest(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
@ -46,6 +49,7 @@ function consoleOpened(hud) {
|
|||||||
}],
|
}],
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
let nodes = hud.outputNode.querySelectorAll(".message");
|
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");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
// Test that properties starting with underscores or dollars can be
|
// Test that properties starting with underscores or dollars can be
|
||||||
// autocompleted (bug 967468).
|
// autocompleted (bug 967468).
|
||||||
|
|
||||||
|
|
||||||
let test = asyncTest(function*() {
|
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);
|
yield loadTab(TEST_URI);
|
||||||
|
|
||||||
function* autocomplete(term) {
|
function* autocomplete(term) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615";
|
const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615";
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
|
XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
|
||||||
@ -55,34 +57,33 @@ function consoleOpened(HUD) {
|
|||||||
goDoCommand("cmd_paste");
|
goDoCommand("cmd_paste");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Self xss prevention tests (bug 994134)
|
// Self xss prevention tests (bug 994134)
|
||||||
function testSelfXss(){
|
function testSelfXss() {
|
||||||
info("Self-xss paste tests")
|
info("Self-xss paste tests");
|
||||||
WebConsoleUtils.usageCount = 0;
|
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
|
// 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.setInputValue(i);
|
||||||
jsterm.execute();
|
jsterm.execute();
|
||||||
}
|
}
|
||||||
is(WebConsoleUtils.usageCount, 4, "Usage count incremented")
|
is(WebConsoleUtils.usageCount, 4, "Usage count incremented");
|
||||||
WebConsoleUtils.usageCount = 0;
|
WebConsoleUtils.usageCount = 0;
|
||||||
updateEditUIVisibility();
|
updateEditUIVisibility();
|
||||||
|
|
||||||
let oldVal = jsterm.inputNode.value;
|
let oldVal = jsterm.inputNode.value;
|
||||||
goDoCommand("cmd_paste");
|
goDoCommand("cmd_paste");
|
||||||
let notificationbox = jsterm.hud.document.getElementById("webconsole-notificationbox");
|
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");
|
ok(notification, "Self-xss notification shown");
|
||||||
is(oldVal, jsterm.inputNode.value, "Paste blocked by self-xss prevention");
|
is(oldVal, jsterm.inputNode.value, "Paste blocked by self-xss prevention");
|
||||||
|
|
||||||
// Allow pasting
|
// Allow pasting
|
||||||
jsterm.inputNode.value = "allow pasting";
|
jsterm.inputNode.value = "allow pasting";
|
||||||
var evt = document.createEvent("KeyboardEvent");
|
let evt = document.createEvent("KeyboardEvent");
|
||||||
evt.initKeyEvent ("keyup", true, true, window,
|
evt.initKeyEvent("keyup", true, true, window,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
0, " ".charCodeAt(0));
|
0, " ".charCodeAt(0));
|
||||||
jsterm.inputNode.dispatchEvent(evt);
|
jsterm.inputNode.dispatchEvent(evt);
|
||||||
jsterm.inputNode.value = "";
|
jsterm.inputNode.value = "";
|
||||||
goDoCommand("cmd_paste");
|
goDoCommand("cmd_paste");
|
||||||
@ -106,7 +107,8 @@ function consoleOpened(HUD) {
|
|||||||
|
|
||||||
info("wait for completion update after clipboard paste (ctrl-v)");
|
info("wait for completion update after clipboard paste (ctrl-v)");
|
||||||
jsterm.once("autocomplete-updated", () => {
|
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.
|
// using executeSoon() to get out of the webconsole event loop.
|
||||||
executeSoon(deferred.resolve);
|
executeSoon(deferred.resolve);
|
||||||
|
@ -4,16 +4,19 @@
|
|||||||
// Test that autocomplete doesn't break when trying to reach into objects from
|
// Test that autocomplete doesn't break when trying to reach into objects from
|
||||||
// a different domain, bug 989025.
|
// a different domain, bug 989025.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
let hud;
|
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*() {
|
Task.spawn(function*() {
|
||||||
const {tab} = yield loadTab(TEST_URI);
|
const {tab} = yield loadTab(TEST_URI);
|
||||||
hud = yield openConsole(tab);
|
hud = yield openConsole(tab);
|
||||||
|
|
||||||
hud.jsterm.execute('document.title');
|
hud.jsterm.execute("document.title");
|
||||||
|
|
||||||
yield waitForMessages({
|
yield waitForMessages({
|
||||||
webconsole: hud,
|
webconsole: hud,
|
||||||
|
@ -3,15 +3,17 @@
|
|||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test that makes sure web console autocomplete happens in the user-selected stackframe
|
// Test that makes sure web console autocomplete happens in the user-selected
|
||||||
// from the js debugger.
|
// 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;
|
let testDriver, gStackframes;
|
||||||
|
|
||||||
function test()
|
function test() {
|
||||||
{
|
|
||||||
requestLongerTimeout(2);
|
requestLongerTimeout(2);
|
||||||
loadTab(TEST_URI).then(() => {
|
loadTab(TEST_URI).then(() => {
|
||||||
openConsole().then((hud) => {
|
openConsole().then((hud) => {
|
||||||
@ -191,7 +193,8 @@ function* testCompletion(hud) {
|
|||||||
return item.label != "prop11";
|
return item.label != "prop11";
|
||||||
}), "autocomplete results do contain 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.value = "foo2Obj.prop1.prop11.";
|
||||||
input.setSelectionRange(21, 21);
|
input.setSelectionRange(21, 21);
|
||||||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
|
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
|
||||||
@ -216,8 +219,7 @@ function* testCompletion(hud) {
|
|||||||
yield undefined;
|
yield undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function debuggerOpened(aResult)
|
function debuggerOpened(aResult) {
|
||||||
{
|
|
||||||
let debuggerWin = aResult.panelWin;
|
let debuggerWin = aResult.panelWin;
|
||||||
let debuggerController = debuggerWin.DebuggerController;
|
let debuggerController = debuggerWin.DebuggerController;
|
||||||
let thread = debuggerController.activeThread;
|
let thread = debuggerController.activeThread;
|
||||||
@ -230,8 +232,7 @@ function debuggerOpened(aResult)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFramesAdded()
|
function onFramesAdded() {
|
||||||
{
|
|
||||||
info("onFramesAdded, openConsole() now");
|
info("onFramesAdded, openConsole() now");
|
||||||
executeSoon(() => openConsole().then(testNext));
|
executeSoon(() => openConsole().then(testNext));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
// Test that the autocomplete popup closes on switching tabs. See bug 900448.
|
// 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*() {
|
let test = asyncTest(function*() {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
@ -26,7 +29,8 @@ function onPopupShown(panel) {
|
|||||||
|
|
||||||
panel.addEventListener("popupshown", function popupOpened() {
|
panel.addEventListener("popupshown", function popupOpened() {
|
||||||
panel.removeEventListener("popupshown", popupOpened, false);
|
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);
|
}, false);
|
||||||
|
|
||||||
return finished.promise;
|
return finished.promise;
|
||||||
|
@ -8,10 +8,13 @@
|
|||||||
|
|
||||||
"use strict";
|
"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* () {
|
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();
|
let hud = yield openConsole();
|
||||||
|
|
||||||
content.location = TEST_NETWORK_URI;
|
content.location = TEST_NETWORK_URI;
|
||||||
|
@ -12,9 +12,12 @@
|
|||||||
// Bug 875456 - Log mixed content messages from the Mixed Content
|
// Bug 875456 - Log mixed content messages from the Mixed Content
|
||||||
// Blocker to the Security Pane in the Web Console
|
// Blocker to the Security Pane in the Web Console
|
||||||
|
|
||||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-mixedcontent-securityerrors.html";
|
"use strict";
|
||||||
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* () {
|
let test = asyncTest(function* () {
|
||||||
yield pushPrefEnv();
|
yield pushPrefEnv();
|
||||||
@ -50,31 +53,30 @@ let test = asyncTest(function* () {
|
|||||||
yield testClickOpenNewTab(hud, results2[0]);
|
yield testClickOpenNewTab(hud, results2[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
function pushPrefEnv()
|
function pushPrefEnv() {
|
||||||
{
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
let options = {"set": [["security.mixed_content.block_active_content", true],
|
let options = {"set": [
|
||||||
["security.mixed_content.block_display_content", true]]};
|
["security.mixed_content.block_active_content", true],
|
||||||
|
["security.mixed_content.block_display_content", true]
|
||||||
|
]};
|
||||||
SpecialPowers.pushPrefEnv(options, deferred.resolve);
|
SpecialPowers.pushPrefEnv(options, deferred.resolve);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForNotificationShown(notification, callback)
|
function waitForNotificationShown(notification, callback) {
|
||||||
{
|
|
||||||
if (PopupNotifications.panel.state == "open") {
|
if (PopupNotifications.panel.state == "open") {
|
||||||
executeSoon(callback);
|
executeSoon(callback);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PopupNotifications.panel.addEventListener("popupshown", function onShown(e) {
|
PopupNotifications.panel.addEventListener("popupshown", function onShown() {
|
||||||
PopupNotifications.panel.removeEventListener("popupshown", onShown);
|
PopupNotifications.panel.removeEventListener("popupshown", onShown);
|
||||||
callback();
|
callback();
|
||||||
}, false);
|
}, false);
|
||||||
notification.reshow();
|
notification.reshow();
|
||||||
}
|
}
|
||||||
|
|
||||||
function mixedContentOverrideTest2(hud, browser)
|
function mixedContentOverrideTest2(hud, browser) {
|
||||||
{
|
let notification = PopupNotifications.getNotification("bad-content", browser);
|
||||||
var notification = PopupNotifications.getNotification("bad-content", browser);
|
|
||||||
ok(notification, "Mixed Content Doorhanger did appear");
|
ok(notification, "Mixed Content Doorhanger did appear");
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
waitForNotificationShown(notification, () => {
|
waitForNotificationShown(notification, () => {
|
||||||
@ -83,9 +85,9 @@ function mixedContentOverrideTest2(hud, browser)
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterNotificationShown(hud, notification, deferred)
|
function afterNotificationShown(hud, notification, deferred) {
|
||||||
{
|
ok(PopupNotifications.panel.firstChild.isMixedContentBlocked,
|
||||||
ok(PopupNotifications.panel.firstChild.isMixedContentBlocked, "OK: Mixed Content is being blocked");
|
"OK: Mixed Content is being blocked");
|
||||||
// Click on the doorhanger.
|
// Click on the doorhanger.
|
||||||
PopupNotifications.panel.firstChild.disableMixedContentProtection();
|
PopupNotifications.panel.firstChild.disableMixedContentProtection();
|
||||||
notification.remove();
|
notification.remove();
|
||||||
@ -95,8 +97,8 @@ function afterNotificationShown(hud, notification, deferred)
|
|||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
name: "Logged blocking mixed active content",
|
name: "Logged blocking mixed active content",
|
||||||
text: "Loading mixed (insecure) active content \"http://example.com/\"" +
|
text: "Loading mixed (insecure) active content " +
|
||||||
" on a secure page",
|
"\"http://example.com/\" on a secure page",
|
||||||
category: CATEGORY_SECURITY,
|
category: CATEGORY_SECURITY,
|
||||||
severity: SEVERITY_WARNING,
|
severity: SEVERITY_WARNING,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
@ -8,9 +8,9 @@ function test() {
|
|||||||
Task.spawn(runner).then(finishTest);
|
Task.spawn(runner).then(finishTest);
|
||||||
|
|
||||||
function* runner() {
|
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);
|
const hud = yield openConsole(tab);
|
||||||
|
|
||||||
hud.jsterm.execute("console.log('bug1006027')");
|
hud.jsterm.execute("console.log('bug1006027')");
|
||||||
@ -25,17 +25,20 @@ function test() {
|
|||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
|
|
||||||
info('hud.outputNode.textContent:\n'+hud.outputNode.textContent);
|
info("hud.outputNode.textContent:\n" + hud.outputNode.textContent);
|
||||||
let timestampNodes = hud.outputNode.querySelectorAll('span.timestamp');
|
let timestampNodes = hud.outputNode.querySelectorAll("span.timestamp");
|
||||||
let aTimestampMilliseconds = Array.prototype.map.call(timestampNodes,
|
let aTimestampMilliseconds = Array.prototype.map.call(timestampNodes,
|
||||||
function (value) {
|
function(value) {
|
||||||
// We are parsing timestamps as local time, relative to the begin of the epoch.
|
// We are parsing timestamps as local time, relative to the begin of
|
||||||
// This is not the correct value of the timestamp, but good enough for comparison.
|
// the epoch.
|
||||||
return Date.parse('T'+String.trim(value.textContent));
|
// 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 minTimestamp = Math.min.apply(null, aTimestampMilliseconds);
|
||||||
let maxTimestamp = Math.max.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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
So we expect a warning (image has been blocked) and a report
|
||||||
(script should not load and was reported)
|
(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";
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only test (bug 1010953)";
|
const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only " +
|
||||||
const TEST_VIOLATION = "http://example.com/browser/browser/devtools/webconsole/test/test_bug_1010953_cspro.html";
|
"test (bug 1010953)";
|
||||||
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 TEST_VIOLATION = "http://example.com/browser/browser/devtools/" +
|
||||||
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.';
|
"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 test = asyncTest(function* () {
|
||||||
let { browser } = yield loadTab(TEST_URI);
|
let { browser } = yield loadTab(TEST_URI);
|
||||||
@ -32,10 +42,9 @@ let test = asyncTest(function* () {
|
|||||||
content.location = TEST_VIOLATION;
|
content.location = TEST_VIOLATION;
|
||||||
yield loaded;
|
yield loaded;
|
||||||
|
|
||||||
let aOutputNode = hud.outputNode;
|
|
||||||
|
|
||||||
yield waitForSuccess({
|
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() {
|
validator: function() {
|
||||||
console.log(hud.outputNode.textContent);
|
console.log(hud.outputNode.textContent);
|
||||||
let success = false;
|
let success = false;
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"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*() {
|
let test = asyncTest(function*() {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// Tests that the console object still exists after a page reload.
|
// 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;
|
let browser;
|
||||||
|
|
||||||
@ -21,7 +25,6 @@ function test() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPageReload() {
|
function testPageReload() {
|
||||||
|
|
||||||
browser.removeEventListener("DOMContentLoaded", testPageReload, false);
|
browser.removeEventListener("DOMContentLoaded", testPageReload, false);
|
||||||
|
|
||||||
let console = browser.contentWindow.wrappedJSObject.console;
|
let console = browser.contentWindow.wrappedJSObject.console;
|
||||||
@ -36,4 +39,3 @@ function testPageReload() {
|
|||||||
browser = null;
|
browser = null;
|
||||||
finishTest();
|
finishTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"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*() {
|
let test = asyncTest(function*() {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
// Tests to ensure that errors don't appear when the console is closed while a
|
// Tests to ensure that errors don't appear when the console is closed while a
|
||||||
// completion is being performed.
|
// 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 test = asyncTest(function* () {
|
||||||
let { browser } = yield loadTab(TEST_URI);
|
let { browser } = yield loadTab(TEST_URI);
|
||||||
@ -22,7 +22,7 @@ function testClosingAfterCompletion(hud, browser) {
|
|||||||
let inputNode = hud.jsterm.inputNode;
|
let inputNode = hud.jsterm.inputNode;
|
||||||
|
|
||||||
let errorWhileClosing = false;
|
let errorWhileClosing = false;
|
||||||
function errorListener(evt) {
|
function errorListener() {
|
||||||
errorWhileClosing = true;
|
errorWhileClosing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
// See bug 580030: the error handler fails silently after page reload.
|
// See bug 580030: the error handler fails silently after page reload.
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=580030
|
// 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() {
|
function test() {
|
||||||
Task.spawn(function*() {
|
Task.spawn(function*() {
|
||||||
|
@ -12,13 +12,14 @@
|
|||||||
|
|
||||||
"use strict";
|
"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*() {
|
let test = asyncTest(function*() {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
const TEST_TIMESTAMP = 12345678;
|
const TEST_TIMESTAMP = 12345678;
|
||||||
let date = new Date(TEST_TIMESTAMP);
|
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 " +
|
isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
|
||||||
"timestamp contains the hours");
|
"timestamp contains the hours");
|
||||||
isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
|
isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const INIT_URI = "data:text/html;charset=utf8,hello world";
|
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* () {
|
let test = asyncTest(function* () {
|
||||||
yield loadTab(INIT_URI);
|
yield loadTab(INIT_URI);
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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* () {
|
let test = asyncTest(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
@ -13,19 +16,20 @@ let test = asyncTest(function* () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function testCompletion(hud) {
|
function testCompletion(hud) {
|
||||||
var jsterm = hud.jsterm;
|
let jsterm = hud.jsterm;
|
||||||
var input = jsterm.inputNode;
|
let input = jsterm.inputNode;
|
||||||
|
|
||||||
jsterm.setInputValue("");
|
jsterm.setInputValue("");
|
||||||
EventUtils.synthesizeKey("VK_TAB", {});
|
EventUtils.synthesizeKey("VK_TAB", {});
|
||||||
is(jsterm.completeNode.value, "<- no result", "<- no result - matched");
|
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");
|
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");
|
jsterm.setInputValue("window.Bug583816");
|
||||||
EventUtils.synthesizeKey("VK_TAB", {});
|
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.value, "window.Bug583816", "inputnode content - matched");
|
||||||
is(input.getAttribute("focused"), "true", "input is still focused");
|
is(input.getAttribute("focused"), "true", "input is still focused");
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
// Tests that the Web Console limits the number of lines displayed according to
|
// Tests that the Web Console limits the number of lines displayed according to
|
||||||
// the user's preferences.
|
// the user's preferences.
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "data:text/html;charset=utf8,test for bug 585237";
|
const TEST_URI = "data:text/html;charset=utf8,test for bug 585237";
|
||||||
|
|
||||||
let outputNode;
|
let outputNode;
|
||||||
|
@ -5,19 +5,25 @@
|
|||||||
|
|
||||||
// Tests that the network panel works.
|
// Tests that the network panel works.
|
||||||
|
|
||||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
"use strict";
|
||||||
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_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 =
|
const TEST_IMG_BASE64 =
|
||||||
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
|
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJ" +
|
||||||
"OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
|
"REFUOI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuF" +
|
||||||
"FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
|
"Djq5dxD8FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNU" +
|
||||||
"FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
|
"yhsKAChRBQcPFVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQE" +
|
||||||
"BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
|
"od+Z5sP1FizDxGgyBqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTs" +
|
||||||
"BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
|
"DizDRMPuIOC+zEeTMZo9BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joRE" +
|
||||||
"A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
|
"N2uqnlBmCwW1hIJagtev4f3zA16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOn" +
|
||||||
"Dr4AAAAASUVORK5CYII=";
|
"idadmwtwsnMu18q83/kHSou+bFNDDr4AAAAASUVORK5CYII=";
|
||||||
|
|
||||||
let testDriver, hud;
|
let testDriver, hud;
|
||||||
|
|
||||||
@ -37,7 +43,8 @@ function checkIsVisible(aPanel, aList) {
|
|||||||
for (let id in aList) {
|
for (let id in aList) {
|
||||||
let node = aPanel.document.getElementById(id);
|
let node = aPanel.document.getElementById(id);
|
||||||
let isVisible = aList[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);
|
let node = aPanel.document.getElementById(aId);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
ok(false, "Tried to access node " + aId + " that doesn't exist!");
|
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);
|
ok(true, "checking content of " + aId);
|
||||||
}
|
} else {
|
||||||
else {
|
ok(false, "Got false value for " + aId + ": " + node.textContent +
|
||||||
ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
|
" doesn't have " + aContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +174,8 @@ function* testGen() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
checkNodeContent(networkPanel, "header", "HTTP/3.14 999 earthquake win");
|
checkNodeContent(networkPanel, "header", "HTTP/3.14 999 earthquake win");
|
||||||
checkNodeKeyValue(networkPanel, "responseHeadersContent", "leaveHouses", "true");
|
checkNodeKeyValue(networkPanel, "responseHeadersContent", "leaveHouses",
|
||||||
|
"true");
|
||||||
checkNodeContent(networkPanel, "responseHeadersInfo", "10ms");
|
checkNodeContent(networkPanel, "responseHeadersInfo", "10ms");
|
||||||
|
|
||||||
info("test 4");
|
info("test 4");
|
||||||
@ -399,7 +406,8 @@ function* testGen() {
|
|||||||
|
|
||||||
// Test no space after Content-Type:
|
// Test no space after Content-Type:
|
||||||
info("test 10: no space after Content-Type header in post data");
|
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 = hud.ui.openNetworkPanel(filterBox, httpActivity);
|
||||||
networkPanel._onUpdate = function() {
|
networkPanel._onUpdate = function() {
|
||||||
@ -490,9 +498,11 @@ function* testGen() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let responseString =
|
let responseString =
|
||||||
WCU_l10n.getFormatStr("NetworkPanel.responseBodyUnableToDisplay.content",
|
WCUL10n.getFormatStr("NetworkPanel.responseBodyUnableToDisplay.content",
|
||||||
["application/x-shockwave-flash"]);
|
["application/x-shockwave-flash"]);
|
||||||
checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString);
|
checkNodeContent(networkPanel,
|
||||||
|
"responseBodyUnknownTypeContent",
|
||||||
|
responseString);
|
||||||
networkPanel.panel.hidePopup();
|
networkPanel.panel.hidePopup();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user