Closed Bug 869005 Opened 12 years ago Closed 12 years ago

Values of globals retrieved only with get and getEntity are cached forever

Categories

(L20n :: JS Library, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: stas)

Details

Attachments

(1 file, 1 obsolete file)

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.
Attached patch Check if the global is active (obsolete) — Splinter Review
Gandalf, does this look right?
Assignee: nobody → stas
Attachment #745866 - Flags: review?(gandalf)
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+
Attached patch Better patchSplinter Review
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 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+
(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?
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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.

Attachment

General

Created:
Updated:
Size: