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

Port to WebExtensions API (support Firefox Quantum, version 57) #45

Closed
eric-bixby opened this issue Feb 23, 2017 · 66 comments
Closed

Port to WebExtensions API (support Firefox Quantum, version 57) #45

eric-bixby opened this issue Feb 23, 2017 · 66 comments
Assignees
Labels
Priority: 2-High Serious problem that could block progress Status: Completed The issue is closed Type: Enhancement The issue is a request for new functionality
Milestone

Comments

@eric-bixby
Copy link
Owner

@EMLVIRUS: You might find this interesting based on your request to have this add-on support Chrome in issue #38.

Based on the following article, it appears the Mozilla wants to require add-ons use the WebExtensions API:
https://www.bleepingcomputer.com/news/software/the-future-of-firefox-add-ons/

FYI...information about WebExtensions:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions

@eric-bixby eric-bixby self-assigned this Feb 23, 2017
@Riajyuu
Copy link
Contributor

Riajyuu commented Feb 23, 2017

Currently, Web Extension requires any extension injects code on website-based level (that's why it got its name) instead of accessing browser's files (including bookmarks folder in user's profile) directly.
conclusion: if Web Extension doesn't complement at all in this way, this addon is likely to be abandoned.

@eric-bixby eric-bixby changed the title Investigate Porting to WebExtension API Port to WebExtension API Feb 23, 2017
@eric-bixby
Copy link
Owner Author

Unfortunately, yes. If the WebExtensions doesn't provide the capabilities that this add-on needs, then this add-on will not be supported by the November 2017 release of Firefox. However, it may live on in Firefox ESR and PaleMoon.
http://www.palemoon.org/

@eric-bixby eric-bixby added Priority: 3-Medium Has the potential to affect progress Status: Pending The issue has been assigned but is not currently being worked on Type: Enhancement The issue is a request for new functionality labels Feb 25, 2017
@eric-bixby eric-bixby added this to the 3.0 milestone Feb 25, 2017
@yfdyh000
Copy link

@eric-bixby
Copy link
Owner Author

My plan is to port the main branch of this add-on to WebExtensions. I will do this as beta releases (so hopefully, I can get some beta testers to sign-up).

Since PaleMoon doesn't plan to support WebExtensions, I will need to update the PM branch:
https://github.com/antoyo/auto-sort-bookmarks/tree/palemoon

I tried ChromeStoreFoxified on a different Chrome add-on and it didn't work, so WebExtensions is getting Firefox closer to Chrome, but it's not 100% yet.

@yfdyh000
Copy link

so WebExtensions is getting Firefox closer to Chrome, but it's not 100% yet.

Yes, see http://arewewebextensionsyet.com/.

@eric-bixby
Copy link
Owner Author

I saw that site, thanks, it is useful to see the progress.

@Taurean75
Copy link

Any progress?

@eric-bixby
Copy link
Owner Author

eric-bixby commented Aug 12, 2017 via email

@Taurean75
Copy link

Hmmm, I can't find any good ones on Chrome Store.

@eric-bixby
Copy link
Owner Author

IMHO, I like sprucemarks:
https://github.com/ForestMist/sprucemarks

@heftig
Copy link

heftig commented Aug 15, 2017

Thanks for supporting us this far. Two years of sorted bookmarks for me.

I've cobbled together a replacement this weekend:
https://addons.mozilla.org/en-US/firefox/addon/sort-bookmarks-webext/

Mostly for myself, I admit. It's definitely not at feature parity.

It was quite the adventure diving into JavaScript.

@eric-bixby
Copy link
Owner Author

eric-bixby commented Aug 15, 2017 via email

@eric-bixby
Copy link
Owner Author

eric-bixby commented Aug 15, 2017 via email

@Taurean75
Copy link

I can. BTW, I've some programming experiences but not in JavaScript unfortunately.

@eric-bixby
Copy link
Owner Author

eric-bixby commented Aug 16, 2017 via email

@Riajyuu
Copy link
Contributor

Riajyuu commented Aug 16, 2017

@eric-bixby why not post a pre-release on GitHub so that people will decide if they will test.

@eric-bixby eric-bixby added Priority: 2-High Serious problem that could block progress and removed Priority: 3-Medium Has the potential to affect progress labels Aug 16, 2017
@eric-bixby
Copy link
Owner Author

@EMLVIRUS: Yes, that's what I'm planning to do (use the pre-release feature), except I just need one person (more is even better) to provide me feedback (or reassurance) that at lease one person has tried it and their browser didn't crash. I definitely want it easy for anyone to try the pre-release.

@eric-bixby
Copy link
Owner Author

I changed my mind. I'll keep it completely open. I'll just post the pre-release and not wait for feedback. If @Taurean75 checks it out, then great. If he doesn't, then that's fine too. I'll just be sure to give people a chance to try it before doing a normal release.

@Taurean75
Copy link

Okay, fine with me.

@eric-bixby
Copy link
Owner Author

I posted my first beta release:
https://github.com/antoyo/auto-sort-bookmarks/releases/tag/v3.0beta1

Enter "about:debugging" into location bar, then load the .xpi file.

No sorting yet. This just shows the settings page.

@Riajyuu
Copy link
Contributor

Riajyuu commented Aug 20, 2017

Nothing wrong here.

@eric-bixby
Copy link
Owner Author

Cool, thanks.

@eric-bixby
Copy link
Owner Author

eric-bixby commented Sep 28, 2017

I created a hybrid version for migrating prefs from the legacy API to web-ext. I got stuck trying to figure out how weh (web-extension-helper) stores the prefs. Looks like it's a list of name/value pairs that is saved in local-storage. I was trying to find a dev-tool to show me what the data looks like. Mozilla provides a dev-tool (previously called FireBug) for doing inspection. I'm just having problems getting it to work (I don't see the data). It may be that since the add-on is temporarily installed then the prefs don't actually get saved to storage.

@Taurean75
Copy link

In that case, how about working on other parts first...?

@eric-bixby
Copy link
Owner Author

I'm no longer blocked, I was able to get my question answered on the web-ext-support mailing list:
https://mail.mozilla.org/listinfo/webextensions-support

Anyway, I'll try to post another beta release this weekend.

@Taurean75
Copy link

Any updates?

@eric-bixby
Copy link
Owner Author

I've been working on it. Once I have manual sorting working, then I'll post another beta release. I decided to skip doing a embedded/hybrid release and just focusing on porting.

@eric-bixby
Copy link
Owner Author

Due to a typo in my .eslintrc, I'm also upgrading from es5 to es6. I wasn't planning to but since there's some nice features in es6, I figured I may as well upgrade.

@havrancek
Copy link

great, when i will be ready?

@eric-bixby
Copy link
Owner Author

The goal is to be finished before the end of November. Ideally, I'll be able to release a couple beta releases before then.

@Taurean75
Copy link

No beta release?

@eric-bixby
Copy link
Owner Author

I'm planning another beta release this weekend.

The two remaining hurdles are:

  1. port to browser.bookmarks.getChildren() API.
  2. exclude folders feature: create new code for annotations/tags.

For #2, since tags work differently in the chrome API, I think this will take more work, so I'm going to skip it for the 3.0 release and concentrate on the auto/manual sorting (#1).

@eric-bixby
Copy link
Owner Author

Still not sorting yet. I got the getChildren() call working. Except it's async, so still need to do some more work to get the flow right. It tries to sort, before the getChildren() finishes, thus there is nothing to sort.

@defmonk0
Copy link

defmonk0 commented Nov 14, 2017

The getChildren function seems to return a promise. You have a couple options from there for reacting to it. Using the standard promise->then syntax, or using await. It's up to you on which one you prefer.

Assuming you weren't using the promise syntax before, using promise->then is likely much easier since await generally is a bit harder to make clean code without planning for it in the code structure from the start.

A simple example:

// Just using the id supplied in the example from MDN.
var bookmarkPromise = bookmarks.getChildren("unfiled_____");

bookmarkPromise.then(
	function(children) {
		// Simple name sort for example.
		// Can use child.type to sort folders and stuff first.
		children.sort(function(a, b) {
			return a.title.localeCompare(b.title);
		});

		// Continue the rest of your code here...
		// The children should be properly sorted.
	},
	function(err) {
		console.error("Couldn't get children. Error: " + err);
	}
);

Keep in mind that anything inside the then block will wait for all the bookmarks to be fetched. If you have anything you can do at the same time because it is not dependent on the bookmarks themselves, you can do it outside the block and it'll execute in the meantime.

@eric-bixby
Copy link
Owner Author

@defmonk0: I agree, thanks, I'll do that. I actually had added a call using the promise->next syntax, but was getting an error. In chrome, it appears that the id passed to getChildren() must be a string. Whereas, in MDN, id was an int/number. Anyway, I ran out of time debugging that issue.

@defmonk0
Copy link

Ah. Yea. Small inaccuracies in documentation like that are the worst.

Well, good luck. I and I'm sure many others are waiting patiently. Quantum may have released today, but none of the alternatives to this extension quite manage everything this was doing. I look forward to the day my bookmarks are once again alphabetized. Lol.

@eric-bixby
Copy link
Owner Author

You are right, Firefox 57/Quantum is now available. I thought I had one more week. I'll try to spend more time on it.

@eric-bixby eric-bixby changed the title Port to WebExtensions API Port to WebExtensions API (support Firefox Quantum, version 57) Nov 17, 2017
@MeiGuddet
Copy link

I like this addon and will patiently wait 👍

@eric-bixby
Copy link
Owner Author

Someone please try beta4:
https://github.com/eric-bixby/auto-sort-bookmarks-webext/releases/tag/v3.0beta4
(you'll need to type "about:debugging" into the address-bar in order to load it).

This version does sorting using default preferences (preferences not working yet).

@Selmi
Copy link

Selmi commented Nov 21, 2017

it seems it is working, hard to do anything special with it when there are not preferences
tested on 57.0 x64 from linux ubuntu repository

@eric-bixby
Copy link
Owner Author

Cool, thanks. Yes, I'm working on preferences now. Once that works, then I can release it.

@eric-bixby
Copy link
Owner Author

I've released version 3.0 to AMO.

@Taurean75
Copy link

Taurean75 commented Nov 26, 2017

Thanks for the update; however, many sort criteria seems to be missing. Are you going to add "last visited" criteria soon? Without that, this extension is useless to me.

@eric-bixby eric-bixby added Status: Completed The issue is closed and removed Status: Pending The issue has been assigned but is not currently being worked on labels Nov 26, 2017
@eric-bixby
Copy link
Owner Author

@Taurean75 : Yes, if there is an API available for this. See issue #55

@georgthegreat
Copy link

Hi.

It looks like new extension ignores sorting "Other bookmarks" folder (where new bookmarks are being added bt defaut).

@zaphmann
Copy link

Hi Eric, very interesting reading and much appreciated effort on your part and others. What's the state of play? Is there an alternative that does "last visited" and "most visited", or do you think you will get that feature back sometime?

@eric-bixby
Copy link
Owner Author

See issue #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2-High Serious problem that could block progress Status: Completed The issue is closed Type: Enhancement The issue is a request for new functionality
Projects
None yet
Development

No branches or pull requests