OTR manage fingerprints: disable "remove all" button if list is empty
Categories
(Chat Core :: Security: OTR, defect)
Tracking
(Not tracked)
People
(Reporter: KaiE, Assigned: aleca)
References
Details
Attachments
(1 file, 5 obsolete files)
(deleted),
patch
|
aleca
:
review+
|
Details | Diff | Splinter Review |
OTR manage fingerprints: disable "remove all" button is list is empty
Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
I started working on this but there are some problems with this dialog.
When launching it I get these errors:
JavaScript error: chrome://chat/content/otr-finger.js, line 1: SyntaxError: redeclaration of var Localization
JavaScript error: chrome://chat/content/otr-finger.xhtml, line 1: ReferenceError: otrFinger is not defined
It seems we're experiencing a leak from the OTR.jsm
file with some variables redeclaration.
I tried wrapping the code around a {}
block but that doesn't seem to solve the problem.
Reporter | ||
Comment 2•5 years ago
|
||
(In reply to Alessandro Castellani (:aleca) from comment #1)
When launching it I get these errors:
JavaScript error: chrome://chat/content/otr-finger.js, line 1: SyntaxError: redeclaration of var Localization JavaScript error: chrome://chat/content/otr-finger.xhtml, line 1: ReferenceError: otrFinger is not defined
It seems we're experiencing a leak from the
OTR.jsm
file with some variables redeclaration.
I tried wrapping the code around a{}
block but that doesn't seem to solve the problem.
Not sure it's a "leak". OTR.jsm defines its exports, so local variables shouldn't have an impact on other files.
I don't fully understand why we get that error. However, I remember that Magnus complained in the past that I used "const" for an import. An in fact, if we change that "var", the error goes away.
With that fixed, I get additional errors. The assignment to the account argument fails, because it's differently structured. I fixed that, too.
Finally, I got an error from Fluent (ftl) that some attributes from finger.ftl are loaded synchronously, and others are asynchrounosly. That's probably because the xhtml refers to it and loads async, while in the .js file we request sync loading. I don't know if that's a big problem, but it seemed to be fixed easily, by moving the strings we want to load synchronously into a separate ftl file.
Reporter | ||
Comment 3•5 years ago
|
||
Reporter | ||
Comment 4•5 years ago
|
||
Comment 5•5 years ago
|
||
Assignee | ||
Comment 6•5 years ago
|
||
Thanks both for the reviews, I'm updating the patch.
Now I'm dealing with another error, which is:
JavaScript error: chrome://chat/content/otr-finger.js, line 13:
TypeError: can't access property Symbol.iterator, window.arguments.account is undefined
I think this is happening because I don't have any fingerprints stored.
Also, is there a reason why some objects, variables, and methods are declared outside the otrFinger
object?
Assignee | ||
Comment 7•5 years ago
|
||
(In reply to Alessandro Castellani (:aleca) from comment #6)
I think this is happening because I don't have any fingerprints stored.
Not true, as doing gFingers = OTR.knownFingerprints(window.arguments.account);
works and shows all my fingerprints.
Assignee | ||
Comment 8•5 years ago
|
||
All right, this solves everything and the button properly updates.
Reporter | ||
Comment 9•5 years ago
|
||
I get "ReferenceError: reference to undefined property "account"" in line 66.
Change it to: window.arguments[0].account
Note there's a global object "document.l10n" which works asynchrounously. I had named our local variable syncL10n to make it obvious for the reader that we're using the non-standard approach of synchronous loading (because we use the "true" parameter when constructing the object). IMHO it might be better to keep the existing name, for self-documentation purposes, but up to you.
Other than that, patch looks good to me.
Assignee | ||
Comment 10•5 years ago
|
||
Mh, strange, I wasn't getting that error even on an empty list.
Anyway, updated and it works perfectly.
Regarding l10n
vs syncL10n
, I don't have a strong opinion on that, so I'm good with what Magnus decides.
Reporter | ||
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Thanks both for the review.
I updated the message to because the fingerprint is currently used in an active conversation
as it's grammatically more correct.
I launched a try run, even if I think we currently don't have any OTR test going on: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=0a6dec02054e8d37e11c630f6785320c0c074319
Reporter | ||
Comment 14•5 years ago
|
||
maybe "because the fingerprint is used in currently active conversation"
Sorry for my late response, but I disagree with the suggested text. Attempts for simplification shouldn't result in incorrect text.
We aren't using fingerprints. We're using keys, and the fingerprint is just an identifier that we use to label keys.
The original text is correct. If you don't like the original text, we need to try to come up with a shorter text that's still precise.
Assignee | ||
Comment 15•5 years ago
|
||
What about because the corresponding key is currently used in an active conversation
?
Reporter | ||
Comment 16•5 years ago
|
||
(In reply to Alessandro Castellani (:aleca) from comment #15)
What about
because the corresponding key is currently used in an active conversation
?
Yes that's good.
r+
Reporter | ||
Comment 17•5 years ago
|
||
I think this example shows that our existing wording isn't easy to understand, and that it should be reviewed. Maybe we should use the term "fingerprint" less. I'll file a separate bug for that.
Assignee | ||
Comment 18•5 years ago
|
||
String updated.
Assignee | ||
Updated•5 years ago
|
Comment 19•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/368f0e33482a
Disable 'Remove All' button in OTR manage fingerprints list if the list is empty. r=kaie, r=mkmelin
Description
•