mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
first attempt to track the origin requesters of webRequest events
This commit is contained in:
@@ -75,9 +75,14 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) {
|
||||
details->SetInteger("id", request->identifier());
|
||||
details->SetDouble("timestamp", base::Time::Now().ToDoubleT() * 1000);
|
||||
auto info = content::ResourceRequestInfo::ForRequest(request);
|
||||
details->SetString("resourceType",
|
||||
info ? ResourceTypeToString(info->GetResourceType())
|
||||
: "other");
|
||||
if (info) {
|
||||
int64_t process_id = info->GetChildID();
|
||||
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,
|
||||
|
||||
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) {
|
||||
assert.equal(typeof details.id, 'number')
|
||||
assert.equal(typeof details.timestamp, 'number')
|
||||
assert.equal(typeof details.webContentsGetId, 'number')
|
||||
assert.equal(details.url, defaultURL)
|
||||
assert.equal(details.method, 'GET')
|
||||
assert.equal(details.resourceType, 'xhr')
|
||||
|
||||
Reference in New Issue
Block a user