зеркало из https://github.com/mozilla/gecko-dev.git
merge fx-team to mozilla-central a=merge
This commit is contained in:
Коммит
4fd246e6b8
|
@ -377,12 +377,6 @@ pref("browser.search.context.loadInBackground", false);
|
|||
// comma seperated list of of engines to hide in the search panel.
|
||||
pref("browser.search.hiddenOneOffs", "");
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("browser.search.redirectWindowsSearch", true);
|
||||
#else
|
||||
pref("browser.search.redirectWindowsSearch", false);
|
||||
#endif
|
||||
|
||||
pref("browser.search.reset.enabled", true);
|
||||
|
||||
pref("browser.usedOnWindows10", false);
|
||||
|
@ -1525,4 +1519,4 @@ pref("browser.crashReports.unsubmittedCheck.enabled", true);
|
|||
// without a user choice before we suppress the notification for
|
||||
// some number of days.
|
||||
pref("browser.crashReports.unsubmittedCheck.chancesUntilSuppress", 4);
|
||||
pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);
|
||||
pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
Components.utils.importGlobalProperties(["URLSearchParams"]);
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
@ -744,60 +742,10 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
let redirectWinSearch = false;
|
||||
if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
|
||||
redirectWinSearch = Services.prefs.getBoolPref("browser.search.redirectWindowsSearch");
|
||||
}
|
||||
|
||||
try {
|
||||
var ar;
|
||||
while ((ar = cmdLine.handleFlagWithParam("url", false))) {
|
||||
var uri = resolveURIInternal(cmdLine, ar);
|
||||
|
||||
// Searches in the Windows 10 task bar searchbox simply open the default browser
|
||||
// with a URL for a search on Bing. Here we extract the search term and use the
|
||||
// user's default search engine instead.
|
||||
var uriScheme = "", uriHost = "", uriPath = "";
|
||||
try {
|
||||
uriScheme = uri.scheme;
|
||||
uriHost = uri.host;
|
||||
uriPath = uri.path;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
// Most Windows searches are "https://www.bing.com/search...", but bug
|
||||
// 1182308 reports a Chinese edition of Windows 10 using
|
||||
// "http://cn.bing.com/search...", so be a bit flexible in what we match.
|
||||
if (redirectWinSearch &&
|
||||
(uriScheme == "http" || uriScheme == "https") &&
|
||||
uriHost.endsWith(".bing.com") && uriPath.startsWith("/search")) {
|
||||
try {
|
||||
var url = uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
var params = new URLSearchParams(url.query);
|
||||
// We don't want to rewrite all Bing URLs coming from external apps. Look
|
||||
// for the magic URL parm that's present in searches from the task bar.
|
||||
// * Typed searches use "form=WNSGPH"
|
||||
// * Cortana voice searches use "FORM=WNSBOX" or direct results, or "FORM=WNSFC2"
|
||||
// for "see more results on Bing.com")
|
||||
// * Cortana voice searches started from "Hey, Cortana" use "form=WNSHCO"
|
||||
// or "form=WNSSSV" or "form=WNSSCX"
|
||||
var allowedParams = ["WNSGPH", "WNSBOX", "WNSFC2", "WNSHCO", "WNSSCX", "WNSSSV"];
|
||||
var formParam = params.get("form");
|
||||
if (!formParam) {
|
||||
formParam = params.get("FORM");
|
||||
}
|
||||
if (allowedParams.indexOf(formParam) != -1) {
|
||||
var term = params.get("q");
|
||||
var engine = Services.search.defaultEngine;
|
||||
logSystemBasedSearch(engine);
|
||||
var submission = engine.getSubmission(term, null, "system");
|
||||
uri = submission.uri;
|
||||
}
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Couldn't redirect Windows search: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
urilist.push(uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
|
@ -12,12 +10,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
|||
|
||||
const ENGINE_FLAVOR = "text/x-moz-search-engine";
|
||||
|
||||
document.addEventListener("Initialized", () => {
|
||||
if (!AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
|
||||
document.getElementById("redirectSearchCheckbox").hidden = true;
|
||||
}
|
||||
});
|
||||
|
||||
var gEngineView = null;
|
||||
|
||||
var gSearchPane = {
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
name="browser.search.hiddenOneOffs"
|
||||
type="unichar"/>
|
||||
|
||||
<preference id="browser.search.redirectWindowsSearch"
|
||||
name="browser.search.redirectWindowsSearch"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript"
|
||||
|
@ -51,10 +47,6 @@
|
|||
<label flex="1">&urlBarSuggestionsPermanentPB.label;</label>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<checkbox id="redirectSearchCheckbox"
|
||||
label="&redirectWindowsSearch.label;"
|
||||
accesskey="&redirectWindowsSearch.accesskey;"
|
||||
preference="browser.search.redirectWindowsSearch"/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
|
||||
|
|
|
@ -379,6 +379,7 @@ description#identity-popup-content-verifier,
|
|||
|
||||
.identity-popup-permission-icon.in-use {
|
||||
fill: rgb(224, 41, 29);
|
||||
opacity: 1;
|
||||
animation: 1.5s ease in-use-blink infinite;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,17 +37,18 @@ function* navigate(usage, options) {
|
|||
|
||||
ok(usage.isRunning(), "csscoverage is running");
|
||||
|
||||
let load1Promise = helpers.listenOnce(options.browser, "load", true);
|
||||
// Load page 1.
|
||||
options.browser.loadURI(PAGE_1);
|
||||
// And wait until page 1 and page 2 (an iframe inside page 1) are both loaded.
|
||||
yield Promise.all([
|
||||
BrowserTestUtils.browserLoaded(options.browser, false, PAGE_1),
|
||||
BrowserTestUtils.browserLoaded(options.browser, true, PAGE_2)
|
||||
]);
|
||||
is(options.browser.currentURI.spec, PAGE_1, "page 1 loaded");
|
||||
|
||||
yield helpers.navigate(PAGE_1, options);
|
||||
|
||||
// Wait for the test pages to auto-cycle
|
||||
yield load1Promise;
|
||||
is(options.window.location.href, PAGE_1, "page 1 loaded");
|
||||
|
||||
// Page 2 is a frame in page 1. JS in the page navigates to page 3.
|
||||
yield helpers.listenOnce(options.browser, "load", true);
|
||||
is(options.window.location.href, PAGE_3, "page 3 loaded");
|
||||
// page 2 has JS that navigates to page 3 after a timeout.
|
||||
yield BrowserTestUtils.browserLoaded(options.browser, false, PAGE_3);
|
||||
is(options.browser.currentURI.spec, PAGE_3, "page 3 loaded");
|
||||
|
||||
let toolboxReady = gDevTools.once("toolbox-ready");
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ var tests = {
|
|||
exec: {
|
||||
output: ""
|
||||
},
|
||||
post: function () {
|
||||
let body = options.window.document.body;
|
||||
let style = options.window.getComputedStyle(body);
|
||||
is(style.backgroundColor, "rgb(255, 255, 0)", "media correctly emulated");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
yield ContentTask.spawn(options.browser, {}, function* () {
|
||||
let color = content.getComputedStyle(content.document.body).backgroundColor;
|
||||
is(color, "rgb(255, 255, 0)", "media correctly emulated");
|
||||
});
|
||||
})
|
||||
}
|
||||
]);
|
||||
},
|
||||
|
@ -63,11 +64,12 @@ var tests = {
|
|||
exec: {
|
||||
output: ""
|
||||
},
|
||||
post: function () {
|
||||
let body = options.window.document.body;
|
||||
let style = options.window.getComputedStyle(body);
|
||||
is(style.backgroundColor, "rgb(255, 255, 255)", "media reset");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
yield ContentTask.spawn(options.browser, {}, function* () {
|
||||
let color = content.getComputedStyle(content.document.body).backgroundColor;
|
||||
is(color, "rgb(255, 255, 255)", "media reset");
|
||||
});
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -14,19 +14,29 @@ function* spawnTest() {
|
|||
let options = yield helpers.openTab(TEST_URI);
|
||||
yield helpers.openToolbar(options);
|
||||
|
||||
const documentElement = options.document.documentElement;
|
||||
const initialHtml = documentElement.innerHTML;
|
||||
function getHTML() {
|
||||
return ContentTask.spawn(options.browser, {}, function* () {
|
||||
return content.document.documentElement.innerHTML;
|
||||
});
|
||||
}
|
||||
|
||||
const initialHtml = yield getHTML();
|
||||
|
||||
function resetContent() {
|
||||
options.document.documentElement.innerHTML = initialHtml;
|
||||
return ContentTask.spawn(options.browser, initialHtml, function* (html) {
|
||||
content.document.documentElement.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// Test exporting HTML
|
||||
let oldOpen = options.window.open;
|
||||
let openURL = "";
|
||||
options.window.open = function (url) {
|
||||
// The URL is a data: URL that contains the document source
|
||||
openURL = decodeURIComponent(url);
|
||||
};
|
||||
yield ContentTask.spawn(options.browser, {}, function* () {
|
||||
content.wrappedJSObject.oldOpen = content.open;
|
||||
content.wrappedJSObject.openURL = "";
|
||||
content.wrappedJSObject.open = function (url) {
|
||||
// The URL is a data: URL that contains the document source
|
||||
content.wrappedJSObject.openURL = decodeURIComponent(url);
|
||||
};
|
||||
});
|
||||
|
||||
yield helpers.audit(options, [
|
||||
{
|
||||
|
@ -41,11 +51,14 @@ function* spawnTest() {
|
|||
exec: {
|
||||
output: ""
|
||||
},
|
||||
post: function () {
|
||||
isnot(openURL.indexOf('<html lang="en">'), -1, "export html works: <html>");
|
||||
isnot(openURL.indexOf("<title>GCLI"), -1, "export html works: <title>");
|
||||
isnot(openURL.indexOf('<p id="someid">#'), -1, "export html works: <p>");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
yield ContentTask.spawn(options.browser, {}, function* () {
|
||||
let openURL = content.wrappedJSObject.openURL;
|
||||
isnot(openURL.indexOf('<html lang="en">'), -1, "export html works: <html>");
|
||||
isnot(openURL.indexOf("<title>GCLI"), -1, "export html works: <title>");
|
||||
isnot(openURL.indexOf('<p id="someid">#'), -1, "export html works: <p>");
|
||||
});
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "export html stdout",
|
||||
|
@ -68,8 +81,11 @@ function* spawnTest() {
|
|||
}
|
||||
]);
|
||||
|
||||
options.window.open = oldOpen;
|
||||
oldOpen = undefined;
|
||||
yield ContentTask.spawn(options.browser, {}, function* () {
|
||||
content.wrappedJSObject.open = content.wrappedJSObject.oldOpen;
|
||||
delete content.wrappedJSObject.openURL;
|
||||
delete content.wrappedJSObject.oldOpen;
|
||||
});
|
||||
|
||||
// Test 'pagemod replace'
|
||||
yield helpers.audit(options, [
|
||||
|
@ -114,82 +130,84 @@ function* spawnTest() {
|
|||
exec: {
|
||||
output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "no change in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "no change in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod replace sOme foOBar true",
|
||||
exec: {
|
||||
output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 2\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
isnot(html.indexOf('<p class="foOBarclass">.foOBarclass'), -1,
|
||||
".someclass changed to .foOBarclass");
|
||||
isnot(html.indexOf('<p id="foOBarid">#foOBarid'), -1,
|
||||
"#someid changed to #foOBarid");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod replace some foobar --contentOnly",
|
||||
exec: {
|
||||
output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
isnot(html.indexOf('<p class="someclass">.foobarclass'), -1,
|
||||
".someclass changed to .foobarclass (content only)");
|
||||
isnot(html.indexOf('<p id="someid">#foobarid'), -1,
|
||||
"#someid changed to #foobarid (content only)");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod replace some foobar --attrOnly",
|
||||
exec: {
|
||||
output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 2\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
isnot(html.indexOf('<p class="foobarclass">.someclass'), -1,
|
||||
".someclass changed to .foobarclass (attr only)");
|
||||
isnot(html.indexOf('<p id="foobarid">#someid'), -1,
|
||||
"#someid changed to #foobarid (attr only)");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod replace some foobar --root head",
|
||||
exec: {
|
||||
output: /^[^:]+: 2\. [^:]+: 0\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod replace some foobar --selector .someclass,div,span",
|
||||
exec: {
|
||||
output: /^[^:]+: 4\. [^:]+: 1\. [^:]+: 1\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
isnot(html.indexOf('<p class="foobarclass">.foobarclass'), -1,
|
||||
".someclass changed to .foobarclass");
|
||||
isnot(html.indexOf('<p id="someid">#someid'), -1,
|
||||
"#someid did not change");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -227,56 +245,58 @@ function* spawnTest() {
|
|||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
|
||||
is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
|
||||
is(html.indexOf("<p><strong>"), -1, "<p> wrapping <strong> removed");
|
||||
isnot(html.indexOf("<span>"), -1, "<span> not removed");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove element p head",
|
||||
exec: {
|
||||
output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove element p --ifEmptyOnly",
|
||||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove element meta,title --ifEmptyOnly",
|
||||
exec: {
|
||||
output: /^[^:]+: 2\. [^:]+: 1\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
is(html.indexOf("<meta charset="), -1, "<meta> removed");
|
||||
isnot(html.indexOf("<title>"), -1, "<title> not removed");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove element p --stripOnly",
|
||||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
let html = documentElement.innerHTML;
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
|
||||
is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
|
||||
|
@ -285,8 +305,8 @@ function* spawnTest() {
|
|||
isnot(html.indexOf("#someid"), -1, "#someid still exists");
|
||||
isnot(html.indexOf("<strong>p"), -1, "<strong> still exists");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -334,55 +354,60 @@ function* spawnTest() {
|
|||
exec: {
|
||||
output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove attribute foo p",
|
||||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove attribute id p,span",
|
||||
exec: {
|
||||
output: /^[^:]+: 5\. [^:]+: 1\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML.indexOf('<p id="someid">#someid'), -1,
|
||||
"p#someid attribute removed");
|
||||
isnot(documentElement.innerHTML.indexOf("<p>#someid"), -1,
|
||||
"p with someid content still exists");
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
resetContent();
|
||||
}
|
||||
is(html.indexOf('<p id="someid">#someid'), -1, "p#someid attribute removed");
|
||||
isnot(html.indexOf("<p>#someid"), -1, "p with someid content still exists");
|
||||
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove attribute Class p",
|
||||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML, initialHtml, "nothing changed in the page");
|
||||
}
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
is(html, initialHtml, "nothing changed in the page");
|
||||
})
|
||||
},
|
||||
{
|
||||
setup: "pagemod remove attribute Class p --ignoreCase",
|
||||
exec: {
|
||||
output: /^[^:]+: 3\. [^:]+: 1\.\s*$/
|
||||
},
|
||||
post: function () {
|
||||
is(documentElement.innerHTML.indexOf('<p class="someclass">.someclass'), -1,
|
||||
post: Task.async(function* () {
|
||||
let html = yield getHTML();
|
||||
|
||||
is(html.indexOf('<p class="someclass">.someclass'), -1,
|
||||
"p.someclass attribute removed");
|
||||
isnot(documentElement.innerHTML.indexOf("<p>.someclass"), -1,
|
||||
isnot(html.indexOf("<p>.someclass"), -1,
|
||||
"p with someclass content still exists");
|
||||
|
||||
resetContent();
|
||||
}
|
||||
yield resetContent();
|
||||
})
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ var { helpers, assert } = (function () {
|
|||
* - tab: The new XUL tab element, as returned by gBrowser.addTab()
|
||||
* - target: The debug target as defined by the devtools framework
|
||||
* - browser: The XUL browser element for the given tab
|
||||
* - window: Content window for the created tab. a.k.a 'content' in mochitest
|
||||
* - isFirefox: Always true. Allows test sharing with GCLI
|
||||
*
|
||||
* Normally addTab will create an options object containing the values as
|
||||
|
@ -133,9 +132,6 @@ var { helpers, assert } = (function () {
|
|||
options.target = TargetFactory.forTab(options.tab);
|
||||
|
||||
var loaded = helpers.listenOnce(options.browser, "load", true).then(function (ev) {
|
||||
options.document = options.browser.contentDocument;
|
||||
options.window = options.document.defaultView;
|
||||
|
||||
var reply = callback.call(null, options);
|
||||
|
||||
return Promise.resolve(reply).then(null, function (error) {
|
||||
|
@ -143,9 +139,6 @@ var { helpers, assert } = (function () {
|
|||
}).then(function () {
|
||||
tabbrowser.removeTab(options.tab);
|
||||
|
||||
delete options.window;
|
||||
delete options.document;
|
||||
|
||||
delete options.target;
|
||||
delete options.browser;
|
||||
delete options.tab;
|
||||
|
@ -168,8 +161,6 @@ var { helpers, assert } = (function () {
|
|||
* - tab
|
||||
* - browser
|
||||
* - target
|
||||
* - document
|
||||
* - window
|
||||
* @return A promise which resolves to the options object when the 'load' event
|
||||
* happens on the new tab
|
||||
*/
|
||||
|
@ -197,9 +188,6 @@ var { helpers, assert } = (function () {
|
|||
helpers.closeTab = function (options) {
|
||||
options.chromeWindow.gBrowser.removeTab(options.tab);
|
||||
|
||||
delete options.window;
|
||||
delete options.document;
|
||||
|
||||
delete options.target;
|
||||
delete options.browser;
|
||||
delete options.tab;
|
||||
|
@ -234,7 +222,7 @@ var { helpers, assert } = (function () {
|
|||
/**
|
||||
* Navigate the current tab to a URL
|
||||
*/
|
||||
helpers.navigate = function (url, options) {
|
||||
helpers.navigate = Task.async(function* (url, options) {
|
||||
options = options || {};
|
||||
options.chromeWindow = options.chromeWindow || window;
|
||||
options.tab = options.tab || options.chromeWindow.gBrowser.selectedTab;
|
||||
|
@ -242,16 +230,12 @@ var { helpers, assert } = (function () {
|
|||
var tabbrowser = options.chromeWindow.gBrowser;
|
||||
options.browser = tabbrowser.getBrowserForTab(options.tab);
|
||||
|
||||
var promise = helpers.listenOnce(options.browser, "load", true).then(function () {
|
||||
options.document = options.browser.contentDocument;
|
||||
options.window = options.document.defaultView;
|
||||
return options;
|
||||
});
|
||||
let onLoaded = BrowserTestUtils.browserLoaded(options.browser);
|
||||
options.browser.loadURI(url);
|
||||
yield onLoaded;
|
||||
|
||||
options.browser.contentWindow.location = url;
|
||||
|
||||
return promise;
|
||||
};
|
||||
return options;
|
||||
});
|
||||
|
||||
/**
|
||||
* Undo the effects of |helpers.openToolbar|
|
||||
|
|
|
@ -53,23 +53,25 @@ function test() {
|
|||
|
||||
yield helpers.audit(aOptions, [{
|
||||
name: "open toolbox",
|
||||
setup: function () {
|
||||
return initDebugger(gBrowser.selectedTab).then(([aTab, aDebuggee, aPanel]) => {
|
||||
// Spin the event loop before causing the debuggee to pause, to allow
|
||||
// this function to return first.
|
||||
executeSoon(() => aDebuggee.firstCall());
|
||||
setup: Task.async(function* () {
|
||||
let [aTab, aDebuggee, aPanel] = yield initDebugger(gBrowser.selectedTab);
|
||||
|
||||
return waitForSourceAndCaretAndScopes(aPanel, ".html", 1).then(() => {
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gThreadClient = gPanel.panelWin.gThreadClient;
|
||||
gLineNumber = "" + aOptions.window.wrappedJSObject.gLineNumber;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
// Spin the event loop before causing the debuggee to pause, to allow this
|
||||
// function to return first.
|
||||
executeSoon(() => aDebuggee.firstCall());
|
||||
|
||||
expectedActorObj.value = getSourceActor(gSources, TAB_URL);
|
||||
});
|
||||
yield waitForSourceAndCaretAndScopes(aPanel, ".html", 1);
|
||||
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gThreadClient = gPanel.panelWin.gThreadClient;
|
||||
gLineNumber = yield ContentTask.spawn(aOptions.browser, {}, function* () {
|
||||
return "" + content.wrappedJSObject.gLineNumber;
|
||||
});
|
||||
},
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
expectedActorObj.value = getSourceActor(gSources, TAB_URL);
|
||||
}),
|
||||
post: function () {
|
||||
ok(gThreadClient, "Debugger client exists.");
|
||||
is(gLineNumber, 14, "gLineNumber is correct.");
|
||||
|
|
|
@ -961,6 +961,9 @@ PropertyView.prototype = {
|
|||
// Reset its tabindex attribute otherwise, if an ellipsis is applied
|
||||
// it will be reachable via TABing
|
||||
this.nameNode.setAttribute("tabindex", "");
|
||||
// Avoid english text (css properties) from being altered
|
||||
// by RTL mode
|
||||
this.nameNode.setAttribute("dir", "ltr");
|
||||
this.nameNode.textContent = this.nameNode.title = this.name;
|
||||
// Make it hand over the focus to the container
|
||||
this.onFocus = () => this.element.focus();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "devtools",
|
||||
"version": "0.1",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "",
|
||||
"scripts": {
|
||||
|
|
|
@ -34,7 +34,7 @@ define(function (require, exports, module) {
|
|||
if (this.props.objectLink) {
|
||||
return this.props.objectLink({
|
||||
object: object
|
||||
}, object.class + " ");
|
||||
}, object.class);
|
||||
}
|
||||
return object.class || "Object";
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ define(function (require, exports, module) {
|
|||
if (this.props.objectLink) {
|
||||
return this.props.objectLink({
|
||||
object: object
|
||||
}, object.class + " ");
|
||||
}, object.class);
|
||||
}
|
||||
return "Object";
|
||||
},
|
||||
|
|
|
@ -21,6 +21,16 @@ define(function (require, exports, module) {
|
|||
const StringRep = React.createClass({
|
||||
displayName: "StringRep",
|
||||
|
||||
propTypes: {
|
||||
useQuotes: React.PropTypes.bool,
|
||||
},
|
||||
|
||||
getDefaultProps: function () {
|
||||
return {
|
||||
useQuotes: true,
|
||||
};
|
||||
},
|
||||
|
||||
render: function () {
|
||||
let text = this.props.object;
|
||||
let member = this.props.member;
|
||||
|
@ -35,8 +45,8 @@ define(function (require, exports, module) {
|
|||
let croppedString = this.props.cropLimit ?
|
||||
cropMultipleLines(text, this.props.cropLimit) : cropMultipleLines(text);
|
||||
|
||||
let formattedString = this.props.omitQuotes ?
|
||||
croppedString : "\"" + croppedString + "\"";
|
||||
let formattedString = this.props.useQuotes ?
|
||||
"\"" + croppedString + "\"" : croppedString;
|
||||
|
||||
return (
|
||||
span({className: "objectBox objectBox-string"}, formattedString
|
||||
|
|
|
@ -32,7 +32,7 @@ define(function (require, exports, module) {
|
|||
return DOM.span({className: "objectBox"},
|
||||
this.props.objectLink({
|
||||
object: grip
|
||||
}, title + " ")
|
||||
}, title)
|
||||
);
|
||||
}
|
||||
return title;
|
||||
|
|
|
@ -27,7 +27,7 @@ window.onload = Task.async(function* () {
|
|||
yield testMultiline();
|
||||
yield testMultilineOpen();
|
||||
yield testMultilineLimit();
|
||||
yield testOmitQuotes();
|
||||
yield testUseQuotes();
|
||||
} catch(e) {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
} finally {
|
||||
|
@ -49,9 +49,9 @@ window.onload = Task.async(function* () {
|
|||
is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n\"", "String rep has expected text content for multiline string when open");
|
||||
}
|
||||
|
||||
function testOmitQuotes(){
|
||||
const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testOmitQuotes"), omitQuotes: true });
|
||||
is(renderedComponent.textContent, "abc","String rep has expected to omit quotes");
|
||||
function testUseQuotes(){
|
||||
const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testUseQuotes"), useQuotes: false });
|
||||
is(renderedComponent.textContent, "abc","String rep was expected to omit quotes");
|
||||
}
|
||||
|
||||
function getGripStub(name) {
|
||||
|
@ -59,7 +59,7 @@ window.onload = Task.async(function* () {
|
|||
case "testMultiline":
|
||||
return "aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n";
|
||||
break;
|
||||
case "testOmitQuotes":
|
||||
case "testUseQuotes":
|
||||
return "abc";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Webconsole specific theme variables */
|
||||
.theme-light,
|
||||
.theme-firebug {
|
||||
--error-color: #FF0000;
|
||||
--error-background-color: #FFEBEB;
|
||||
|
@ -54,12 +55,14 @@ a {
|
|||
}
|
||||
|
||||
.theme-firebug .message[severity="error"],
|
||||
.theme-light .message.error,
|
||||
.theme-firebug .message.error {
|
||||
color: var(--error-color);
|
||||
background-color: var(--error-background-color);
|
||||
}
|
||||
|
||||
.theme-firebug .message[severity="warn"],
|
||||
.theme-light .message.warn,
|
||||
.theme-firebug .message.warn {
|
||||
background-color: var(--warning-background-color);
|
||||
}
|
||||
|
@ -354,24 +357,17 @@ a {
|
|||
|
||||
.message[category=console][severity=error] > .icon::before,
|
||||
.message[category=output][severity=error] > .icon::before,
|
||||
.message[category=server][severity=error] > .icon::before,
|
||||
.message.console-api.error > .icon::before,
|
||||
.message.output.error > .icon::before,
|
||||
.message.server.error > .icon::before {
|
||||
.message[category=server][severity=error] > .icon::before {
|
||||
background-position: -12px -36px;
|
||||
}
|
||||
|
||||
.message[category=console][severity=warn] > .icon::before,
|
||||
.message[category=server][severity=warn] > .icon::before,
|
||||
.message.console-api.warn > .icon::before,
|
||||
.message.server.warn > .icon::before {
|
||||
.message[category=server][severity=warn] > .icon::before {
|
||||
background-position: -24px -36px;
|
||||
}
|
||||
|
||||
.message[category=console][severity=info] > .icon::before,
|
||||
.message[category=server][severity=info] > .icon::before,
|
||||
.message.console-api.info > .icon::before,
|
||||
.message.server.info > .icon::before {
|
||||
.message[category=server][severity=info] > .icon::before {
|
||||
background-position: -36px -36px;
|
||||
}
|
||||
|
||||
|
@ -390,18 +386,18 @@ a {
|
|||
/* Input and output styles */
|
||||
.message[category=input] > .indent,
|
||||
.message[category=output] > .indent,
|
||||
.message.input > .indent,
|
||||
.message.output > .indent {
|
||||
.message.command > .indent,
|
||||
.message.result > .indent {
|
||||
border-inline-end: solid #808080 6px;
|
||||
}
|
||||
|
||||
.message[category=input] > .icon::before,
|
||||
.message.input > .icon::before {
|
||||
.message.command > .icon::before {
|
||||
background-position: -48px -36px;
|
||||
}
|
||||
|
||||
.message[category=output] > .icon::before,
|
||||
.message.output > .icon::before {
|
||||
.message.result > .icon::before {
|
||||
background-position: -60px -36px;
|
||||
}
|
||||
|
||||
|
@ -711,3 +707,19 @@ a.learn-more-link.webconsole-learn-more-link {
|
|||
.webconsole-filterbar-primary .devtools-plaininput {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.message.error > .icon::before {
|
||||
background-position: -12px -36px;
|
||||
}
|
||||
|
||||
.message.warn > .icon::before {
|
||||
background-position: -24px -36px;
|
||||
}
|
||||
|
||||
.message.info > .icon::before {
|
||||
background-position: -36px -36px;
|
||||
}
|
||||
|
||||
.message.network .method {
|
||||
margin-inline-end: 5px;
|
||||
}
|
||||
|
|
|
@ -446,9 +446,6 @@ JSTerm.prototype = {
|
|||
const { ConsoleCommand } = require("devtools/client/webconsole/new-console-output/types");
|
||||
let message = new ConsoleCommand({
|
||||
messageText: executeString,
|
||||
// @TODO remove category and severity
|
||||
category: "input",
|
||||
severity: "log",
|
||||
});
|
||||
this.hud.newConsoleOutput.dispatchMessageAdd(message);
|
||||
} else {
|
||||
|
|
|
@ -16,19 +16,26 @@ const {
|
|||
MESSAGES_CLEAR,
|
||||
MESSAGE_OPEN,
|
||||
MESSAGE_CLOSE,
|
||||
MESSAGE_TYPE,
|
||||
} = require("../constants");
|
||||
|
||||
const defaultIdGenerator = new IdGenerator();
|
||||
|
||||
function messageAdd(packet, idGenerator = null) {
|
||||
if (idGenerator == null) {
|
||||
idGenerator = defaultIdGenerator;
|
||||
}
|
||||
let message = prepareMessage(packet, idGenerator);
|
||||
return (dispatch) => {
|
||||
if (idGenerator == null) {
|
||||
idGenerator = defaultIdGenerator;
|
||||
}
|
||||
let message = prepareMessage(packet, idGenerator);
|
||||
|
||||
return {
|
||||
type: MESSAGE_ADD,
|
||||
message
|
||||
if (message.type === MESSAGE_TYPE.CLEAR) {
|
||||
dispatch(messagesClear());
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: MESSAGE_ADD,
|
||||
message
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,17 +13,18 @@ const {
|
|||
PropTypes,
|
||||
} = require("devtools/client/shared/vendor/react");
|
||||
|
||||
const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
|
||||
const CollapseButton = createClass({
|
||||
|
||||
displayName: "CollapseButton",
|
||||
|
||||
propTypes: {
|
||||
open: PropTypes.bool.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
},
|
||||
|
||||
render: function () {
|
||||
const { title, open, onClick } = this.props;
|
||||
const { open, onClick } = this.props;
|
||||
|
||||
let classes = ["theme-twisty"];
|
||||
|
||||
|
@ -33,8 +34,8 @@ const CollapseButton = createClass({
|
|||
|
||||
return dom.a({
|
||||
className: classes.join(" "),
|
||||
onClick: onClick,
|
||||
title
|
||||
onClick,
|
||||
title: l10n.getStr("messageToggleDetails"),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,8 +20,11 @@ const ConsoleOutput = createClass({
|
|||
propTypes: {
|
||||
jsterm: PropTypes.object.isRequired,
|
||||
messages: PropTypes.object.isRequired,
|
||||
messagesUi: PropTypes.object.isRequired,
|
||||
sourceMapService: PropTypes.object,
|
||||
onViewSourceInDebugger: PropTypes.func.isRequired,
|
||||
openNetworkPanel: PropTypes.func.isRequired,
|
||||
openLink: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "ConsoleOutput",
|
||||
|
@ -46,10 +49,12 @@ const ConsoleOutput = createClass({
|
|||
messages,
|
||||
messagesUi,
|
||||
sourceMapService,
|
||||
onViewSourceInDebugger
|
||||
onViewSourceInDebugger,
|
||||
openNetworkPanel,
|
||||
openLink,
|
||||
} = this.props;
|
||||
|
||||
let messageNodes = messages.map(function (message) {
|
||||
let messageNodes = messages.map((message) => {
|
||||
return (
|
||||
MessageContainer({
|
||||
dispatch,
|
||||
|
@ -57,7 +62,9 @@ const ConsoleOutput = createClass({
|
|||
key: message.id,
|
||||
sourceMapService,
|
||||
onViewSourceInDebugger,
|
||||
open: messagesUi.includes(message.id)
|
||||
openNetworkPanel,
|
||||
openLink,
|
||||
open: messagesUi.includes(message.id),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -77,7 +84,7 @@ function isScrolledToBottom(outputNode, scrollNode) {
|
|||
function mapStateToProps(state) {
|
||||
return {
|
||||
messages: getAllMessages(state),
|
||||
messagesUi: getAllMessagesUiById(state)
|
||||
messagesUi: getAllMessagesUiById(state),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ const {
|
|||
} = require("devtools/client/shared/vendor/react");
|
||||
const { createFactories } = require("devtools/client/shared/components/reps/rep-utils");
|
||||
const { Rep } = createFactories(require("devtools/client/shared/components/reps/rep"));
|
||||
const StringRep = createFactories(require("devtools/client/shared/components/reps/string").StringRep).rep;
|
||||
const VariablesViewLink = createFactory(require("devtools/client/webconsole/new-console-output/components/variables-view-link").VariablesViewLink);
|
||||
const { Grip } = require("devtools/client/shared/components/reps/grip");
|
||||
|
||||
|
@ -33,11 +34,21 @@ GripMessageBody.propTypes = {
|
|||
};
|
||||
|
||||
function GripMessageBody(props) {
|
||||
return Rep({
|
||||
object: props.grip,
|
||||
objectLink: VariablesViewLink,
|
||||
defaultRep: Grip
|
||||
});
|
||||
const { grip } = props;
|
||||
|
||||
return (
|
||||
// @TODO once there is a longString rep, also turn off quotes for those.
|
||||
typeof grip === "string"
|
||||
? StringRep({
|
||||
object: grip,
|
||||
useQuotes: false
|
||||
})
|
||||
: Rep({
|
||||
object: grip,
|
||||
objectLink: VariablesViewLink,
|
||||
defaultRep: Grip
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.GripMessageBody = GripMessageBody;
|
||||
|
|
|
@ -23,6 +23,7 @@ const componentMap = new Map([
|
|||
["ConsoleCommand", require("./message-types/console-command").ConsoleCommand],
|
||||
["DefaultRenderer", require("./message-types/default-renderer").DefaultRenderer],
|
||||
["EvaluationResult", require("./message-types/evaluation-result").EvaluationResult],
|
||||
["NetworkEventMessage", require("./message-types/network-event-message").NetworkEventMessage],
|
||||
["PageError", require("./message-types/page-error").PageError]
|
||||
]);
|
||||
|
||||
|
@ -33,9 +34,17 @@ const MessageContainer = createClass({
|
|||
message: PropTypes.object.isRequired,
|
||||
sourceMapService: PropTypes.object,
|
||||
onViewSourceInDebugger: PropTypes.func.isRequired,
|
||||
openNetworkPanel: PropTypes.func.isRequired,
|
||||
openLink: PropTypes.func.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
},
|
||||
|
||||
getDefaultProps: function () {
|
||||
return {
|
||||
open: false
|
||||
};
|
||||
},
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return this.props.message.repeat !== nextProps.message.repeat
|
||||
|| this.props.open !== nextProps.open;
|
||||
|
@ -47,7 +56,9 @@ const MessageContainer = createClass({
|
|||
message,
|
||||
sourceMapService,
|
||||
onViewSourceInDebugger,
|
||||
open
|
||||
openNetworkPanel,
|
||||
openLink,
|
||||
open,
|
||||
} = this.props;
|
||||
|
||||
let MessageComponent = createFactory(getMessageComponent(message));
|
||||
|
@ -56,7 +67,9 @@ const MessageContainer = createClass({
|
|||
message,
|
||||
sourceMapService,
|
||||
onViewSourceInDebugger,
|
||||
open
|
||||
openNetworkPanel,
|
||||
openLink,
|
||||
open,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -65,6 +78,8 @@ function getMessageComponent(message) {
|
|||
switch (message.source) {
|
||||
case MESSAGE_SOURCE.CONSOLE_API:
|
||||
return componentMap.get("ConsoleApiCall");
|
||||
case MESSAGE_SOURCE.NETWORK:
|
||||
return componentMap.get("NetworkEventMessage");
|
||||
case MESSAGE_SOURCE.JAVASCRIPT:
|
||||
switch (message.type) {
|
||||
case MESSAGE_TYPE.COMMAND:
|
||||
|
|
|
@ -18,7 +18,6 @@ const GripMessageBody = createFactory(require("devtools/client/webconsole/new-co
|
|||
const MessageRepeat = createFactory(require("devtools/client/webconsole/new-console-output/components/message-repeat").MessageRepeat);
|
||||
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
|
||||
const CollapseButton = createFactory(require("devtools/client/webconsole/new-console-output/components/collapse-button").CollapseButton);
|
||||
const {l10n} = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const actions = require("devtools/client/webconsole/new-console-output/actions/messages");
|
||||
|
||||
ConsoleApiCall.displayName = "ConsoleApiCall";
|
||||
|
@ -27,24 +26,31 @@ ConsoleApiCall.propTypes = {
|
|||
message: PropTypes.object.isRequired,
|
||||
sourceMapService: PropTypes.object,
|
||||
onViewSourceInDebugger: PropTypes.func.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
open: PropTypes.bool,
|
||||
};
|
||||
|
||||
ConsoleApiCall.defaultProps = {
|
||||
open: false
|
||||
};
|
||||
|
||||
function ConsoleApiCall(props) {
|
||||
const { dispatch, message, sourceMapService, onViewSourceInDebugger, open } = props;
|
||||
const {source, level, stacktrace, type, frame } = message;
|
||||
const { source, level, stacktrace, type, frame, parameters } = message;
|
||||
|
||||
let messageBody;
|
||||
if (type === "trace") {
|
||||
messageBody = dom.span({className: "cm-variable"}, "console.trace()");
|
||||
} else if (message.parameters) {
|
||||
messageBody = message.parameters.map((grip, key) => GripMessageBody({grip, key}));
|
||||
messageBody = dom.span({ className: "cm-variable" }, "console.trace()");
|
||||
} else if (type === "assert") {
|
||||
let reps = formatReps(parameters);
|
||||
messageBody = dom.span({ className: "cm-variable" }, "Assertion failed: ", reps);
|
||||
} else if (parameters) {
|
||||
messageBody = formatReps(parameters);
|
||||
} else {
|
||||
messageBody = message.messageText;
|
||||
}
|
||||
|
||||
const icon = MessageIcon({level});
|
||||
const repeat = MessageRepeat({repeat: message.repeat});
|
||||
const icon = MessageIcon({ level });
|
||||
const repeat = MessageRepeat({ repeat: message.repeat });
|
||||
const shouldRenderFrame = frame && frame.source !== "debugger eval code";
|
||||
const location = dom.span({ className: "message-location devtools-monospace" },
|
||||
shouldRenderFrame ? FrameView({
|
||||
|
@ -58,16 +64,17 @@ function ConsoleApiCall(props) {
|
|||
let collapse = "";
|
||||
let attachment = "";
|
||||
if (stacktrace) {
|
||||
attachment = dom.div({className: "stacktrace devtools-monospace"},
|
||||
StackTrace({
|
||||
stacktrace: stacktrace,
|
||||
onViewSourceInDebugger: onViewSourceInDebugger
|
||||
})
|
||||
);
|
||||
if (open) {
|
||||
attachment = dom.div({ className: "stacktrace devtools-monospace" },
|
||||
StackTrace({
|
||||
stacktrace: stacktrace,
|
||||
onViewSourceInDebugger: onViewSourceInDebugger
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
collapse = CollapseButton({
|
||||
open: open,
|
||||
title: l10n.getStr("messageToggleDetails"),
|
||||
open,
|
||||
onClick: function () {
|
||||
if (open) {
|
||||
dispatch(actions.messageClose(message.id));
|
||||
|
@ -80,28 +87,22 @@ function ConsoleApiCall(props) {
|
|||
|
||||
const classes = ["message", "cm-s-mozilla"];
|
||||
|
||||
if (source) {
|
||||
classes.push(source);
|
||||
}
|
||||
|
||||
if (level) {
|
||||
classes.push(level);
|
||||
}
|
||||
classes.push(source);
|
||||
classes.push(type);
|
||||
classes.push(level);
|
||||
|
||||
if (open === true) {
|
||||
classes.push("open");
|
||||
}
|
||||
|
||||
return dom.div({
|
||||
className: classes.join(" ")
|
||||
},
|
||||
return dom.div({ className: classes.join(" ") },
|
||||
// @TODO add timestamp
|
||||
// @TODO add indent if necessary
|
||||
icon,
|
||||
collapse,
|
||||
dom.span({className: "message-body-wrapper"},
|
||||
dom.span({className: "message-flex-body"},
|
||||
dom.span({className: "message-body devtools-monospace"},
|
||||
dom.span({ className: "message-body-wrapper" },
|
||||
dom.span({ className: "message-flex-body" },
|
||||
dom.span({ className: "message-body devtools-monospace" },
|
||||
messageBody
|
||||
),
|
||||
repeat,
|
||||
|
@ -112,4 +113,18 @@ function ConsoleApiCall(props) {
|
|||
);
|
||||
}
|
||||
|
||||
function formatReps(parameters) {
|
||||
return (
|
||||
parameters
|
||||
// Get all the grips.
|
||||
.map((grip, key) => GripMessageBody({ grip, key }))
|
||||
// Interleave spaces.
|
||||
.reduce((arr, v, i) => {
|
||||
return i + 1 < parameters.length
|
||||
? arr.concat(v, dom.span({}, " "))
|
||||
: arr.concat(v);
|
||||
}, [])
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.ConsoleApiCall = ConsoleApiCall;
|
||||
|
|
|
@ -26,19 +26,15 @@ ConsoleCommand.propTypes = {
|
|||
*/
|
||||
function ConsoleCommand(props) {
|
||||
const { message } = props;
|
||||
const {source, level} = message;
|
||||
const {source, type, level} = message;
|
||||
|
||||
const icon = MessageIcon({level});
|
||||
|
||||
const classes = ["message"];
|
||||
|
||||
if (source) {
|
||||
classes.push(source);
|
||||
}
|
||||
|
||||
if (level) {
|
||||
classes.push(level);
|
||||
}
|
||||
classes.push(source);
|
||||
classes.push(type);
|
||||
classes.push(level);
|
||||
|
||||
return dom.div({
|
||||
className: classes.join(" "),
|
||||
|
|
|
@ -23,18 +23,14 @@ EvaluationResult.propTypes = {
|
|||
|
||||
function EvaluationResult(props) {
|
||||
const { message } = props;
|
||||
const {source, level} = message;
|
||||
const {source, type, level} = message;
|
||||
const icon = MessageIcon({level});
|
||||
|
||||
const classes = ["message", "cm-s-mozilla"];
|
||||
|
||||
if (source) {
|
||||
classes.push(source);
|
||||
}
|
||||
|
||||
if (level) {
|
||||
classes.push(level);
|
||||
}
|
||||
classes.push(source);
|
||||
classes.push(type);
|
||||
classes.push(level);
|
||||
|
||||
return dom.div({
|
||||
className: classes.join(" ")
|
||||
|
|
|
@ -8,5 +8,6 @@ DevToolsModules(
|
|||
'console-command.js',
|
||||
'default-renderer.js',
|
||||
'evaluation-result.js',
|
||||
'network-event-message.js',
|
||||
'page-error.js',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// React & Redux
|
||||
const {
|
||||
createFactory,
|
||||
DOM: dom,
|
||||
PropTypes
|
||||
} = require("devtools/client/shared/vendor/react");
|
||||
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
|
||||
const CollapseButton = createFactory(require("devtools/client/webconsole/new-console-output/components/collapse-button").CollapseButton);
|
||||
const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const actions = require("devtools/client/webconsole/new-console-output/actions/messages");
|
||||
|
||||
NetworkEventMessage.displayName = "NetworkEventMessage";
|
||||
|
||||
NetworkEventMessage.propTypes = {
|
||||
message: PropTypes.object.isRequired,
|
||||
openNetworkPanel: PropTypes.func.isRequired,
|
||||
// @TODO: openLink will be used for mixed-content handling
|
||||
openLink: PropTypes.func.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
function NetworkEventMessage(props) {
|
||||
const { dispatch, message, openNetworkPanel, open } = props;
|
||||
const { actor, source, type, level, request, response, isXHR, totalTime } = message;
|
||||
let { method, url } = request;
|
||||
let { httpVersion, status, statusText } = response;
|
||||
|
||||
let classes = ["message", "cm-s-mozilla"];
|
||||
|
||||
classes.push(source);
|
||||
classes.push(type);
|
||||
classes.push(level);
|
||||
|
||||
if (open) {
|
||||
classes.push("open");
|
||||
}
|
||||
|
||||
let statusInfo = "[]";
|
||||
|
||||
// @TODO: Status will be enabled after NetworkUpdateEvent packet arrives
|
||||
if (httpVersion && status && statusText && totalTime) {
|
||||
statusInfo = `[${httpVersion} ${status} ${statusText} ${totalTime}ms]`;
|
||||
}
|
||||
|
||||
let xhr = l10n.getStr("webConsoleXhrIndicator");
|
||||
|
||||
function onUrlClick() {
|
||||
openNetworkPanel(actor);
|
||||
}
|
||||
|
||||
return dom.div({ className: classes.join(" ") },
|
||||
// @TODO add timestamp
|
||||
// @TODO add indent if necessary
|
||||
MessageIcon({ level }),
|
||||
CollapseButton({
|
||||
open,
|
||||
title: l10n.getStr("messageToggleDetails"),
|
||||
onClick: () => {
|
||||
if (open) {
|
||||
dispatch(actions.messageClose(message.id));
|
||||
} else {
|
||||
dispatch(actions.messageOpen(message.id));
|
||||
}
|
||||
},
|
||||
}),
|
||||
dom.span({
|
||||
className: "message-body-wrapper message-body devtools-monospace",
|
||||
"aria-haspopup": "true"
|
||||
},
|
||||
dom.span({ className: "method" }, method),
|
||||
isXHR ? dom.span({ className: "xhr" }, xhr) : null,
|
||||
dom.a({ className: "url", title: url, onClick: onUrlClick },
|
||||
url.replace(/\?.+/, "")),
|
||||
dom.a({ className: "status" }, statusInfo)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.NetworkEventMessage = NetworkEventMessage;
|
|
@ -13,18 +13,27 @@ const {
|
|||
PropTypes
|
||||
} = require("devtools/client/shared/vendor/react");
|
||||
const FrameView = createFactory(require("devtools/client/shared/components/frame"));
|
||||
const StackTrace = createFactory(require("devtools/client/shared/components/stack-trace"));
|
||||
const CollapseButton = createFactory(require("devtools/client/webconsole/new-console-output/components/collapse-button").CollapseButton);
|
||||
const MessageRepeat = createFactory(require("devtools/client/webconsole/new-console-output/components/message-repeat").MessageRepeat);
|
||||
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
|
||||
|
||||
const actions = require("devtools/client/webconsole/new-console-output/actions/messages");
|
||||
|
||||
PageError.displayName = "PageError";
|
||||
|
||||
PageError.propTypes = {
|
||||
message: PropTypes.object.isRequired,
|
||||
open: PropTypes.bool,
|
||||
};
|
||||
|
||||
PageError.defaultProps = {
|
||||
open: false
|
||||
};
|
||||
|
||||
function PageError(props) {
|
||||
const { message, sourceMapService, onViewSourceInDebugger } = props;
|
||||
const { source, level, frame } = message;
|
||||
const { dispatch, message, open, sourceMapService, onViewSourceInDebugger } = props;
|
||||
const { source, type, level, stacktrace, frame } = message;
|
||||
|
||||
const repeat = MessageRepeat({repeat: message.repeat});
|
||||
const icon = MessageIcon({level});
|
||||
|
@ -38,27 +47,52 @@ function PageError(props) {
|
|||
}) : null
|
||||
);
|
||||
|
||||
const classes = ["message"];
|
||||
let collapse = "";
|
||||
let attachment = "";
|
||||
if (stacktrace) {
|
||||
if (open) {
|
||||
attachment = dom.div({ className: "stacktrace devtools-monospace" },
|
||||
StackTrace({
|
||||
stacktrace: stacktrace,
|
||||
onViewSourceInDebugger: onViewSourceInDebugger
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (source) {
|
||||
classes.push(source);
|
||||
collapse = CollapseButton({
|
||||
open,
|
||||
onClick: function () {
|
||||
if (open) {
|
||||
dispatch(actions.messageClose(message.id));
|
||||
} else {
|
||||
dispatch(actions.messageOpen(message.id));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (level) {
|
||||
classes.push(level);
|
||||
const classes = ["message"];
|
||||
classes.push(source);
|
||||
classes.push(type);
|
||||
classes.push(level);
|
||||
if (open === true) {
|
||||
classes.push("open");
|
||||
}
|
||||
|
||||
return dom.div({
|
||||
className: classes.join(" ")
|
||||
},
|
||||
icon,
|
||||
collapse,
|
||||
dom.span({ className: "message-body-wrapper" },
|
||||
dom.span({ className: "message-flex-body" },
|
||||
dom.span({ className: "message-body devtools-monospace" },
|
||||
message.messageText
|
||||
),
|
||||
repeat
|
||||
)
|
||||
repeat,
|
||||
location
|
||||
),
|
||||
attachment
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ const NewConsoleOutputWrapper = BrowserLoader({
|
|||
baseURI: "resource://devtools/client/webconsole/new-console-output/",
|
||||
window: this}).require("./new-console-output-wrapper");
|
||||
|
||||
this.NewConsoleOutput = function (parentNode, jsterm, toolbox) {
|
||||
this.NewConsoleOutput = function (parentNode, jsterm, toolbox, owner) {
|
||||
console.log("Creating NewConsoleOutput", parentNode, NewConsoleOutputWrapper);
|
||||
return new NewConsoleOutputWrapper(parentNode, jsterm, toolbox);
|
||||
return new NewConsoleOutputWrapper(parentNode, jsterm, toolbox, owner);
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ const FilterBar = React.createFactory(require("devtools/client/webconsole/new-co
|
|||
|
||||
const store = configureStore();
|
||||
|
||||
function NewConsoleOutputWrapper(parentNode, jsterm, toolbox) {
|
||||
function NewConsoleOutputWrapper(parentNode, jsterm, toolbox, owner) {
|
||||
const sourceMapService = toolbox ? toolbox._sourceMapService : null;
|
||||
let childComponent = ConsoleOutput({
|
||||
jsterm,
|
||||
|
@ -25,7 +25,15 @@ function NewConsoleOutputWrapper(parentNode, jsterm, toolbox) {
|
|||
toolbox,
|
||||
frame.url,
|
||||
frame.line
|
||||
)
|
||||
),
|
||||
openNetworkPanel: (requestId) => {
|
||||
return toolbox.selectTool("netmonitor").then(panel => {
|
||||
return panel.panelWin.NetMonitorController.inspectRequest(requestId);
|
||||
});
|
||||
},
|
||||
openLink: (url) => {
|
||||
owner.openLink(url);
|
||||
},
|
||||
});
|
||||
let filterBar = FilterBar({});
|
||||
let provider = React.createElement(
|
||||
|
@ -45,7 +53,7 @@ NewConsoleOutputWrapper.prototype = {
|
|||
},
|
||||
dispatchMessagesClear: () => {
|
||||
store.dispatch(actions.messagesClear());
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Exports from this module
|
||||
|
|
|
@ -25,10 +25,6 @@ function messages(state = new MessageState(), action) {
|
|||
return state;
|
||||
}
|
||||
|
||||
if (newMessage.type === constants.MESSAGE_TYPE.CLEAR) {
|
||||
return state.set("messagesById", Immutable.List([newMessage]));
|
||||
}
|
||||
|
||||
if (newMessage.allowRepeating && messagesById.size > 0) {
|
||||
let lastMessage = messagesById.last();
|
||||
if (lastMessage.repeatId === newMessage.repeatId) {
|
||||
|
@ -47,7 +43,10 @@ function messages(state = new MessageState(), action) {
|
|||
}
|
||||
});
|
||||
case constants.MESSAGES_CLEAR:
|
||||
return state.set("messagesById", Immutable.List());
|
||||
return state.withMutations(function (record) {
|
||||
record.set("messagesById", Immutable.List());
|
||||
record.set("messagesUiById", Immutable.List());
|
||||
});
|
||||
case constants.MESSAGE_OPEN:
|
||||
return state.set("messagesUiById", messagesUiById.push(action.id));
|
||||
case constants.MESSAGE_CLOSE:
|
||||
|
|
|
@ -10,7 +10,7 @@ const Immutable = require("devtools/client/shared/vendor/immutable");
|
|||
|
||||
const Ui = Immutable.Record({
|
||||
filterBarVisible: false,
|
||||
filteredMessageVisible: false
|
||||
filteredMessageVisible: false,
|
||||
});
|
||||
|
||||
function ui(state = new Ui(), action) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
|
||||
const { getLogLimit } = require("devtools/client/webconsole/new-console-output/selectors/prefs");
|
||||
const {
|
||||
|
@ -31,7 +32,7 @@ function getAllMessagesUiById(state) {
|
|||
|
||||
function filterLevel(messages, filters) {
|
||||
return messages.filter((message) => {
|
||||
return filters[message.level] === true
|
||||
return filters.get(message.level) === true
|
||||
|| [MESSAGE_TYPE.COMMAND, MESSAGE_TYPE.RESULT].includes(message.type);
|
||||
});
|
||||
}
|
||||
|
@ -42,17 +43,51 @@ function search(messages, text = "") {
|
|||
}
|
||||
|
||||
return messages.filter(function (message) {
|
||||
// @TODO: message.parameters can be a grip, see how we can handle that
|
||||
if (!Array.isArray(message.parameters)) {
|
||||
// Evaluation Results and Console Commands are never filtered.
|
||||
if ([ MESSAGE_TYPE.RESULT, MESSAGE_TYPE.COMMAND ].includes(message.type)) {
|
||||
return true;
|
||||
}
|
||||
return message
|
||||
.parameters.join("")
|
||||
.toLocaleLowerCase()
|
||||
.includes(text.toLocaleLowerCase());
|
||||
|
||||
return (
|
||||
// @TODO currently we return true for any object grip. We should find a way to
|
||||
// search object grips.
|
||||
message.parameters !== null && !Array.isArray(message.parameters)
|
||||
// Look for a match in location.
|
||||
|| isTextInFrame(text, message.frame)
|
||||
// Look for a match in stacktrace.
|
||||
|| (
|
||||
Array.isArray(message.stacktrace) &&
|
||||
message.stacktrace.some(frame => isTextInFrame(text,
|
||||
// isTextInFrame expect the properties of the frame object to be in the same
|
||||
// order they are rendered in the Frame component.
|
||||
{
|
||||
functionName: frame.functionName ||
|
||||
l10n.getStr("stacktrace.anonymousFunction"),
|
||||
filename: frame.filename,
|
||||
lineNumber: frame.lineNumber,
|
||||
columnNumber: frame.columnNumber
|
||||
}))
|
||||
)
|
||||
// Look for a match in messageText.
|
||||
|| (message.messageText !== null
|
||||
&& message.messageText.toLocaleLowerCase().includes(text.toLocaleLowerCase()))
|
||||
// Look for a match in parameters. Currently only checks value grips.
|
||||
|| (message.parameters !== null
|
||||
&& message.parameters.join("").toLocaleLowerCase()
|
||||
.includes(text.toLocaleLowerCase()))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function isTextInFrame(text, frame) {
|
||||
// @TODO Change this to Object.values once it's supported in Node's version of V8
|
||||
return Object.keys(frame)
|
||||
.map(key => frame[key])
|
||||
.join(":")
|
||||
.toLocaleLowerCase()
|
||||
.includes(text.toLocaleLowerCase());
|
||||
}
|
||||
|
||||
function prune(messages, logLimit) {
|
||||
let messageCount = messages.count();
|
||||
if (messageCount > logLimit) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
const {FilterState} = require("devtools/client/webconsole/new-console-output/reducers/filters");
|
||||
const {PrefState} = require("devtools/client/webconsole/new-console-output/reducers/prefs");
|
||||
const { combineReducers, createStore } = require("devtools/client/shared/vendor/redux");
|
||||
const { applyMiddleware, combineReducers, createStore } = require("devtools/client/shared/vendor/redux");
|
||||
const { thunk } = require("devtools/client/shared/redux/middleware/thunk");
|
||||
const { reducers } = require("./reducers/index");
|
||||
const Services = require("Services");
|
||||
|
||||
|
@ -22,7 +23,11 @@ function configureStore() {
|
|||
})
|
||||
};
|
||||
|
||||
return createStore(combineReducers(reducers), initialState);
|
||||
return createStore(
|
||||
combineReducers(reducers),
|
||||
initialState,
|
||||
applyMiddleware(thunk)
|
||||
);
|
||||
}
|
||||
|
||||
// Provide the store factory for test code so that each test is working with
|
||||
|
|
|
@ -2,52 +2,60 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { thunk } = require("devtools/client/shared/redux/middleware/thunk");
|
||||
const configureStore = require("redux-mock-store").default;
|
||||
const { getRepeatId } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const { stubPackets, stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const { setupActions } = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
const constants = require("devtools/client/webconsole/new-console-output/constants");
|
||||
|
||||
const mockStore = configureStore([ thunk ]);
|
||||
|
||||
const expect = require("expect");
|
||||
|
||||
let actions;
|
||||
|
||||
describe("Message actions:", () => {
|
||||
before(()=>{
|
||||
beforeEach(()=>{
|
||||
actions = setupActions();
|
||||
});
|
||||
|
||||
describe("messageAdd", () => {
|
||||
it("creates expected action given a packet", () => {
|
||||
const packet = {
|
||||
"from": "server1.conn4.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
"foobar",
|
||||
"test"
|
||||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
"lineNumber": 1,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1455064271115,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
}
|
||||
};
|
||||
const action = actions.messageAdd(packet);
|
||||
it("dispatches expected action given a packet", () => {
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
const store = mockStore({});
|
||||
store.dispatch(actions.messageAdd(packet));
|
||||
|
||||
const expectedActions = store.getActions();
|
||||
expect(expectedActions.length).toEqual(1);
|
||||
|
||||
const addAction = expectedActions[0];
|
||||
const {message} = addAction;
|
||||
const expected = {
|
||||
type: constants.MESSAGE_ADD,
|
||||
message: stubPreparedMessages.get("console.log('foobar', 'test')")
|
||||
};
|
||||
expect(message.toJS()).toEqual(expected.message.toJS());
|
||||
});
|
||||
|
||||
expect(action.message.toJS()).toEqual(expected.message.toJS());
|
||||
it("dispatches expected actions given a console.clear packet", () => {
|
||||
const packet = stubPackets.get("console.clear()");
|
||||
const store = mockStore({});
|
||||
store.dispatch(actions.messageAdd(packet));
|
||||
|
||||
const expectedActions = store.getActions();
|
||||
expect(expectedActions.length).toEqual(2);
|
||||
|
||||
const [clearAction, addAction] = expectedActions;
|
||||
expect(clearAction.type).toEqual(constants.MESSAGES_CLEAR);
|
||||
|
||||
const {message} = addAction;
|
||||
const expected = {
|
||||
type: constants.MESSAGE_ADD,
|
||||
message: stubPreparedMessages.get("console.clear()")
|
||||
};
|
||||
expect(addAction.type).toEqual(constants.MESSAGE_ADD);
|
||||
expect(message.toJS()).toEqual(expected.message.toJS());
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -4,77 +4,99 @@
|
|||
|
||||
// Test utils.
|
||||
const expect = require("expect");
|
||||
const { renderComponent } = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
const { render } = require("enzyme");
|
||||
|
||||
// React
|
||||
const { createFactory } = require("devtools/client/shared/vendor/react");
|
||||
|
||||
// Components under test.
|
||||
const { ConsoleApiCall } = require("devtools/client/webconsole/new-console-output/components/message-types/console-api-call");
|
||||
const ConsoleApiCall = createFactory(require("devtools/client/webconsole/new-console-output/components/message-types/console-api-call").ConsoleApiCall);
|
||||
|
||||
// Test fakes.
|
||||
const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const onViewSourceInDebugger = () => {};
|
||||
|
||||
const tempfilePath = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js";
|
||||
|
||||
describe("ConsoleAPICall component:", () => {
|
||||
describe("console.log", () => {
|
||||
it("renders string grips", () => {
|
||||
const message = stubPreparedMessages.get("console.log('foobar', 'test')");
|
||||
const rendered = renderComponent(ConsoleApiCall, {message, onViewSourceInDebugger});
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
// @TODO should output: foobar test
|
||||
expect(messageBody.textContent).toBe("\"foobar\"\"test\"");
|
||||
|
||||
const consoleStringNodes = messageBody.querySelectorAll(".objectBox-string");
|
||||
expect(consoleStringNodes.length).toBe(2);
|
||||
expect(wrapper.find(".message-body").text()).toBe("foobar test");
|
||||
expect(wrapper.find(".objectBox-string").length).toBe(2);
|
||||
expect(wrapper.find("div.message.cm-s-mozilla span span.message-flex-body span.message-body.devtools-monospace").length).toBe(1);
|
||||
});
|
||||
|
||||
it("renders repeat node", () => {
|
||||
const message =
|
||||
stubPreparedMessages.get("console.log('foobar', 'test')")
|
||||
.set("repeat", 107);
|
||||
const rendered = renderComponent(ConsoleApiCall, {message, onViewSourceInDebugger});
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
const repeatNode = getRepeatNode(rendered);
|
||||
expect(repeatNode[0].textContent).toBe("107");
|
||||
expect(wrapper.find(".message-repeats").text()).toBe("107");
|
||||
|
||||
expect(wrapper.find("span > span.message-flex-body > span.message-body.devtools-monospace + span.message-repeats").length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("console.count", () => {
|
||||
it("renders", () => {
|
||||
const message = stubPreparedMessages.get("console.count('bar')");
|
||||
const rendered = renderComponent(ConsoleApiCall, {message, onViewSourceInDebugger});
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
expect(messageBody.textContent).toBe(message.messageText);
|
||||
expect(wrapper.find(".message-body").text()).toBe("bar: 1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("console.assert", () => {
|
||||
it("renders", () => {
|
||||
const message = stubPreparedMessages.get("console.assert(false, {message: 'foobar'})");
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
expect(wrapper.find(".message-body").text()).toBe("Assertion failed: Object { message: \"foobar\" }");
|
||||
});
|
||||
});
|
||||
|
||||
describe("console.time", () => {
|
||||
it("does not show anything", () => {
|
||||
const message = stubPreparedMessages.get("console.time('bar')");
|
||||
const rendered = renderComponent(ConsoleApiCall, {message, onViewSourceInDebugger});
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
expect(messageBody.textContent).toBe("");
|
||||
expect(wrapper.find(".message-body").text()).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("console.timeEnd", () => {
|
||||
it("renders as expected", () => {
|
||||
const message = stubPreparedMessages.get("console.timeEnd('bar')");
|
||||
const rendered = renderComponent(ConsoleApiCall, {message, onViewSourceInDebugger});
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger }));
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
expect(messageBody.textContent).toBe(message.messageText);
|
||||
expect(messageBody.textContent).toMatch(/^bar: \d+(\.\d+)?ms$/);
|
||||
expect(wrapper.find(".message-body").text()).toBe(message.messageText);
|
||||
expect(wrapper.find(".message-body").text()).toMatch(/^bar: \d+(\.\d+)?ms$/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("console.trace", () => {
|
||||
it("renders", () => {
|
||||
const message = stubPreparedMessages.get("console.trace()");
|
||||
const wrapper = render(ConsoleApiCall({ message, onViewSourceInDebugger, open: true }));
|
||||
const filepath = `${tempfilePath}`;
|
||||
|
||||
expect(wrapper.find(".message-body").text()).toBe("console.trace()");
|
||||
|
||||
const frameLinks = wrapper.find(`.stack-trace span.frame-link[data-url='${filepath}']`);
|
||||
expect(frameLinks.length).toBe(3);
|
||||
|
||||
expect(frameLinks.eq(0).find(".frame-link-function-display-name").text()).toBe("testStacktraceFiltering");
|
||||
expect(frameLinks.eq(0).find(".frame-link-filename").text()).toBe(filepath);
|
||||
|
||||
expect(frameLinks.eq(1).find(".frame-link-function-display-name").text()).toBe("foo");
|
||||
expect(frameLinks.eq(1).find(".frame-link-filename").text()).toBe(filepath);
|
||||
|
||||
expect(frameLinks.eq(2).find(".frame-link-function-display-name").text()).toBe("triggerPacket");
|
||||
expect(frameLinks.eq(2).find(".frame-link-filename").text()).toBe(filepath);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getMessageBody(rendered) {
|
||||
const queryPath = "div.message.cm-s-mozilla span span.message-flex-body span.message-body.devtools-monospace";
|
||||
return rendered.querySelector(queryPath);
|
||||
}
|
||||
|
||||
function getRepeatNode(rendered) {
|
||||
const repeatPath = "span > span.message-flex-body > span.message-body.devtools-monospace + span.message-repeats";
|
||||
return rendered.querySelectorAll(repeatPath);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ describe("EvaluationResult component:", () => {
|
|||
const rendered = renderComponent(EvaluationResult, props);
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
expect(messageBody.textContent).toBe("Date1970-01-01T00:00:00.000Z");
|
||||
expect(messageBody.textContent).toBe("Date 1970-01-01T00:00:00.000Z");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// Test utils.
|
||||
const expect = require("expect");
|
||||
const { render } = require("enzyme");
|
||||
|
||||
// React
|
||||
const { createFactory } = require("devtools/client/shared/vendor/react");
|
||||
|
||||
// Components under test.
|
||||
const NetworkEventMessage = createFactory(require("devtools/client/webconsole/new-console-output/components/message-types/network-event-message").NetworkEventMessage);
|
||||
|
||||
// Test fakes.
|
||||
const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const onViewSourceInDebugger = () => {};
|
||||
const openNetworkPanel = () => {};
|
||||
const openLink = () => {};
|
||||
const EXPECTED_URL = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html";
|
||||
|
||||
describe("NetworkEventMessage component:", () => {
|
||||
describe("GET request", () => {
|
||||
it("renders as expected", () => {
|
||||
const message = stubPreparedMessages.get("GET request");
|
||||
const wrapper = render(NetworkEventMessage({ message, onViewSourceInDebugger, openNetworkPanel, openLink }));
|
||||
|
||||
expect(wrapper.find(".message-body .method").text()).toBe("GET");
|
||||
expect(wrapper.find(".message-body .xhr").length).toBe(0);
|
||||
expect(wrapper.find(".message-body .url").length).toBe(1);
|
||||
expect(wrapper.find(".message-body .url").text()).toBe(EXPECTED_URL);
|
||||
expect(wrapper.find(".message-body .status").length).toBe(1);
|
||||
expect(wrapper.find("div.message.cm-s-mozilla span.message-body.devtools-monospace").length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("XHR GET request", () => {
|
||||
it("renders as expected", () => {
|
||||
const message = stubPreparedMessages.get("XHR GET request");
|
||||
const wrapper = render(NetworkEventMessage({ message, onViewSourceInDebugger, openNetworkPanel, openLink }));
|
||||
|
||||
expect(wrapper.find(".message-body .method").text()).toBe("GET");
|
||||
expect(wrapper.find(".message-body .xhr").length).toBe(1);
|
||||
expect(wrapper.find(".message-body .xhr").text()).toBe("XHR");
|
||||
expect(wrapper.find(".message-body .url").text()).toBe(EXPECTED_URL);
|
||||
expect(wrapper.find(".message-body .status").length).toBe(1);
|
||||
expect(wrapper.find("div.message.cm-s-mozilla span.message-body.devtools-monospace").length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("XHR POST request", () => {
|
||||
it("renders as expected", () => {
|
||||
const message = stubPreparedMessages.get("XHR POST request");
|
||||
const wrapper = render(NetworkEventMessage({ message, onViewSourceInDebugger, openNetworkPanel, openLink }));
|
||||
|
||||
expect(wrapper.find(".message-body .method").text()).toBe("POST");
|
||||
expect(wrapper.find(".message-body .xhr").length).toBe(1);
|
||||
expect(wrapper.find(".message-body .xhr").text()).toBe("XHR");
|
||||
expect(wrapper.find(".message-body .url").length).toBe(1);
|
||||
expect(wrapper.find(".message-body .url").text()).toBe(EXPECTED_URL);
|
||||
expect(wrapper.find(".message-body .status").length).toBe(1);
|
||||
expect(wrapper.find("div.message.cm-s-mozilla span.message-body.devtools-monospace").length).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -2,27 +2,41 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
// Test utils.
|
||||
const expect = require("expect");
|
||||
const { render } = require("enzyme");
|
||||
|
||||
// Components under test.
|
||||
const { PageError } = require("devtools/client/webconsole/new-console-output/components/message-types/page-error");
|
||||
|
||||
const expect = require("expect");
|
||||
|
||||
const {
|
||||
renderComponent
|
||||
} = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
// Test fakes.
|
||||
const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
describe("PageError component:", () => {
|
||||
it("renders a page error", () => {
|
||||
it("renders", () => {
|
||||
const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
|
||||
const rendered = renderComponent(PageError, {message});
|
||||
const wrapper = render(PageError({ message }));
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
expect(messageBody.textContent).toBe("ReferenceError: asdf is not defined");
|
||||
expect(wrapper.find(".message-body").text())
|
||||
.toBe("ReferenceError: asdf is not defined");
|
||||
|
||||
// The stacktrace should be closed by default.
|
||||
const frameLinks = wrapper.find(`.stack-trace`);
|
||||
expect(frameLinks.length).toBe(0);
|
||||
|
||||
// There should be the location
|
||||
const locationLink = wrapper.find(`.message-location`);
|
||||
expect(locationLink.length).toBe(1);
|
||||
// @TODO Will likely change. See https://github.com/devtools-html/gecko-dev/issues/285
|
||||
expect(locationLink.text()).toBe("test-tempfile.js:3:5");
|
||||
});
|
||||
|
||||
it("has a stacktrace which can be openned", () => {
|
||||
const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
|
||||
const wrapper = render(PageError({ message, open: true }));
|
||||
|
||||
// There should be three stacktrace items.
|
||||
const frameLinks = wrapper.find(`.stack-trace span.frame-link`);
|
||||
expect(frameLinks.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
function getMessageBody(rendered) {
|
||||
const queryPath = "div.message span.message-body-wrapper span.message-body";
|
||||
return rendered.querySelector(queryPath);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,15 @@ class L10n {
|
|||
return "Error";
|
||||
case "consoleCleared":
|
||||
return "Console was cleared.";
|
||||
case "webConsoleXhrIndicator":
|
||||
return "XHR";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
getFormatStr(str) {
|
||||
return this.getStr(str);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = L10n;
|
||||
|
|
|
@ -5,11 +5,14 @@ support-files =
|
|||
head.js
|
||||
!/devtools/client/framework/test/shared-head.js
|
||||
test-console-api.html
|
||||
test-network-event.html
|
||||
test-tempfile.js
|
||||
|
||||
[browser_webconsole_update_stubs_console_api.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
[browser_webconsole_update_stubs_evaluation_result.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
[browser_webconsole_update_stubs_network_event.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
[browser_webconsole_update_stubs_page_error.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
|
|
|
@ -16,34 +16,40 @@ let stubs = {
|
|||
};
|
||||
|
||||
add_task(function* () {
|
||||
let tempFilePath = OS.Path.join(`${BASE_PATH}/stub-generators`, "test-tempfile.js");
|
||||
for (var [key, {keys, code}] of snippets) {
|
||||
OS.File.writeAtomic(tempFilePath, `function triggerPacket() {${code}}`);
|
||||
yield OS.File.writeAtomic(TEMP_FILE_PATH, `function triggerPacket() {${code}}`);
|
||||
|
||||
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
|
||||
let hud = toolbox.getCurrentPanel().hud;
|
||||
let {ui} = hud;
|
||||
let {ui} = toolbox.getCurrentPanel().hud;
|
||||
|
||||
ok(ui.jsterm, "jsterm exists");
|
||||
ok(ui.newConsoleOutput, "newConsoleOutput exists");
|
||||
|
||||
let received = new Promise(resolve => {
|
||||
let i = 0;
|
||||
toolbox.target.client.addListener("consoleAPICall", (type, res) => {
|
||||
let listener = (type, res) => {
|
||||
stubs.packets.push(formatPacket(keys[i], res));
|
||||
stubs.preparedMessages.push(formatStub(keys[i], res));
|
||||
if(++i === keys.length ){
|
||||
toolbox.target.client.removeListener("consoleAPICall", listener);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
};
|
||||
toolbox.target.client.addListener("consoleAPICall", listener);
|
||||
});
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
content.wrappedJSObject.triggerPacket();
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, key, function(key) {
|
||||
var script = content.document.createElement("script");
|
||||
script.src = "test-tempfile.js?key=" + encodeURIComponent(key);
|
||||
script.onload = function() { content.wrappedJSObject.triggerPacket(); }
|
||||
content.document.body.appendChild(script);
|
||||
});
|
||||
|
||||
yield received;
|
||||
|
||||
yield closeTabAndToolbox();
|
||||
}
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs`, "consoleApi.js");
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
OS.File.writeAtomic(tempFilePath, "");
|
||||
OS.File.writeAtomic(TEMP_FILE_PATH, "");
|
||||
});
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
const TARGET = "networkEvent";
|
||||
const { [TARGET]: snippets } = require("devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js");
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html";
|
||||
|
||||
let stubs = {
|
||||
preparedMessages: [],
|
||||
packets: [],
|
||||
};
|
||||
|
||||
add_task(function* () {
|
||||
for (var [key, {keys, code}] of snippets) {
|
||||
OS.File.writeAtomic(TEMP_FILE_PATH, `function triggerPacket() {${code}}`);
|
||||
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
|
||||
let {ui} = toolbox.getCurrentPanel().hud;
|
||||
|
||||
ok(ui.jsterm, "jsterm exists");
|
||||
ok(ui.newConsoleOutput, "newConsoleOutput exists");
|
||||
|
||||
let received = new Promise(resolve => {
|
||||
let i = 0;
|
||||
toolbox.target.client.addListener(TARGET, (type, res) => {
|
||||
stubs.packets.push(formatPacket(keys[i], res));
|
||||
stubs.preparedMessages.push(formatNetworkStub(keys[i], res));
|
||||
if(++i === keys.length ){
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
content.wrappedJSObject.triggerPacket();
|
||||
});
|
||||
|
||||
yield received;
|
||||
}
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs/${TARGET}.js`);
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
OS.File.writeAtomic(TEMP_FILE_PATH, "");
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
const TEST_URI = "data:text/html;charset=utf-8,stub generation";
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html";
|
||||
|
||||
const { pageError: snippets} = require("devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js");
|
||||
|
||||
|
@ -20,6 +20,7 @@ add_task(function* () {
|
|||
ok(true, "make the test not fail");
|
||||
|
||||
for (var [key,code] of snippets) {
|
||||
OS.File.writeAtomic(TEMP_FILE_PATH, `${code}`);
|
||||
let received = new Promise(resolve => {
|
||||
toolbox.target.client.addListener("pageError", function onPacket(e, packet) {
|
||||
toolbox.target.client.removeListener("pageError", onPacket);
|
||||
|
@ -32,13 +33,10 @@ add_task(function* () {
|
|||
});
|
||||
});
|
||||
|
||||
info("Injecting script: " + code);
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, code, function(code) {
|
||||
let container = content.document.createElement("script");
|
||||
content.document.body.appendChild(container);
|
||||
container.textContent = code;
|
||||
content.document.body.removeChild(container);
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, key, function(key) {
|
||||
var script = content.document.createElement("script");
|
||||
script.src = "test-tempfile.js?key=" + encodeURIComponent(key);
|
||||
content.document.body.appendChild(script);
|
||||
});
|
||||
|
||||
yield received;
|
||||
|
@ -46,4 +44,5 @@ add_task(function* () {
|
|||
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs`, "pageError.js");
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
OS.File.writeAtomic(TEMP_FILE_PATH, "");
|
||||
});
|
||||
|
|
|
@ -20,6 +20,7 @@ registerCleanupFunction(() => {
|
|||
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
|
||||
const BASE_PATH = "../../../../devtools/client/webconsole/new-console-output/test/fixtures";
|
||||
const TEMP_FILE_PATH = OS.Path.join(`${BASE_PATH}/stub-generators`, "test-tempfile.js");
|
||||
|
||||
function formatPacket(key, packet) {
|
||||
return `
|
||||
|
@ -34,6 +35,36 @@ stubPreparedMessages.set("${key}", new ConsoleMessage(${JSON.stringify(prepared,
|
|||
`;
|
||||
}
|
||||
|
||||
function formatNetworkStub(key, packet) {
|
||||
let actor = packet.eventActor;
|
||||
let networkInfo = {
|
||||
_type: "NetworkEvent",
|
||||
timeStamp: actor.timeStamp,
|
||||
node: null,
|
||||
actor: actor.actor,
|
||||
discardRequestBody: true,
|
||||
discardResponseBody: true,
|
||||
startedDateTime: actor.startedDateTime,
|
||||
request: {
|
||||
url: actor.url,
|
||||
method: actor.method,
|
||||
},
|
||||
isXHR: actor.isXHR,
|
||||
cause: actor.cause,
|
||||
response: {},
|
||||
timings: {},
|
||||
// track the list of network event updates
|
||||
updates: [],
|
||||
private: actor.private,
|
||||
fromCache: actor.fromCache,
|
||||
fromServiceWorker: actor.fromServiceWorker
|
||||
};
|
||||
let prepared = prepareMessage(networkInfo, {getNextId: () => "1"});
|
||||
return `
|
||||
stubPreparedMessages.set("${key}", new NetworkEventMessage(${JSON.stringify(prepared, null, "\t")}));
|
||||
`;
|
||||
}
|
||||
|
||||
function formatFile(stubs) {
|
||||
return `/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
@ -44,7 +75,7 @@ function formatFile(stubs) {
|
|||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
const { ConsoleMessage, NetworkEventMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubPreparedMessages = new Map();
|
||||
let stubPackets = new Map();
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a");
|
||||
var initialString = longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
|
||||
|
||||
// Console API
|
||||
|
||||
const consoleApiCommands = [
|
||||
|
@ -11,8 +15,12 @@ const consoleApiCommands = [
|
|||
"console.warn('danger, will robinson!')",
|
||||
"console.log(NaN)",
|
||||
"console.log(null)",
|
||||
"console.log('\u9f2c')",
|
||||
"console.clear()",
|
||||
"console.count('bar')",
|
||||
"console.assert(false, {message: 'foobar'})",
|
||||
"console.log('hello \\nfrom \\rthe \\\"string world!')",
|
||||
"console.log('\xFA\u1E47\u0129\xE7\xF6d\xEA \u021B\u0115\u0219\u0165')",
|
||||
];
|
||||
|
||||
let consoleApi = new Map(consoleApiCommands.map(
|
||||
|
@ -21,11 +29,11 @@ let consoleApi = new Map(consoleApiCommands.map(
|
|||
consoleApi.set("console.trace()", {
|
||||
keys: ["console.trace()"],
|
||||
code: `
|
||||
function bar() {
|
||||
function testStacktraceFiltering() {
|
||||
console.trace()
|
||||
}
|
||||
function foo() {
|
||||
bar()
|
||||
testStacktraceFiltering()
|
||||
}
|
||||
|
||||
foo()
|
||||
|
@ -46,16 +54,51 @@ const evaluationResultCommands = [
|
|||
|
||||
let evaluationResult = new Map(evaluationResultCommands.map(cmd => [cmd, cmd]));
|
||||
|
||||
// Network Event
|
||||
|
||||
let networkEvent = new Map();
|
||||
|
||||
networkEvent.set("GET request", {
|
||||
keys: ["GET request"],
|
||||
code: `
|
||||
let i = document.createElement("img");
|
||||
i.src = "inexistent.html";
|
||||
`});
|
||||
|
||||
networkEvent.set("XHR GET request", {
|
||||
keys: ["XHR GET request"],
|
||||
code: `
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "inexistent.html");
|
||||
xhr.send();
|
||||
`});
|
||||
|
||||
networkEvent.set("XHR POST request", {
|
||||
keys: ["XHR POST request"],
|
||||
code: `
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "inexistent.html");
|
||||
xhr.send();
|
||||
`});
|
||||
|
||||
// Page Error
|
||||
|
||||
const pageErrorCommands = [
|
||||
"asdf()",
|
||||
];
|
||||
let pageError = new Map();
|
||||
|
||||
let pageError = new Map(pageErrorCommands.map(cmd => [cmd, cmd]));
|
||||
pageError.set("Reference Error", `
|
||||
function bar() {
|
||||
asdf()
|
||||
}
|
||||
function foo() {
|
||||
bar()
|
||||
}
|
||||
|
||||
foo()
|
||||
`);
|
||||
|
||||
module.exports = {
|
||||
consoleApi,
|
||||
evaluationResult,
|
||||
networkEvent,
|
||||
pageError,
|
||||
};
|
||||
|
|
11
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html
поставляемый
Normal file
11
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html
поставляемый
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Stub generator for network event</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Stub generator for network event</p>
|
||||
<script src="test-tempfile.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -7,7 +7,7 @@
|
|||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
const { ConsoleMessage, NetworkEventMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubPreparedMessages = new Map();
|
||||
let stubPackets = new Map();
|
||||
|
@ -25,10 +25,10 @@ stubPreparedMessages.set("console.log('foobar', 'test')", new ConsoleMessage({
|
|||
"test"
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"foobar\",\"test\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"foobar\",\"test\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27foobar%27%2C%20%27test%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27foobar%27%2C%20%27test%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ stubPreparedMessages.set("console.log(undefined)", new ConsoleMessage({
|
|||
}
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"undefined\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"undefined\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(undefined)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(undefined)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ stubPreparedMessages.set("console.warn('danger, will robinson!')", new ConsoleMe
|
|||
"danger, will robinson!"
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"warn\",\"level\":\"warn\",\"messageText\":null,\"parameters\":[\"danger, will robinson!\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"warn\",\"level\":\"warn\",\"messageText\":null,\"parameters\":[\"danger, will robinson!\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.warn(%27danger%2C%20will%20robinson!%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.warn(%27danger%2C%20will%20robinson!%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -89,10 +89,10 @@ stubPreparedMessages.set("console.log(NaN)", new ConsoleMessage({
|
|||
}
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"NaN\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"NaN\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(NaN)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(NaN)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -111,10 +111,30 @@ stubPreparedMessages.set("console.log(null)", new ConsoleMessage({
|
|||
}
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"null\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"null\"}],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(null)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(null)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("console.log('鼬')", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"type": "log",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": [
|
||||
"鼬"
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"鼬\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%E9%BC%AC%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%E9%BC%AC%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -131,10 +151,10 @@ stubPreparedMessages.set("console.clear()", new ConsoleMessage({
|
|||
"Console was cleared."
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"clear\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"Console was cleared.\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"clear\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"Console was cleared.\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.clear()\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.clear()",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -149,10 +169,99 @@ stubPreparedMessages.set("console.count('bar')", new ConsoleMessage({
|
|||
"messageText": "bar: 1",
|
||||
"parameters": null,
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"debug\",\"messageText\":\"bar: 1\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":1,\"column\":27}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"debug\",\"messageText\":\"bar: 1\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.count(%27bar%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.count(%27bar%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("console.assert(false, {message: 'foobar'})", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"type": "assert",
|
||||
"level": "error",
|
||||
"messageText": null,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "object",
|
||||
"actor": "server1.conn8.child1/obj31",
|
||||
"class": "Object",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 1,
|
||||
"preview": {
|
||||
"kind": "Object",
|
||||
"ownProperties": {
|
||||
"message": {
|
||||
"configurable": true,
|
||||
"enumerable": true,
|
||||
"writable": true,
|
||||
"value": "foobar"
|
||||
}
|
||||
},
|
||||
"ownPropertiesLength": 1,
|
||||
"safeGetterValues": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"assert\",\"level\":\"error\",\"messageText\":null,\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn8.child1/obj31\",\"class\":\"Object\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":1,\"preview\":{\"kind\":\"Object\",\"ownProperties\":{\"message\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"foobar\"}},\"ownPropertiesLength\":1,\"safeGetterValues\":{}}}],\"repeatId\":null,\"stacktrace\":[{\"columnNumber\":27,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)\",\"functionName\":\"triggerPacket\",\"language\":2,\"lineNumber\":1}],\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": [
|
||||
{
|
||||
"columnNumber": 27,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)",
|
||||
"functionName": "triggerPacket",
|
||||
"language": 2,
|
||||
"lineNumber": 1
|
||||
}
|
||||
],
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("console.log('hello \nfrom \rthe \"string world!')", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"type": "log",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": [
|
||||
"hello \nfrom \rthe \"string world!"
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"hello \\nfrom \\rthe \\\"string world!\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27hello%20%5Cnfrom%20%5Crthe%20%5C%22string%20world!%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27hello%20%5Cnfrom%20%5Crthe%20%5C%22string%20world!%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("console.log('úṇĩçödê țĕșť')", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"type": "log",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": [
|
||||
"úṇĩçödê țĕșť"
|
||||
],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"log\",\"level\":\"log\",\"messageText\":null,\"parameters\":[\"úṇĩçödê țĕșť\"],\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%C3%BA%E1%B9%87%C4%A9%C3%A7%C3%B6d%C3%AA%20%C8%9B%C4%95%C8%99%C5%A5%27)\",\"line\":1,\"column\":27}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%C3%BA%E1%B9%87%C4%A9%C3%A7%C3%B6d%C3%AA%20%C8%9B%C4%95%C8%99%C5%A5%27)",
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
|
@ -167,32 +276,32 @@ stubPreparedMessages.set("console.trace()", new ConsoleMessage({
|
|||
"messageText": null,
|
||||
"parameters": [],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"trace\",\"level\":\"log\",\"messageText\":null,\"parameters\":[],\"repeatId\":null,\"stacktrace\":[{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"bar\",\"language\":2,\"lineNumber\":3},{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"foo\",\"language\":2,\"lineNumber\":6},{\"columnNumber\":1,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"triggerPacket\",\"language\":2,\"lineNumber\":9}],\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":3,\"column\":3}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"trace\",\"level\":\"log\",\"messageText\":null,\"parameters\":[],\"repeatId\":null,\"stacktrace\":[{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()\",\"functionName\":\"testStacktraceFiltering\",\"language\":2,\"lineNumber\":3},{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()\",\"functionName\":\"foo\",\"language\":2,\"lineNumber\":6},{\"columnNumber\":1,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()\",\"functionName\":\"triggerPacket\",\"language\":2,\"lineNumber\":9}],\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()\",\"line\":3,\"column\":3}}",
|
||||
"stacktrace": [
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "bar",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "testStacktraceFiltering",
|
||||
"language": 2,
|
||||
"lineNumber": 3
|
||||
},
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "foo",
|
||||
"language": 2,
|
||||
"lineNumber": 6
|
||||
},
|
||||
{
|
||||
"columnNumber": 1,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "triggerPacket",
|
||||
"language": 2,
|
||||
"lineNumber": 9
|
||||
}
|
||||
],
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"line": 3,
|
||||
"column": 3
|
||||
}
|
||||
|
@ -207,10 +316,10 @@ stubPreparedMessages.set("console.time('bar')", new ConsoleMessage({
|
|||
"messageText": null,
|
||||
"parameters": null,
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"nullMessage\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":2,\"column\":1}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"nullMessage\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)\",\"line\":2,\"column\":1}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)",
|
||||
"line": 2,
|
||||
"column": 1
|
||||
}
|
||||
|
@ -222,13 +331,13 @@ stubPreparedMessages.set("console.timeEnd('bar')", new ConsoleMessage({
|
|||
"source": "console-api",
|
||||
"type": "timeEnd",
|
||||
"level": "log",
|
||||
"messageText": "bar: 2.01ms",
|
||||
"messageText": "bar: 1.63ms",
|
||||
"parameters": null,
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"timeEnd\",\"level\":\"log\",\"messageText\":\"bar: 2.01ms\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":3,\"column\":1}}",
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"timeEnd\",\"level\":\"log\",\"messageText\":\"bar: 1.63ms\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)\",\"line\":3,\"column\":1}}",
|
||||
"stacktrace": null,
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)",
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
|
@ -245,7 +354,7 @@ stubPackets.set("console.log('foobar', 'test')", {
|
|||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27foobar%27%2C%20%27test%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
|
@ -253,6 +362,7 @@ stubPackets.set("console.log('foobar', 'test')", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
|
@ -260,7 +370,7 @@ stubPackets.set("console.log('foobar', 'test')", {
|
|||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1471885545204,
|
||||
"timeStamp": 1474329261562,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
|
@ -278,7 +388,7 @@ stubPackets.set("console.log(undefined)", {
|
|||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(undefined)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
|
@ -286,6 +396,7 @@ stubPackets.set("console.log(undefined)", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
|
@ -293,7 +404,7 @@ stubPackets.set("console.log(undefined)", {
|
|||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1471885546075,
|
||||
"timeStamp": 1474329262588,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
|
@ -309,7 +420,7 @@ stubPackets.set("console.warn('danger, will robinson!')", {
|
|||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.warn(%27danger%2C%20will%20robinson!%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "warn",
|
||||
|
@ -317,6 +428,7 @@ stubPackets.set("console.warn('danger, will robinson!')", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
|
@ -324,7 +436,7 @@ stubPackets.set("console.warn('danger, will robinson!')", {
|
|||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1471885546795,
|
||||
"timeStamp": 1474329263650,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
|
@ -342,7 +454,7 @@ stubPackets.set("console.log(NaN)", {
|
|||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(NaN)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
|
@ -350,6 +462,7 @@ stubPackets.set("console.log(NaN)", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
|
@ -357,7 +470,7 @@ stubPackets.set("console.log(NaN)", {
|
|||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1471885547605,
|
||||
"timeStamp": 1474329264822,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
|
@ -375,7 +488,7 @@ stubPackets.set("console.log(null)", {
|
|||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(null)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
|
@ -383,6 +496,7 @@ stubPackets.set("console.log(null)", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
|
@ -390,7 +504,39 @@ stubPackets.set("console.log(null)", {
|
|||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1471885548414,
|
||||
"timeStamp": 1474329265855,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("console.log('鼬')", {
|
||||
"from": "server1.conn5.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
"鼬"
|
||||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%E9%BC%AC%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
"lineNumber": 1,
|
||||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1474329266922,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
|
@ -398,13 +544,13 @@ stubPackets.set("console.log(null)", {
|
|||
});
|
||||
|
||||
stubPackets.set("console.clear()", {
|
||||
"from": "server1.conn5.child1/consoleActor2",
|
||||
"from": "server1.conn6.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.clear()",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "clear",
|
||||
|
@ -412,13 +558,14 @@ stubPackets.set("console.clear()", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1471885549077,
|
||||
"timeStamp": 1474329267971,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
|
@ -427,7 +574,7 @@ stubPackets.set("console.clear()", {
|
|||
});
|
||||
|
||||
stubPackets.set("console.count('bar')", {
|
||||
"from": "server1.conn6.child1/consoleActor2",
|
||||
"from": "server1.conn7.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
|
@ -438,7 +585,7 @@ stubPackets.set("console.count('bar')", {
|
|||
"count": 1,
|
||||
"label": "bar"
|
||||
},
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.count(%27bar%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "count",
|
||||
|
@ -446,13 +593,14 @@ stubPackets.set("console.count('bar')", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1471885549791,
|
||||
"timeStamp": 1474329269084,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
|
@ -460,47 +608,174 @@ stubPackets.set("console.count('bar')", {
|
|||
}
|
||||
});
|
||||
|
||||
stubPackets.set("console.trace()", {
|
||||
"from": "server1.conn7.child1/consoleActor2",
|
||||
stubPackets.set("console.assert(false, {message: 'foobar'})", {
|
||||
"from": "server1.conn8.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [],
|
||||
"columnNumber": 3,
|
||||
"arguments": [
|
||||
{
|
||||
"type": "object",
|
||||
"actor": "server1.conn8.child1/obj31",
|
||||
"class": "Object",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 1,
|
||||
"preview": {
|
||||
"kind": "Object",
|
||||
"ownProperties": {
|
||||
"message": {
|
||||
"configurable": true,
|
||||
"enumerable": true,
|
||||
"writable": true,
|
||||
"value": "foobar"
|
||||
}
|
||||
},
|
||||
"ownPropertiesLength": 1,
|
||||
"safeGetterValues": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "bar",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "trace",
|
||||
"lineNumber": 3,
|
||||
"level": "assert",
|
||||
"lineNumber": 1,
|
||||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1471885551114,
|
||||
"styles": [],
|
||||
"timeStamp": 1474329270125,
|
||||
"timer": null,
|
||||
"stacktrace": [
|
||||
{
|
||||
"columnNumber": 27,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.assert(false%2C%20%7Bmessage%3A%20%27foobar%27%7D)",
|
||||
"functionName": "triggerPacket",
|
||||
"language": 2,
|
||||
"lineNumber": 1
|
||||
}
|
||||
],
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("console.log('hello \nfrom \rthe \"string world!')", {
|
||||
"from": "server1.conn9.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
"hello \nfrom \rthe \"string world!"
|
||||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27hello%20%5Cnfrom%20%5Crthe%20%5C%22string%20world!%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
"lineNumber": 1,
|
||||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1474329271256,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("console.log('úṇĩçödê țĕșť')", {
|
||||
"from": "server1.conn10.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
"úṇĩçödê țĕșť"
|
||||
],
|
||||
"columnNumber": 27,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.log(%27%C3%BA%E1%B9%87%C4%A9%C3%A7%C3%B6d%C3%AA%20%C8%9B%C4%95%C8%99%C5%A5%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "log",
|
||||
"lineNumber": 1,
|
||||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1474329272298,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("console.trace()", {
|
||||
"from": "server1.conn11.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [],
|
||||
"columnNumber": 3,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "testStacktraceFiltering",
|
||||
"groupName": "",
|
||||
"level": "trace",
|
||||
"lineNumber": 3,
|
||||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1474329273375,
|
||||
"timer": null,
|
||||
"stacktrace": [
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "bar",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "testStacktraceFiltering",
|
||||
"language": 2,
|
||||
"lineNumber": 3
|
||||
},
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "foo",
|
||||
"language": 2,
|
||||
"lineNumber": 6
|
||||
},
|
||||
{
|
||||
"columnNumber": 1,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.trace()",
|
||||
"functionName": "triggerPacket",
|
||||
"language": 2,
|
||||
"lineNumber": 9
|
||||
|
@ -513,7 +788,7 @@ stubPackets.set("console.trace()", {
|
|||
});
|
||||
|
||||
stubPackets.set("console.time('bar')", {
|
||||
"from": "server1.conn8.child1/consoleActor2",
|
||||
"from": "server1.conn12.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
|
@ -521,7 +796,7 @@ stubPackets.set("console.time('bar')", {
|
|||
],
|
||||
"columnNumber": 1,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "time",
|
||||
|
@ -529,16 +804,17 @@ stubPackets.set("console.time('bar')", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1471885552201,
|
||||
"timeStamp": 1474329274410,
|
||||
"timer": {
|
||||
"name": "bar",
|
||||
"started": 970.09
|
||||
"started": 618.57
|
||||
},
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
|
@ -547,7 +823,7 @@ stubPackets.set("console.time('bar')", {
|
|||
});
|
||||
|
||||
stubPackets.set("console.timeEnd('bar')", {
|
||||
"from": "server1.conn8.child1/consoleActor2",
|
||||
"from": "server1.conn12.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"arguments": [
|
||||
|
@ -555,7 +831,7 @@ stubPackets.set("console.timeEnd('bar')", {
|
|||
],
|
||||
"columnNumber": 1,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=console.time(%27bar%27)",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"level": "timeEnd",
|
||||
|
@ -563,15 +839,16 @@ stubPackets.set("console.timeEnd('bar')", {
|
|||
"originAttributes": {
|
||||
"addonId": "",
|
||||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"signedPkg": "",
|
||||
"userContextId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1471885552203,
|
||||
"timeStamp": 1474329274411,
|
||||
"timer": {
|
||||
"duration": 2.0149999999999864,
|
||||
"duration": 1.3249999999999318,
|
||||
"name": "bar"
|
||||
},
|
||||
"workerType": "none",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
const { ConsoleMessage, NetworkEventMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubPreparedMessages = new Map();
|
||||
let stubPackets = new Map();
|
||||
|
|
|
@ -8,6 +8,7 @@ let maps = [];
|
|||
[
|
||||
"consoleApi",
|
||||
"evaluationResult",
|
||||
"networkEvent",
|
||||
"pageError",
|
||||
].forEach((filename) => {
|
||||
maps[filename] = require(`./${filename}`);
|
||||
|
@ -18,9 +19,11 @@ module.exports = {
|
|||
stubPreparedMessages: new Map([
|
||||
...maps.consoleApi.stubPreparedMessages,
|
||||
...maps.evaluationResult.stubPreparedMessages,
|
||||
...maps.networkEvent.stubPreparedMessages,
|
||||
...maps.pageError.stubPreparedMessages, ]),
|
||||
stubPackets: new Map([
|
||||
...maps.consoleApi.stubPackets,
|
||||
...maps.evaluationResult.stubPackets,
|
||||
...maps.networkEvent.stubPackets,
|
||||
...maps.pageError.stubPackets, ]),
|
||||
};
|
||||
|
|
186
devtools/client/webconsole/new-console-output/test/fixtures/stubs/networkEvent.js
поставляемый
Normal file
186
devtools/client/webconsole/new-console-output/test/fixtures/stubs/networkEvent.js
поставляемый
Normal file
|
@ -0,0 +1,186 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage, NetworkEventMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubPreparedMessages = new Map();
|
||||
let stubPackets = new Map();
|
||||
|
||||
|
||||
stubPreparedMessages.set("GET request", new NetworkEventMessage({
|
||||
"id": "1",
|
||||
"actor": "server1.conn0.child1/netEvent29",
|
||||
"level": "log",
|
||||
"isXHR": false,
|
||||
"request": {
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {},
|
||||
"source": "network",
|
||||
"type": "log"
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("XHR GET request", new NetworkEventMessage({
|
||||
"id": "1",
|
||||
"actor": "server1.conn1.child1/netEvent29",
|
||||
"level": "log",
|
||||
"isXHR": true,
|
||||
"request": {
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {},
|
||||
"source": "network",
|
||||
"type": "log"
|
||||
}));
|
||||
|
||||
stubPreparedMessages.set("XHR POST request", new NetworkEventMessage({
|
||||
"id": "1",
|
||||
"actor": "server1.conn2.child1/netEvent29",
|
||||
"level": "log",
|
||||
"isXHR": true,
|
||||
"request": {
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "POST"
|
||||
},
|
||||
"response": {},
|
||||
"source": "network",
|
||||
"type": "log"
|
||||
}));
|
||||
|
||||
|
||||
stubPackets.set("GET request", {
|
||||
"from": "server1.conn0.child1/consoleActor2",
|
||||
"type": "networkEvent",
|
||||
"eventActor": {
|
||||
"actor": "server1.conn0.child1/netEvent29",
|
||||
"startedDateTime": "2016-09-14T02:38:18.046Z",
|
||||
"timeStamp": 1473820698046,
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "GET",
|
||||
"isXHR": false,
|
||||
"cause": {
|
||||
"type": 3,
|
||||
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"lineNumber": 3,
|
||||
"columnNumber": 1,
|
||||
"functionName": "triggerPacket",
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js line 52 > eval",
|
||||
"lineNumber": 4,
|
||||
"columnNumber": 7,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js",
|
||||
"lineNumber": 53,
|
||||
"columnNumber": 20,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"private": false
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("XHR GET request", {
|
||||
"from": "server1.conn1.child1/consoleActor2",
|
||||
"type": "networkEvent",
|
||||
"eventActor": {
|
||||
"actor": "server1.conn1.child1/netEvent29",
|
||||
"startedDateTime": "2016-09-14T02:38:18.812Z",
|
||||
"timeStamp": 1473820698812,
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "GET",
|
||||
"isXHR": true,
|
||||
"cause": {
|
||||
"type": 11,
|
||||
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"lineNumber": 4,
|
||||
"columnNumber": 1,
|
||||
"functionName": "triggerPacket",
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js line 52 > eval",
|
||||
"lineNumber": 4,
|
||||
"columnNumber": 7,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js",
|
||||
"lineNumber": 53,
|
||||
"columnNumber": 20,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"private": false
|
||||
}
|
||||
});
|
||||
|
||||
stubPackets.set("XHR POST request", {
|
||||
"from": "server1.conn2.child1/consoleActor2",
|
||||
"type": "networkEvent",
|
||||
"eventActor": {
|
||||
"actor": "server1.conn2.child1/netEvent29",
|
||||
"startedDateTime": "2016-09-14T02:38:19.483Z",
|
||||
"timeStamp": 1473820699483,
|
||||
"url": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/inexistent.html",
|
||||
"method": "POST",
|
||||
"isXHR": true,
|
||||
"cause": {
|
||||
"type": 11,
|
||||
"loadingDocumentUri": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-network-event.html",
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"lineNumber": 4,
|
||||
"columnNumber": 1,
|
||||
"functionName": "triggerPacket",
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js line 52 > eval",
|
||||
"lineNumber": 4,
|
||||
"columnNumber": 7,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js",
|
||||
"lineNumber": 53,
|
||||
"columnNumber": 20,
|
||||
"functionName": null,
|
||||
"asyncCause": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"private": false
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
module.exports = {
|
||||
stubPreparedMessages,
|
||||
stubPackets,
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
const { ConsoleMessage, NetworkEventMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubPreparedMessages = new Map();
|
||||
let stubPackets = new Map();
|
||||
|
@ -22,9 +22,32 @@ stubPreparedMessages.set("ReferenceError: asdf is not defined", new ConsoleMessa
|
|||
"messageText": "ReferenceError: asdf is not defined",
|
||||
"parameters": null,
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"javascript\",\"type\":\"log\",\"level\":\"error\",\"messageText\":\"ReferenceError: asdf is not defined\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":null}",
|
||||
"stacktrace": null,
|
||||
"frame": null
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"javascript\",\"type\":\"log\",\"level\":\"error\",\"messageText\":\"ReferenceError: asdf is not defined\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":[{\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error\",\"lineNumber\":3,\"columnNumber\":5,\"functionName\":\"bar\"},{\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error\",\"lineNumber\":6,\"columnNumber\":5,\"functionName\":\"foo\"},{\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error\",\"lineNumber\":9,\"columnNumber\":3,\"functionName\":null}],\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error\",\"line\":3,\"column\":5}}",
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 3,
|
||||
"columnNumber": 5,
|
||||
"functionName": "bar"
|
||||
},
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 6,
|
||||
"columnNumber": 5,
|
||||
"functionName": "foo"
|
||||
},
|
||||
{
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 9,
|
||||
"columnNumber": 3,
|
||||
"functionName": null
|
||||
}
|
||||
],
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"line": 3,
|
||||
"column": 5
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
|
@ -35,12 +58,12 @@ stubPackets.set("ReferenceError: asdf is not defined", {
|
|||
"errorMessage": "ReferenceError: asdf is not defined",
|
||||
"errorMessageName": "JSMSG_NOT_DEFINED",
|
||||
"exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
|
||||
"sourceName": "data:text/html;charset=utf-8,stub%20generation",
|
||||
"sourceName": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineText": "",
|
||||
"lineNumber": 1,
|
||||
"columnNumber": 1,
|
||||
"lineNumber": 3,
|
||||
"columnNumber": 5,
|
||||
"category": "content javascript",
|
||||
"timeStamp": 1471886066466,
|
||||
"timeStamp": 1473960366996,
|
||||
"warning": false,
|
||||
"error": false,
|
||||
"exception": true,
|
||||
|
@ -49,21 +72,21 @@ stubPackets.set("ReferenceError: asdf is not defined", {
|
|||
"private": false,
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "data:text/html;charset=utf-8,stub%20generation",
|
||||
"lineNumber": 1,
|
||||
"columnNumber": 1,
|
||||
"functionName": null
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 3,
|
||||
"columnNumber": 5,
|
||||
"functionName": "bar"
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js line 52 > eval",
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 6,
|
||||
"columnNumber": 7,
|
||||
"functionName": null
|
||||
"columnNumber": 5,
|
||||
"functionName": "foo"
|
||||
},
|
||||
{
|
||||
"filename": "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js",
|
||||
"lineNumber": 53,
|
||||
"columnNumber": 20,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js?key=Reference%20Error",
|
||||
"lineNumber": 9,
|
||||
"columnNumber": 3,
|
||||
"functionName": null
|
||||
}
|
||||
]
|
||||
|
|
|
@ -12,25 +12,19 @@ const { getAllMessages } = require("devtools/client/webconsole/new-console-outpu
|
|||
const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
|
||||
const { setupStore } = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
const { MESSAGE_LEVEL } = require("devtools/client/webconsole/new-console-output/constants");
|
||||
const { stubPackets } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
describe("Filtering", () => {
|
||||
const numMessages = 7;
|
||||
const store = setupStore([
|
||||
// Console API
|
||||
"console.log('foobar', 'test')",
|
||||
"console.warn('danger, will robinson!')",
|
||||
"console.log(undefined)",
|
||||
"console.count('bar')",
|
||||
// Evaluation Result
|
||||
"new Date(0)",
|
||||
// PageError
|
||||
"ReferenceError: asdf is not defined"
|
||||
]);
|
||||
// Console Command
|
||||
store.dispatch(messageAdd(new ConsoleCommand({ messageText: `console.warn("x")` })));
|
||||
let store;
|
||||
let numMessages;
|
||||
// Number of messages in prepareBaseStore which are not filtered out, i.e. Evaluation
|
||||
// Results and console commands .
|
||||
const numUnfilterableMessages = 2;
|
||||
|
||||
beforeEach(() => {
|
||||
store = prepareBaseStore();
|
||||
store.dispatch(actions.filtersClear());
|
||||
numMessages = getAllMessages(store.getState()).size;
|
||||
});
|
||||
|
||||
describe("Level filter", () => {
|
||||
|
@ -38,7 +32,7 @@ describe("Filtering", () => {
|
|||
store.dispatch(actions.filterToggle(MESSAGE_LEVEL.LOG));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size).toEqual(numMessages - 2);
|
||||
expect(messages.size).toEqual(numMessages - 3);
|
||||
});
|
||||
|
||||
it("filters debug messages", () => {
|
||||
|
@ -71,9 +65,63 @@ describe("Filtering", () => {
|
|||
store.dispatch(actions.filterTextSet("danger"));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
// @TODO figure out what this should filter
|
||||
// This does not filter out PageErrors, Evaluation Results or console commands
|
||||
expect(messages.size).toEqual(5);
|
||||
expect(messages.size - numUnfilterableMessages).toEqual(1);
|
||||
});
|
||||
|
||||
it("matches unicode values", () => {
|
||||
store.dispatch(actions.filterTextSet("鼬"));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size - numUnfilterableMessages).toEqual(1);
|
||||
});
|
||||
|
||||
it("matches locations", () => {
|
||||
// Add a message with a different filename.
|
||||
let locationMsg =
|
||||
Object.assign({}, stubPackets.get("console.log('foobar', 'test')"));
|
||||
locationMsg.message =
|
||||
Object.assign({}, locationMsg.message, { filename: "search-location-test.js" });
|
||||
store.dispatch(messageAdd(locationMsg));
|
||||
|
||||
store.dispatch(actions.filterTextSet("search-location-test.js"));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size - numUnfilterableMessages).toEqual(1);
|
||||
});
|
||||
|
||||
it("matches stacktrace functionName", () => {
|
||||
let traceMessage = stubPackets.get("console.trace()");
|
||||
store.dispatch(messageAdd(traceMessage));
|
||||
|
||||
store.dispatch(actions.filterTextSet("testStacktraceFiltering"));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size - numUnfilterableMessages).toEqual(1);
|
||||
});
|
||||
|
||||
it("matches stacktrace location", () => {
|
||||
let traceMessage = stubPackets.get("console.trace()");
|
||||
traceMessage.message =
|
||||
Object.assign({}, traceMessage.message, {
|
||||
filename: "search-location-test.js",
|
||||
lineNumber: 85,
|
||||
columnNumber: 13
|
||||
});
|
||||
|
||||
store.dispatch(messageAdd(traceMessage));
|
||||
|
||||
store.dispatch(actions.filterTextSet("search-location-test.js:85:13"));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size - numUnfilterableMessages).toEqual(1);
|
||||
});
|
||||
|
||||
it("restores all messages once text is cleared", () => {
|
||||
store.dispatch(actions.filterTextSet("danger"));
|
||||
store.dispatch(actions.filterTextSet(""));
|
||||
|
||||
let messages = getAllMessages(store.getState());
|
||||
expect(messages.size).toEqual(numMessages);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -113,3 +161,23 @@ describe("Clear filters", () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function prepareBaseStore() {
|
||||
const store = setupStore([
|
||||
// Console API
|
||||
"console.log('foobar', 'test')",
|
||||
"console.warn('danger, will robinson!')",
|
||||
"console.log(undefined)",
|
||||
"console.count('bar')",
|
||||
"console.log('鼬')",
|
||||
// Evaluation Result - never filtered
|
||||
"new Date(0)",
|
||||
// PageError
|
||||
"ReferenceError: asdf is not defined"
|
||||
]);
|
||||
|
||||
// Console Command - never filtered
|
||||
store.dispatch(messageAdd(new ConsoleCommand({ messageText: `console.warn("x")` })));
|
||||
|
||||
return store;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { getAllMessages } = require("devtools/client/webconsole/new-console-output/selectors/messages");
|
||||
const { getRepeatId } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const {
|
||||
getAllMessages,
|
||||
getAllMessagesUiById,
|
||||
} = require("devtools/client/webconsole/new-console-output/selectors/messages");
|
||||
const {
|
||||
setupActions,
|
||||
setupStore
|
||||
|
@ -19,90 +21,130 @@ describe("Message reducer:", () => {
|
|||
actions = setupActions();
|
||||
});
|
||||
|
||||
it("adds a message to an empty store", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
describe("messagesById", () => {
|
||||
it("adds a message to an empty store", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
const message = stubPreparedMessages.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.first()).toEqual(message);
|
||||
});
|
||||
|
||||
it("increments repeat on a repeating message", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log('foobar', 'test')"
|
||||
]);
|
||||
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
dispatch(actions.messageAdd(packet));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(1);
|
||||
expect(messages.first().repeat).toBe(4);
|
||||
});
|
||||
|
||||
it("does not clobber a unique message", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log('foobar', 'test')"
|
||||
]);
|
||||
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
|
||||
const packet2 = stubPackets.get("console.log(undefined)");
|
||||
dispatch(actions.messageAdd(packet2));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(2);
|
||||
expect(messages.first().repeat).toBe(3);
|
||||
expect(messages.last().repeat).toBe(1);
|
||||
});
|
||||
|
||||
it("clears the store in response to console.clear()", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log(undefined)"
|
||||
]);
|
||||
|
||||
dispatch(actions.messageAdd(stubPackets.get("console.clear()")));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(1);
|
||||
expect(messages.first().parameters[0]).toBe("Console was cleared.");
|
||||
});
|
||||
|
||||
it("limits the number of messages displayed", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
const logLimit = 1000;
|
||||
const packet = stubPackets.get("console.log(undefined)");
|
||||
for (let i = 1; i <= logLimit + 1; i++) {
|
||||
packet.message.arguments = [`message num ${i}`];
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
const message = stubPreparedMessages.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
}
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
expect(messages.count()).toBe(logLimit);
|
||||
expect(messages.first().parameters[0]).toBe(`message num 2`);
|
||||
expect(messages.last().parameters[0]).toBe(`message num ${logLimit + 1}`);
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.first()).toEqual(message);
|
||||
});
|
||||
|
||||
it("increments repeat on a repeating message", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log('foobar', 'test')"
|
||||
]);
|
||||
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
dispatch(actions.messageAdd(packet));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(1);
|
||||
expect(messages.first().repeat).toBe(4);
|
||||
});
|
||||
|
||||
it("does not clobber a unique message", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log('foobar', 'test')"
|
||||
]);
|
||||
|
||||
const packet = stubPackets.get("console.log('foobar', 'test')");
|
||||
dispatch(actions.messageAdd(packet));
|
||||
|
||||
const packet2 = stubPackets.get("console.log(undefined)");
|
||||
dispatch(actions.messageAdd(packet2));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(2);
|
||||
expect(messages.first().repeat).toBe(3);
|
||||
expect(messages.last().repeat).toBe(1);
|
||||
});
|
||||
|
||||
it("adds a message in response to console.clear()", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
dispatch(actions.messageAdd(stubPackets.get("console.clear()")));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
|
||||
expect(messages.size).toBe(1);
|
||||
expect(messages.first().parameters[0]).toBe("Console was cleared.");
|
||||
});
|
||||
|
||||
it("clears the messages list in response to MESSAGES_CLEAR action", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log(undefined)"
|
||||
]);
|
||||
|
||||
dispatch(actions.messagesClear());
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
expect(messages.size).toBe(0);
|
||||
});
|
||||
|
||||
it("limits the number of messages displayed", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
const logLimit = 1000;
|
||||
const packet = stubPackets.get("console.log(undefined)");
|
||||
for (let i = 1; i <= logLimit + 1; i++) {
|
||||
packet.message.arguments = [`message num ${i}`];
|
||||
dispatch(actions.messageAdd(packet));
|
||||
}
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
expect(messages.count()).toBe(logLimit);
|
||||
expect(messages.first().parameters[0]).toBe(`message num 2`);
|
||||
expect(messages.last().parameters[0]).toBe(`message num ${logLimit + 1}`);
|
||||
});
|
||||
|
||||
it("does not add null messages to the store", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
const message = stubPackets.get("console.time('bar')");
|
||||
dispatch(actions.messageAdd(message));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
expect(messages.size).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not add null messages to the store", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
describe("messagesUiById", () => {
|
||||
it("opens console.trace messages when they are added", () => {
|
||||
const { dispatch, getState } = setupStore([]);
|
||||
|
||||
const message = stubPackets.get("console.time('bar')");
|
||||
dispatch(actions.messageAdd(message));
|
||||
const message = stubPackets.get("console.trace()");
|
||||
dispatch(actions.messageAdd(message));
|
||||
|
||||
const messages = getAllMessages(getState());
|
||||
expect(messages.size).toBe(0);
|
||||
const messages = getAllMessages(getState());
|
||||
const messagesUi = getAllMessagesUiById(getState());
|
||||
expect(messagesUi.size).toBe(1);
|
||||
expect(messagesUi.first()).toBe(messages.first().id);
|
||||
});
|
||||
|
||||
it("clears the messages UI list in response to MESSAGES_CLEAR action", () => {
|
||||
const { dispatch, getState } = setupStore([
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log(undefined)"
|
||||
]);
|
||||
|
||||
const traceMessage = stubPackets.get("console.trace()");
|
||||
dispatch(actions.messageAdd(traceMessage));
|
||||
|
||||
dispatch(actions.messagesClear());
|
||||
|
||||
const messagesUi = getAllMessagesUiById(getState());
|
||||
expect(messagesUi.size).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,3 +35,14 @@ exports.ConsoleMessage = Immutable.Record({
|
|||
stacktrace: null,
|
||||
frame: null,
|
||||
});
|
||||
|
||||
exports.NetworkEventMessage = Immutable.Record({
|
||||
id: null,
|
||||
actor: null,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
isXHR: false,
|
||||
request: null,
|
||||
response: null,
|
||||
source: MESSAGE_SOURCE.NETWORK,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
});
|
||||
|
|
|
@ -15,7 +15,10 @@ const {
|
|||
MESSAGE_TYPE,
|
||||
MESSAGE_LEVEL,
|
||||
} = require("../constants");
|
||||
const { ConsoleMessage } = require("../types");
|
||||
const {
|
||||
ConsoleMessage,
|
||||
NetworkEventMessage,
|
||||
} = require("../types");
|
||||
|
||||
function prepareMessage(packet, idGenerator) {
|
||||
// This packet is already in the expected packet structure. Simply return.
|
||||
|
@ -127,10 +130,22 @@ function transformPacket(packet) {
|
|||
type: MESSAGE_TYPE.LOG,
|
||||
level,
|
||||
messageText: pageError.errorMessage,
|
||||
stacktrace: pageError.stacktrace ? pageError.stacktrace : null,
|
||||
frame,
|
||||
});
|
||||
}
|
||||
|
||||
case "networkEvent": {
|
||||
let { networkEvent } = packet;
|
||||
|
||||
return new NetworkEventMessage({
|
||||
actor: networkEvent.actor,
|
||||
isXHR: networkEvent.isXHR,
|
||||
request: networkEvent.request,
|
||||
response: networkEvent.response,
|
||||
});
|
||||
}
|
||||
|
||||
case "evaluationResult":
|
||||
default: {
|
||||
let { result } = packet;
|
||||
|
@ -165,6 +180,9 @@ function convertCachedPacket(packet) {
|
|||
} else if ("_navPayload" in packet) {
|
||||
convertPacket.type = "navigationMessage";
|
||||
convertPacket.message = packet;
|
||||
} else if (packet._type === "NetworkEvent") {
|
||||
convertPacket.networkEvent = packet;
|
||||
convertPacket.type = "networkEvent";
|
||||
} else {
|
||||
throw new Error("Unexpected packet type");
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
"jsdom": "^9.4.1",
|
||||
"jsdom-global": "^2.0.0",
|
||||
"mocha": "^2.5.3",
|
||||
"redux-mock-store": "^1.1.4",
|
||||
"require-hacker": "^2.1.4",
|
||||
"sinon": "^1.17.5"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "cd ../ && npm install && cd webconsole",
|
||||
"test": "NODE_PATH=`pwd`/../../../:`pwd`/../../../devtools/client/shared/vendor/ mocha new-console-output/test/**/*.test.js --compilers js:babel-register -r jsdom-global/register -r ./new-console-output/test/requireHelper.js"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -586,7 +586,8 @@ WebConsoleFrame.prototype = {
|
|||
this.outputNode.parentNode.appendChild(this.experimentalOutputNode);
|
||||
// @TODO Once the toolbox has been converted to React, see if passing
|
||||
// in JSTerm is still necessary.
|
||||
this.newConsoleOutput = new this.window.NewConsoleOutput(this.experimentalOutputNode, this.jsterm, toolbox);
|
||||
this.newConsoleOutput = new this.window.NewConsoleOutput(
|
||||
this.experimentalOutputNode, this.jsterm, toolbox, this.owner);
|
||||
console.log("Created newConsoleOutput", this.newConsoleOutput);
|
||||
|
||||
let filterToolbar = doc.querySelector(".hud-console-filter-toolbar");
|
||||
|
@ -3323,7 +3324,10 @@ WebConsoleConnectionProxy.prototype = {
|
|||
_onPageError: function (type, packet) {
|
||||
if (this.webConsoleFrame && packet.from == this._consoleActor) {
|
||||
if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
|
||||
this.dispatchMessageAdd(packet);
|
||||
let category = Utils.categoryForScriptError(packet.pageError);
|
||||
if (category !== CATEGORY_CSS) {
|
||||
this.dispatchMessageAdd(packet);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.webConsoleFrame.handlePageError(packet.pageError);
|
||||
|
@ -3378,7 +3382,11 @@ WebConsoleConnectionProxy.prototype = {
|
|||
*/
|
||||
_onNetworkEvent: function (type, networkInfo) {
|
||||
if (this.webConsoleFrame) {
|
||||
this.webConsoleFrame.handleNetworkEvent(networkInfo);
|
||||
if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
|
||||
this.dispatchMessageAdd(networkInfo);
|
||||
} else {
|
||||
this.webConsoleFrame.handleNetworkEvent(networkInfo);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -67,21 +67,6 @@ differ, no such emphasized headings will appear.
|
|||
A `Debugger.Source` instance inherits the following accessor properties
|
||||
from its prototype:
|
||||
|
||||
`canonicalId`
|
||||
: **If the instance refers to JavaScript source**, a stable, unique
|
||||
identifier for the source referent. This identifier is suitable for
|
||||
checking if two `Debugger.Source` instances originating from different
|
||||
`Debugger` instances refer to the same source that was compiled by
|
||||
SpiderMonkey. The `canonicalId` is reliable even when the source does not
|
||||
have a URL, or shares the same URL as another source but has different
|
||||
source text. It is more efficient to compare `canonicalId`s than to
|
||||
compare source text character-by-character. The `canonicalId` is not
|
||||
suitable for ordering comparisons such as "greater than" or "less
|
||||
than". It is not suitable for checking the equality of sources across
|
||||
worker threads.
|
||||
|
||||
**If the instance refers to WebAssembly code**, throw a `TypeError`.
|
||||
|
||||
`text`
|
||||
: **If the instance refers to JavaScript source**, the JavaScript source
|
||||
code, as a string. The value satisfies the `Program`,
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Test Debugger.Source.prototype.canonicalId
|
||||
|
||||
const g = newGlobal();
|
||||
|
||||
const dbg1 = new Debugger;
|
||||
const dbg2 = new Debugger;
|
||||
|
||||
const gw1 = dbg1.addDebuggee(g);
|
||||
const gw2 = dbg2.addDebuggee(g);
|
||||
|
||||
g.eval("function f(x) { return 2*x; }");
|
||||
g.eval("function g(x) { return 2+x; }");
|
||||
|
||||
const fw1 = gw1.getOwnPropertyDescriptor('f').value;
|
||||
const fw2 = gw2.getOwnPropertyDescriptor('f').value;
|
||||
const hw1 = gw1.getOwnPropertyDescriptor('g').value;
|
||||
const hw2 = gw2.getOwnPropertyDescriptor('g').value;
|
||||
|
||||
const fs1 = fw1.script.source;
|
||||
const fs2 = fw2.script.source;
|
||||
const gs1 = hw1.script.source;
|
||||
const gs2 = hw2.script.source;
|
||||
|
||||
assertEq(!!fs1, true);
|
||||
assertEq(!!fs2, true);
|
||||
assertEq(fs1.canonicalId, fs2.canonicalId);
|
||||
|
||||
assertEq(!!gs1, true);
|
||||
assertEq(!!gs2, true);
|
||||
assertEq(gs1.canonicalId, gs2.canonicalId);
|
||||
|
||||
assertEq(fs1.canonicalId !== gs1.canonicalId, true);
|
|
@ -34,7 +34,3 @@ source.element;
|
|||
source.displayURL;
|
||||
source.introductionOffset;
|
||||
source.elementAttributeName;
|
||||
|
||||
// canonicalId doesn't make sense since wasm sources aren't backed by
|
||||
// ScriptSource.
|
||||
assertThrowsInstanceOf(() => source.canonicalId, Error);
|
||||
|
|
|
@ -7149,31 +7149,6 @@ DebuggerSource_getSourceMapURL(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
DebuggerSource_getCanonicalId(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
THIS_DEBUGSOURCE_SOURCE(cx, argc, vp, "(get sourceMapURL)", args, obj, sourceObject);
|
||||
|
||||
ScriptSource* ss = sourceObject->source();
|
||||
MOZ_ASSERT(ss);
|
||||
|
||||
static_assert(!mozilla::IsBaseOf<gc::Cell, ScriptSource>::value,
|
||||
"We rely on ScriptSource* pointers to be stable, and not move in memory. "
|
||||
"Currently, this holds true because ScriptSource is not managed by the GC. If "
|
||||
"that changes, it doesn't necessarily mean that it will start moving, but we "
|
||||
"will need a new assertion here. If we do start moving ScriptSources in memory, "
|
||||
"then DebuggerSource_getCanonicalId will need to be reworked!");
|
||||
auto id = uintptr_t(ss);
|
||||
|
||||
// IEEE 754 doubles can precisely store integers of up 53 bits. On 32 bit
|
||||
// platforms, pointers trivially fit. On 64 bit platforms, pointers only use
|
||||
// 48 bits so we are still good.
|
||||
MOZ_ASSERT(Value::isNumberRepresentable(id));
|
||||
|
||||
args.rval().set(NumberValue(id));
|
||||
return true;
|
||||
}
|
||||
|
||||
static const JSPropertySpec DebuggerSource_properties[] = {
|
||||
JS_PSG("text", DebuggerSource_getText, 0),
|
||||
JS_PSG("url", DebuggerSource_getURL, 0),
|
||||
|
@ -7184,7 +7159,6 @@ static const JSPropertySpec DebuggerSource_properties[] = {
|
|||
JS_PSG("introductionType", DebuggerSource_getIntroductionType, 0),
|
||||
JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0),
|
||||
JS_PSGS("sourceMapURL", DebuggerSource_getSourceMapURL, DebuggerSource_setSourceMapURL, 0),
|
||||
JS_PSG("canonicalId", DebuggerSource_getCanonicalId, 0),
|
||||
JS_PS_END
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче