Closed Bug 501913 Opened 16 years ago Closed 4 years ago

Error console doesn't report errors of undefined variables on javascript

Categories

(Core :: DOM: Core & HTML, defect, P5)

1.9.1 Branch
x86
Windows XP
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sirio3mil, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729) FirePHP/0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729) FirePHP/0.3 On firefox 3.5 for example if you have that code: <script> ... document.form.input_name.value = data_array[index]; ... </script> The execution is stoped on that line becouse data_array[index] is undefined but don´t report the error, in firefox 3.0.11 the console error message is "variable data_array[index] is undefined" it´s occour with varibles from forms and in ajax with response xml node thats are null Reproducible: Always Steps to Reproduce: 1.Declare an array 2.Call that array with and out of index value 3. Actual Results: The scripts stop but don´t report an error Expected Results: the scripts stop and report an error and line
Can you upload a testcase?
I´ll try because it´s an internal application
i hope it help you: <script> .... if(typeof document.formulario.carpeta_id != "undefined" && !isEmpty(document.formulario.carpeta_id.value)){ fecha_inicio_carpeta = req.responseXML.getElementsByTagName('horario_citacion_inicio').item(0).firstChild.data; fecha_fin_carpeta = req.responseXML.getElementsByTagName('horario_citacion_fin').item(0).firstChild.data; warning = document.getElementById('advertencia_inicio'); warning.innerHTML = "<p style='color:red;font-weight:bold;'>El horario de inicio debe ser mayor o igual que "+pinta_fecha_de_xml(fecha_inicio_carpeta)+"</p>"; warning = document.getElementById('advertencia_fin'); warning.innerHTML = "<p style='color:red;font-weight:bold;'>El horario de fin debe ser menor o igual que "+pinta_fecha_de_xml(fecha_fin_carpeta)+"</p>"; cliente_carpeta = req.responseXML.getElementsByTagName('cliente').item(0).firstChild.data; if(!isEmpty(req.responseXML.getElementsByTagName('operador').item(0).firstChild.data)) document.formulario.operador_nombre.value = operadores[req.responseXML.getElementsByTagName('operador').item(0).firstChild.data]['nombre']; if(cliente_carpeta != OCASIONAL && cliente_carpeta != ""){ document.getElementById('cellcliente').style.display='none'; document.getElementById('celldepartamento_cliente').style.display='none'; warning = document.getElementById('cliente_no_ocasional'); nombre_cliente = document.formulario.cliente.options[document.formulario.cliente.selectedIndex].text; warning.innerHTML = '<input class="formtext" type="text" class="blue" maxlength="25" size="25" value="'+nombre_cliente+'" name="2345985" readonly /><div class="formtextend"></div>&nbsp;&nbsp;'; warning = document.getElementById('departamento_no_ocasional'); nombre_departamento = document.formulario.departamento_cliente.options[document.formulario.departamento_cliente.selectedIndex].text; nombre_departamento = (nombre_departamento == 'Departamento' || isEmpty(nombre_departamento))?'ninguno':nombre_departamento; warning.innerHTML = '<input class="formtext" type="text" class="blue" maxlength="25" size="50" value="'+nombre_departamento+'" name="256985" readonly /><div class="formtextend"></div>&nbsp;'; } } .... </script> var req is and ajax and error occour on : operadores[req.responseXML.getElementsByTagName('operador').item(0).firstChild.data]['nombre'] becouse the value of req.responseXML.getElementsByTagName('operador').item(0).firstChild.data is "null" not null, and operadores["null"] is not defined
I also observe this problem when testing FF extensions under 3.5 on Windows 2000. The problem does not occur on 3.0.0.11. In my case it only seems to happen within an XBL binding. Setting dom.report_all_js_exceptions has no affect. If a try/catch block surrounds the statement, then the exception text is '... is not defined'.
Not sure whether this is Core > DOM or JavaScript, or Toolkit > Error Console.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.9.1 Branch
I am seeing this exact same problem. I cannot duplicate it outside of an XHR response function. Here is an incredibly simplistic sample that shows the bug: http://www.golflocker.com/noerrormessage.html The XHR is handled with my personal library. It's used here just to greatly simplify the code. It just downloads itself. The MyIntComResponse function (line 12) is called when the XHR responds. On line 13, I have a simple if statement that accesses a non-existant variable, something_that_doesnt_exist. This should cause an error to appear in the console, but it does not. However, javascript does stop execution at this point. This makes debugging difficult! The error shows up in the console in FF3.0.13 (something_that_doesnt_exist is not defined), but not in FF3.5.2. Both are running on different computers in Windows XP x64 SP2, if that is important.
This bug should be renamed to something like: "Error console doesn't report errors that happen in an XHR callback". This is a VERY ANNOYING bug, imho. Especially because in my current project, almost everything is done after some XHR is loaded.
Summary: Error console don´t report errors of undefined variables on javascript → Error console doesn't report errors of undefined variables on javascript
Dup of bug 503244?
I observed similar behavior in strict mode under Firefox 26.0a1 on Windows 7. The following snippet breaks in Chrome generating an adequate error in the console but works "normally" in Firefox: http://pastebin.com/nZ8Myhdu Should I open another bug for this?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML

Marking this as Resolved > Worksforme since the issue is no longer reproducible on the latest versions of Firefox Nightly 96.0a1 (2021-11-01), beta 94.0 or release 93.0 on Windows 10. The xhr errors are reported.
If anyone is still able to reproduce the issue please re-open it or file a new one.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: