Skip to content

Request.processScripts always evals .js files. #2220

@ibolmo

Description

@ibolmo

(from Lighthouse)

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?


(from comment)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions