Bug 1445808 - Remove unsafe CPOWs in Console tests r=jryans

MozReview-Commit-ID: LMVB3ErUZnZ

--HG--
extra : rebase_source : 5fe24c1d954ba58b9f08c120efc85e9c4cf73eb1
This commit is contained in:
Oriol Brufau 2018-03-21 01:53:49 +01:00
Родитель 86a24f96ba
Коммит 14d67a2e1c
18 изменённых файлов: 190 добавлений и 164 удалений

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

@ -261,7 +261,6 @@ skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32
subsuite = clipboard
[browser_webconsole_context_menu_object_in_sidebar.js]
[browser_webconsole_context_menu_open_url.js]
uses-unsafe-cpows = true
[browser_webconsole_context_menu_store_as_global.js]
[browser_webconsole_csp_ignore_reflected_xss_message.js]
skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows
@ -306,7 +305,6 @@ skip-if = true # Bug 1403448
skip-if = true # Bug 1403448
[browser_webconsole_message_categories.js]
[browser_webconsole_multiple_windows_and_tabs.js]
uses-unsafe-cpows = true
[browser_webconsole_network_attach.js]
[browser_webconsole_network_exceptions.js]
[browser_webconsole_network_messages_expand.js]

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

@ -55,7 +55,7 @@ add_task(async function() {
openUrlItem.click();
await hideContextMenu(hud);
let newTab = await tabLoaded;
let newTabHref = newTab.linkedBrowser._contentWindow.location.href;
let newTabHref = newTab.linkedBrowser.currentURI.spec;
is(newTabHref, TEST_URI, "Tab was opened with the expected URL");
info("Remove the new tab and select the previous tab back");

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

@ -35,12 +35,14 @@ add_task(async function() {
for (let tab of tabs) {
// Open the console in tab${i}.
let hud = await openConsole(tab);
let tabWindow = hud.target.tab.linkedBrowser.contentWindowAsCPOW;
let browser = hud.target.tab.linkedBrowser;
let message = "message for tab " + tabs.indexOf(tab);
// Log a message in the newly opened console.
let onMessage = waitForMessage(hud, message);
tabWindow.console.log(message);
await ContentTask.spawn(browser, message, function(msg) {
content.console.log(msg);
});
await onMessage;
}

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

@ -150,7 +150,6 @@ support-files =
skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows
[browser_bug664688_sandbox_update_after_navigation.js]
[browser_bug_638949_copy_link_location.js]
uses-unsafe-cpows = true
subsuite = clipboard
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
[browser_bug_862916_console_dir_and_filter_off.js]
@ -167,7 +166,6 @@ skip-if = (e10s && (os == 'win' || os == 'mac')) # Bug 1243976
[browser_console_click_focus.js]
[browser_console_consolejsm_output.js]
[browser_console_copy_command.js]
uses-unsafe-cpows = true
subsuite = clipboard
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
[browser_console_dead_objects.js]
@ -191,7 +189,6 @@ skip-if = e10s # Bug 1042253 - webconsole e10s tests
[browser_console_restore.js]
[browser_console_server_logging.js]
[browser_console_variables_view.js]
uses-unsafe-cpows = true
[browser_console_variables_view_filter.js]
[browser_console_variables_view_dom_nodes.js]
[browser_console_variables_view_dont_sort_non_sortable_classes_properties.js]
@ -204,7 +201,6 @@ uses-unsafe-cpows = true
skip-if = e10s && debug && (os == 'win' || os == 'mac') # Bug 1243966
[browser_longstring_hang.js]
[browser_output_breaks_after_console_dir_uninspectable.js]
uses-unsafe-cpows = true
[browser_output_longstring_expand.js]
[browser_repeated_messages_accuracy.js]
[browser_result_format_as_string.js]
@ -221,7 +217,6 @@ skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_bug_579412_input_focus.js]
[browser_webconsole_bug_580001_closing_after_completion.js]
[browser_webconsole_bug_580030_errors_after_page_reload.js]
uses-unsafe-cpows = true
[browser_webconsole_bug_582201_duplicate_errors.js]
[browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js]
[browser_webconsole_bug_585237_line_limit.js]
@ -248,7 +243,6 @@ skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_597136_external_script_errors.js]
[browser_webconsole_bug_597136_network_requests_from_chrome.js]
[browser_webconsole_bug_597460_filter_scroll.js]
uses-unsafe-cpows = true
[browser_webconsole_bug_597756_reopen_closed_tab.js]
[browser_webconsole_bug_599725_response_headers.js]
[browser_webconsole_bug_600183_charset.js]
@ -271,7 +265,6 @@ skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32
skip-if = os != "win"
[browser_webconsole_bug_630733_response_redirect_headers.js]
[browser_webconsole_bug_632275_getters_document_width.js]
uses-unsafe-cpows = true
[browser_webconsole_bug_632347_iterators_generators.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_632817.js]
@ -281,7 +274,6 @@ skip-if = true # Bug 1244707
subsuite = clipboard
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
[browser_webconsole_bug_644419_log_limits.js]
uses-unsafe-cpows = true
[browser_webconsole_bug_646025_console_file_location.js]
[browser_webconsole_bug_651501_document_body_autocomplete.js]
[browser_webconsole_bug_653531_highlighter_console_helper.js]
@ -329,9 +321,7 @@ skip-if = e10s && (os == 'win' || os == 'mac') # Bug 1243987
[browser_webconsole_closure_inspection.js]
[browser_webconsole_completion.js]
[browser_webconsole_console_extras.js]
uses-unsafe-cpows = true
[browser_webconsole_console_logging_api.js]
uses-unsafe-cpows = true
[browser_webconsole_console_logging_workers_api.js]
[browser_webconsole_console_trace_async.js]
[browser_webconsole_count.js]
@ -349,9 +339,7 @@ skip-if = e10s # Bug 1042253 - webconsole e10s tests
[browser_webconsole_jsterm.js]
skip-if = e10s # Bug 1042253 - webconsole e10s tests (Linux debug timeout)
[browser_webconsole_live_filtering_of_message_types.js]
uses-unsafe-cpows = true
[browser_webconsole_live_filtering_on_search_strings.js]
uses-unsafe-cpows = true
[browser_webconsole_message_node_id.js]
[browser_webconsole_multiline_input.js]
[browser_webconsole_netlogging.js]
@ -360,12 +348,9 @@ skip-if = true # Bug 1298364
[browser_webconsole_netlogging_panel.js]
[browser_webconsole_netlogging_reset_filter.js]
[browser_webconsole_notifications.js]
uses-unsafe-cpows = true
[browser_webconsole_open-links-without-callback.js]
uses-unsafe-cpows = true
[browser_webconsole_promise.js]
[browser_webconsole_output_copy_newlines.js]
uses-unsafe-cpows = true
subsuite = clipboard
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
[browser_webconsole_output_order.js]
@ -380,9 +365,7 @@ skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_view_source.js]
skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_reflow.js]
uses-unsafe-cpows = true
[browser_webconsole_log_file_filter.js]
uses-unsafe-cpows = true
[browser_webconsole_expandable_timestamps.js]
[browser_webconsole_autocomplete_accessibility.js]
[browser_webconsole_autocomplete_in_debugger_stackframe.js]

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

