Skip to content

Commit

Permalink
Add window sizing fix for outerWidth and outerHeight (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston authored Apr 20, 2022
1 parent a7c6f41 commit 89ccf8f
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 97 deletions.
78 changes: 47 additions & 31 deletions build/apple/contentScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,11 @@
case './features/fingerprinting-temporary-storage.js': return Promise.resolve().then(function () { return fingerprintingTemporaryStorage; });
case './features/google-rejected.js': return Promise.resolve().then(function () { return googleRejected; });
case './features/gpc.js': return Promise.resolve().then(function () { return gpc; });
case './features/navigator-credentials.js': return Promise.resolve().then(function () { return navigatorCredentials; });
case './features/navigator-interface.js': return Promise.resolve().then(function () { return navigatorInterface; });
case './features/referrer.js': return Promise.resolve().then(function () { return referrer; });
case './features/tracking-cookies-1p.js': return Promise.resolve().then(function () { return trackingCookies1p; });
case './features/tracking-cookies-3p.js': return Promise.resolve().then(function () { return trackingCookies3p; });
case './features/web-compat.js': return Promise.resolve().then(function () { return webCompat; });
default: return Promise.reject(new Error("Unknown variable dynamic import: " + path));
}
}
Expand All @@ -984,6 +984,7 @@
return
}
const featureNames = [
'webCompat',
'fingerprintingAudio',
'fingerprintingBattery',
'fingerprintingCanvas',
Expand All @@ -995,8 +996,7 @@
'referrer',
'fingerprintingScreenSize',
'fingerprintingTemporaryStorage',
'navigatorInterface',
'navigatorCredentials'
'navigatorInterface'
];

for (const featureName of featureNames) {
Expand Down Expand Up @@ -2758,28 +2758,6 @@
});

function init$4 (args) {
try {
const value = {
get () {
return Promise.reject(new Error())
}
};
defineProperty(Navigator.prototype, 'credentials', {
value,
configurable: true,
enumerable: true
});
} catch {
// Ignore exceptions that could be caused by conflicting with other extensions
}
}

var navigatorCredentials = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$4
});

function init$3 (args) {
try {
if (navigator.duckduckgo) {
return
Expand All @@ -2805,10 +2783,10 @@

var navigatorInterface = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$3
init: init$4
});

function init$2 (args) {
function init$3 (args) {
// Unfortunately, we only have limited information about the referrer and current frame. A single
// page may load many requests and sub frames, all with different referrers. Since we
if (args.referrer && // make sure the referrer was set correctly
Expand All @@ -2834,7 +2812,7 @@

var referrer = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$2
init: init$3
});

class Cookie {
Expand Down Expand Up @@ -3012,7 +2990,7 @@
applyCookieExpiryPolicy();
}

function init$1 (args) {
function init$2 (args) {
args.cookie.debug = args.debug;
loadedPolicyResolve(args.cookie);
}
Expand All @@ -3026,7 +3004,7 @@
var trackingCookies1p = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load,
init: init$1,
init: init$2,
update: update
});

Expand Down Expand Up @@ -3060,7 +3038,7 @@
});
}

function init (args) {
function init$1 (args) {
args.cookie.debug = args.debug;
if (globalThis.top !== globalThis && args.cookie.isTrackerFrame && args.cookie.shouldBlock && args.cookie.isThirdParty) {
// overrides expiry policy with blocking - only in subframes
Expand All @@ -3069,6 +3047,44 @@
}

var trackingCookies3p = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$1
});

/**
* Fixes incorrect sizing value for outerHeight and outerWidth
*/
function windowSizingFix () {
window.outerHeight = window.innerHeight;
window.outerWidth = window.innerWidth;
}

/**
* Add missing navigator.credentials API
*/
function navigatorCredentialsFix () {
try {
const value = {
get () {
return Promise.reject(new Error())
}
};
defineProperty(Navigator.prototype, 'credentials', {
value,
configurable: true,
enumerable: true
});
} catch {
// Ignore exceptions that could be caused by conflicting with other extensions
}
}

function init () {
windowSizingFix();
navigatorCredentialsFix();
}

var webCompat = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init
});
Expand Down
2 changes: 1 addition & 1 deletion build/chrome/inject.js

