Comments (17)
According to your report, I had do some tests. Like you said, if I select 'Always Allow on This Website', there won't be any memory issues, but if I choose 'Always Allow on Every Website', it does.
After trying a few times, I found the issue lies not in 'Always Allow on This Website' or 'Always Allow on Every Website', but in the length of the matches list in the manifest file.
google: {
contentScripts: [
{
matches: [
"https://www.google.com/search?*",
"https://www.google.ad/search?*",
]
}
]
}
bing: {
contentScripts: [
{
matches: [
"https://www.bing.com/search?*",
"https://www.bing.com/images/search?*",
]
}
]
}
etc...
If I keep only a few matches rules in the manifest file as shown above, then select 'Always Allow on Every Website' is also fine.
So the key point is that each enabled matches rule contributes to the increasing severity of this memory issue.
The following is my speculation (not verified in practice), provided for reference only.
- Maybe every enabled matches will trigger the content-script, even this page was not loaded at all? (can we print some log in content-script file to verify this?)
- If above is true, maybe some memory leak in content-script. We can find the issue by debugging the code in the content-script in depth.(disable functions one by one)
- If a blank content-script file still can't solve the problem. This means that 1 and 2 are wrong
- Is it possible to avoid this issue by reducing matches list in manifest?
Thank you very much for your continued attention to this difficult issue.
My help on this issue is very limited. If you need me do some check work, feel free to leave a message.
from ublacklist.
Perhaps simply replacing the content script with a short script that imports it might fix the problem...?
import-content-script.js
import("./content-script.js");@HoneyLuka Would you please try #505 , which is based on v8.8.1 and introduces import-content-script.js?
After my test, I think this issue has been completely resolved, and the memory usage is even more efficient than in the previous version.
It just ... magic.
After this, I think safari version can be updated normally
Thank you for your hard work :)
from ublacklist.
@HoneyLuka I appreciate your prompt action.
The problem occurs with my own build too. When Safari crashes, Xcode reports that "uBlacklist" was killed by OS because of too much memory, but not always. I guess some code introduced by #490 (my own code or dependencies) has a problem with Safari, but I have no idea what it is. Interestingly, the problem cannot be reproduced with iOS simulator (17.5). @HoneyLuka Do you have any thoughts?
If the problem cannot be solved immediately, we may need to create a branch for Safari based on v8.7.1 and cherry-pick bug fixes of the main branch.
After two hours of debugging, I still couldn't find the root cause of the problem. As you mentioned, the problematic version causes Safari's memory usage to be significantly high. I tried upgrading or downgrading the dependencies in package.json, but the issue wasn't resolved.
This memory issue occurs even when Safari is left with just a blank page. Therefore, I think we can narrow down the problem by gradually disabling the program's functional modules. If disabling a particular module causes Safari's memory usage to return to normal, then we have identified that the issue lies within that module. After that, it will be much easier to continue to go deep into the module to locate specific problems.
For example, we could directly disable the cloud sync module. If we find that Safari's memory usage returns to normal once this module is disabled, then we have pinpointed the problem.
Because I'm not very familiar with the project, I don't have a clear idea of where to quickly disable the entire module. So, I think it would be faster if you do this.
I apologize for being occupied with work-related matters recently, which has limited my availability to focus on this issue.
from ublacklist.
I’ve observed that even after completely disabling the background page, the problem persists. On the other hand, it doesn’t occur when the content script is empty. However, identifying the specific code in the content script causing the problem remains unclear. It seems to me that gradually applying changes in #490 leads to a gradual increase in memory usage. Additionally, reducing the number of entries in the content_scripts
field in manifest.json
mitigates the problem.
I’ve also noticed that enabling the extension via ‘Always Allow on Every Website’ causes the settings page in Safari settings (not the extension’s options page) to become very slow and display incorrect permission information. To be specific, the dropdowns show ‘Ask’ even though they actually behave as ‘Allow’. After encountering this issue, every page—regardless of its relation to the extension—consumes a significant amount of memory. Escaping this state is challenging because Safari remembers the ‘Always Allow on Every Website’ setting, which cannot be reset by reinstalling the extension. I haven’t encountered this problem on my iPad, where the extension is enabled via ‘Always Allow on This Website’.
Interestingly, this phenomenon persists even with v8.8.2 (the same as v8.7.1) to some extent. With my iPhone, enabling ‘Always Allow on Every Website’ made the settings page slow, and every page exhibits high memory usage (hundreds of megabytes).
My hypothesis is that this issue is related to a memory leak bug of Safari concerning content script permissions (possibly related to issue #398 ?) and the memory usage increase in v8.8.0 has brought this bug to light.
@HoneyLuka, I apologize for interrupting your busy schedule, but could you please investigate whether 'Always Allow on This Website' does not trigger the bug and ‘Always Allow on Every Website’ does? Perhaps you need to build v8.8.1 with a different bundle ID to reset the permission settings.
from ublacklist.
@HoneyLuka Thank you for your rapid response!
- Maybe every enabled matches will trigger the content-script, even this page was not loaded at all? (can we print some log in content-script file to verify this?)
As far as I tested, the content script is not loaded when search engine result pages (SERPs) are not loaded. I added code that modifies DOM, calls console.log()
, and sends blocklists to the background page to the content script, but it had no effect unless SERPs are loaded.
Nonetheless, memory usage on non-SERP pages increases significantly.
- If above is true, maybe some memory leak in content-script. We can find the issue by debugging the code in the content-script in depth.(disable functions one by one)
- If a blank content-script file still can't solve the problem. This means that 1 and 2 are wrong
I'm not sure if 1. is true, but since the problem does not occur with an empty content script, I believe that the content of the content script is somehow affecting the bug. I will continue to look for code that increases memory usage.
- Is it possible to avoid this issue by reducing matches list in manifest?
I think so, but how do we select which matches to remove...?
from ublacklist.
Perhaps simply replacing the content script with a short script that imports it might fix the problem...?
import-content-script.js
import("./content-script.js");
@HoneyLuka Would you please try #505 , which is based on v8.8.1 and introduces import-content-script.js?
from ublacklist.
@HoneyLuka Thank you for testing the solution so quickly! I'll merge it soon.
from ublacklist.
I didn't test it in detail, but there are some problems with the performance. I tested it on mac, and when I opened the new tab (command + T), I would feel an obvious delay, and the problem disappeared after disabling uBlacklist.
from ublacklist.
For me on top of the stuttering, Safari crashes every time I close the last Tab or try to open a new one.
from ublacklist.
I installed the previous version (8.7.1) and there is no performance problem
from ublacklist.
I didn't test it in detail, but there are some problems with the performance. I tested it on mac, and when I opened the new tab (command + T), I would feel an obvious delay, and the problem disappeared after disabling uBlacklist.
The Settings app on iOS/iPadOS can be also stuttering when uBlacklist is enabled right on the Safari section.
from ublacklist.
I have an older iPhone and with this latest update it's enough to crash Safari consistently.
from ublacklist.
I have an older iPhone and with this latest update it's enough to crash Safari consistently.
I tested with iPhone 15 Plus and iPad mini 6. They are a bit outdated actually.
from ublacklist.
I have already submit a new version to rollback the code to 8.7.1
from ublacklist.
For me on top of the stuttering, Safari crashes every time I close the last Tab or try to open a new one.
Same here. Safari crashes every time I try to switch profiles or groups. Also, after I search for something on Google, I cannot click the search results, and my phone starts getting really hot. I'm using iPhone 15 Pro on iOS 17.5.1.
from ublacklist.
@HoneyLuka I appreciate your prompt action.
The problem occurs with my own build too. When Safari crashes, Xcode reports that "uBlacklist" was killed by OS because of too much memory, but not always. I guess some code introduced by #490 (my own code or dependencies) has a problem with Safari, but I have no idea what it is. Interestingly, the problem cannot be reproduced with iOS simulator (17.5).
@HoneyLuka Do you have any thoughts?
If the problem cannot be solved immediately, we may need to create a branch for Safari based on v8.7.1 and cherry-pick bug fixes of the main branch.
from ublacklist.
Perhaps simply replacing the content script with a short script that imports it might fix the problem...?
No way! 😅
I was regularly checking this issue, and to think that this would be the solution haha.
Software development can be so weird sometimes.
from ublacklist.
Related Issues (20)
- Google new layout HOT 4
- Add support for Mojeek
- Traditional Chinese is not displayed HOT 2
- [{?} sites blocked by uBlacklist] [Show] is not displayed. HOT 3
- Websites aren't blocked in Google Image Search HOT 9
- Add Web Search (vanilla google search) to default google url lists? HOT 2
- Opera Browser HOT 4
- Yandex HOT 1
- Invisible all search results in Ecosia HOT 2
- [Safari]"Block this site" button in google search list display issue HOT 4
- Can't block specifically for DDG image search HOT 3
- I had Quora blocked from search results but now.. HOT 2
- v8.8.1 Stopped working on Firefox (127.0.1 Windows 11) as of June 22, 2024 HOT 1
- "Block this site" links layout issue in Google Videos tab
- Using Google's advanced operators disables full-range uB blocking
- [Bug] DuckDuckGo's "More Videos" button overlaps search results when using uBlacklist HOT 5
- url including specific Chinese words
- sites.google.com title
- block this site link not appearing on search results - opera - duck duck go HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ublacklist.