@ -26,7 +26,9 @@ add_task(function* () {
let menu = hud.iframeWindow.document.getElementById("output-contextmenu");
hud.jsterm.clearOutput();
gBrowser.contentWindowAsCPOW.console.log("bug 638949");
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("bug 638949");
});
// Test that the "Copy Link Location" command is disabled for non-network
// messages.

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

@ -46,7 +46,9 @@ add_task(function* testCopy() {
[obj.toSource(), JSON.stringify(obj, null, " ")],
[
"$('#" + ID + "')",
gBrowser.contentDocumentAsCPOW.getElementById(ID).outerHTML
yield ContentTask.spawn(gBrowser.selectedBrowser, ID, function(id) {
return content.document.getElementById(id).outerHTML;
})
]
];
for (let [source, reference] of samples) {

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

@ -134,12 +134,14 @@ function onFooObjFetchAfterUpdate(aVar) {
], { webconsole: hud });
}
function onUpdatedTestPropFound(aResults) {
async function onUpdatedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the updated |testProp| property value");
is(gBrowser.contentWindowAsCPOW.wrappedJSObject.fooObj.testProp, aResults[0].value,
"|fooObj.testProp| value has been updated");
await ContentTask.spawn(gBrowser.selectedBrowser, aResults[0].value, function(value) {
is(content.wrappedJSObject.fooObj.testProp, value,
"|fooObj.testProp| value has been updated");
});
// Check that property name updates work.
return updateVariablesViewProperty({
@ -164,14 +166,16 @@ function* onFooObjFetchAfterPropRename(aVar) {
], { webconsole: hud });
}
function onRenamedTestPropFound(aResults) {
async function onRenamedTestPropFound(aResults) {
let prop = aResults[0].matchedProp;
ok(prop, "matched the renamed |testProp| property");
ok(!gBrowser.contentWindowAsCPOW.wrappedJSObject.fooObj.testProp,
"|fooObj.testProp| has been deleted");
is(gBrowser.contentWindowAsCPOW.wrappedJSObject.fooObj.testUpdatedProp, aResults[0].value,
"|fooObj.testUpdatedProp| is correct");
await ContentTask.spawn(gBrowser.selectedBrowser, aResults[0].value, function(value) {
ok(!content.wrappedJSObject.fooObj.testProp,
"|fooObj.testProp| has been deleted");
is(content.wrappedJSObject.fooObj.testUpdatedProp, value,
"|fooObj.testUpdatedProp| is correct");
});
// Check that property value updates that cause exceptions are reported in
// the web console output.
@ -220,9 +224,15 @@ function testPropDelete(aProp) {
EventUtils.synthesizeKey("VK_DELETE", {}, gVariablesView.window);
});
let success = false;
return waitForSuccess({
name: "property deleted",
timeout: 60000,
validator: () => !("testUpdatedProp" in gBrowser.contentWindowAsCPOW.wrappedJSObject.fooObj)
validator: function() {
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
return !("testUpdatedProp" in content.wrappedJSObject.fooObj);
}).then((result) => success = result);
return success;
}
});
}

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

