Last Comment Bug 834457 - Remove deprecated synchronous APIs from Places
: Remove deprecated synchronous APIs from Places
Status: RESOLVED FIXED
: addon-compat, dev-doc-needed
Product: Toolkit
Classification: Components
Component: Places (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: ---
Assigned To: Marco Bonardo [::mak]
:
Mentors:
http://blog.bonardo.net/2013/01/29/ad...
Depends on: 834495 700250 asyncFaviconCallers 739218 820797 826409 834492 834493 834498 834915 838798 838839 838841 838872 838874 838875
Blocks: asyncHistory placesSessionID
  Show dependency treegraph
 
Reported: 2013-01-24 14:03 PST by Marco Bonardo [::mak]
Modified: 2013-09-01 06:54 PDT (History)
27 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
patch v1.0 (14.66 KB, patch)
2013-02-13 14:55 PST, Marco Bonardo [::mak]
no flags Details | Diff | Splinter Review
patch v1.1 (16.75 KB, patch)
2013-02-13 16:22 PST, Marco Bonardo [::mak]
no flags Details | Diff | Splinter Review
patch v1.2 (18.37 KB, patch)
2013-02-13 16:33 PST, Marco Bonardo [::mak]
gavin.sharp: review+
Details | Diff | Splinter Review
patch v1.3 (18.26 KB, patch)
2013-02-13 17:00 PST, Marco Bonardo [::mak]
no flags Details | Diff | Splinter Review
patch v1.4 (18.33 KB, patch)
2013-02-14 03:00 PST, Marco Bonardo [::mak]
no flags Details | Diff | Splinter Review
patch v1.5 (18.41 KB, patch)
2013-02-14 04:34 PST, Marco Bonardo [::mak]
no flags Details | Diff | Splinter Review

Description Marco Bonardo [::mak] 2013-01-24 14:03:39 PST
Many APIs have been replaced by async versions and can be removed, here is a list of what I plan to remove, possibly in this version (when all dependencies are done):

(replaced by methods in mozIAsyncFavicons)
nsIFaviconService::setFaviconUrlForPage
nsIFaviconService::setFaviconData
nsIFaviconService::getFaviconData
nsIFaviconService::getFaviconForPage
nsIFaviconService::setAndLoadFaviconForPage
nsIFaviconService::getFaviconImageForPage
nsIFaviconService::getFaviconDataAsDataURL

(replaced by mozIAsyncLivemarks)
nsILivemarkService (the whole interface)
PlacesUtils.itemIsLivemark
PlacesUtils.nodeIsLivemarkContainer
PlacesUtils.nodeIsLivemarkItem

(remove only third argument)
PlacesUIUtils.showBookmarkDialog

(no more implemented by Places)
nsIGlobalHistory2::addURI
nsIGlobalHistory2::isVisited
nsIGlobalHistory2::setPageTitle

Plus, if time allows:

nsINavHistoryObserver::OnBeforeDeleteURI
nsINavBookmarkObserver::OnBeforeItemRemoved

Please notify me and add dependency to any problem that should be fixed, even in other projects, before this can be achieved.
Comment 1 neil@parkwaycc.co.uk 2013-01-24 15:31:35 PST
nsILivemarkService is used by FUEL and SMILE

I don't understand the change to PlacesUIUtils.showBookmarkDialog

ChatZilla tries to use addURI

One of SeaMonkey's tests uses setPageTitle and another uses isVisited
Comment 2 Marco Bonardo [::mak] 2013-01-24 15:40:38 PST
(In reply to neil@parkwaycc.co.uk from comment #1)
> nsILivemarkService is used by FUEL and SMILE

I fear that feature will have to be dropped, since I don't think someone may be interested in making those frameworks use new livemarks async API.
Will file a bug.

> I don't understand the change to PlacesUIUtils.showBookmarkDialog

the third param was used to specify if the dialog had to be resizable, but that always was true if the folder picker was visible, so for now showBookmarkDialog uses the folderPicker to decide which kind of dialog it is.
I understand this sucks, but the dialog itself is not the best idea in the world.
Any problem here to be filed?

> ChatZilla tries to use addURI

we don't remove addURI, we stop implementing it in Places, that means getting a nsIGlobalHistory2 service will fail (not sure if this makes a difference since I don't know their code).  Who should I reach for chatzilla?

> One of SeaMonkey's tests uses setPageTitle and another uses isVisited

We are fixing tests in Firefox yet, we have bug 820797 for addVisit in seamonkey (should likely just port our revised tests). I will file a bug to also handle any remaining piece.
Comment 3 Marco Bonardo [::mak] 2013-01-24 15:58:18 PST
I think I covered all issues in dependencies, if anyone notices something else that should be handled, please keep up with this good feedback!
Comment 4 Marco Bonardo [::mak] 2013-01-28 11:12:25 PST
I forgot nsINavHistoryService::addVisit() in the list of comment 0, that is also being removed. Will further notify the newsgroups and likely make a blog post.
Comment 5 Marco Bonardo [::mak] 2013-02-13 14:55:22 PST
Created attachment 713673 [details] [diff] [review]
patch v1.0
Comment 6 Marco Bonardo [::mak] 2013-02-13 14:58:35 PST
the patch (apart breaking all of my current patches) adds warnings and @deprecated to APIs that didn't have a notification of any kind yet.
We may land this in FF21, and proceed with the removal in FF22.
Comment 7 Marco Bonardo [::mak] 2013-02-13 16:22:51 PST
Created attachment 713708 [details] [diff] [review]
patch v1.1

spews to the console, though warnings are invisible due to CSS warnings... should I rater make this an error (it's just matter of changing the warningFlag to an errorFlag)?
Comment 8 Marco Bonardo [::mak] 2013-02-13 16:33:17 PST
Created attachment 713709 [details] [diff] [review]
patch v1.2

Now sending Errors to the console, since warnings are invisible.

Also, inverted the forwarding among SetAndFetchFavicon and SetAndLoadFavicon, the latter is deprecated, but the former was forwarding the call to it (they are the same method, just in 2 different interfaces and thus with different names).
I should have done this inversion regardless at the removal, practically nothing changes.
Comment 9 :Gavin Sharp [email: gavin@gavinsharp.com] 2013-02-13 16:42:59 PST
Comment on attachment 713709 [details] [diff] [review]
patch v1.2

s/nsString/nsAutoString/ in the macro? Not sure it matters. __FILE__/__LINE__ probably aren't actually useful to expose in the error message, right? Can you just omit them?
Comment 10 Marco Bonardo [::mak] 2013-02-13 17:00:50 PST
Created attachment 713721 [details] [diff] [review]
patch v1.3

removed __FILE__ and __LINE__ (I was indeed in doubt cause the former returns the path at time of compilation too). Kept nsString cause the autostring buffer is basically already depleted.
Comment 11 Marco Bonardo [::mak] 2013-02-14 03:00:09 PST
Created attachment 713851 [details] [diff] [review]
patch v1.4

oops, __FUNCTION__ is MSC_VER only, thus defining it through __func__ where it's missing.
Comment 12 Marco Bonardo [::mak] 2013-02-14 04:34:36 PST
Created attachment 713864 [details] [diff] [review]
patch v1.5

and u__func__ doesn't exist... this one compiles on win and lin.
Comment 14 Ryan VanderMeulen [:RyanVM] 2013-02-14 14:24:12 PST
https://hg.mozilla.org/mozilla-central/rev/88fc7f93845c
Comment 15 Marco 2013-02-25 20:18:54 PST
I remember, when bug 613588 landed, to decide that I will update to the new api just when some of documentation about the new mozIAsyncLivemarks lands in MDN, and, well... Is it possible to expect something about this in the near future?
Comment 16 Marco Bonardo [::mak] 2013-02-26 02:29:29 PST
(In reply to Marco from comment #15)
> I remember, when bug 613588 landed, to decide that I will update to the new
> api just when some of documentation about the new mozIAsyncLivemarks lands
> in MDN, and, well... Is it possible to expect something about this in the
> near future?

It's plausible, though, especially when referring to idl files, I strongly suggest you to directly read the documentation on the idl itself, mdn in most cases will just be a copy of it
http://mxr.mozilla.org/mozilla-central/source/toolkit/components/places/mozIAsyncLivemarks.idl
Comment 17 Sonthakit 2013-03-20 07:57:40 PDT
This change will make my add-on "bookmark favicon changer" permanently break without anyway to correct.

I agree with asynchronous when set favicon, but don't agree when get favicon.

Favicon is in history data, it should get easily. When there is no favicon in history - it return null. So it do not need to be asynchronous.

Please look in my add-on "bookmark favicon changer" you will see long series of get and set favicon in one function. I cannot split it into many part without confusion.

More ever, when you hook function such as gbrowser.seticon
You can't return this hook function before every thing finish.

One sample code is in browser.js in bookmark favicon changer.

gBrowser.setIcon = function()
                {
                        try {
                                var tabCurrentURI = gBrowser.getBrowserForTab(arguments[0]).currentURI;
                                var bookmarkURI = bookmarkfaviconchangerModule.bookmarksService.getBookmarkedURIFor(tabCurrentURI);
                                if (bookmarkURI==null) {
                                        bookmarkURI = tabCurrentURI;
                                }
                                var originalFaviconURISpec = bookmarkfaviconchangerModule.annotationService.getPageAnnotation(bookmarkURI
                                        ,bookmarkfaviconchangerModule.pageOriginalFaviconURISpecNS);
                                // throw exception if no annotation data
                                try {
                                        var faviconURI = bookmarkfaviconchangerModule.annotationService.getPageAnnotation(bookmarkURI,bookmarkfaviconchangerModule.pageFaviconDataURISpecNS);
                                } catch(e) {
                                        var faviconURI = bookmarkfaviconchangerModule.faviconService.getFaviconForPage(bookmarkURI);
                                }
                                arguments[1] = faviconURI;
                        } catch(e) {
                        }
                        bookmarkfaviconchangerBrowser.setIcon.apply(this, arguments);
                };


Please see - arguments[1] need before apply. And this function is in hooking process. I cannot make this asynchronous.

I am 100% disagree for get function to asynchronous.

Mozilla, please stop to break my add-on. You break it every 6 weeks. And it is unnecessary to do it.

Tell me, why simple get favicon function need to be asynchronous?
If you need to do this unnecessary thing, why don't do everything asynchronous such as get preference, get annotation.
Comment 18 :Gavin Sharp [email: gavin@gavinsharp.com] 2013-03-20 08:57:37 PDT
(In reply to Sonthakit from comment #17)
> Tell me, why simple get favicon function need to be asynchronous?
> If you need to do this unnecessary thing, why don't do everything
> asynchronous such as get preference, get annotation.

We don't store all favicons in memory. Getting favicon data means getting data off the disk. We can't block the main thread on getting data off the disk, because that can result in performance problems. And so the API needs to be asynchronous.

I'm sorry this makes your add-on more complicated, but it really is important for performance - we're not making this change just for the sake of it. I recommend you post to some of the add-on help forums (or IRC) to get advice on how to adjust to the API change.
Comment 19 Sonthakit 2013-03-20 10:50:01 PDT
You're wrong.
There is no performance problem.
If you use asynchronous method. It still need to access disk. And the overall speed is not decrease because the all code still need to run as the same.

For post helping. It has done already for a long time until it success into this. There is no other way for hooking function process. I need synchronous method.

If you care about main thread speed. You may forgot that modern OS has disk cache.
And that I am request is a function to read, not write.
More likely that the first time it read history on disk. It should stay in memory by OS disk cache. So, I don't think it is using significant time.

As I said, I want to read favicon. These function is very short in time usage. It do not require internet connection. So it should be equal as many functions that use synchronous method such as read preference. Why read favicon must be asynchronous when getBoolPref is synchronous?

Why don't you put both synchronous and asynchronous method together if you care about this so much?
Comment 20 :Gavin Sharp [email: gavin@gavinsharp.com] 2013-03-20 13:49:44 PDT
The system disk cache isn't a magical tool that eliminates the cost of reads from the disk; disk I/O blocking the main thread is a very real problem. The preferences API is synchronous because we keep prefs loaded into memory (it's a relatively small amount of data).
Comment 21 Sonthakit 2013-03-20 23:34:30 PDT
Have you consider this?
Many function need return value.

Example is context menu of bookmark.
OnPopupShowing need to return true or false.

If the reason to return true or false depend on node (is it livemark or not).
How can I return value. NodeIsLivemark is turn to be asynchronous. So you force me to use processNextEvent for wait-loop in main thread until it get result from asynchronous NodeIsLivemark. 

processNextEvent is very bad function which make frequent crash. Do you accept it?
Comment 22 Marco Bonardo [::mak] 2013-03-21 01:20:03 PDT
you can have your own caches of data for synchronous operations. And yes, processNextEvent is a very bad choice.
There is no way out of these changes, all APIs will soon or later become async, also because the profile may not even be a disk file forever, it may become a network profile, or even something in the cloud, so the information is no always available in a synchronous way.
If there are xul APIs problematic to use with async behaviors we should rather fix those.
Comment 23 Sonthakit 2013-03-21 02:35:01 PDT
You mean that I need to create my own cache when firefox start everytime, when import bookmark everytime, when firefox sync bookmark everytime?

Let imagine that user have 1000 bookmarks. I need to asynchronous load all 1000 bookmark favicon and store in my variable with asynchronous method. I can't let any user interface to manipulate bookmark at that time because my cache is not complete. It will make 5-10 minute firefox freeze before anything can happen. Is this your solution.

There is no way out is not true. The way out is to quit doing this.
Comment 24 Marco Bonardo [::mak] 2013-03-21 07:19:23 PDT
non-constructive criticism won't bring this discussion anywhere, please live with the fact these API conversions cannot be avoided, and try to suggest meaningful changes to browser functions used by your add-on. We surely can improve add-ons hooks where they are needed, if a specific method doesn't work well with async APIs, file a bug to fix that method.
Comment 25 Marco Bonardo [::mak] 2013-03-21 07:24:15 PDT
The Places part of the bug is complete, remaining dependencies just track work left to do in external consumers (SM and CZ so far), but those don't block the bug from being fixed.
Comment 26 Sonthakit 2013-03-21 07:28:31 PDT
meaningful change that I suggest is "don't remove synchronous for get function"

fire a bug to fix --> I have try it in the past. If your Mozilla don't care. It will be a bug forever without anyone to fix.

And this topic is to solve the problem of removing synchronous favicon. And there is no one have solution to fix this. And you still want to remove it even it cause uncorrectable problem. And I need to fire another bug? Hm...
Comment 27 Marco Bonardo [::mak] 2013-03-21 07:36:19 PDT
(In reply to Sonthakit from comment #26)
> meaningful change that I suggest is "don't remove synchronous for get
> function"

I'm sorry, this will never happen.
What I suggested is filing bug to fix the reasons you can't work with async favicons, not to make them synchronous.
Fwiw, you may want to look at Promise and Task modules to simplify the flow of async code.
Comment 28 Sonthakit 2013-03-21 18:48:08 PDT
I don't understand.
It create uncorrectable problem. And this status change to resolved-fixed.
I don't understand. It create uncorrectable problem. But it still push to release. Not delay, not consider, not fix problem it create.
Promise and Module don't work. Bookmark favicon changer run in module environment for a long time. And promise is asynchronous.

I will summary for you the problem. - Some function need value before return
1) - hooking process. It need data before "apply". It cannot asynchronous
2) - event of popup such as onPopupShowing. It need data to manipulate context menu before it can return the event. It cannot asynchronous.
Comment 29 Tony Mechelynck [:tonymec] 2013-03-27 20:45:54 PDT
Sonthakit, whining won't get you anywhere. It might even make the developers angry at you, and yet, most of those I know are slow to anger.

Please read https://bugzilla.mozilla.org/page.cgi?id=etiquette.html attentively.

If you have positive suggestions about how to make your life easier in a world where everything (other than RAM access) is going to become asynchronous sooner or later, please open one new bug per issue and mark each of those bug with "Depends on bug 834457".

But it's a constant rule that once the developers have (after long discussions, usually in places open to the public but not necessarily easy for outsiders to find) decided upon some long-range target (in this case, converting synchronous calls to asynchronous), they won't be swayed by someone on the side of the road crying "Ma! They broke my favourite toy!". Now that (apparently) asynchrony is the way of the future, you (and I, and everyone else) will have to Just Live With It.

I hope you find some way to make your add-on work even with asynchronous APIs everywhere.
Comment 30 chiaroscuro 2013-03-31 10:22:23 PDT
Please could this page be updated

https://developer.mozilla.org/en/nsIFaviconService

Thank you
Comment 31 Marshall 2013-04-05 09:59:55 PDT
Sonthakit is no longer developing extensions: 

 https://sites.google.com/site/sonthakit/message-from-developer

I had used Bookmark Favicon Changer previously and installed Firefox Nightly over my existing version and all the Favicons that I had previously changed remained changed, but new bookmarks could not be changed.

I suspect the extension could be adapted to work, but I don't understand the code or even where stored previous bookmarks are located ...
Comment 32 bhavana bajaj [:bajaj] 2013-05-13 11:12:19 PDT
This was added across all channels for Fx21 notes but :mak and I think MDN is a right place for this .In addition :mak also pointed out that this is not completely fixed in FX21 and a few dependencies were indeed resolved in FX22, hence removing it from release notes for Fx21.
Comment 33 dfoulkes 2013-05-14 10:27:45 PDT
This comment is not related to any specific code-items but does relate to what the users ... the real users out there think of some of these types of "improvements".

There are currently over 26k downloads for the extension Bookmark Favicon Changer ... and, I am one of them.  I've probably changed over 40 bookmarks and folder icons using this extension and before this extension came out I was using another favicon changing extension...but, that one went away... I suppose due to not wanting to keep up with Firefox releases.... and, B4 that one... I was keeping userChrome data updated but for only 4-5 folders...I'm not going to do that with 40 entries.   I was very glad that another author came along and created this one... but, AFAIK ... it will die with release 21.0 or version 22.0.. and, that's probably when I'll stop updating Firefox.... and, of course even using Firefox in the long run.

Firefox is a fantastic browser (or was) and I've worked on the MozillaZine board for a number of years with over 13 thousand posts trying to help users with issues. So, possibly over 26 thousands users of the extension mentioned above will update their Firefox and find that one of their favorite extensions will no longer work... if it no longer works for them ... then they will probably move to another browser...probably Chrome... like so many people have done already...why use Firefox if all the little user-enabling goodies get dumped! 

Is that the kind of future Mozilla wants? ... and, if in the future Firefox is say... number 6 (or worse) on the list used browsers... Mozilla will look back on changes like this one where yet another extension died because of the thinking process that takes place at Mozilla.... somebody at Mozilla will say or think... "boy, did we screw up."
Comment 34 Marshall 2013-05-14 10:57:37 PDT
@dfoulkes - Sonthakit has left the barn already.  I don't think even if Mozilla Dev changed their mind and scrapped this idea, she would come back so the extension will probably die anyway unless someone else volunteers to maintain it.

She is using SRFIron now, so you might see the extension for that at some point.  I tried that, but didn't like it as well as FF.

FWIW - I installed Nightly FF 23.0 over a version on FF that I have used BFC on and custom bookmarks remained changed, but I couldn't change any new ones.

That doesn't help anyone new to FF and BFC, and it certainly isn't ideal, but if you don't want to change new bookmarks, you can probably keep using FF for quite a while at least.
Comment 35 dfoulkes 2013-05-14 11:40:17 PDT
Thanks for the reply... I guess the main point with my first comment is... not so much losing that extension (but, it is a big deal with me and I'll have to wait out the rev-levels to see what I do) ... is more to the point of what I am... pretty much a plain ol' user out there wanting to use a good browser "but" a browser that I can rely on when it comes to using extensions... I use over 40 extensions (isn't that what Firefox is all about?) and, have been using it since 3.0Beta.... those extensions allow the "general" user to build up their profile to work and act the way the user wants it to.  As an example here... like I mentioned... I have a large number of changes in Favicons and I'm not about to put the required code into my userChrome.css file to handle that... just like a majority of users out there... they don't want to/understand how to... do that... that is where that extension comes into play... Mozilla forgets that kind of stuff at times.

From everything and everywhere I've read... Dev. people don't visit the main Mozilla support board nor do they visit the MozillaZine board... at least that's what everybody tells me... "those areas" are where the "common user" posts their aggravations... not here in the Bug site...where "daily-user-reality" never visits.  ... like I posted above... is Firefox going to lose another 26k users?
Comment 36 Marshall 2013-05-14 12:08:19 PDT
@dfoulkes - I'm with you.  If you look at Sonthakit's post above:

BookmarkFaviconChanger - abandoned b/c the Dev's wouldn't work with her to find a solution.
CheckPlaces - abandoned b/c the extension manager got tired of constant core changes (I think).
MostlyCrystal theme - same thing.

In most cases, I can use previous version and modify the install.rdf to keep them working, or I'm not above using FF 4.0 if required if they are completely hosed, but the average user won't be bothered with that.

The dev's don't hang out in the Mozillazine board.  The users don't post on bugzilla - partly b/c they don't know about it, partly b/c they get ignored b/c of the "Microsoft Mentality" (It's not a bug, it's a feature.)  I.e. - we know Bookmark Favicon Changer doesn't work, we put the changes to the code in that broke it.  It is not a bug, it was a designed change.  If YOU want it to work again, YOU figure out what the author's original code did, and then YOU figure out what we changed that broke it, and then YOU figure out how to make it work with the new code (until we change something else and break YOUR modified code, and then YOU'LL have to fix that).
Comment 37 dfoulkes 2013-05-14 12:49:02 PDT
Yeah... that pretty well sums it up... The issue is... a majority of the general population out there that use Firefox are just that ... General in the ways of the tech. world... and, they just want to use what they added (in the form of extensions) ... the way they formatted it at the beginning. If they can't do that then they will just move on to a more advertised browser... that same idea goes along with most products in the world.  I suppose that in this case... users are just blowing in the wind.
Comment 38 Marshall 2013-05-14 13:02:25 PDT
OTOH - from what I could tell, SRFIron/Chrome goes too far the other way, in my opinion ...

i.e. if you want to have new tabs open on the end instead of after the current tab, there's an extension for that (and only for that), so you have 50 extensions for things that could be more easily handled under Tools-Options (or Edit-Preferences).
Comment 39 Jorge Villalobos [:jorgev] 2013-05-14 13:12:27 PDT
Sorry, but this is not a discussion forum and not the right place to have this conversation. Many people tried to give Sonthakit advice on how to fix the extension (see comment #22, fo example), and Sonthakit decided to stick to complaining about the change.

This wasn't done gratuitously. Changing to asynchronous APIs has a significant impact on how users perceive Firefox performance. Making Firefox faster has been a major priority for us, and this is just part of that effort. Unfortunately, it's not possible to accomplish this without breaking some add-ons. For the most part developers adapt quickly and get their add-ons updated. Unfortunately, this wasn't the case.

Breaking APIs add-ons rely on is an inevitable side effect of moving forward with Firefox, and all we can do is do our best to inform add-on developers about it and give them the information they need to keep their add-ons working.
Comment 40 Marshall 2013-05-14 13:33:25 PDT
Comment #22 was a helpful suggestion.

Comment #23 said that the suggestion in Comment #22 would cause a 5-10 minute freeze in Firefox.

Comment #24 said non-constructive criticism was not helpful, but no further suggestions were offered, nor was an explanation of whether the 5-10 minute freeze was acceptable ever given.
Comment 41 Jorge Villalobos [:jorgev] 2013-05-14 13:51:08 PDT
Comment #23 is wrong, and the developer probably knew it.
Comment 42 Marshall 2013-05-14 13:54:35 PDT
So BFC could still work with the latest Firefox if anyone else knows enough to be able to update it ???
Comment 43 :Gavin Sharp [email: gavin@gavinsharp.com] 2013-05-14 14:00:12 PDT
Yes, definitely.
Comment 44 dfoulkes 2013-05-14 19:09:27 PDT
Jorge,
I basically understand that this is not the best place to discuss things like this... but, where does one post comments about changes that Mozilla is making in where those changes can be a negative affect on users?  It's obviously not on either of the support boards ... so, where does one do that where it would be "meaningful" dialog ... with open minds involved?
Comment 45 Tony Mechelynck [:tonymec] 2013-05-14 21:38:13 PDT
(In reply to dfoulkes from comment #44)
> Jorge,
> I basically understand that this is not the best place to discuss things
> like this... but, where does one post comments about changes that Mozilla is
> making in where those changes can be a negative affect on users?  It's
> obviously not on either of the support boards ... so, where does one do that
> where it would be "meaningful" dialog ... with open minds involved?

The mozilla.dev.apps.firefox and mozilla.support.firefox newsgroups (on the news.mozilla.org news server). The former is more technical, the latter more user-oriented.
Comment 46 Florian Bender 2013-05-15 02:30:54 PDT
… or firefox-dev mailing list (https://mail.mozilla.org/listinfo/firefox-dev).
Comment 47 Marco Bonardo [::mak] 2013-05-15 03:52:24 PDT
just a side note (and I hope this discussion is moving to a better place) I often get emails from add-ons developers trying to figure how to address API changes and I always answer explaining the new APIs.  it's untrue that we don't answer or don't try to help.  Moreover I always say we are open to add new APIs whether the existing ones are unable to satisfy the needs. this has worked pretty well so far, even with much larger extensions (like XMarks). We also tend to remove APIs after many months (or even years) that there is an alternative.
Comment 48 Marshall 2013-05-15 03:54:46 PDT
My apologies, but from the comments that were posted previously in this bug report, that was not the impression that was conveyed.
Comment 49 Sonthakit 2013-05-15 04:54:18 PDT
Oh. I still can get email for this bug.

All of you are wrong. It cannot fix.
Bookmark favicon changer hook into many synchronous functions.
I need to return the value when my hook code complete.
But when you change it into asynchronous.
It force me to return without any value because asynchronous function still don't run. It is not as simple as you thought.

All I ask is very simple, don't remove synchronous function.
You want to change all your code of firefox to asynchronous - do it as you want.
But don't remove the synchronous, you just mention it in your reference book that this synchronous function should use only in necessary situation, that's it. This is not hurt anyone.

See on my computer, my OS still can run my 16-bit program .COM file in MS-DOS  even I have written it for 25 years. Your firefox should do like this, backward compatibility as much as possible.

Someone say that I will not return if firefox change back. It is not true, I will come back to use firefox if you get my synchronous function back.

And the last, I am not a woman.
Comment 50 Marshall 2013-05-15 05:08:32 PDT
>See on my computer, my OS still can run my 16-bit program .COM file in MS-DOS  even I have written it for 25 years.

Not necessarily - at least not without the DosBox emulator, but at least there are workarounds to make it happen.

>Someone say that I will not return if firefox change back. It is not true, I will come back to use firefox if you get my synchronous function back.

"Someone" would be me, sorry, I inferred too much here.

>And the last, I am not a woman.

Deepest apologies - I definitely inferred too much here.  Sonya or Sonia is a common woman's name.  I assumed Sontha was a variation on it.  No offense intended.
Comment 51 Andreas Wagner [:TheOne] 2013-05-15 06:06:23 PDT
(In reply to Marshall from comment #48)
> My apologies, but from the comments that were posted previously in this bug
> report, that was not the impression that was conveyed.

That's because this bug is not the proper place to talk about this, as said in the previous comments.

(In reply to Sonthakit from comment #49)
> Oh. I still can get email for this bug.
> 
> All of you are wrong. It cannot fix.

That doesn't necessarily mean it's impossible. Frankly, I highly doubt that it's impossible to change the code to work with the async API. Up to now, you were only complaining and demanding that the sync APIs should stay but didn't mention what exact functionality you need is missing in the async API.

:mak said several times now that we are willing to add functionalities if there is a demand, so please tell us exactly what you need or stop complaining as this is not constructive.
Comment 52 Sonthakit 2013-05-15 06:57:26 PDT
I have mention one example the code that cause problem in comment 17
I have tell you the problem situation of context menu showing in comment 21
Sorry, I try to polite. I tell you that your asynchronous function cannot solve the problem. It need synchronous, not to add any new functionality to asynchronous.

I try to polite but my English is not good. Sorry.
I can tell you again... may be you don't get the point

If you need to hook into synchronous function, you need return value to send back to the caller or you need to complete the operation before you return. You cannot call asynchronous function and return and do it later.

I agree that normal code can change from synchronous to asynchronous. But one situation is in the hooking process especially hooking in synchronous function. It can't.
Comment 53 Marco Bonardo [::mak] 2013-05-15 07:10:07 PDT
Yes, currently there are issues with context menus and drag&drop in using async APIs, that's totally true and something we ourselves need to fix for many of the components. Don't think we are not hitting similar problems to you in everyday development and we are not interested in resolving those.  Though, workarounds (even through alternative UIs) can be found already.
Comment 54 Tony Mechelynck [:tonymec] 2013-05-15 07:59:51 PDT
I'm not convinced that there are use cases which are so essentially synchronous that it is not possible to write an asynchronous API that they can use. What I can accept is that converting from synchronous to asynchronous can be an enormous change, sometimes so enormous that it is seen as not worth the trouble.

The synchronous use case is simple: call a function, get back a return value when it is ready, voilà.

The asynchronous use case is much more complex, something like this:
1. set up a callback function
2. call a request function with parameters including the entry point to the callback.
3. The request returns (almost) immediately, with no return value (or with an error or an exception if the parameters were invalid).
4. do other stuff. If there is no other stuff to do, sleep (letting other threads use the CPU).
5. When the result is ready, the backend calls you (invoking your callback function)
6. cancel the timeout if there is one pending (started at step 4b). Save the return value, putting it where it can be found
7. exit the callback, returning control to whatever was interrupted at step 5
8. The waiting routine finds the result and processes it.
This means a lot more things have to be juggled and caught (from the frontend's point of view) than in the synchronous case; but I think it can be made to work, if done carefully.

Of course, having two or more asynchronous calls (where the second one needs to use the result from the first) compounds the complexity. Maybe it is "too difficult to do it right", "too complex to be worth the trouble", but it is hard for me to believe that it is "essentially impossible" whatever the [asynchronous] APIs there might be. This sounds to me like a use case for getting and passing promises but I don't know that kind of stuff well enough to be sure.

I "hope" I've contributed something useful to the argument and not just uselessly spammed the bug. Developers, please pardon me if it was a false hope.
Comment 55 Sonthakit 2013-05-15 08:16:02 PDT
Thank Marco Bonardo.
Seem like someone understand.
For context menu problem. you can change by not using it, change user interface into button ect...
But for hooking in firefox function, it has no other way. Sorry but I still need to say that synchronous function still need.

For Tony Mechelynck comment. I can give him example.
Let say that you control the context menu in the onpopupShowing
If user click bookmark, you will show context menu only if this bookmark is livemark.
See onopopupShowing at https://developer.mozilla.org/en-US/docs/XUL/Attribute/onpopupshowing

onpopupShowing need return value true or false.
If return false, it will not show context menu.

popupShowing: function(event) {
    nodeisLivemark(event, callback function{..});
    return xxx
}

You can see, I cannot return. I don't know what to return.
It return before callback function run.
return value need result from callback.
Comment 56 Sonthakit 2013-05-16 13:14:43 PDT
Thank to dfoulkes that using my add-on.
You can see that no matter what happen, Mozilla has a strong will to remove the synchronous function.
So I think there is no more point to discuss in here.
We should move a discussion to Mozillazine.
I will post the discussion in
http://forums.mozillazine.org/viewtopic.php?f=19&p=12801017

But for the last record, I will explain why I need synchronous API again.
Sorry, if it seem unpolite. My English is not good.

This is about 24 hours that Andreas Wagner and Tony Mechelynck who believe they can 100% convert any synchronous code into asynchronous function cannot tell me how to do it in problem of comment 55.

I assume that they agree with me that in comment 55 cannot write in asynchronous.

The principle is... you can not inject asynchronous code into synchronous function. The previous post I use the word "hook" to it, but I think "inject" seem to work better.

If you look in the different way in problem of comment 55
onpopupShowing: function(event) {
    nodeisLivemark(event, callback function{..});
    return xxx
}
You can see that whoever create onpopupShowing function make it in synchronous behavior. He need return value when function return. And usually return true.
Your code inject into it to manipulate return value to be false if node is Livemark. And you can see that your code cannot be asynchronous.

This is an example of "get" type of synchronous function. Whoever call these function expect to get return value
There is also another type of synchronous function. It is "set" type. Whoever call these functions expect the job of function to be complete when function return. And it is in the same situation, you cannot inject asynchronous in these functions.

And in Firefox, there are a lot of synchronous functions. And "bookmark favicon changer" inject the code into many of them. It is not only a user interface just like context menu. They are function of gbrowser to set tab icon, manipulate icon of menu, manipulate icon in bookmark manager, manipulate icon in bookmark sidebar.  manipulate icon in bookmark bar, set icon in treeview, prevent favicon turn back, manipulate JSON bookmark backup file.... ect.  And nearly all of them write in synchronous behavior. Whoever call these function expect return value or job to be complete when function return. Yes, it is in the same situation, you cannot inject asynchronous into it.

Firefox is great. No other browser can do this. You can inject the code to manipulate firefox function. And at this point if someone interest how I inject the code into firefox function, you can use function.aply by see this link
https://developer.mozilla.org/en-US/docs/XUL/School_tutorial/Appendix_C:_Avoid_using_eval_in_Add-ons#Overriding.2FExtending_existing_functions

I think I have explain it in the best way that I can. To make people understand that I cannot fix "bookmark favicon changer", not I won't fix. To make people understand that you cannot use asynchronous API in every situation. And to stop false blame me that I don't request a new feature of asynchronous API.
I repeat, asynchronous cannot correct the problem. I need synchronous.
Comment 57 flii (cj) 2013-07-05 07:36:49 PDT
Chalk me up as someone who dutifully upgraded Firefox and then lost almost every icon in the bookmarks window and had a hell of a time trying to figure out why.  Chalk me up also as someone who now has to roll Firefox back in order to have a functioning bookmark menu again and is *not* very happy about it.

I understand and agree with the need to go forward; what I don't appreciate is that this hit me full bore from the side without any warning whatsoever (for a common user, at least).  Nothing in the release notes gave any indication that I was about to screw myself, and I had to spend quite some time going through every bug in the patch notes, searching for various words until I got the right one -- which, of course, was after I restarted Firefox several times over several days and my computer once, thinking it was a bug.  BTW nothing at all like "bookmark", "favicon", or "icon" shows up in this bug title, so perhaps you can guess at the frustration level I'm currently at.

My request is deceptively simple:  if you are making a breaking change to an extremely popular extension (and you know about it, like in this case), give some kind of release note about it so that faithful users who trust you enough to keep upgrading Firefox don't end up with a broken browser.  This whole situation is incredibly frustrating for me, and I gotta say, trying to write a rational comment at my current anger level is quite difficult.  Apologies in advance if I ended up too harsh after all.
Comment 58 Marco Bonardo [::mak] 2013-07-05 08:16:19 PDT
(In reply to flii (cj) from comment #57)
> Chalk me up as someone who dutifully upgraded Firefox and then lost almost
> every icon in the bookmarks window and had a hell of a time trying to figure
> out why.

There's nothing here causing dataloss, nor there is any functionality change in Firefox, but as many other changes it can break add-ons.
In the past add-ons were automatically disabled on each new version, until the add-on author could confirm they were still working properly. Unfortunately this was very annoying for the user cause on upgrade most of his add-ons where disabled, authors were taking lots of time to bump up the version, even if nothing changed.  Since 90% of the add-ons were still compatible on update, it was decided to just stop marking them as not compatible.
Unfortunately, while that has the nice effect of not annoying users disabling all of their add-ons, it may still be a problem when an author fails to update his add-on in the 12 weeks available in Aurora and Beta channels, then, if our internal checks don't identify the add-on as problematic the user may experience a broken browser.
You were definitely hit by a communication problem, though I don't think we can fill up the relnotes of technical details that 95% of users wouldn't understand.  It's pretty clear add-ons may break at any update, and if we could identify subtle breakage so easily, it would be simpler for us to just mark it as not compatible than to notify obscure API changes to users (you can't and shouldn't know if you add-on uses a given API). This is what happens actually, but there is some subtle add-ons breakage that is not easily detectable until some user unfortunately hits it.  And there are so many add-ons that is impossible for us to manage without direct help from their authors, as a community we must work together on the issues.
There is space for improving the add-ons compatibility experience, but the system is so powerful it's a very hard task to obtain perfection.

Which extension caused the breakage in your case?
Comment 59 flii (cj) 2013-07-05 08:40:18 PDT
I'll answer this one first:
> Which extension caused the breakage in your case?
Bookmark Favicon Changer


(In reply to Marco Bonardo [:mak] from comment #58)
> There's nothing here causing dataloss, nor there is any functionality change
> in Firefox, but as many other changes it can break add-ons.

Actually Firefox did change.  ;)  You can't modify code without changing something.


> You were definitely hit by a communication problem, though I don't think we
> can fill up the relnotes of technical details that 95% of users wouldn't
> understand.

I don't agree that technical details are required simply to warn people that popular X extension is severely impacted and/or rendered unusable.


> It's pretty clear add-ons may break at any update [...] but there is some subtle add-ons breakage that is not easily detectable [...]

This is where my request came in.  Due to comments made on this bug, development *knew* that the BFC extension was going to break, and who carries the blame for that doesn't even matter.  They were also aware that BFC is a very popular extension, meaning that a lot of people were going to be impacted by the change.  I believe a short sentence of warning would have been extremely useful.  "The Bookmark Favicon Changer is not compatible with this version" would have sufficed just fine.
Comment 60 Elbart 2013-07-05 09:07:14 PDT
Sorry for abusing BMO for discussion.

(In reply to Marco Bonardo [:mak] from comment #58)
> This is what
> happens actually, but there is some subtle add-ons breakage that is not
> easily detectable until some user unfortunately hits it.
What is subtle about non-working addons extensively using APIs, which are going to be removed with version X?
I have no idea how the code-scanning is working on AMO, but if there is code-scanning, and it cannot detect addons with calls to soon-to-be removed APIs, it ain't worth much.

> And there are so
> many add-ons that is impossible for us to manage without direct help from
> their authors, as a community we must work together on the issues.
Authors, who abandoned their addons (and/or Firefox), aren't going to help.

And considering that many reports from the "Add-on Compatibility Reporter" are completely bogus, that tool ain't helping either; see https://blog.mozilla.org/addons/2013/06/26/add-ons-update-33/comment-page-1/#comment-165457

The vast majority of users won't notice the breaking of the addons until the code-changes hit stable and after they updated to the new version. So the primary method of weeding out incompatible addons is to wait until the end-users have a bad experience?

As I said in that blog-comment: Users do not "notice" their addons to still work after updating Firefox, but they sure notice when the addons break or stop working at all.

Merely setting all addons to be compatible and hoping for the best cannot be the best practice to achieve good user experience.
Comment 61 Marco Bonardo [::mak] 2013-07-05 09:31:59 PDT
(In reply to flii (cj) from comment #59)
> I don't agree that technical details are required simply to warn people that
> popular X extension is severely impacted and/or rendered unusable.

Very few advanced users read the release notes, and most would not know what to do once they know an add-on may be impacted.

(In reply to elbart from comment #60)
> I have no idea how the code-scanning is working on AMO, but if there is
> code-scanning, and it cannot detect addons with calls to soon-to-be removed
> APIs, it ain't worth much.

It can, it notifies authors that their add-on should be updated. There is no automatic blocking, blocking software unilaterally is far from our values. I was saying there are also cases where amo cannot detect breakage cause it's not so clear as an API change.

> Merely setting all addons to be compatible and hoping for the best cannot be
> the best practice to achieve good user experience.

Doing the opposite demonstrated to be worst, in many years where it was working like that.

Now, please, post your suggestions to improve the situation to mozilla.dev.extensions newsgroup, where they can actually be discussed, these comments here won't bring any useful action.
Comment 62 Ian Nartowicz 2013-09-01 05:37:22 PDT
I know this is closed (sorry for yet more bug spam), but is this a good place to mention the preferences API that is synchronous and involves file IO, savePrefFile()?  Perhaps it is desirable to keep it synchronous?  However, there are some serious blocking issues in instant-apply prefwindows, where each change results in the entire prefs file being written synchronously.  Not (usually) noticeable for individual changes such as clicking a checkbox, but definitely clunky when typing into a textbox, very bad when auto-repeating such as deleting characters, and awful when changing multiple preferences values at the same time.

The non-instant-apply (ie. Windows) dialog isn't so bad.  savePrefFile() is only called once when the OK button is pressed, currently implemented with the undocumented batching property on preference elements.  This can also be used when programmatically applying multiple preference changes so that the dialog won't hang with instant-apply.

At the very least the preference binding should background the savePrefFile() call, ideally timed so that multiple preference changes in a short period only result in one flush to disk.
Comment 63 Josh Matthews [:jdm] 2013-09-01 06:54:16 PDT
(In reply to Ian Nartowicz from comment #62)
> I know this is closed (sorry for yet more bug spam), but is this a good
> place to mention the preferences API that is synchronous and involves file
> IO, savePrefFile()?  Perhaps it is desirable to keep it synchronous? 
> However, there are some serious blocking issues in instant-apply
> prefwindows, where each change results in the entire prefs file being
> written synchronously.  Not (usually) noticeable for individual changes such
> as clicking a checkbox, but definitely clunky when typing into a textbox,
> very bad when auto-repeating such as deleting characters, and awful when
> changing multiple preferences values at the same time.
> 
> The non-instant-apply (ie. Windows) dialog isn't so bad.  savePrefFile() is
> only called once when the OK button is pressed, currently implemented with
> the undocumented batching property on preference elements.  This can also be
> used when programmatically applying multiple preference changes so that the
> dialog won't hang with instant-apply.
> 
> At the very least the preference binding should background the
> savePrefFile() call, ideally timed so that multiple preference changes in a
> short period only result in one flush to disk.

That's covered by bug 789945.

Note You need to log in before you can comment on or make changes to this bug.