This project is archived and is in readonly mode.

#957 ✓invalid

auto exec JS

Reported by Gabriel | August 10th, 2010 @ 07:13 PM | in 2.0 (closed)

processScripts: function(text){
    if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text);
    return text.stripScripts(this.options.evalScripts);

After a little trip to the Request class I realized that all js files are being exec. Is there any reason why you are imposing this? We have the option of exec something that is NOT js but we DONT have the options of NOT exec something that is js??? Is it possible you guys can rework the class or give us an extra option for this?

Comments and changes to this ticket

  • Fábio M. Costa

    Fábio M. Costa August 11th, 2010 @ 01:34 AM

    • Milestone set to 1.3.0 rc2
    • State changed from “new” to “open”
    • Assigned user set to “Fábio M. Costa”
    • Milestone order changed from “788” to “0”

    yeah, i propose:

    processScripts: function(text){
        if (this.options.evalResponse) return $exec(text);
        return text.stripScripts(this.options.evalScripts);

    doesnt make much sense to force the exec if you have the option.

  • Michael Ficarra

    Michael Ficarra August 11th, 2010 @ 05:05 AM

    I agree. +1 to Fabio's suggested fix.

  • Gabriel

    Gabriel August 11th, 2010 @ 03:35 PM

    My only concern with the original solution and the newly proposed one is that we are not sending the "real" response, Mootools again will be changing the response... Specifically stripping and executing script tags. I think i would prefer something more along these lines...

    processScripts: function(text){
            text = text.stripScripts(true);
        if (this.options.evalResponse) 
            text = $exec(text);
        return text;

    This way we ensure users get exactly what they asked for. Either get the plain text or the text with script tags executed, or get the script executed but not the script tags or get fully executed script and tags.

  • Valerio

    Valerio September 4th, 2010 @ 11:24 AM

    Why would someone request a .js file if it's not going to be executed?

    Once we know the reason, we can decide if we need a fix or not.

  • Christoph Pojer

    Christoph Pojer September 7th, 2010 @ 12:12 AM

    • Milestone changed from 1.3.0 rc2 to 1.3.1
    • Milestone order changed from “40” to “0”

    It doesn't seem to be really important. I'll move the Milestone and I am waiting for a valid reason to implement this.

  • Gabriel

    Gabriel September 7th, 2010 @ 11:12 PM

    Im working on a "desktop app" that runs in the browser... it is fetch from a server (not necessarily from the internet, in most cases the server is in an embedded device) and we want to prefetch scripts at a certain time but not execute them up front. Scripts must be managed later when they are needed due to the nature of the project (but they must have been loaded and stored already). The scripts will be eval but we are the ones that will decide when.

    Anyhow I think the code should give the user the flexibility to choose whether the scripts get executed or not.

  • Fábio M. Costa

    Fábio M. Costa September 7th, 2010 @ 11:18 PM

    Thank you Gabriel, we just wanted to understand why you needed to execute it later. The reason looks fair to me.
    Now we need to think about a way that will not break any other script that uses mootools 1.2.

  • Fábio M. Costa

    Fábio M. Costa October 23rd, 2010 @ 04:06 PM

    • Milestone changed from 1.3.1 to 2.0
  • ibolmo

    ibolmo January 19th, 2012 @ 08:16 AM

    • State changed from “open” to “invalid”

    Moved to Github Issues:

    Please use Github Issues, since Lighthouse has been deprecated.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins