Skip to content

Commit

Permalink
Backed out 6 changesets (bug 1392408) for build bustages at nsContent…
Browse files Browse the repository at this point in the history
…Policy.cpp and nsFrameLoaderOwner.cpp. CLOSED TREE

Backed out changeset a32ab60deb60 (bug 1392408)
Backed out changeset 69cbc0afb1f1 (bug 1392408)
Backed out changeset cd9081aac4bf (bug 1392408)
Backed out changeset d88d5959f4a6 (bug 1392408)
Backed out changeset 01fd757e335b (bug 1392408)
Backed out changeset 872645a5122c (bug 1392408)
  • Loading branch information
cristianbrindusan committed May 2, 2019
1 parent 239349e commit 05b6a8d
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 651 deletions.
4 changes: 0 additions & 4 deletions devtools/client/netmonitor/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ support-files =
html_copy-as-curl.html
html_curl-utils.html
html_open-request-in-tab.html
html_worker-test-page.html
js_worker-test.js
js_worker-test2.js
sjs_content-type-test-server.sjs
sjs_cors-test-server.sjs
sjs_https-redirect-test-server.sjs
Expand Down Expand Up @@ -221,4 +218,3 @@ skip-if = true # TODO: fix the test
[browser_net_truncate.js]
[browser_net_view-source-debugger.js]
[browser_net_waterfall-click.js]
[browser_net_worker_stacks.js]
40 changes: 39 additions & 1 deletion devtools/client/netmonitor/test/browser_net_cause.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ add_task(async function() {
const { document, store, windowRequire, connector } = monitor.panelWin;
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
const {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");

Expand All @@ -109,7 +110,44 @@ add_task(async function() {
is(store.getState().requests.requests.size, EXPECTED_REQUESTS.length,
"All the page events should be recorded.");

validateRequests(EXPECTED_REQUESTS, monitor);
EXPECTED_REQUESTS.forEach((spec, i) => {
const { method, url, causeType, causeUri, stack } = spec;

const requestItem = getSortedRequests(store.getState()).get(i);
verifyRequestItemTarget(
document,
getDisplayedRequests(store.getState()),
requestItem,
method,
url,
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);

const stacktrace = requestItem.stacktrace;
const stackLen = stacktrace ? stacktrace.length : 0;

if (stack) {
ok(stacktrace, `Request #${i} has a stacktrace`);
ok(stackLen > 0,
`Request #${i} (${causeType}) has a stacktrace with ${stackLen} items`);

// if "stack" is array, check the details about the top stack frames
if (Array.isArray(stack)) {
stack.forEach((frame, j) => {
is(stacktrace[j].functionName, frame.fn,
`Request #${i} has the correct function on JS stack frame #${j}`);
is(stacktrace[j].filename.split("/").pop(), frame.file,
`Request #${i} has the correct file on JS stack frame #${j}`);
is(stacktrace[j].lineNumber, frame.line,
`Request #${i} has the correct line number on JS stack frame #${j}`);
is(stacktrace[j].asyncCause, frame.asyncCause,
`Request #${i} has the correct async cause on JS stack frame #${j}`);
});
}
} else {
is(stackLen, 0, `Request #${i} (${causeType}) has an empty stacktrace`);
}
});

// Sort the requests by cause and check the order
EventUtils.sendMouseEvent({ type: "click" },
Expand Down
100 changes: 0 additions & 100 deletions devtools/client/netmonitor/test/browser_net_worker_stacks.js

This file was deleted.

47 changes: 0 additions & 47 deletions devtools/client/netmonitor/test/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,50 +867,3 @@ function queryTelemetryEvents(query) {
// Return the `extra` field (which is event[5]e).
return filtersChangedEvents.map(event => event[5]);
}

function validateRequests(requests, monitor) {
const { document, store, windowRequire } = monitor.panelWin;

const {
getDisplayedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");

requests.forEach((spec, i) => {
const { method, url, causeType, causeUri, stack } = spec;

const requestItem = getSortedRequests(store.getState()).get(i);
verifyRequestItemTarget(
document,
getDisplayedRequests(store.getState()),
requestItem,
method,
url,
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);

const stacktrace = requestItem.stacktrace;
const stackLen = stacktrace ? stacktrace.length : 0;

if (stack) {
ok(stacktrace, `Request #${i} has a stacktrace`);
ok(stackLen > 0,
`Request #${i} (${causeType}) has a stacktrace with ${stackLen} items`);

// if "stack" is array, check the details about the top stack frames
if (Array.isArray(stack)) {
stack.forEach((frame, j) => {
is(stacktrace[j].functionName, frame.fn,
`Request #${i} has the correct function on JS stack frame #${j}`);
is(stacktrace[j].filename.split("/").pop(), frame.file,
`Request #${i} has the correct file on JS stack frame #${j}`);
is(stacktrace[j].lineNumber, frame.line,
`Request #${i} has the correct line number on JS stack frame #${j}`);
is(stacktrace[j].asyncCause, frame.asyncCause,
`Request #${i} has the correct async cause on JS stack frame #${j}`);
});
}
} else {
is(stackLen, 0, `Request #${i} (${causeType}) has an empty stacktrace`);
}
});
}
13 changes: 0 additions & 13 deletions devtools/client/netmonitor/test/html_worker-test-page.html

This file was deleted.

24 changes: 0 additions & 24 deletions devtools/client/netmonitor/test/js_worker-test.js

This file was deleted.

3 changes: 0 additions & 3 deletions devtools/client/netmonitor/test/js_worker-test2.js

This file was deleted.

75 changes: 15 additions & 60 deletions devtools/server/actors/network-monitor/stack-trace-collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function StackTraceCollector(filters, netmonitors) {
StackTraceCollector.prototype = {
init() {
Services.obs.addObserver(this, "http-on-opening-request");
Services.obs.addObserver(this, "network-monitor-alternate-stack");
ChannelEventSinkFactory.getService().registerCollector(this);
this.onGetStack = this.onGetStack.bind(this);
for (const { messageManager } of this.netmonitors) {
Expand All @@ -35,7 +34,6 @@ StackTraceCollector.prototype = {

destroy() {
Services.obs.removeObserver(this, "http-on-opening-request");
Services.obs.removeObserver(this, "network-monitor-alternate-stack");
ChannelEventSinkFactory.getService().unregisterCollector(this);
for (const { messageManager } of this.netmonitors) {
messageManager.removeMessageListener("debug:request-stack:request",
Expand All @@ -44,12 +42,6 @@ StackTraceCollector.prototype = {
},

_saveStackTrace(channel, stacktrace) {
if (this.stacktracesById.has(channel.channelId)) {
// We can get up to two stack traces for the same channel: one each from
// the two observer topics we are listening to. Use the first stack trace
// which is specified, and ignore any later one.
return;
}
for (const { messageManager } of this.netmonitors) {
messageManager.sendAsyncMessage("debug:request-stack-available", {
channelId: channel.channelId,
Expand All @@ -59,66 +51,29 @@ StackTraceCollector.prototype = {
this.stacktracesById.set(channel.channelId, stacktrace);
},

observe(subject, topic, data) {
observe(subject) {
const channel = subject.QueryInterface(Ci.nsIHttpChannel);

if (!matchRequest(channel, this.filters)) {
return;
}

// Convert the nsIStackFrame XPCOM objects to a nice JSON that can be
// passed around through message managers etc.
let frame = components.stack;
const stacktrace = [];
switch (topic) {
case "http-on-opening-request": {
// The channel is being opened on the main thread, associate the current
// stack with it.
//
// Convert the nsIStackFrame XPCOM objects to a nice JSON that can be
// passed around through message managers etc.
let frame = components.stack;
if (frame && frame.caller) {
frame = frame.caller;
while (frame) {
stacktrace.push({
filename: frame.filename,
lineNumber: frame.lineNumber,
columnNumber: frame.columnNumber,
functionName: frame.name,
asyncCause: frame.asyncCause,
});
frame = frame.caller || frame.asyncCaller;
}
}
break;
}
case "network-monitor-alternate-stack": {
// An alternate stack trace is being specified for this channel.
// The topic data is the JSON for the saved frame stack we should use,
// so convert this into the expected format.
//
// This topic is used in the following cases:
//
// - The HTTP channel is opened asynchronously or on a different thread
// from the code which triggered its creation, in which case the stack
// from components.stack will be empty. The alternate stack will be
// for the point we want to associate with the channel.
//
// - The channel is not a nsIHttpChannel, and we will receive no
// opening request notification for it.
let frame = JSON.parse(data);
while (frame) {
stacktrace.push({
filename: frame.source,
lineNumber: frame.line,
columnNumber: frame.column,
functionName: frame.functionDisplayName,
asyncCause: frame.asyncCause,
});
frame = frame.parent || frame.asyncParent;
}
break;
if (frame && frame.caller) {
frame = frame.caller;
while (frame) {
stacktrace.push({
filename: frame.filename,
lineNumber: frame.lineNumber,
columnNumber: frame.columnNumber,
functionName: frame.name,
asyncCause: frame.asyncCause,
});
frame = frame.caller || frame.asyncCaller;
}
default:
throw new Error("Unexpected observe() topic");
}

this._saveStackTrace(channel, stacktrace);
Expand Down
Loading

0 comments on commit 05b6a8d

Please sign in to comment.