@ -34,7 +34,9 @@ add_task(function* () {
}],
});
gBrowser.contentWindowAsCPOW.console.log("fooBug773466b");
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("bug fooBug773466b");
});
yield waitForMessages({
webconsole: hud,

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

@ -27,16 +27,17 @@ function test() {
yield hud.target.once("navigate");
info("target navigated");
let button = gBrowser.contentDocumentAsCPOW.querySelector("button");
ok(button, "button found");
// On e10s, the exception is triggered in child process
// and is ignored by test harness
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
EventUtils.sendMouseEvent({type: "click"}, button, gBrowser.contentWindowAsCPOW);
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let button = content.document.querySelector("button");
ok(button, "button found");
button.click();
});
yield waitForMessages({
webconsole: hud,

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

@ -22,12 +22,12 @@ add_task(function* () {
Services.prefs.clearUserPref(PREF);
});
function consoleOpened(hud) {
let deferred = defer();
for (let i = 0; i < 200; i++) {
gBrowser.contentWindowAsCPOW.console.log("test message " + i);
}
async function consoleOpened(hud) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
for (let i = 0; i < 200; i++) {
content.console.log("test message " + i);
}
});
hud.setFilterState("network", false);
hud.setFilterState("networkinfo", false);
@ -35,7 +35,7 @@ function consoleOpened(hud) {
hud.ui.filterBox.value = "test message";
hud.ui.adjustVisibilityOnSearchStringChange();
waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
name: "console messages displayed",
@ -43,20 +43,17 @@ function consoleOpened(hud) {
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
}],
}).then(() => {
waitForMessages({
webconsole: hud,
messages: [{
text: "test-network.html",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
}],
}).then(deferred.resolve);
gBrowser.reload();
});
return deferred.promise;
let promise = waitForMessages({
webconsole: hud,
messages: [{
text: "test-network.html",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
}],
});
gBrowser.reload();
return promise;
}
function testScroll([result], hud) {

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

@ -16,32 +16,34 @@ function test() {
});
}
function consoleOpened(hud) {
let doc = gBrowser.contentWindowAsCPOW.wrappedJSObject.document;
getterValue = doc.foobar._val;
async function consoleOpened(hud) {
getterValue = await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
return content.wrappedJSObject.document.foobar._val;
});
hud.jsterm.execute("console.dir(document)");
let onOpen = onViewOpened.bind(null, hud);
hud.jsterm.once("variablesview-fetched", onOpen);
}
function onViewOpened(hud, view) {
let doc = gBrowser.contentWindowAsCPOW.wrappedJSObject.document;
findVariableViewProperties(view, [
async function onViewOpened(hud, view) {
await findVariableViewProperties(view, [
{ name: /^(width|height)$/, dontMatch: 1 },
{ name: "foobar._val", value: getterValue },
{ name: "foobar.val", isGetter: true },
], { webconsole: hud }).then(function () {
is(doc.foobar._val, getterValue, "getter did not execute");
is(doc.foobar.val, getterValue + 1, "getter executed");
is(doc.foobar._val, getterValue + 1, "getter executed (recheck)");
], { webconsole: hud });
let textContent = hud.outputNode.textContent;
is(textContent.indexOf("document.body.client"), -1,
"no document.width/height warning displayed");
getterValue = null;
finishTest();
await ContentTask.spawn(gBrowser.selectedBrowser, getterValue, function(value) {
let doc = content.wrappedJSObject.document;
is(doc.foobar._val, value, "getter did not execute");
is(doc.foobar.val, value + 1, "getter executed");
is(doc.foobar._val, value + 1, "getter executed (recheck)");
});
let textContent = hud.outputNode.textContent;
is(textContent.indexOf("document.body.client"), -1,
"no document.width/height warning displayed");
getterValue = null;
finishTest();
}

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

@ -63,35 +63,39 @@ function testWebDevLimits() {
});
}
function testWebDevLimits2() {
async function testWebDevLimits2() {
// Fill the log with Web Developer errors.
for (let i = 0; i < 11; i++) {
gBrowser.contentWindowAsCPOW.console.log("test message " + i);
}
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
for (let i = 0; i < 11; i++) {
content.console.log("test message " + i);
}
});
return waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
text: "test message 10",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
}],
}).then(() => {
testLogEntry(outputNode, "test message 0", "first message is pruned",
false, true);
findLogEntry("test message 1");
// Check if the sentinel entry is still there.
findLogEntry("bar is not defined");
Services.prefs.clearUserPref("devtools.hud.loglimit.console");
});
testLogEntry(outputNode, "test message 0", "first message is pruned",
false, true);
findLogEntry("test message 1");
// Check if the sentinel entry is still there.
findLogEntry("bar is not defined");
Services.prefs.clearUserPref("devtools.hud.loglimit.console");
}
function testJsLimits() {
async function testJsLimits() {
Services.prefs.setIntPref("devtools.hud.loglimit.exception", 10);
hud.jsterm.clearOutput();
gBrowser.contentWindowAsCPOW.console.log("testing JS limits");
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("testing JS limits");
});
// Find the sentinel entry.
return waitForMessages({
@ -104,74 +108,81 @@ function testJsLimits() {
});
}
function testJsLimits2() {
async function testJsLimits2() {
// Fill the log with JS errors.
let head = gBrowser.contentDocumentAsCPOW.getElementsByTagName("head")[0];
for (let i = 0; i < 11; i++) {
let script = gBrowser.contentDocumentAsCPOW.createElement("script");
script.text = "fubar" + i + ".bogus(6);";
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
head.insertBefore(script, head.firstChild);
await ContentTask.spawn(gBrowser.selectedBrowser, i, function(idx) {
let head = content.document.getElementsByTagName("head")[0];
let script = content.document.createElement("script");
script.text = "fubar" + idx + ".bogus(6);";
head.insertBefore(script, head.firstChild);
});
}
return waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
text: "fubar10 is not defined",
category: CATEGORY_JS,
severity: SEVERITY_ERROR,
}],
}).then(() => {
testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned",
false, true);
findLogEntry("fubar1 is not defined");
// Check if the sentinel entry is still there.
findLogEntry("testing JS limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.exception");
});
testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned",
false, true);
findLogEntry("fubar1 is not defined");
// Check if the sentinel entry is still there.
findLogEntry("testing JS limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.exception");
}
var gCounter, gImage;
var gCounter;
function testNetLimits() {
async function testNetLimits() {
Services.prefs.setIntPref("devtools.hud.loglimit.network", 10);
hud.jsterm.clearOutput();
gBrowser.contentWindowAsCPOW.console.log("testing Net limits");
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("testing Net limits");
});
// Find the sentinel entry.
return waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
text: "testing Net limits",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
}],
}).then(() => {
// Fill the log with network messages.
gCounter = 0;
});
// Fill the log with network messages.
gCounter = 0;
}
function loadImage() {
async function loadImage() {
if (gCounter < 11) {
let body = gBrowser.contentDocumentAsCPOW.getElementsByTagName("body")[0];
gImage && gImage.removeEventListener("load", loadImage, true);
gImage = gBrowser.contentDocumentAsCPOW.createElement("img");
gImage.src = "test-image.png?_fubar=" + gCounter;
body.insertBefore(gImage, body.firstChild);
gImage.addEventListener("load", loadImage, true);
await ContentTask.spawn(gBrowser.selectedBrowser, gCounter, function(counter) {
let body = content.document.getElementsByTagName("body")[0];
let gImage = content.document.createElement("img");
gImage.src = "test-image.png?_fubar=" + counter;
body.insertBefore(gImage, body.firstChild);
return new Promise(function(resolve) {
gImage.addEventListener("load", resolve, {once: true});
});
});
gCounter++;
loadImage();
return true;
}
is(gCounter, 11, "loaded 11 files");
return waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
text: "test-image.png",
@ -179,22 +190,24 @@ function loadImage() {
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
}],
}).then(() => {
let msgs = outputNode.querySelectorAll(".message[category=network]");
is(msgs.length, 10, "number of network messages");
isnot(msgs[0].url.indexOf("fubar=1"), -1, "first network message");
isnot(msgs[1].url.indexOf("fubar=2"), -1, "second network message");
findLogEntry("testing Net limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.network");
});
let msgs = outputNode.querySelectorAll(".message[category=network]");
is(msgs.length, 10, "number of network messages");
isnot(msgs[0].url.indexOf("fubar=1"), -1, "first network message");
isnot(msgs[1].url.indexOf("fubar=2"), -1, "second network message");
findLogEntry("testing Net limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.network");
}
function testCssLimits() {
async function testCssLimits() {
Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", 10);
hud.jsterm.clearOutput();
gBrowser.contentWindowAsCPOW.console.log("testing CSS limits");
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("testing CSS limits");
});
// Find the sentinel entry.
return waitForMessages({
@ -207,29 +220,31 @@ function testCssLimits() {
});
}
function testCssLimits2() {
async function testCssLimits2() {
// Fill the log with CSS errors.
let body = gBrowser.contentDocumentAsCPOW.getElementsByTagName("body")[0];
for (let i = 0; i < 11; i++) {
let div = gBrowser.contentDocumentAsCPOW.createElement("div");
div.setAttribute("style", "-moz-foobar" + i + ": 42;");
body.insertBefore(div, body.firstChild);
}
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let body = content.document.getElementsByTagName("body")[0];
for (let i = 0; i < 11; i++) {
let div = content.document.createElement("div");
div.setAttribute("style", "-moz-foobar" + i + ": 42;");
body.insertBefore(div, body.firstChild);
}
});
return waitForMessages({
await waitForMessages({
webconsole: hud,
messages: [{
text: "-moz-foobar10",
category: CATEGORY_CSS,
severity: SEVERITY_WARNING,
}],
}).then(() => {
testLogEntry(outputNode, "Unknown property \u2018-moz-foobar0\u2019",
"first message is pruned", false, true);
findLogEntry("Unknown property \u2018-moz-foobar1\u2019");
// Check if the sentinel entry is still there.
findLogEntry("testing CSS limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
});
testLogEntry(outputNode, "Unknown property \u2018-moz-foobar0\u2019",
"first message is pruned", false, true);
findLogEntry("Unknown property \u2018-moz-foobar1\u2019");
// Check if the sentinel entry is still there.
findLogEntry("testing CSS limits");
Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
}

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

@ -37,7 +37,9 @@ function consoleOpened(hud) {
finishTest();
});
let button = gBrowser.contentDocumentAsCPOW.querySelector("button");
ok(button, "we have the button");
EventUtils.sendMouseEvent({ type: "click" }, button, gBrowser.contentWindowAsCPOW);
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let button = content.document.querySelector("button");
ok(button, "we have the button");
button.click();
});
}

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

