Coder Social home page Coder Social logo

mozilla 8.0, js caching breaks mozrepl about mozrepl HOT 11 OPEN

bard avatar bard commented on September 21, 2024
mozilla 8.0, js caching breaks mozrepl

from mozrepl.

Comments (11)

rpl avatar rpl commented on September 21, 2024

Hi retroj, thanks for reporting this bug.

There's another workaround in my fork:
rpl@28a9b1d

We are evaluating which one has less impact on the xulrunner runtime.

Thanks again,
Luca

from mozrepl.

retroj avatar retroj commented on September 21, 2024

Ah, I see you used the method of altering the name of the temp file for each load. The reason we didn't do this in our situation is that it would lead to growing the startup cache larger and larger over the life of the program. That is something to consider. If you do go that way, I wouldn't use Math.random() because that won't guarantee uniqueness, only randomness, and random failure is the worst kind of failure! :-)

from mozrepl.

rpl avatar rpl commented on September 21, 2024

You're right about the side effects of that workaround and that are the reasons we've not merged it :-(

About cache invalidation: it's possible to do a more selective cleanup? invalidate all the cache content
could generate some other negative side effects?

from mozrepl.

retroj avatar retroj commented on September 21, 2024

Annoyingly, Mozilla doesn't provide a way to invalidate a single item in the startup cache. Even the fact that startup cache invalidation works through an observer rather than there being a complete interface (an nsIStartupCacheManager or whatnot) makes one wonder if this feature was more tacked on than planned. Perhaps this should be brought to Mozilla's attention as a feature request.

The drawback to invalidating the startup cache is the loss of the efficiency it provides with repeat loading of js files. Other than that, there are no side effects. I would choose this method, myself, because although it is a blunt instrument, it is still the right instrument, according to the intent of the design of the startup cache. That design may be flawed, but that's Mozilla's problem.

from mozrepl.

bard avatar bard commented on September 21, 2024

In cb151c0 and 552ed9b I'm adopting a hybrid approach—cache is flushed when the JavaScript interactor starts, then a new script is cached every time the REPL evaluates something. This should prevent the cache from growing indefinitely.

A more correct behavior would be to flush the cache when the interactor stops, or even better to flush the cache when the browser quits and the REPL is found to have been running. Consider this a quick fix.

I haven't looked much into the cache implementation, but certainly it will have some expiry mechanism? @retroj have you seen anything about that?

from mozrepl.

retroj avatar retroj commented on September 21, 2024

Here is a link: http://mxr.mozilla.org/mozilla-central/source/startupcache/StartupCache.cpp#487

from mozrepl.

retroj avatar retroj commented on September 21, 2024

Oh look, there is an idl: http://mxr.mozilla.org/mozilla-central/source/startupcache/nsIStartupCache.idl

from mozrepl.

retroj avatar retroj commented on September 21, 2024

I find Cc["@mozilla.org/startupcache/cache;1"] exists but Ci.nsIStartupCache does not. Puzzled. Perhaps it isn't scriptable.

from mozrepl.

bard avatar bard commented on September 21, 2024

@retroj I was thinking "automatic expiry". I think there ought to be one as otherwise the cache would get bigger and bigger regardless of MozRepl. I'll look into it at some point.

from mozrepl.

dmitrii-maksimov avatar dmitrii-maksimov commented on September 21, 2024

can u make one new .xpi pack with this patch?
rpl@28a9b1d
if i trying change repl.jx myself - it was crashed...

from mozrepl.

bard avatar bard commented on September 21, 2024

Current repo contains a workaround already, it will be in the next xpi.

On Tue, Nov 15, 2011 at 2:08 PM, BlackSnow98
[email protected]
wrote:

can u make one nex .xpi pack with this patch?
rpl@28a9b1d
if i trying change repl.jx myself - it was crashed...


Reply to this email directly or view it on GitHub:
#21 (comment)

from mozrepl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.