mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-28 15:21:49 +12:00
Mitigate undesireable side-effect of 901c325eab
Related discussion/issue: - https://github.com/uBlockOrigin/uMatrix-issues/issues/156#issuecomment-494427094 - https://github.com/uBlockOrigin/uMatrix-issues/issues/155 Due to a Chromium issue about not providing the proper context information, a negative side-effect was introduced with fix to #155. This commit will force the originator of a network request of type `main_frame` to be that of the request URL itself, i.e. the originator of a top-level document request is the requested document itself.
This commit is contained in:
parent
0807d71704
commit
1ddb822509
1 changed files with 7 additions and 3 deletions
|
@ -71,17 +71,21 @@
|
||||||
const parsedURL = new URL('https://www.example.org/');
|
const parsedURL = new URL('https://www.example.org/');
|
||||||
|
|
||||||
vAPI.net.normalizeDetails = function(details) {
|
vAPI.net.normalizeDetails = function(details) {
|
||||||
|
let type = details.type;
|
||||||
|
|
||||||
|
// https://github.com/uBlockOrigin/uMatrix-issues/issues/156#issuecomment-494427094
|
||||||
|
if ( type === 'main_frame' ) {
|
||||||
|
details.documentUrl = details.url;
|
||||||
|
}
|
||||||
// Chromium 63+ supports the `initiator` property, which contains
|
// Chromium 63+ supports the `initiator` property, which contains
|
||||||
// the URL of the origin from which the network request was made.
|
// the URL of the origin from which the network request was made.
|
||||||
if (
|
else if (
|
||||||
typeof details.initiator === 'string' &&
|
typeof details.initiator === 'string' &&
|
||||||
details.initiator !== 'null'
|
details.initiator !== 'null'
|
||||||
) {
|
) {
|
||||||
details.documentUrl = details.initiator;
|
details.documentUrl = details.initiator;
|
||||||
}
|
}
|
||||||
|
|
||||||
let type = details.type;
|
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/1493
|
// https://github.com/gorhill/uBlock/issues/1493
|
||||||
// Chromium 49+/WebExtensions support a new request type: `ping`,
|
// Chromium 49+/WebExtensions support a new request type: `ping`,
|
||||||
// which is fired as a result of using `navigator.sendBeacon`.
|
// which is fired as a result of using `navigator.sendBeacon`.
|
||||||
|
|
Loading…
Reference in a new issue