Large diffs are not rendered by default.

78 changes: 47 additions & 31 deletions build/firefox/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,11 @@
case './features/fingerprinting-temporary-storage.js': return Promise.resolve().then(function () { return fingerprintingTemporaryStorage; });
case './features/google-rejected.js': return Promise.resolve().then(function () { return googleRejected; });
case './features/gpc.js': return Promise.resolve().then(function () { return gpc; });
case './features/navigator-credentials.js': return Promise.resolve().then(function () { return navigatorCredentials; });
case './features/navigator-interface.js': return Promise.resolve().then(function () { return navigatorInterface; });
case './features/referrer.js': return Promise.resolve().then(function () { return referrer; });
case './features/tracking-cookies-1p.js': return Promise.resolve().then(function () { return trackingCookies1p; });
case './features/tracking-cookies-3p.js': return Promise.resolve().then(function () { return trackingCookies3p; });
case './features/web-compat.js': return Promise.resolve().then(function () { return webCompat; });
default: return Promise.reject(new Error("Unknown variable dynamic import: " + path));
}
}
Expand All @@ -953,6 +953,7 @@
return
}
const featureNames = [
'webCompat',
'fingerprintingAudio',
'fingerprintingBattery',
'fingerprintingCanvas',
Expand All @@ -964,8 +965,7 @@
'referrer',
'fingerprintingScreenSize',
'fingerprintingTemporaryStorage',
'navigatorInterface',
'navigatorCredentials'
'navigatorInterface'
];

for (const featureName of featureNames) {
Expand Down Expand Up @@ -2727,28 +2727,6 @@
});

function init$4 (args) {
try {
const value = {
get () {
return Promise.reject(new Error())
}
};
defineProperty(Navigator.prototype, 'credentials', {
value,
configurable: true,
enumerable: true
});
} catch {
// Ignore exceptions that could be caused by conflicting with other extensions
}
}

var navigatorCredentials = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$4
});

function init$3 (args) {
try {
if (navigator.duckduckgo) {
return
Expand All @@ -2774,10 +2752,10 @@

var navigatorInterface = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$3
init: init$4
});

function init$2 (args) {
function init$3 (args) {
// Unfortunately, we only have limited information about the referrer and current frame. A single
// page may load many requests and sub frames, all with different referrers. Since we
if (args.referrer && // make sure the referrer was set correctly
Expand All @@ -2803,7 +2781,7 @@

var referrer = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$2
init: init$3
});

class Cookie {
Expand Down Expand Up @@ -2981,7 +2959,7 @@
applyCookieExpiryPolicy();
}

function init$1 (args) {
function init$2 (args) {
args.cookie.debug = args.debug;
loadedPolicyResolve(args.cookie);
}
Expand All @@ -2995,7 +2973,7 @@
var trackingCookies1p = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load,
init: init$1,
init: init$2,
update: update
});

Expand Down Expand Up @@ -3029,7 +3007,7 @@
});
}

function init (args) {
function init$1 (args) {
args.cookie.debug = args.debug;
if (globalThis.top !== globalThis && args.cookie.isTrackerFrame && args.cookie.shouldBlock && args.cookie.isThirdParty) {
// overrides expiry policy with blocking - only in subframes
Expand All @@ -3038,6 +3016,44 @@
}

var trackingCookies3p = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init$1
});

/**
* Fixes incorrect sizing value for outerHeight and outerWidth
*/
function windowSizingFix () {
window.outerHeight = window.innerHeight;
window.outerWidth = window.innerWidth;
}

/**
* Add missing navigator.credentials API
*/
function navigatorCredentialsFix () {
try {
const value = {
get () {
return Promise.reject(new Error())
}
};
defineProperty(Navigator.prototype, 'credentials', {
value,
configurable: true,
enumerable: true
});
} catch {
// Ignore exceptions that could be caused by conflicting with other extensions
}
}

function init () {
windowSizingFix();
navigatorCredentialsFix();
}

var webCompat = /*#__PURE__*/Object.freeze({
__proto__: null,
init: init
});
Expand Down
Loading

0 comments on commit 89ccf8f

Please sign in to comment.