Firefox generates uncaught exception NS_ERROR_XPC_BAD_CONVERT_JS when loading scripts with long lines
I have an application that dynamically loads Javascript files via XMLHttpRequest when needed. Firefox is generating the following error when trying to load one of the files: Error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"
The file it is trying to load has one really long line in it that is part of a library to display gauges. The line is 100920 characters long. If this single line is removed, the script will load properly without generating the error (but, of course, nothing works properly). The error also occurs when loading the script in the HTML "head" section as opposed to loading it dynamically in Javascript. This has been working fine in Firefox up until the latest update I did. I am currently running V12.0. Internet Explorer also works fine with no issues and is what I am having to currently use to access my application since it is now broken with Firefox.
선택된 해결법
The following line in the library was causing the error in Firefox 11+ (specifically "HTMLElement.prototype.outerHTML"):
noNativeOuterHTML:typeof HTMLElement !="undefined"&& typeof HTMLElement.prototype.outerHTML=="undefined",
This was replaced with: typeof HTMLElement.outerHTML=="undefined" and now the library works properly with Firefox 11+.
문맥에 따라 이 답변을 읽어주세요 👍 2모든 댓글 (3)
There are a lot of packed JavaScripts around that do not have any line breaks in it, so I can't imagine that such a change would have passed unnoticed.
Start Firefox in Diagnose Firefox issues using Troubleshoot Mode to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
- Don't make any changes on the Safe mode start window.
- https://support.mozilla.org/kb/Safe+Mode
Safe mode did not resolve the issue. I still get the error message. The library I am using is all packed on a single line. Unfortunately, I honed in on that as being the obvious issue since removing it make the error go away. Apparently there is actually an issue in the library itself that is causing this error, but the error message Firefox is presenting is pretty cryptic and doesn't help much in determining where the problem is. For now, I have gone back to Firefox V10 and everything is working again. It is very frustrating to have something that has worked fine for many years through versions of Firefox since V3 and IE since V7 and have it suddenly stop working with a browser update. I'll have to get with the vendor and see if it can be determined what is causing Firefox V11 and up to be having an issue with the code.
선택된 해결법
The following line in the library was causing the error in Firefox 11+ (specifically "HTMLElement.prototype.outerHTML"):
noNativeOuterHTML:typeof HTMLElement !="undefined"&& typeof HTMLElement.prototype.outerHTML=="undefined",
This was replaced with: typeof HTMLElement.outerHTML=="undefined" and now the library works properly with Firefox 11+.