Skip to content

File tree

3 files changed

+64
-12
lines changed

3 files changed

+64
-12
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Require Firefox >= 55
1616
- Require Chrome >= 37
1717

18+
19+
## [1.27.3] - 2025-XX-XX
20+
21+
### Changed
22+
- Google Search `window.rwt` detection
23+
24+
### Fixed
25+
- Google Docs
26+
- [#134](https://github.com/ClearURLs/Addon/issues/134)
27+
- [#187](https://gitlab.com/ClearURLs/rules/-/issues/187)
28+
- [#387](https://github.com/ClearURLs/Addon/issues/387)
29+
- [#393](https://github.com/ClearURLs/Addon/issues/393)
30+
- [#978](https://gitlab.com/ClearURLs/ClearUrls/-/issues/978)
31+
- [#980](https://gitlab.com/ClearURLs/ClearUrls/-/issues/980)
32+
- [#1301](https://gitlab.com/ClearURLs/ClearUrls/-/issues/1301)
33+
- [#1302](https://gitlab.com/ClearURLs/ClearUrls/-/issues/1302)
34+
- [#1305](https://gitlab.com/ClearURLs/ClearUrls/-/issues/1305)
35+
36+
37+
### Compatibility note
38+
- Require Firefox >= 55
39+
- Require Chrome >= 37
40+
1841
## [1.27.2] - 2025-01-27
1942

2043
### Fixed

core_js/google_link_fix.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,36 @@
2626

2727
function injectFunction() {
2828
let ele = document.createElement('script');
29+
ele.type = 'text/javascript';
30+
ele.textContent = `
31+
(function() {
32+
"use strict";
33+
34+
${hookRwtProperty.toString()}
35+
36+
const rwtDescriptor = Object.getOwnPropertyDescriptor(window, 'rwt');
37+
if (!('rwt' in window) || (rwtDescriptor && rwtDescriptor.configurable)) {
38+
hookRwtProperty();
39+
}
40+
})();
41+
`;
42+
2943
let s = document.getElementsByTagName('script')[0];
30-
if (s === undefined) {
31-
return;
44+
if (s !== undefined) {
45+
s.parentNode.insertBefore(ele, s);
3246
}
47+
}
3348

34-
ele.type = 'text/javascript';
35-
ele.textContent = "Object.defineProperty(window, 'rwt', {" +
36-
" value: function() { return true; }," +
37-
" writable: false," +
38-
" configurable: false" +
39-
"});";
40-
41-
s.parentNode.insertBefore(ele, s);
49+
function hookRwtProperty() {
50+
try {
51+
Object.defineProperty(window, 'rwt', {
52+
configurable: false,
53+
writable: false,
54+
value: function() { return true; }
55+
});
56+
} catch (e) {
57+
console.debug('ClearURLs: Failed to hook rwt property', e);
58+
}
4259
}
4360

4461
/*
@@ -65,6 +82,6 @@
6582
}
6683
}, true);
6784
}
68-
85+
6986
main();
7087
})(window);

manifest.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "ClearURLs",
4-
"version": "1.27.2",
4+
"version": "1.27.3",
55
"author": "Kevin Roebert",
66
"description": "__MSG_extension_description__",
77
"homepage_url": "https://docs.clearurls.xyz",
@@ -270,6 +270,18 @@
270270
"*://*.google.co.zw/*",
271271
"*://*.google.cat/*"
272272
],
273+
"include_globs": [
274+
"http?://www.google.*/",
275+
"http?://www.google.*/#hl=*",
276+
"http?://www.google.*/search*",
277+
"http?://www.google.*/webhp?hl=*",
278+
"https://encrypted.google.*/",
279+
"https://encrypted.google.*/#hl=*",
280+
"https://encrypted.gogole.*/search*",
281+
"https://encrypted.google.*/webhp?hl=*",
282+
"http?://ipv6.google.com/",
283+
"http?://ipv6.google.com/search*"
284+
],
273285
"js": [
274286
"core_js/google_link_fix.js"
275287
],

0 commit comments

Comments
 (0)