Does anyone have any idea how to resolve this error?
The google devt tools does not pinpoint the location of the erroneous code which makes it hard to troubleshoot.
Im currently on Meteor and MongoDB.
Ive searched for Unexpected tokens, theres A, N, C but M is not common.
What Ive read is it might be a server commenting problem as it adds random letters and non-recognizable scripts.
Any suggestions?
ng-inspector maintainer here (I don't have enough rep to add a comment)
I'm sorry that the extension caused issues for you. For what it's worth, we've since updated it (v0.5.8) to handle exceptions from the postMessage data.
I've got the exact same problem, and it's happening at line 1472 in ng-inspector.js at JSON.parse(eventData);
The reason is presumably that event.data is holding some kind of setImmediate string (which begins with the letter 'M') - "Meteor._setImmediate.0.5014774943701923.5"
Here are the five lines in ng-inspector.js leading up to the JSON.parse():
window.addEventListener('message', function (event) {
// Ensure the message was sent by this origin
if (event.origin !== window.location.origin) return;
var eventData = event.data;
if (!eventData || typeof eventData !== 'string') return;
eventData = JSON.parse(eventData);
the debugger shows this stuff in the event object:
event = MessageEvent {data: "Meteor._setImmediate.0.5014774943701923.5", origin: "http://localhost:3000", lastEventId: "", source: Window, ports:
ng-inspector.js is an angular extension for Chrome so I guess all we have to do is uninstall it now that we are using Meteor!
Yes, I can confirm that I have uninstalled the Angular inspector from the Chrome extensions and that the problem is solved.
Related
Here is my code :
const videoElem = document.getElementById("videoScan");
var stream = document.getElementById("videoScan").srcObject;
var tracks = stream.getTracks();
tracks.forEach(function (track) {
track.stop();
});
videoElem.srcObject = null;
I am trying to stop all camera streams in order to make ZXing work. However, I have the following error (only on android tablet) :
Problem is, I can't solve it, but everything is working well. And when I do a try/catch, code stops working. I can't figure out why this error is displaying.
When you say "everything is working well", you mean that you get what you want as output?
If the code throwing the error is the same you are showing us, then it means that streams contains null.
Since streams is a const value (thus once only) assigned on the previous instructions, it means that document.getElementById("videoScan").srcObject is null too.
I'd suggest you to do some other debug by, i.e., printing out to JS console (if you have access to it from your Android debug environment, I'm sure there's a way) what's inside stream, before trying to access its getTracks method reference.
Please do also check the compatibility with srcObject with your Android (browser?) environment: MDN has a compatibility list you can inspect.
The simplest way to catch this null reference error, is to check if tracks actually exists.
const videoElem = document.getElementById("videoScan");
const stream = videoElem.srcObject;
if (stream && stream?.getTracks()) {
const tracks = stream.getTracks();
tracks.forEach(function (track) {
track.stop();
});
} else {
console.warn('Stream object is not available');
}
videoElem.srcObject = null;
So I found the solution. The error stopped the code from continuing, which, in my case, actually made it work. I made a very basic mistake : not paying enough attention to the debug results. However, if anyone has the error "Uncaught (in promise) DOMException: Could not start video source" with ZXing on Android, you simply have to cut all video streams to allow chrome starting an other camera. It will not work otherwise.
I remember getting this error a lot a while before. Today I wanted to show it to a friend unfamiliar with Javascript. Chrome and Safari instead gave me something like:
> const o = {};
< undefined
> o.doge()
< TypeError: o.doge is not a function (In 'o.doge()',' 'o.doge' is undefined)
Chrome and Firefox seem to be user-friendly as well.
How can I get an original error, without this helpful message?
You will never get that error in a modern browser; the error comes from js engine itself not the browser; and if there are no others other than that Type Error, modern engines will return a more developer friendly error by applying a (similar) /(w+)/ regex on what ever typed before () and placing it in the error message check out:
v8 (chrome) message templates that will make the error string (line 51, 52):
T(CalledNonCallable, "% is not a function")
and SpiderMoneky (mozilla) message templates (at line 51, 54):
MSG_DEF(JSMSG_NOT_FUNCTION, 1, JSEXN_TYPEERR, "{0} is not a function")
non-callable test case in v8 and a SpiderMokney test case .
So the only way to a undefined is not a function error message in a modern browser is doing undefined() :)
undefined()
you can just try to find and download an older version of the browser which logged the original error. (if that version is still publicly available).
This particular chunk of code is receiving an error of a missing semi-colon. What is odd is that the code itself is a direct duplicate of code that is saving without the error in another file.
This is the only message I am receiving from the compiler (Hubspot). The error is supposedly happening on the first line. I am limited in my Javascript knowledge and thus am unable to verify with certainty that the error message I am receiving is correct. Could it be an incorrect error? If it is not, could someone help me with correcting what is causing the error?
Thanks in advance.
var isIE = /*#cc_on!#*/false || !!document.documentMode; // At least IE6
if (isIE) {
$("#svg >g, #logos, #logos > g, g.text, .services-svg, .services-svg > g, #a-experience-svg-figure,#experience-a-svg-group a.paragraph.link")
.each(function() {
$(this).attr('transform', $(this).css('transform'));
});
}
In your code fragment are not problem with semicolon.
I've tried back and forth between different examples in FF, and all i get is The operation failed for reasons unrelated to the database itself and not covered by any other error code. I believe its caused by var request = indexedDB.open("mydb",2);
var db;
var indexedDB = window.indexedDB || window.webkitIndexedDB
||window.mozIndexedDB||window.msIndexedDB;
var request = indexedDB.open("mydb",2);
customerData=[
{ssn:"444-44-4444",name:"Bill",age:35,email:"bill#company.com"},
{ssn:"555-55-5555",name:"Donna",age:32,email:"donna#home.org"}
];
request.onerror = function(event){
};
request.onupgradeneeded = function(event) {
var objectStore = db.createObjectStore("customers",{keyPath:"ssn"});
objectStore.createIndex("name","name",{unique:false});
objectStore.createIndex("email","email",{unique:true});
for(var i in customerData){
objectStore.add(customerData[i]);
}
} ;
request.onsuccess = function(e) {
} ;
Thanks
How do you open this html/js script?
If I recall correctly FF can not open indexedDB from file.html
It's a bug or a feature depending of a view point.
Try using xampit or other "server". Or just do quick test with Chrome.
I had the same problem when I tried to open a file "locally".
I found on MDC a post saying that by security reasons any operation with indexedDb will be only available by a request via a webserver.
So it seems the problem doesn't have nothing related to file name (namelly file.html) but with protocol.
There's an open bug on BugZilla about this curious error message:
https://bugzilla.mozilla.org/show_bug.cgi?id=1628125
It's possible it arises due to hard disk corruption, but is not clear.
We'd like Mozilla to improve their diagnostics, and not go in the direction of a "Sorry, something went wrong" generic error message that product management think is more user-friendly - it isn't, and is no more helpful than a WSOD.
I am using phonegap cordova-1.5.0.js and jar.
and using the phonegap-plugins for cordova with jsOAtuh.1.3.3.js
I am getting error message:
"Uncaught module xhr not found at file:///android_asset/www/cordova-1.5.0.js"
whenever I am trying to create OAuth Object.
I have the following reference:
https://github.com/bytespider/jsoauth
Here is my code.
var config_google={
var config_google={
consumerKey: "{removed}",
consumerSecret: "{removed}",
requestTokenUrl: "https://www.google.com/accounts/OAuthGetRequestToken?scope={removed}",
authorizationUrl:"https://www.google.com/accounts/OAuthAuthorizeToken",
accessTokenUrl:"https://www.google.com/accounts/OAuthGetAccessToken"
};
function authservice(service){
//alert(service);
curfunc = "authservice";
str_service = service;
if (service === 'google'){
oauth = new OAuth(config_google);
}else if....
........
}
I used that code with phonegap-1.4.1.js(previous version) before and it works. and I searched xhr on both 1.4.1 and 1.5.0 they both don't have xhr in it but some commented references. Not exactly sure why changed the 1.5.0 and it will disable the code. and I need to use 1.5.0 is because I need to use the childbrowser plugins.
Would you able to point me to the right direction?
Thanks in advance.
I have a hack that got it to work. The require("xhr") at line 802 thinks someone, somewhere registered it, but in logging it, I don't see anyone ever calling Cordova's "define" function to register it.
So, if you comment out those 3 lines of code, it's a quick way to get it to fall back to XMLHttpRequest like so (around line 800 within Request constructor):
if (typeof global.Titanium !== 'undefined' && typeof global.Titanium.Network.createHTTPClient != 'undefined') {
XHR = global.Titanium.Network.createHTTPClient();
//} else if (typeof require !== 'undefined') {
// // CommonJS require
// XHR = new require("xhr").XMLHttpRequest();
} else {
// W3C
XHR = new global.XMLHttpRequest();
}