Proxy, solution to replace .js locally

I am connection to a Server via HTTPS.
Now I think ive found a bug in a Javascript file.

I would like to lacally test, if the fix works before contacting the administrator.

I already installed Privoxy, but as I learned this only supports HTTP.

Is there a simple solution for this?

Can I test this with a Tampermonkey scriptß
I already tried to add my local file, but tampermonkey cant seem to load it:
// @require file:///home/myname/Downloads/polyfiller-bug-line196.js
It always says 0 bytes size.

I already allowed the Tampermonkey-Extension to use local files.

Or maybe someone know if i can override a function before loading the page somehow or if theres any other way.

In JavaScript Profiler of Chrome a “send” function takes over 2000 miliseconds to load.
It is this function:

    n.ajaxTransport(function(a) {
        var b;
        return k.cors || Ec && !a.crossDomain ? {
            send: function(c, d) {
                var e, f = a.xhr(), g = ++Bc;
                if (f.open(a.type, a.url, a.async, a.username, a.password),
                a.xhrFields)
                    for (e in a.xhrFields)
                        f[e] = a.xhrFields[e];
                a.mimeType && f.overrideMimeType && f.overrideMimeType(a.mimeType),
                a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");
                for (e in c)
                    f.setRequestHeader(e, c[e]);
                b = function(a) {
                    return function() {
                        b && (delete Cc[g],
                        b = f.onload = f.onerror = null,
                        "abort" === a ? f.abort() : "error" === a ? d(f.status, f.statusText) : d(Dc[f.status] || f.status, f.statusText, "string" == typeof f.responseText ? {
                            text: f.responseText
                        } : void 0, f.getAllResponseHeaders()))
                    }
                }
                ,
                f.onload = b(),
                f.onerror = b("error"),
                b = Cc[g] = b("abort");
                try {
                    f.send(a.hasContent && a.data || null)
                } catch (h) {
                    if (b)
                        throw h
                }
            },
            abort: function() {
                b && b()
            }
        } : void 0
    }),

Chrome already warns me, that this line:
(f.open(a.type, a.url, a.async, a.username, a.password),
Is using a synchronouse XMLHTTPrequest in the main thread, that is deprecaced.
Can this be the cause for the long delay?
It is in the file jquery.js

If this is the reaon, is there a way to set this to asynchronous from my client side? so before the page is loaded?

Yes, absolutely – the page will hang until the requests completes.

Well jQuery does support synchronous requests, but explicitly warns against using them. Some people are still using them though because they either are not aware of this, or don’t know how to properly handle asynchronous requests (or both).

I don’t think so… even if you’d enforce requests to be asynchronous (e.g. by monkey patching jQuery itself), the rest of the script would break as it requires a different approach of handling responses (namely callbacks or promises).

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.