Closed Bug 1166434 Opened 9 years ago Closed 7 years ago

[e10s] Google Translator for Firefox add-on compatibility tracker

Categories

(Firefox :: Extension Compatibility, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
e10s + ---

People

(Reporter: ratulbracu, Unassigned, NeedInfo)

References

()

Details

(Whiteboard: [sitewait][awe:translator@zoli.bod] triaged)

Build ID: 20150519030202

not Worked in E10s mode but worked smoothly in non e10s mode. In E10s mode nor the selected text neither the full page translation is worked. Opposite scenery in non- e10s mode.
[e10s tracking info]

Assignee: Giorgio Maone

Link to add-on: https://addons.mozilla.org/en-US/firefox/addon/google-translator-for-firefox/

Contact info for add-on: http://translatorforfirefox.blogspot.it/

Add-on ID: translator@zoli.bod

How well does it work?: 50%

Steps to reproduce working features:
* Right click on a non-English web page and choose "Translate selection with Google Translate" - no matter what you selected, a popup saying "The selected text may not be longer than 1100 characters!" will be shown instead of the expected translation

Any obvious performance problems? none

SDK-based: No, legacy XUL add-on

Chromium version: N/A (built-in Chrome feature)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 8.1 → All
Hardware: x86_64 → All
Summary: "Google Translator for Firefox" add-on does not work with e10s → [e10s] Google Translator for Firefox add-on compatibility tracker
Version: 41 Branch → unspecified
Giorgio, can you try to contact the author? I seem to recall you saying this one would be not too hard to convert.
Flags: needinfo?(g.maone)
The author seems to be very privacy-conscious, having no contact information (no email, no social pointers, no phone, nothing) listed on AMO and on his private websites.

Therefore I used the AMO editors dashboard to send him this "Request for more info" message:

Hi,

Thank you for your hard work on this useful add-on!
Unfortunately, it is broken by Electrolysis: therefore it will cease to work correctly in the stable Firefox versions likely by the end of this year. Please check https://bugzilla.mozilla.org/show_bug.cgi?id=1166434 for more details, and possibly CC yourself.

Fortunately, this kind of add-ons should be very easy to port on the Add-on SDK using high level APIs, or even to the new WebExtensions API, https://wiki.mozilla.org/WebExtensions . 
The former option would ensure your add-on a reasonable longevity, but the latter will stay around far longer and an early port of a popular add-on like yours would make for a great story encouraging our fellow developers.

Are you interested in either?

Thank you!
Flags: needinfo?(g.maone)
This might be a good candidate for WebExtensions.
Hi, I am nobzol, developer of the add-on. Sorry for the late answer, but I am very busy recently.

I am trying to catch up... so what version do I need to download to test Electrolysis?

Is it okay to start from https://wiki.mozilla.org/Electrolysis?

Thanks, Zoli
(In reply to nobzol from comment #5)

> I am trying to catch up... so what version do I need to download to test
> Electrolysis?

Either current Development Edition ( https://www.mozilla.org/en-US/firefox/developer/ ) or Nightly ( https://nightly.mozilla.org/ ).

For local testing you'll need to turn the "xpinstall.signatures.required" about:config preference to false.
 
> Is it okay to start from https://wiki.mozilla.org/Electrolysis?

Looking at your add-on we determined it should be very easy to port on the new WebExtensions API, so the best tarting point is https://wiki.mozilla.org/WebExtensions/

Be sure you read also https://wiki.mozilla.org/WebExtensions/FAQ

Feel free to contact me if you've got any doubt or need any help.
nobzol, any progress on this?
Flags: needinfo?(nobzol)
Contacted Zoli by email.
Hi, I have finally started working on this. I am getting used to the new things, the main functions are operating now. However I have encountered some problems, so I have a few questions:
 1. how can I get the selected text from the active tab? Previously I could say document.commandDispatcher.focusedWindow.getSelection().toString();. Now as far as I know, the only thing that works now is window.getSelection().toString();, but this does not return the selected text if it is in either in an input field or textarea (or maybe in a frame but I have not tried that one). So how can I get the selected text from the focused element? Document.activeElement seems not to have getSelection() method.
 2. I have not dig myself into this really, but now it seems it is not possible to make a toolbar button, which has a little arrow next to it. All I could do is to make a popup, but I don't really want to do that, because it would slow down the workflow. Any workarounds for this one?
 3. And I have absolutely not tried this, but maybe there will be a problem, so I ask first. How does preferences reading/writing work these days? Previously there was Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.addonname."); for this, and then getBoolPref()/setBoolPref() etc. could be used on this object to read/write preferences. Is this still working, or is there something else I should use?

Thanks, and sorry for the slow progress.
Flags: needinfo?(nobzol)
(In reply to nobzol from comment #9)
> Hi, I have finally started working on this. I am getting used to the new
> things, the main functions are operating now.

It looks you've chosen not to go with the WebExtensions API, though.
Again, your extension looks pretty simple to port to this new framework, and you will need to do anyway, eventually, so I strongly advise you to start looking right now at https://developer.mozilla.org/en-US/Add-ons/WebExtensions

>  1. how can I get the selected text from the active tab? 

You need to use a content script ( https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts ), where you can use the common Web Platform API (i.e. window.getSelection(), primarily) to grab your text and send it to your background script in a message.

> input field or textarea (or maybe in a frame
> but I have not tried that one). So how can I get the selected text from the
> focused element? Document.activeElement seems not to have getSelection()
> method.

var el = document.activeElement;
var text = el && "value" in el && el.selectionEnd > el.selectionStart
  ? el.value.substring(el.selectionStart, el.selectionEnd)
  : "";



>  2. I have not dig myself into this really, but now it seems it is not
> possible to make a toolbar button, which has a little arrow next to it. All
> I could do is to make a popup, but I don't really want to do that, because
> it would slow down the workflow. Any workarounds for this one?

This is what we use in WebExtension: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/browserAction

If you've got some strong use case to extend this API in unsupported ways, we'll soon have a process in place to act on this kind of feedback / RFEs.

>  3. And I have absolutely not tried this, but maybe there will be a problem,
> so I ask first. How does preferences reading/writing work these days?

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage

Notice that the documentation above is still in progress and mainly generated automatically from Chrome's, so when in doubt refer also to https://developer.chrome.com/extensions and/or ask in IRC, #webextensions channel.
(In reply to Giorgio Maone from comment #10)
> (In reply to nobzol from comment #9)
> > Hi, I have finally started working on this. I am getting used to the new
> > things, the main functions are operating now.
> 
> It looks you've chosen not to go with the WebExtensions API, though.
> Again, your extension looks pretty simple to port to this new framework, and
> you will need to do anyway, eventually, so I strongly advise you to start
> looking right now at
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions
Uhm, sorry, it was not clear in my message that I HAVE chosen to use the WebExtensions API. So my questions are related to it. There are some functions that I could port to the new API, but these I couldn't (yet).

> 
> >  1. how can I get the selected text from the active tab? 
> 
> You need to use a content script (
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts ),
> where you can use the common Web Platform API (i.e. window.getSelection(),
> primarily) to grab your text and send it to your background script in a
> message.
> 
> > input field or textarea (or maybe in a frame
> > but I have not tried that one). So how can I get the selected text from the
> > focused element? Document.activeElement seems not to have getSelection()
> > method.
> 
> var el = document.activeElement;
> var text = el && "value" in el && el.selectionEnd > el.selectionStart
>   ? el.value.substring(el.selectionStart, el.selectionEnd)
>   : "";
> 
Content<->Background script is OK, I've done it already, the problem is only with these special places. I will give a try to the lines above tonight, thanks.

> 
> 
> >  2. I have not dig myself into this really, but now it seems it is not
> > possible to make a toolbar button, which has a little arrow next to it. All
> > I could do is to make a popup, but I don't really want to do that, because
> > it would slow down the workflow. Any workarounds for this one?
> 
> This is what we use in WebExtension:
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/browserAction
> 
> If you've got some strong use case to extend this API in unsupported ways,
> we'll soon have a process in place to act on this kind of feedback / RFEs.
Yes, I did find this, and I'm already using it to place the icon, and it works ok. However, I did not find a way to place the small arrow, which opens up a list with some possibilities other than the main (instant translate) function: Options, Translate selected text and Translate full page. The source is currently not in front of me, maybe it was called menupopup in a toolboxbutton or something like this. Maybe is it possible to make a listener which listens to right-mouse-button? So the primary function would run if the button is clicked with left (primary) mouse button, and these extra functions would appear if right mouse button is clicked. This is not a very important function, but it would be nice.

> 
> >  3. And I have absolutely not tried this, but maybe there will be a problem,
> > so I ask first. How does preferences reading/writing work these days?
> 
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage
> 
> Notice that the documentation above is still in progress and mainly
> generated automatically from Chrome's, so when in doubt refer also to
> https://developer.chrome.com/extensions and/or ask in IRC, #webextensions
> channel.

Thanks, I will look at this.

And sorry again that I was not clear enough.
Depends on: 1244789
(In reply to nobzol from comment #11)
> (In reply to Giorgio Maone from comment #10)
> > (In reply to nobzol from comment #9)
> > > input field or textarea (or maybe in a frame
> > > but I have not tried that one). So how can I get the selected text from the
> > > focused element? Document.activeElement seems not to have getSelection()
> > > method.
> > 
> > var el = document.activeElement;
> > var text = el && "value" in el && el.selectionEnd > el.selectionStart
> >   ? el.value.substring(el.selectionStart, el.selectionEnd)
> >   : "";
> > 
> I will give a try to the lines above tonight,
> thanks.
This works for input and textarea fields, thank you (mostly because it seems, that my add-on does not do this currently... it did it some day, so it seems it went wrong some time in the past).

Anyway, it's not working in iframes. As I see, this must be a JavaScript limitation, as some quick tries on http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_document_activeelement ended with the same result: iframes don't get activeElement status. Maybe this was the reason for the existance of document.commandDispatcher.focusedWindow? Is there any way I can get the focused window (frame)? It's also good, if there is somewhere a getSelection() method which returns the Selection object which would be used if I pressed Ctrl+C. Maybe a "hack" using window.frames, and iterating through them (but how do I know which one is active). This one is kind of a "must have" request (not a "killer"), but a lot of people asked for this functionality earlier.

> > >  2. [...]small arrow[...]
Thanks for recording this as a bug. (1244789)

Thanks for the help, Zoli
Whiteboard: [sitewait]
(In reply to nobzol from comment #12)

> This works for input and textarea fields, thank you (mostly because it
> seems, that my add-on does not do this currently... it did it some day, so
> it seems it went wrong some time in the past).
> 
> Anyway, it's not working in iframes. As I see, this must be a JavaScript
> limitation, as some quick tries on
> http://www.w3schools.com/jsref/tryit.
> asp?filename=tryjsref_document_activeelement ended with the same result:
> iframes don't get activeElement status.

They do, you just need to use this recursive function to get the right element even if it's nested inside multiple (i)frames:

function findActiveIn(document) { 
  let active = document && document.activeElement;
  return active && active.contentWindow && findActiveIn(active.contentWindow.document) || active;
}

> > > >  2. [...]small arrow[...]
> Thanks for recording this as a bug. (1244789)
> 

No problem. Unfortunately it's not something that can be done overnight, and in facts that bug cannot block WebExtensions 1.0, where we need to reach Chrome parity as a priority before adding "big" divergent new features (which we definitely want to implement, though).

So, could you just please try to deliver a version with the level of UI currently allowed by WebExtensions / Chrome extensions (with the benefit of Chrome compatibility for free) and then "upgrade" it when Firefox supports a richer user experience which Chrome does not?

BTW, feel free to answer with your angle on https://bugzilla.mozilla.org/show_bug.cgi?id=1244789#c3
Flags: needinfo?(nobzol)
Reproduced with Ubuntu 14.04 (Mozilla/5.0 (X11; Linux i686; rv:48.0) Gecko/20100101 Firefox/48.0). 
Translate selection with Google Translate gives error (The selected text may not be longer than 1100 characters) when e10s is enabled. But the addon translates the same selection if e10s is disabled.
750,000 users
Priority: -- → P1
Whiteboard: [sitewait] → [sitewait] triaged
(In reply to Rakibul Islam Ratul from comment #0)
> Build ID: 20150519030202
> 
> not Worked in E10s mode but worked smoothly in non e10s mode. In E10s mode
> nor the selected text neither the full page translation is worked. Opposite
> scenery in non- e10s mode.
Flags: sec-bounty?
(In reply to michaelzech81 from comment #16)
> (In reply to Rakibul Islam Ratul from comment #0)
> > Build ID: 20150519030202
> > 
> > not Worked in E10s mode but worked smoothly in non e10s mode. In E10s mode
> > nor the selected text neither the full page translation is worked. Opposite
> > scenery in non- e10s mode.
Hi!
I'm still working on this, but I progress really slow because of other stuff to do :(

So, I have a few questions:

1. Keyboard shortcuts / Hotkeys
1/a. Why are function keys (F1...F12) disallowed as a command hotkey? They were enabled before, and it's very annoying to be forced to live without this. It was VERY convenient to press F2, and the translation happened.
1/b. Is there any way to give the user an option to change the "suggested key"?
1/c. I need _execute_browser_action in commands API. Also, I need to get activeTab in chrome.commands.onCommand. Now, without this it's a pain to retrieve the active tab, I need a superfluous "tabs" permission to get the url of the active tab; and sometimes it's not even working.

2. Options page
2/a. How can I make a default for an option easily? --- Now, in my "background script" I have a code, that gets an option, and if it's undefined, it finds out some default value based on the FF settings (default target language for translations are based on chrome.i18n.getAcceptLanguages). I need exactly this on the options page; because I want to show the user the right value. How can I do this without code duplication?
2/b. What css should I include to make the Options part look the same on the Extension page, as the rest? (Big blue radio buttons, not-times-new-roman font and so.)
2/c. How can I migrate old-style preferences? They were visible in the about:config page, but I have not found anything that how can I access these. I need to access them somehow, to help the users with the same settings as they had before.

3. Context menu
3/a. Will "browser_action" value be enabled in contextMenus API? If I understand the documentation well, this would solve 1244789.
3/b. Is it possible to negate "contexts"? I need a context menu when there is a selection, and another when there isn't any. How can I do this? Somehow if I leave "selection" from contexts, the context menu also appears if there is a selection -- but in this case the 2 context menus are grouped under the name of the add-on.

4. Other
- How can I bring up an alert window, or anything else that can replace it in functionality?
- IFrame question: the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1166434#c13 worked well at first, but now in F50 it throws an exception(?), or sets lastError(?) if the frame src is not the same as the page itselft (same origin-policy violation). How can I handle this nicely? Try-catch or something?

Thank you, Zoli
QA update:
Working as expected e10s enabled and disabled
Version 	51.0a2
Build ID 	20160929004005
User Agent 	Mozilla/5.0 (X11; Linux i686; rv:51.0) Gecko/20100101 Firefox/51.0
"ni" me if additional info or testing is needed
Flags: needinfo?(sescalante)
Flags: sec-bounty?
Flags: needinfo?(sescalante)
(In reply to nobzol from comment #18)
> 1. Keyboard shortcuts / Hotkeys
> 1/a. Why are function keys (F1...F12) disallowed as a command hotkey? They
> were enabled before, and it's very annoying to be forced to live without
> this. It was VERY convenient to press F2, and the translation happened.

I don't know, I will try to find this out and get back to you.

> 1/b. Is there any way to give the user an option to change the "suggested
> key"?

Note yet, but we plan on adding this. See bug 1303384 and bug 1348589.

> 1/c. I need _execute_browser_action in commands API. Also, I need to get
> activeTab in chrome.commands.onCommand. Now, without this it's a pain to
> retrieve the active tab, I need a superfluous "tabs" permission to get the
> url of the active tab; and sometimes it's not even working.

_execute_browser_action in commands API is supported since Firefox 52 (the current stable release).

> 
> 2. Options page
> 2/a. How can I make a default for an option easily? --- Now, in my
> "background script" I have a code, that gets an option, and if it's
> undefined, it finds out some default value based on the FF settings (default
> target language for translations are based on
> chrome.i18n.getAcceptLanguages). I need exactly this on the options page;
> because I want to show the user the right value. How can I do this without
> code duplication?

You can provide defaults to the storage API. If the key was not set before, then the defaults are used.
browser.storage.local.get({
   prefNameExample: 'prefValue',
   prefBoolExample: true,
}).then(function(items) {
   // Now do something with prefNameExample and prefBoolExample
});

See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Implement_a_settings_page for another example.


> 2/b. What css should I include to make the Options part look the same on the
> Extension page, as the rest? (Big blue radio buttons, not-times-new-roman
> font and so.)

Since Firefox 55, you can use browser_style (this is not yet documented, but it was added in bug 1275287).

> 2/c. How can I migrate old-style preferences? They were visible in the
> about:config page, but I have not found anything that how can I access
> these. I need to access them somehow, to help the users with the same
> settings as they had before.

You can create an embedded WebExtension to migrate preferences. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Embedded_WebExtensions for documentation and examples.

> 3. Context menu
> 3/a. Will "browser_action" value be enabled in contextMenus API? If I
> understand the documentation well, this would solve 1244789.

Yes. This has already been supported since Firefox 53.

> 3/b. Is it possible to negate "contexts"? I need a context menu when there
> is a selection, and another when there isn't any. How can I do this? Somehow
> if I leave "selection" from contexts, the context menu also appears if there
> is a selection -- but in this case the 2 context menus are grouped under the
> name of the add-on.

This is not possible yet.
What you can do is to create a contextMenu that matches for both contexts, and in the onClicked handler perform different actions depending on whether there is a selection. With this method, your context menu item has the same menu item label for both actions though.
This Q&A might be useful to you: https://stackoverflow.com/questions/40564539/chrome-contextmenus-exclude-type

> 4. Other
> - How can I bring up an alert window, or anything else that can replace it
> in functionality?

If you want to show information, use the notifications API - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/notifications.
If you want to show a popup, use browser.windows.create.
Alternatively, you can also use a content script to insert a styled notification in the current page (this only works if the add-on has the right host permission; also try to avoid information leakage and account for different styles across websites).

> - IFrame question: the code in
> https://bugzilla.mozilla.org/show_bug.cgi?id=1166434#c13 worked well at
> first, but now in F50 it throws an exception(?), or sets lastError(?) if the
> frame src is not the same as the page itselft (same origin-policy
> violation). How can I handle this nicely? Try-catch or something?

This is indeed a same-origin policy violation. You can use try-catch to catch it.
Alternatively, insert a content script in all frames from the background page (browser.tabs.executeScript with allFrames:true), collect the information and combine the pieces in the background page. If the information can be determined synchronously, then the results are simply available in the callback of tabs.executeScript. Otherwise (=asynchronously) you have to send the results using extension messaging (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/onMessage)
(In reply to Rob Wu [:robwu] from comment #20)
> (In reply to nobzol from comment #18)
> > 1. Keyboard shortcuts / Hotkeys
> > 1/a. Why are function keys (F1...F12) disallowed as a command hotkey? They
> > were enabled before, and it's very annoying to be forced to live without
> > this. It was VERY convenient to press F2, and the translation happened.
> 
> I don't know, I will try to find this out and get back to you.

Function keys appear to be supported, since Firefox 53 (bug 1322033). So all blocking issues that you have mentioned so far have been fixed in the current stable version of Firefox :)
Whiteboard: [sitewait] triaged → [sitewait][awe:translator@zoli.bod] triaged
Hi Zoli,  Checking in on your progress and to see if you need any assistance?  On Nov 14th Firefox 57 releases and only webextension based add-ons will run.  I'm sending out a reminder in case you need to migrate any user data or settings.   Time is limited to migrate data [1] using an embedded webextension.  Please let us know if you submit an embedded add-on to migrate data (so we can keep an eye out in the review queues).  

[1] https://blog.mozilla.org/addons/2017/09/08/last-chance-migrate-user-data/ 

Thank you and please Needinfo me with any questions.  You can also email web-extension-outreach@mozilla.com or IRC #addons or #webextensions

(In reply to nobzol from comment #18)
> Hi!
> I'm still working on this, but I progress really slow because of other stuff
> to do :(
> 
> So, I have a few questions:
> 
> 1. Keyboard shortcuts / Hotkeys
> 1/a. Why are function keys (F1...F12) disallowed as a command hotkey? They
> were enabled before, and it's very annoying to be forced to live without
> this. It was VERY convenient to press F2, and the translation happened.
> 1/b. Is there any way to give the user an option to change the "suggested
> key"?
> 1/c. I need _execute_browser_action in commands API. Also, I need to get
> activeTab in chrome.commands.onCommand. Now, without this it's a pain to
> retrieve the active tab, I need a superfluous "tabs" permission to get the
> url of the active tab; and sometimes it's not even working.
> 
> 2. Options page
> 2/a. How can I make a default for an option easily? --- Now, in my
> "background script" I have a code, that gets an option, and if it's
> undefined, it finds out some default value based on the FF settings (default
> target language for translations are based on
> chrome.i18n.getAcceptLanguages). I need exactly this on the options page;
> because I want to show the user the right value. How can I do this without
> code duplication?
> 2/b. What css should I include to make the Options part look the same on the
> Extension page, as the rest? (Big blue radio buttons, not-times-new-roman
> font and so.)
> 2/c. How can I migrate old-style preferences? They were visible in the
> about:config page, but I have not found anything that how can I access
> these. I need to access them somehow, to help the users with the same
> settings as they had before.
> 
> 3. Context menu
> 3/a. Will "browser_action" value be enabled in contextMenus API? If I
> understand the documentation well, this would solve 1244789.
> 3/b. Is it possible to negate "contexts"? I need a context menu when there
> is a selection, and another when there isn't any. How can I do this? Somehow
> if I leave "selection" from contexts, the context menu also appears if there
> is a selection -- but in this case the 2 context menus are grouped under the
> name of the add-on.
> 
> 4. Other
> - How can I bring up an alert window, or anything else that can replace it
> in functionality?
> - IFrame question: the code in
> https://bugzilla.mozilla.org/show_bug.cgi?id=1166434#c13 worked well at
> first, but now in F50 it throws an exception(?), or sets lastError(?) if the
> frame src is not the same as the page itselft (same origin-policy
> violation). How can I handle this nicely? Try-catch or something?
> 
> Thank you, Zoli
Flags: needinfo?(nobzol)
Hi,

alpha version of the updated add-on has been uploaded to AMO (to the Beta channel).

After a few days I've just discovered a problem occuring only on the AMO page:
 - selection translation doesn't work on that page, because I get "Error: Missing host permission for the tab" error when I am trying to get the selected text from the page
 - I found this issue: https://github.com/fwenzel/copy-shorturl/issues/69 . According to this, add-ons don't have the necessary permissions on the AMO site. Why is that? Is this the problem in this add-on, too?

And another minor issue:
 - on the Options page I use "browser_style", and I give my elements the necessary (? why?) "browser-style" class. Still the "select" and "button" elements don't look like what I would expect from "browser_stlye" (larger elements, larger font size, simple border etc.). So I "hacked" it by defining a few styles at the beginning of the html. Now they sorta look like what I would expect, but I don't think this should work like this. Why isn't it enough to use "browser_stlye" in the manifest file (personally I see using "browser-style" class too as superfluous), but hacking is needed to achieve the almost-same-look as the rest of the Options page?

Zoli
(In reply to :shell escalante from comment #22)
> Hi Zoli,  Checking in on your progress and to see if you need any
> assistance?  On Nov 14th Firefox 57 releases and only webextension based
> add-ons will run.  I'm sending out a reminder in case you need to migrate
> any user data or settings.   Time is limited to migrate data [1] using an
> embedded webextension.  Please let us know if you submit an embedded add-on
> to migrate data (so we can keep an eye out in the review queues).  
> 
> [1]
> https://blog.mozilla.org/addons/2017/09/08/last-chance-migrate-user-data/ 
> 
> Thank you and please Needinfo me with any questions.  You can also email
> web-extension-outreach@mozilla.com or IRC #addons or #webextensions
> 

Hi, I just saw this message. Please find the first part of the answer in my previous message (comment 23), and here is the second part.

As migrating data seemed unreasonably complicated, I decided not to do it - there wasn't too much to migrate anyway.

I needinfo you here, but please find my remaining questions in my previous message.

Thanks, Zoli
Flags: needinfo?(sescalante)
Also, do you know anything about WebExtensions support on BabelZilla? I tried to upload the updated add-on, but it didn't work.

Thanks, and sorry for posting in separate messages.
(In reply to nobzol from comment #23)
> Hi,
> 
> alpha version of the updated add-on has been uploaded to AMO (to the Beta
> channel).
> 
> After a few days I've just discovered a problem occuring only on the AMO
> page:
>  - selection translation doesn't work on that page, because I get "Error:
> Missing host permission for the tab" error when I am trying to get the
> selected text from the page
>  - I found this issue: https://github.com/fwenzel/copy-shorturl/issues/69 .
> According to this, add-ons don't have the necessary permissions on the AMO
> site. Why is that? Is this the problem in this add-on, too?

Content scripts are limited on AMO because AMO has super powers we don't want to give extensions. We are hoping to fix this in the future.

> And another minor issue:
>  - on the Options page I use "browser_style", and I give my elements the
> necessary (? why?) "browser-style" class. Still the "select" and "button"
> elements don't look like what I would expect from "browser_stlye" (larger
> elements, larger font size, simple border etc.). So I "hacked" it by
> defining a few styles at the beginning of the html. Now they sorta look like
> what I would expect, but I don't think this should work like this. Why isn't
> it enough to use "browser_stlye" in the manifest file (personally I see
> using "browser-style" class too as superfluous), but hacking is needed to
> achieve the almost-same-look as the rest of the Options page?

We are getting there, but browser_style isn't quite perfect yet. The changes in new UI for Quantum haven't been fully figured out in the browser_style. There's a few other bugs on this, I think, if you find more please open a new bug.
(In reply to nobzol from comment #25)
> Also, do you know anything about WebExtensions support on BabelZilla? I
> tried to upload the updated add-on, but it didn't work.
> 
> Thanks, and sorry for posting in separate messages.

Hi Nobzol,

We'll follow up with Babelzilla to see when they will support webextensions.  It had been in their plan earlier this year, but not sure on timing for completion. 

There is a short discourse thread that has some translation options for the near term.  https://discourse.mozilla.org/t/webextensions-localization-l10n/18238/2
Flags: needinfo?(sescalante)
This is now listed as a WebExtension on AMO.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Hi,

altough the rewritten add-on works for me and for a couple of users, others complain that it doesn't work for them. Just to check they don't report anything stupid, I checked the add-on on a fresh profile and I could reproduce the issue. The problem seems to be, that storage areas (as I testes both sync and local) set lastError and give undefined result callback on get and set functions.

These error logs appear in the console log:

Error: Error(s) encountered during statement execution: no such table: collection_data
Stack trace:
handleCompletion@resource://gre/modules/Sqlite.jsm:810:25
  Sqlite.jsm:648
Error(s) encountered during statement execution: no such table: collection_data  Sqlite.jsm:810
result is undefined  translate.js:70
Unchecked lastError value: Error: An unexpected error occurred  ExtensionCommon.jsm:407


Can you help me (shell, I marked you, but it can be anyone else), what can cause the issue? Thank you.

(All storage.sync.get and set does this in the add-on but here I include one of them to show, it's not a classic "this-is-not-a-sync-but-an-async-function problem")

//line 69:
getStorageArea ().get ({'translationMode':TranslationMode.TranslateSelectionIfPossible}, function (result) {
		var translationMode = (requestedMode ? requestedMode : result.translationMode); //can override with requestedMode //<<<<<<<<<<< this writes "result is undefined" in the console
		setToolbarIcon (TranslationState.TranslationIsInProgress);
		switch (translationMode) {
			/* not really interesting*/
		}
	});

(Full source is available on AMO.)

As this is a major issue, I reset this bug status to open.
Flags: needinfo?(sescalante)
Well, I have no right to change status. Anyway.

Here's a quick follow up:

Definition of getStorageArea():

function getStorageArea () {
	return (chrome.storage.sync ? chrome.storage.sync : chrome.storage.local);
}

I've tried replacing chrome with browser, and instead of placing this in a function, using it directly before the get (like chrome.storage.sync.get (...)), with no success, same error appears.
You need to log in before you can comment on or make changes to this bug.