Re: nsIDownloadManager replaced by Downloads.jsm

2013-09-03 Thread teramako

Hi

I want to notify to the user when the download is finished.

on nsIDownloadManager, I write like following:

Services.downloads.addListener({
 onDownloadStateChange: function (state, download) {
   if (download.state === Services.downloads.DOWNLOAD_FINISHED) {
  openPopup(.);
   }
 },
 ...
});

on Download.jsm, how to register a observer if can do ?
I read Download.jsm and related files, but couldn't find.

Best regards.

On Sat, 03 Aug 2013 21:21:57 +0900, Paolo Amadini  
 wrote:



Hello,

if you are maintaining an add-on or a Mozilla product that interacts
with downloads, you should look into updating your code to use the new
Downloads.jsm module instead of nsIDownloadManager as soon as possible.

While other Mozilla products may migrate at different times, Firefox
for Desktop will do so starting from version 26, meaning that add-ons
that use methods of nsIDownloadManager will no longer be compatible
unless updated. Firefox 26 will reach the Beta channel on October 29th,
and will go to release on December 10th, 2013.

*Overview*

We have been working on this new module over the past few months, with
the goal of eliminating any temporary unresponsiveness that could be
observed when downloads are started, as well as making the browser more
responsive in general while there are downloads in progress.

To make this possible, we removed all access to the "downloads.sqlite"
database, replacing it with an in-memory representation of the state
of current downloads. In Firefox for Desktop, the history of past
downloads is handled separately, using the "places.sqlite" database.

*Changes*

The new API is fully asynchronous and works somewhat differently from
the old one. It has the advantage of being designed for JavaScript from
the start, and is much simpler than the old XPCOM API. In particular,
listing and handling current downloads may be done using JavaScript
objects, without any special code for database access.

The complete documentation of the module can be found here:

https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Downloads.jsm

We may still update existing methods to address specific needs or
new requirements, but the general mechanisms will remain the same.

*Testing*

A new about:config preference named "browser.download.useJSTransfer"
enables the browser and the Downloads Panel to use the Downloads.jsm
module instead of nsIDownloadManager as the back-end. The browser must
be restarted for the preference to take effect.

Support for this preference will be available in Nightly today or
tomorrow. This means that it will be ready for testing in the Aurora
channel starting from version 25, on August 8th.

In the Firefox 26 release train, nsIDownloadManager will not be used
anymore. The preference will be removed and there will be no way to
revert to the old system that caused potential performance issues.
We will finally be able to remove a lot of front-end code that is
complex to maintain and only needed for backwards compatibility.

*Feedback*

The version of the module in Firefox 25 is still in development, and
while the interface is complete, some features like restoring downloads
after a restart and the related prompts are not implemented yet. The
remaining work is tracked with dependencies of bug 847863:

https://bugzilla.mozilla.org/showdependencytree.cgi?id=847863&hide_resolved=1

If you notice any unexpected behavior with the new preference that is
not already listed there, feel free to file a new bug and mark it as
blocking bug 847863. For any other question or need, feel free to
reply to this thread in the relevant list (extensions or platform),
or contact myself directly. Any relevant information emerging from
the discussion will be summarized in a new project update.

Cheers,
Paolo
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform



--
teramako
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


SpiderMonkey Regrets

2013-06-29 Thread teramako

I posted to my blog:

SpiderMonkey Regrets - hogehoge
http://d.hatena.ne.jp/teramako/20130628/p1

I know SpiderMonkey is improving and new methods and statement are 
implemnted every day. I'm loving in these implementations.
But SpiderMonkey has a lot of negative heritage about compatibility for 
ECMAScript6th.


Negative heritage:
 - non block scoped ConstDeclaration
 - mismatch GeneratorFunction syntax
 - mismatch ArrayComplehension and GeneratorComplehension sytax
 - "__iterator__" and "iterator" magic properties

I would want Mozilla to fix those issues rather than implementing new 
methods of ES.next and keep the top engine which has the most 
compatibility for ECMAScript.


Best regards.
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: can not open a link in new tab from mozilla toolbar

2013-03-01 Thread teramako
2013年2月26日火曜日 21時13分36秒 UTC+9 saur m:
> Hello everyone, 
> 
>   I am new to the Mozilla development and have successfully build the nightly 
> browser. I just created a new toolbar but while opening link from toolbar it 
> opens link in new window instead of new tab; whereas same code works in 
> external html file. following is the toolbar code :
> 
> 
> 
>  onclick="window.open('http://www.google.com/','_newtab');">
> 
> 
> 
> Note: have set the setting also to open new links in new tab
> 
> also would like to know if its possible to open link in new tab from toolbar?
> 
> Looking for some help. Thanks in advance.

use openLinkIn 
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/utilityOverlay.js#207
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform