Closed
Bug 869005
Opened 11 years ago
Closed 11 years ago
Values of globals retrieved only with get and getEntity are cached forever
Categories
(L20n :: JS Library, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: stas, Assigned: stas)
Details
Attachments
(1 file, 1 obsolete file)
5.81 KB,
patch
|
zbraniecki
:
review+
|
Details | Diff | Splinter Review |
If you only use `get` or `getEntity` to retrieve entities with a particular global, the global is never activated, and thus the initial value is cached forever.
Assignee | ||
Comment 1•11 years ago
|
||
Gandalf, does this look right?
Assignee: nobody → stas
Attachment #745866 -
Flags: review?(gandalf)
Comment 2•11 years ago
|
||
Comment on attachment 745866 [details] [diff] [review] Check if the global is active Review of attachment 745866 [details] [diff] [review]: ----------------------------------------------------------------- add a comment on why not active global can have it's get fired pls.
Attachment #745866 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 3•11 years ago
|
||
I added the comment and refactored the Global class a little bit. Now, get() has the caching logic, while _get() simply returns the value of the global. Gandalf, can you take another look at this? I also filed two follow-ups that I discovered in testing: bug 869372 and bug 869382.
Attachment #745866 -
Attachment is obsolete: true
Attachment #746321 -
Flags: review?(gandalf)
Comment 4•11 years ago
|
||
Comment on attachment 746321 [details] [diff] [review] Better patch Review of attachment 746321 [details] [diff] [review]: ----------------------------------------------------------------- ::: lib/l20n/compiler.js @@ +457,5 @@ > + } catch (e) { > + throw new RuntimeError('Cannot evaluate global ' + name, entry); > + } > + _references.globals[name] = true; > + return [locals, value]; I'm not convinced we should do catch-all wrappings here. If unsafe code throws, it throws and it's a dev problem to solve.
Attachment #746321 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Zbigniew Braniecki [:gandalf] from comment #4) > I'm not convinced we should do catch-all wrappings here. If unsafe code > throws, it throws and it's a dev problem to solve. The problem is that it doesn't throw, but instead reject the locale.build(true) promise. See bug 869372. OK for landing as-is, or should I change that part?
Comment 6•11 years ago
|
||
land as-is
Assignee | ||
Comment 7•11 years ago
|
||
Thanks. Fixed in https://github.com/l20n/l20n.js/commit/55958409218425b1ab7959ef8de98721cfaba067
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 8•11 years ago
|
||
I had to follow up with https://github.com/l20n/l20n.js/commit/6227bcde57c6eacaa723a693d8315a69e02c4776. Sloppiness on my part, sorry.
You need to log in
before you can comment on or make changes to this bug.
Description
•