@ -24,12 +24,12 @@ add_task(function* () {
});
function* testMethod(method, hud, outputNode) {
let console = gBrowser.contentWindowAsCPOW.console;
hud.jsterm.clearOutput();
console[method]("foo-bar-baz");
console[method]("baar-baz");
yield ContentTask.spawn(gBrowser.selectedBrowser, method, function(method) {
content.console[method]("foo-bar-baz");
content.console[method]("baar-baz");
});
yield waitForMessages({
webconsole: hud,
@ -50,7 +50,9 @@ function* testMethod(method, hud, outputNode) {
// now toggle the current method off - make sure no visible message
// TODO: move all filtering tests into a separate test file: see bug 608135
console[method]("foo-bar-baz");
yield ContentTask.spawn(gBrowser.selectedBrowser, method, function(method) {
content.console[method]("foo-bar-baz");
});
yield waitForMessages({
webconsole: hud,
messages: [{
@ -85,7 +87,9 @@ function* testMethod(method, hud, outputNode) {
hud.jsterm.clearOutput();
// test for multiple arguments.
console[method]("foo", "bar");
yield ContentTask.spawn(gBrowser.selectedBrowser, method, function(method) {
content.console[method]("foo", "bar");
});
yield waitForMessages({
webconsole: hud,

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

@ -24,9 +24,10 @@ add_task(function* () {
hud = null;
});
function consoleOpened() {
let console = gBrowser.contentWindowAsCPOW.console;
console.log("sentinel log");
async function consoleOpened() {
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("sentinel log");
});
return waitForMessages({
webconsole: hud,
messages: [{
@ -63,7 +64,6 @@ function countMessageNodes() {
let outputNode = hud.outputNode;
let messageNodes = outputNode.querySelectorAll(".message");
gBrowser.contentWindowAsCPOW.console.log(messageNodes.length);
let displayedMessageNodes = 0;
let view = hud.iframeWindow;
for (let i = 0; i < messageNodes.length; i++) {

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

@ -26,7 +26,9 @@ function waitForEvents(onConsoleOpened) {
function webConsoleCreated(id) {
Services.obs.removeObserver(observer, "web-console-created");
ok(HUDService.getHudReferenceById(id), "We have a hud reference");
gBrowser.contentWindowAsCPOW.wrappedJSObject.console.log("adding a log message");
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("adding a log message");
});
}
function webConsoleDestroyed(id) {

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

@ -19,8 +19,10 @@ add_task(function* () {
.getControllerForCommand("cmd_copy");
is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled");
gBrowser.contentWindowAsCPOW.console.log("Hello world! bug916997a");
gBrowser.contentWindowAsCPOW.console.log("Hello world 2! bug916997b");
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.console.log("Hello world! bug916997a");
content.console.log("Hello world 2! bug916997b");
});
yield waitForMessages({
webconsole: hud,

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

@ -14,8 +14,10 @@ add_task(function* () {
let hud = yield openConsole();
function onReflowListenersReady() {
browser.contentDocumentAsCPOW.body.style.display = "none";
browser.contentDocumentAsCPOW.body.clientTop;
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.document.body.style.display = "none";
content.document.body.clientTop;
});
}
Services.prefs.setBoolPref("devtools.webconsole.filter.csslog", true);