Skip to content
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

Create a Firefox Quantum version of TabFern #100

Open
2 of 5 tasks
cxw42 opened this issue Dec 17, 2017 · 40 comments
Open
2 of 5 tasks

Create a Firefox Quantum version of TabFern #100

cxw42 opened this issue Dec 17, 2017 · 40 comments
Labels
infrastructure Issues other than direct user-facing functions long-term Issues that are open for long-term discussion, or that will take a while to close request User requests made via other channels target-firefox Firefox-specific issues

Comments

@cxw42
Copy link
Owner

cxw42 commented Dec 17, 2017

Mentioned in #82 and #99.
Firefox does support the chrome.* API (at least at present), so we don't need to switch to browser.*.

Known issues

  • When creating a new window in FF 64, the tab-created and tab-activated messages arrive before the window-created message (!). Therefore, we need to cache new tabs in the multidex without windows somehow, and flush them out if the window never arrives. I think we can probably stick them in the holding pen. Log:

    Object { "Tab created": 14, ctab: {…} }                            main_tl.js:2549
    Unknown window ID 72 - ignoring                                    main_tl.js:2554
    Object { "Tab activated": 14, activeinfo: {…} }                    main_tl.js:2762
    Object { "Window created": 72, "Restore?": "no", cwin: {…} }       main_tl.js:2134
    Object { "Tab updated": 14, Index: 0, changeinfo: {…}, ctab: {…} } main_tl.js:2633
    
  • Figure out how to handle about:debugging, about:config, and any other URLs that extensions aren't allowed to create (see 5e52143). (Are there any other such URLs? May need to grep the FF source.)

  • (Hack added in fdecec3) Update the build pipeline to produce separate Chrome and FF versions. At present, all I know of is that we need to use a different manifest for each browser (see Create a Firefox Quantum version of TabFern #100 (comment)).

  • Cannot find "process" from "/" error on load on macOS (edit currently the workaround has to be applied by hand. At least automate that, if nothing else. But first update the customized Brunch based on upstream.)

  • app/win/const.js:openWindowForURL(): On FF:

  • the window.create call makes a new tab instead of a new window

  • After the tabs.get call, the URL for the settings window is still about:blank. Looks like we need to wait until the tab-load state gets to complete before testing the url.

    • Either that, or just don't use the unwanted-tab code on Firefox and see what happens! :)
@cxw42 cxw42 added infrastructure Issues other than direct user-facing functions request User requests made via other channels labels Dec 17, 2017
@cxw42 cxw42 mentioned this issue Dec 18, 2017
cxw42 pushed a commit that referenced this issue Dec 27, 2017
Changes to get the popup to load in Firefox.  It is nowhere near
functional, though :) .
@cxw42
Copy link
Owner Author

cxw42 commented Apr 16, 2018

Requested by Ismo Räävi via support request 2018/04/15

@cxw42 cxw42 added long-term Issues that are open for long-term discussion, or that will take a while to close target-firefox Firefox-specific issues labels May 10, 2018
cxw42 pushed a commit that referenced this issue Aug 6, 2018
None of the icons are visible, but you can save windows and restore them
from the TabFern window.
cxw42 pushed a commit that referenced this issue Aug 7, 2018
In Firefox, chrome.windows.create throws rather than returning error to
the callback if you try to open a window including, e.g.,
`about:debugging`.  Add a try block so that failure doesn't prevent
opening windows later on.  (#100)
@devinrhode2
Copy link
Contributor

Hey @cxw42 what's the status on FF support?

@devinrhode2
Copy link
Contributor

Looks like the steps in "Hacking on TabFern" for the switchover branch might now be right... not sure... Shouldn't a dev change to switchover branch? And branch off of switchover? https://github.com/cxw42/TabFern/wiki/Hacking-on-TabFern

Last but not least, I'm not sure how to use the built extension in firefox!

@cxw42
Copy link
Owner Author

cxw42 commented Dec 26, 2018

@devinrhode2 Unfortunately, I haven't had a chance to work on it. It does load as a temporary add-on without crashing, but I wouldn't consider it particularly usable :) . I would be delighted to have some help! Yes, if you do have any time, I would ask that you please work off switchover if you are able. I am currently focused on #35 and would be delighted to include FF support in the next release as well!

