-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Firefox support #225
base: master
Are you sure you want to change the base?
Conversation
This bug drove me insane for virtually all the time I'm in porting this extension to Firefox. Sometimes when I switch to a tab and then click unsuspend, it may load not to an intended URL, but to about:blank instead. Few mounths into the work this bug caught my attention, and after dozens of unsuspends I've come with this: Immediately after tab switch, TGS starts a checker to check and match suspended tabs with the extention state. But it forks not immediately, and in a short time window it's possible to unsuspend unchecked tab. It leads to the following log: 'Resuspending unresponsive suspended tab' and the call of `tabsReload(tab.id);`. On Chromium it's perfectly fine, but in FF it just breaks everything (posibly due to a bad code inside the browser engine) and leads to loading blank page insted of a desired. Patch adds a flag so checker won't reload the tab and let it unsuspend properly. This flag later will be cleared by existing code in `handleUnsuspendedTabStateChanged`.
Remove autodiscardable since it's not currently supported by Firefox.
Firefox by default comes with conflicting shortcut in Firefox Screenshots system extension.
This flag allows replacing URL in tab history therefore making tab history clean and usable. NOTE: loadReplace is unique to Firefox, in Chrome achieved via history manipulations.
Firefox does not support callbacks for chrome.tabs.discard, it uses promisses instead.
Internal views for tabs in different containers are currently unavailable in Firefox. Discard container tabs instead of suspending achieves the best possible effect without redesigning entire extension.
Add `wrappedJSObject` to fix "Operation is insecure" exception. Credits: https://bugzilla.mozilla.org/show_bug.cgi?id=1613779#c1
Use promise instead of Chrome's callback
Use the correct argument name to prevent key event errors
}, | ||
"applications": { | ||
"gecko": { | ||
"id": "themarvelloussuspender@dvalter" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires a change
"content_security_policy": "script-src 'self'; object-src 'self'; child-src 'self'; connect-src 'self'; img-src 'self' data: chrome:; style-src 'self'; default-src 'self'", | ||
"incognito": "split", | ||
"incognito": "not_allowed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not make it work in private mode in FF, the easiest workaround would be to split manifests and package different ones for Chrome and FF
@@ -303,6 +303,10 @@ var gsTabSuspendManager = (function() { | |||
let discardInPlaceOfSuspend = gsStorage.getOption( | |||
gsStorage.DISCARD_IN_PLACE_OF_SUSPEND, | |||
); | |||
if (tab.cookieStoreId != "firefox-default") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not make it work with FF tab containers, however, discarding works fine here
See dvalter#6 event.keyCode has been deprecated for a while (apparently) and it could well be that Firefox never supported it. The result is that a JS error is generated at every keystroke, and logged or printed to the calling terminal if |
This is a draft of a Firefox support PR.
It is based on my TGS fork with all the necessary commits rebased on the MS master branch.
It would probably break some (or most) of functionality in Chrome, so some changes are likely needed
Fixes #18