first attempt to track the origin requesters of webRequest events
This commit is contained in:
parent
59cadf9e4b
commit
549c30f9b2
3 changed files with 6338 additions and 3 deletions
|
@ -75,9 +75,14 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) {
|
||||||
details->SetInteger("id", request->identifier());
|
details->SetInteger("id", request->identifier());
|
||||||
details->SetDouble("timestamp", base::Time::Now().ToDoubleT() * 1000);
|
details->SetDouble("timestamp", base::Time::Now().ToDoubleT() * 1000);
|
||||||
auto info = content::ResourceRequestInfo::ForRequest(request);
|
auto info = content::ResourceRequestInfo::ForRequest(request);
|
||||||
details->SetString("resourceType",
|
if (info) {
|
||||||
info ? ResourceTypeToString(info->GetResourceType())
|
int64_t process_id = info->GetChildID();
|
||||||
: "other");
|
int64_t routing_id = info->GetRouteID();
|
||||||
|
details->SetDouble("webContentsGetId", (process_id << 32) + routing_id);
|
||||||
|
details->SetString("resourceType", ResourceTypeToString(info->GetResourceType()));
|
||||||
|
} else {
|
||||||
|
details->SetString("resourceType", "other");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToDictionary(base::DictionaryValue* details,
|
void ToDictionary(base::DictionaryValue* details,
|
||||||
|
|
6329
package-lock.json
generated
Normal file
6329
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -89,6 +89,7 @@ describe('webRequest module', function () {
|
||||||
ses.webRequest.onBeforeRequest(function (details, callback) {
|
ses.webRequest.onBeforeRequest(function (details, callback) {
|
||||||
assert.equal(typeof details.id, 'number')
|
assert.equal(typeof details.id, 'number')
|
||||||
assert.equal(typeof details.timestamp, 'number')
|
assert.equal(typeof details.timestamp, 'number')
|
||||||
|
assert.equal(typeof details.webContentsGetId, 'number')
|
||||||
assert.equal(details.url, defaultURL)
|
assert.equal(details.url, defaultURL)
|
||||||
assert.equal(details.method, 'GET')
|
assert.equal(details.method, 'GET')
|
||||||
assert.equal(details.resourceType, 'xhr')
|
assert.equal(details.resourceType, 'xhr')
|
||||||
|
|
Loading…
Reference in a new issue