Using the built extension: See Loading temporary add-ons in Firefox. Pick public/manifest.json as the thing to load. See the top comment (#100 (comment)) for open concerns I am aware of. Thank you!

@devinrhode2
Copy link
Contributor

I tried loading this, I have the extension icon in the top right in FF, but clicking it doesn't do anything :(

screen shot 2018-12-26 at 11 31 44 am

@devinrhode2
Copy link
Contributor

(So I guess that's what the status on FF is :)

@cxw42
Copy link
Owner Author

cxw42 commented Dec 26, 2018

Yep, those are normal (broadly defined :D). Did you see the extension window pop up on its own? Try double-clicking the icon and see if you get the window (double-click = summon to current browser window).

When I load the temporary extension, I get the same manifest errors, but the TF window opens anyway.

@devinrhode2
Copy link
Contributor

devinrhode2 commented Dec 26, 2018 via email

cxw42 pushed a commit that referenced this issue Dec 26, 2018
`npm run ff` will build and then make a `public-ff` tree you can load
as a temporary extension in Firefox Quantum.

Also removed old files we no longer need.
@cxw42
Copy link
Owner Author

cxw42 commented Dec 26, 2018

@devinrhode2 Unfortunately, the screenshots did not come through. However, I added a fix for the manifest issues, in case that helps. Instead of npx brunch ..., say npm run ff. That will build a public-ff tree. Load public-ff/manifest.json in Firefox and see if that helps any. Thanks!

@devinrhode2
Copy link
Contributor

Original should come through now:

When I first load the extension in about:debugging, I see this:
screen shot 2018-12-26 at 1 16 38 pm

When I reload I see this:
screen shot 2018-12-26 at 12 54 22 pm

After pulling that from switchover I see:
First load:
screen shot 2018-12-26 at 2 59 14 pm

Reload:
screen shot 2018-12-26 at 2 59 26 pm

@cxw42
Copy link
Owner Author

cxw42 commented Dec 27, 2018

Thanks! The screenshots did come through. I am on Windows, which is why I think I might be having trouble replicating. I did try a fresh npm install with all my global modules uninstalled, still without successfully replicating. I can think of three next steps to try:

  1. If you have brunch installed globally, remove it --- I am using a tweaked version.

  2. (See https://developer.mozilla.org/en-US/docs/Tools/Working_with_iframes if you're not familiar with this.) In the developer console, select the middle iframe (win/main.html). Then say log.setLevel(log.levels.INFO). That may provide more debug information.

  3. Would you please send me a copy of your generated public-ff/bg/background.js? I'd like to see if there are any differences.

Thank you for working with me on this!

@devinrhode2
Copy link
Contributor

  1. No global brunch
  2. Not working, we'll need to get creative here I think. log.setLevel throws a ReferenceError on log
  3. Background.js: https://gist.github.com/devinrhode2/86ae0e9e8629ae01ccb0adb142debba4 (this is the only script that appears when I click "edit as html" in the background page)

@devinrhode2
Copy link
Contributor

Some screenshots coming up..

@devinrhode2
Copy link
Contributor

Showed inspecting the location.href of the extension background page, and contrasted with mashable.com - in top right there's a strange little windowing type of button that's for selecting the frame. Not available for the background page. I am surprised that the background page uses iframes though... why is that? I figure the thing to do will be to set the sub-frames to have hijacked console methods that use YourWIndow.sendMessage to log console messages from top frame (only in FF) - or, maybe, we could eliminate usage of iframes.
screen shot 2018-12-26 at 7 46 31 pm
screen shot 2018-12-26 at 7 46 56 pm
screen shot 2018-12-26 at 7 38 19 pm

cxw42 pushed a commit that referenced this issue Dec 27, 2018
Another try at fixing the "can't load process" in #100.
From brunch/brunch#1503 (comment).
@cxw42
Copy link
Owner Author

cxw42 commented Dec 27, 2018

iframes

Oh - my fault. The background doesn't have any iframes. That's the main window, so remember the iframe + log for once we get the window to open :D . Sorry for the confusion!

process

OK - you are indeed getting some code I am not!

$ diff -U3 public-ff/bg/background.js background-devin.js
--- public-ff/bg/background.js  2018-12-26 20:01:04.363629700 -0500
+++ background-devin.js 2018-12-26 21:16:51.100429200 -0500
@@ -355,6 +355,7 @@
 ;
 (function() {
 var global = typeof window === 'undefined' ? this : window;
+var process;
 var __makeRelativeRequire = function(require, mappings, pref) {
   var none = {};
   var tryReq = function(name, pref) {
@@ -893,7 +894,8 @@

 });

-;require.alias("path-browserify", "path");require.register("___globals___", function(exports, require, module) {
+;require.alias("path-browserify", "path");
+require.alias("process/browser.js", "process");process = require('process');require.register("___globals___", function(exports, require, module) {

 });})();require('___globals___');

Seems to be the same symptoms as brunch/brunch#1503.

I added the suggested fix from brunch/brunch#1503 (comment) - would you please try the latest commit when you get a chance and let me know if it works?

@devinrhode2
Copy link
Contributor

wow removing those added bits got the extension to just popup when I reloaded the background page!

@cxw42
Copy link
Owner Author

cxw42 commented Dec 27, 2018

Great news! Now is the time for log.setLevel.

Would you please start a new topic branch from this point for Firefox? I'm going to do the same for issue 35. That way we won't step on each other's toes, and the eventual PRs will be cleaner.

If you find anything I haven't listed above, feel free to ping me here or open a separate issue as you see fit.

I am going to update the wiki with some more development info in the next few days. Re. the event-order issue, for example, every tab has to be represented in both the multidex and the jstree. The jstree had a holding-pen node where we can hang the tree node for a new tab before its window arrives.

@devinrhode2
Copy link
Contributor

The h0-main.js errors were from other extensions
screen shot 2018-12-27 at 12 59 14 pm

@devinrhode2
Copy link
Contributor

It's a success report

@cxw42
Copy link
Owner Author

cxw42 commented Dec 27, 2018

Re. save data - yes - should be no problem. The save-data file is just JSON.

Ideally, there should be no difference in functionality between Chrome and FF when we're done. I certainly have not intentionally added any differences.

@devinrhode2
Copy link
Contributor

Ok so I haven't switched over yet, figured out I can port active tabs by just bookmarking all tabs, but when I restarted firefox, I had some sort of "browser crashed, do you want to restore session?" from firefox, and saw this:

screen shot 2018-12-28 at 8 43 06 am

TabFern is not actually installed, since I'm just loading it from the directory, so probably there's some issue with Tab Center Redux

@cxw42
Copy link
Owner Author

cxw42 commented Dec 28, 2018

Indeed, it may well be an interaction bug. Not sure why the crash would have happened, though. I just found this which looks like it has useful info (most notably, switch to Developer Edition and set xpinstall.signatures.required to false) - I'll try it myself when I get the chance.

cxw42 pushed a commit that referenced this issue Dec 28, 2018
This way your saved tabs will persist across Firefox sessions.
@cxw42
Copy link
Owner Author

cxw42 commented Dec 28, 2018

Edited

OK - I tried web-ext without success. However, what did work for me (with commit 72ffa2f on switchover) is:

At one point, something messed up the permissions on public-ff. However, exiting Dev Edition, removing the dir, and recreating seems to have worked fine.

Hacking

  • Make sure you have c764b39 or later

  • Say npx brunch w --env firefox instead of npm run ff (although the latter will still work).

    • bash alternative: BRUNCH_ENV=firefox npx brunch w

    • cmd alternative:

      set BRUNCH_ENV=firefox
      npx brunch w
      
  • Start up FF Dev Edition, hit "Load temporary," and pick the manifest from public-ff.

  • When you make changes, brunch w will automatically rebuild the public-ff tree 🎉 .

  • Hit Ctrl+F5 in the TabFern window and the rebuilt public-ff/win will be loaded from disk. (Ditto for the Settings window.)

  • If you change the manifest or background, you will need to go to about:debugging and click "Reload" to see the changes.

cxw42 pushed a commit that referenced this issue Dec 28, 2018
Run `BRUNCH_ENV=firefox npx brunch w`, and the watch will regenerate the
public-ff/ tree whenever you change the source files.
@SamirSaidani
Copy link

SamirSaidani commented May 27, 2019

Hi,
I'm reporting success with v0.2.0.1340 release and FF 66.0.3
The css is kinda weird, but as far as I've tested, it's working...

Thanks god you did it !

I'd love to tip you, but didn't find anything for that on TabFern webpage...

@cxw42
Copy link
Owner Author

cxw42 commented May 28, 2019

@Samir-S Thank you! I'll get right on that :D .

Please back up frequently! I don't know what differences between Chrome and Firefox may be lying in wait to cause issues. I look forward to any feedback you may have.

@cxw42
Copy link
Owner Author

cxw42 commented Jul 19, 2019

@devinrhode2 re. "cannot find module process from /" --- I now have an Ubuntu 18.04 setup and am seeing the same. For now I am going to do the manual hack you suggested (removing the lines) :) . If I think of anything better I'll let you know.

Specifically (for the benefit of future readers), after running npx brunch b, I edited public/bg/background.js as follows:

require.alias("process/browser.js", "process");process = require('process');require.register("___globals___", function(exports, require, module) {

was changed to:

//require.alias("process/browser.js", "process");process = require('process');
require.register("___globals___", function(exports, require, module) {

(added // and line break).

My Brunch is somewhat customized, which may be causing an issue. I'll look into it in due course.

cxw42 pushed a commit that referenced this issue Jul 31, 2019
- Added a 'require' to pull process into the background page.  May fix
  the issue identified at
  #100 (comment) .
- More sophisticated stringification of chrome.runtime.lastError.
  Somewhere around Chrome 75, chrome.runtime.lastError lost toString(),
  as far as I can tell.
@cxw42
Copy link
Owner Author

cxw42 commented Jul 31, 2019

@devinrhode2 Would you please join me at #179? Thanks!

@rugk
Copy link

rugk commented Sep 25, 2019

@cxw42
Copy link
Owner Author

cxw42 commented Sep 26, 2019

@rugk Yes, indeed, but thanks for checking! Do you happen to have any bandwidth to help out? :D

The differences TF runs into are largely undocumented assumptions. E.g., in Chrome, a window always has at least one tab, but that's not the case in Vivaldi. In Firefox, the extension can't manipulate any about:debugging tab, unlike in Chrome.

@rugk
Copy link

rugk commented Sep 26, 2019

I may have a look. Though seeing that it has already worked and I don't exactly know what is still TODO here.
I see these tick boxes in the OP, but do all of them need to be solved?

@cxw42
Copy link
Owner Author

cxw42 commented Sep 26, 2019

@rugk Thanks for considering! Yes, all of the check boxes at the top are things that need to be fixed before the general public can use TF on FF. There may be others that will show up once those are done.

Sometime in the next few days I am going to make what is now the issue35 branch the mainline, so that's the branch to look at if you're investigating. The license will be clarified to CC-BY-SA 3.0+ in the near future, unless any of the existing contributors object.

@rugk
Copy link

rugk commented Sep 27, 2019

CC licenses should not really be used for software. (they are intended for everything else) Rather use something like GPL instead then.
Also this trademark claim in the license file is a little strange. Did you really register a trademark?

@cxw42
Copy link
Owner Author

cxw42 commented Sep 27, 2019

@rugk That discussion is at #145

@7vq
Copy link

7vq commented Jan 18, 2022

Just a note for anyone wondering how functional this extension currently is: I tested it for 5 minutes and frankly if Tree Style Tab interop was implemented I would use it as-is. The only bugs I've seen are two from the OP. Specifically:

  • The "When creating a new window ..." bug: when you make a new window, that first tab is not seen by the extension. All later tabs seem to work perfectly. (And if you have multiple tabs in the window and just close and re-open the first tab, that first tab then seems to work perfectly.)
  • The about:debugging etc bug: you can save a window that contains an about page tab, but trying to re-open such windows throws an error. You can just remove that tab from the saved window though.

I installed the extension as @cxw42 recommended earlier (downloading the "webstore" zip from TabFern's releases):

Using the built extension: See Loading temporary add-ons in Firefox. Pick public/manifest.json as the thing to load.

 
 

@cxw42 I skimmed this issue and #179. Given that the extension seemed to work for me (I'm on macOS), should Cannot find "process" from "/" be checked off in the OP of this issue? Or does that bug only show up if you try to build from source, or something?


(Not sure what the "openWindowForURL" checkbox/issue in the OP refers to.)

@cxw42
Copy link
Owner Author

cxw42 commented Jan 20, 2022

@7vq Thanks very much for trying it out, and for the update! Glad to hear the good news --- I haven't run it on FF in a while.

What version of Firefox did you use, and what version+CPU of macOS?

Re. #179, building from source produces exactly what goes in the ZIP file. Therefore, I think that box can be checked! 🎉

@cxw42
Copy link
Owner Author

cxw42 commented Jan 20, 2022

@7vq

Tree Style Tab interop

Would you please open a new issue for that? I'm curious to hear more about what you're looking for.

@7vq
Copy link

7vq commented Jan 21, 2022

Thanks very much for trying it out, and for the update!

Of course. Thanks for making it!

What version of Firefox did you use, and what version+CPU of macOS?

Firefox 96.0.1, Big Sur, Intel

Tree Style Tab interop

Would you please open a new issue for that?

Definitely! Here: #286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Issues other than direct user-facing functions long-term Issues that are open for long-term discussion, or that will take a while to close request User requests made via other channels target-firefox Firefox-specific issues
Projects
None yet
Development

No branches or pull requests

5 participants