Why is wp-includes/js/shortcode.js rendered in gibberish - javascript

I noticed my debugger was flaring up for a javascript error.
Uncaught SyntaxError: Invalid or unexpected token
http://vionms.beee/wp/wp-includes/js/shortcode.js?ver=4.9.8 line 1
When I open it, it shows a lot of gibberish... and then some (partial) information about a Comodo RSA domain validation/SSL wildcard, see screenshot.
I deactivated all plugins and reverted to a WP default theme, but the error persisted...
If I remove the version from the url, the scripts shows its contents (as expected).
I've never seen this before... and I don't know what caused it, so annoying...

Related

Javascript/ Bootstrap/ JQuery doesn't load when switching domains

I have made a website on one domain, perfecting it to my likings. However, now I took all the files, copied them to another domain. Now the website console throws weird errors, that were not there on the first domain where the website was created.
I get errors:
Uncaught SyntaxError: missing ) after argument list on
bootstrap.min.jsand Uncaught SyntaxError: missing ) after argument
list on jquerymagnific-popup.js
In the code, I am referring to all scripts with the following line(s):
<script src="/js/scripts.js"></script>
I can't seem to figure out why it works on for example domain1.com/testing but not on domain2.com

SyntaxError: expected expression, got '<' caused by Heroku's Main.js after rollback

I build a react app using the create-react-app which gets deployed on Heroku. Everything worked until I had to do a rollback using Heroku's rollback feature.
Now, whenever I try to access my website i get a SyntaxError: expected expression, got '<' error.
When checking where the error comes from I can see in my network tab that the request for main.28bbbf43.js returns a text/html file instead of the expected text/javascript.
When pasting the request url in my browser I get a 404.
At this point I am lead to think that the main.28bbbf43.js has not been deployed correctly.
But then comes the tricky part:
If I try to access my site from a private browser of from an other pc it loads correctly and the main.28bbbf43.jsgets returned as the expected text/javascriptformat.
I have only very little experience using Heroku.
Would anyone have an idea how this can be caused and how this should be fixed?

(jQuery.js error) uncaught Error: Syntax error, unrecognized expression: [href=#]

I am having trouble with a WP plugin. Users cannot upload an avatar or background, as well as view their profile from the profile section. Once the button is pushed to perform profile related actions they are redirected to the home page. Here is a bit of the code (functions receiving errors) and pictures of the console log errors errors.
some console log errors are because there are no pictures. I have deliberately removed profile and background photos. This problem happens with or without images.
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0)
function(a){if(!a.document){throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,
function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=
function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:
I have performed the following Troubleshooting task:
uninstalled and reinstalled the plugin.
Adjusted all settings for redirects.
Checked Themes (not the theme).
Deleted everything and started from scratch.
Deactivated all other plugins (plugins not the problem).
This is the Console log error for users attempting to change their background or avatar
The 2nd picture is of the console log error when an individual tries to view their profile
[href=#] is not a valid CSS selector.
In an attribute selector (the [name=value] syntax), the value MUST be surrounded by quotes UNLESS the value is a valid CSS identifier: starts with a letter, contains only letters, numbers, hyphens and underscores (in this case, quotes are optional)
Since # quite clearly fails the "valid CSS identifier", it must be quoted.
[href='#'] will work just fine.

What does view-response.js in Chrome do?

When loading a page (200 OK response header), I received an error in the HTTP response add-on for Firefox:
[Exception... "File error: Not found" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://view-response/content/view-response.js :: sendRequest :: line 186" data: no]
What does that file do? (Contents pasted into JSBin here, notice how semicolons are missing.)
I was able to open it in Firefox and not just Chrome (but not Opera and IE).
That's an error with the plugin internal code, nothing to do with your code. The chrome:// is a little misleading, it's nothing to do with Google Chrome, Mozilla refers to elements of their UI engine as the "chrome".
The error is specifically around the line:
xhr.send(valueOfElement("body-textarea"))
Which is an ajax request initiated on this line:
xhr.open(valueOfElement("method-select"), valueOfElement("uri-input"), true)
...and since you are getting NS_ERROR_FILE_NOT_FOUND I presume the that URL return by the function call valueOfElement("uri-input") is returning a 404 or may be an invalid URL.
The lack of semi-colons in the JS file is (IMO) bad practice, but nothing to do with the error.
Long story short: ignore the error, there's nothing you can do about it except for add some error handling and rebuild the plugin package, which you probably can't do in a meaningful way unless you wrote the plugin.
It has nothing to do with your site code.

Why do I get no source for error in Firefox

The Firebug console gives me:
------------------------------------------
(X) 0
no source for No element with id 'inline_gallery_image_false' found)
------------------------------------------
When I click this error I get a blank source view window. The 'Stack' pane in the Script tab turns up blank as well.
Firefox 3.5.5 + Firebug 1.4.5. All other extensions are disabled.
I've turned on 'Stop on All Errors' and 'Show Javascript Errors' and 'Show Stack Trace on Errors' but all I get is the error shown above. Strangely a Google search turned up nothing helpful.
Basically I know the error is due to a bad argument passed to a function in an external JS file but I want to know what function called it and how it came to send the wrong argument. I also want to know why it won't show the source or even tell me which file the error is in.
If you know what you do to repeat the error, then just put a breakpoint in that section, and just start to step through. At some point you will be jumped completely out of your code, or it will just exit, but you will begin to figure out what happened to cause the error.
It appears that you are trying to access an element that doesn't exist, or is not in the DOM, yet. You may have tried to create an element with setting innerHTML but you haven't given the browser to make the DOM change yet.
Can you explain what is going on when this happened? What are you trying to do, what do you expect to happen?
I noticed the standard Firefox console gives the same error so this issue is not an issue with Firebug after all. When I click the error to view source I get:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebNavigation.loadURI]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/viewSource.js :: viewSource :: line 221" data: no]
UPDATE: After searching around I found another site with a JS error. Upon opening source view I get a blank page and:
Error: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIRequest.name]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: file:///D:/Apps/Firefox3.5/components/nsLoginManager.js :: anonymous :: line 328" data: no]
Source File: file:///D:/Apps/Firefox3.5/components/nsLoginManager.js
Line: 328
Seems pretty clear some extension or plugin has screwed up my FF source view. I'm going to reinstall from scratch. Since it's clear this isn't a programming issue any more feel free to close.
UPDATE: Turned out it WAS a programming error. The offender was this line of code:
if (isStrict && !o) throw new Error(0,"No element with id '" + ref + "' found");
WTF is that 0 in there? No idea. I must have followed a dodgy tutorial because when I looked into the Error constructor the first argument is supposed to be the message string. The second argument is supposed to be the URL of the offending file (optional) so FF rightly thought there was an error called '0' in the file "No element with ...".

Categories