Skip to content

Commit 66362bc

Browse files
authored
Remove FXIOS-15286 [Telemetry] Ad cookies parsing not used (#32832)
* Drop parsing ads cookies * Drop from blockzilla to match
1 parent d59a315 commit 66362bc

2 files changed

Lines changed: 2 additions & 79 deletions

File tree

  • firefox-ios/Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd
  • focus-ios/Blockzilla

firefox-ios/Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/Ads.js

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
/**
66
* Send
77
* - current URL
8-
* - cookies of this page
98
* - all links found in this page
109
* to the native application.
1110
*/
1211
function sendCurrentState() {
1312
let message = {
1413
'url': document.location.href,
15-
'urls': getLinks(),
16-
'cookies': getCookies()
14+
'urls': getLinks()
1715
};
1816

1917
webkit.messageHandlers.adsMessageHandler.postMessage(message);
@@ -38,56 +36,6 @@ function getLinks() {
3836
return urls;
3937
}
4038

41-
/**
42-
* Get all cookies for the current document.
43-
*
44-
* @return {Array<{name: string, value: string}>} containing all cookies.
45-
*/
46-
function getCookies() {
47-
let cookiesList = safeCookiesList();
48-
let result = [];
49-
50-
cookiesList.forEach(cookie => {
51-
var [name, ...value] = cookie.split('=');
52-
// For that special cases where the value contains '='.
53-
value = value.join("=")
54-
55-
result.push({
56-
"name" : name,
57-
"value" : value
58-
});
59-
});
60-
61-
return result;
62-
}
63-
64-
// FXIOS-13891: WebKit process crashes on cross-origin cookie operation on about:blank tabs
65-
// Helper method to verify via SecurityError earlier than touching the document crashes it
66-
function safeCookiesList() {
67-
let documentCookies = [];
68-
69-
const isNewTab = window.location.protocol == "about:";
70-
const hasOpener = !!window.opener;
71-
const hasParent = hasOpener && window.opener.parent != window.opener;
72-
73-
// Special-casing only different origins coming from different frames in new tabs
74-
if (isNewTab && hasOpener && hasParent) {
75-
const frameParent = window.opener.parent;
76-
// Positively catch the SecurityError on the conditional as a way to not touch the cookie inside
77-
try {
78-
if (frameParent.location.origin == window.opener.location.origin) {
79-
documentCookies = document.cookie.split("; ");
80-
}
81-
} catch {
82-
documentCookies = [""];
83-
}
84-
} else {
85-
documentCookies = document.cookie.split("; ");
86-
}
87-
88-
return documentCookies;
89-
}
90-
9139
// Whenever a page is first accessed or when loaded from cache
9240
// send all needed data about the ads provider to the app.
9341
const events = ["pageshow", "load"];

focus-ios/Blockzilla/Ads.js

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
/**
99
* Send
1010
* - current URL
11-
* - cookies of this page
1211
* - all links found in this page
1312
* to the native application.
1413
*/
1514
function sendCurrentState() {
1615
let message = {
1716
'url': document.location.href,
18-
'urls': getLinks(),
19-
'cookies': getCookies()
17+
'urls': getLinks()
2018
};
2119

2220
webkit.messageHandlers.adsMessageHandler.postMessage(message);
@@ -41,29 +39,6 @@ function getLinks() {
4139
return urls;
4240
}
4341

44-
/**
45-
* Get all cookies for the current document.
46-
*
47-
* @return {Array<{name: string, value: string}>} containing all cookies.
48-
*/
49-
function getCookies() {
50-
let cookiesList = document.cookie.split("; ");
51-
let result = [];
52-
53-
cookiesList.forEach(cookie => {
54-
var [name, ...value] = cookie.split('=');
55-
// For that special cases where the value contains '='.
56-
value = value.join("=")
57-
58-
result.push({
59-
"name" : name,
60-
"value" : value
61-
});
62-
});
63-
64-
return result;
65-
}
66-
6742
// Whenever a page is first accessed or when loaded from cache
6843
// send all needed data about the ads provider to the app.
6944
const events = ["pageshow", "load"];

0 commit comments

Comments
 (0)