Closed
Bug 927500
Opened 12 years ago
Closed 12 years ago
No error message pointing to syntax error in JS file
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
People
(Reporter: gkw, Unassigned)
Details
(Whiteboard: [systemsfe])
Sample code from https://developer.mozilla.org/en-US/docs/Web/API/ContactManager.find#Specifications :
var filter = {
filterBy: ['name', 'nickname', 'firstName'],
filterValue: 'zorro',
filterOp: equals,
filterLimit: 100
}
var request = window.navigator.mozContacts.find(filter);
request.onsuccess = function () {
console.log(this.result.length + ' contacts found.');
}
request.onerror = function () {
console.log('Something goes wrong!');
}
===
A contestant in a Firefox OS app development contest tries to use this sample code, but this fails to work (there is no obvious error message around, nor when using the App Manager, nor on the phone, nor in the Developer Tools!).
It is eventually realized that the line 'filterOp: equals,' should be 'filterOp: "equals",' (missing quotes around the word equals), however by then many hours have been wasted trying to debug this.
It would be nice to have an error message pointing to the lack of quotes around the word "equals".
(also, I'll edit the MDN article)
| Reporter | ||
Comment 1•12 years ago
|
||
The other issue, apparently, was that the following line was missing a semi-colon:
var filter = {
filterBy: ['name', 'nickname', 'firstName'],
filterValue: 'zorro',
filterOp: 'equals', # fixed quotes
filterLimit: 100
}
^^^^ here.
It should be:
var filter = {
filterBy: ['name', 'nickname', 'firstName'],
filterValue: 'zorro',
filterOp: 'equals', # fixed quotes
filterLimit: 100
};
However, Developer Tools never gave any indication of failure for both the quotes issue and the missing semi-colon, at least not on the Console tab in Developer Tools.
Comment 2•12 years ago
|
||
This is likely not a regression, so why would this be a blocker for 1.2? We don't typically block on issues that already exist on releases already shipped unless there's a special reason such as support calls & certification waivers.
| Reporter | ||
Comment 3•12 years ago
|
||
AFAIK 1.1 has shipped, whereas 1.2 branched, but perhaps it's a little different for B2G, so I guess you can feel free to switch the flag to 1.3 if necessary.
Comment 5•12 years ago
|
||
David or Gregor, does this fall under the purview of one or your teams?
Flags: needinfo?(dscravaglieri)
Flags: needinfo?(anygregor)
Whiteboard: [systemsfe]
| Reporter | ||
Comment 7•12 years ago
|
||
(In reply to Gregor Wagner [:gwagner] from comment #6)
> This is an overall JS problem.
Setting needinfo for Jason for more analysis on what needs to be done here.
Flags: needinfo?(dscravaglieri) → needinfo?(jorendorff)
Comment 8•12 years ago
|
||
Thanks for reporting this, Gary. I'm not totally sure what needs to be done.
When Gecko (or any other code) calls into the JSAPI, e.g. to run some JavaScript code, errors are reported like this:
1. the API call returns false or nullptr; and
2. either there's an exception pending on cx, or the errorReporter callback was called.
While these JSAPI error-handling conventions are not super usable, or, you know, well-documented, they've been stable for like a decade now.
So it's not like JS makes it impossible to log errors. In fact if you do this exact thing on desktop Firefox, the SyntaxError shows up in the Web Console. We must be sweeping errors under the rug somewhere. If we don't know where, let's talk about how to instrument the engine to figure that out. This is solvable.
I hate errors passing silently. Let's fix it.
Flags: needinfo?(jorendorff) → needinfo?(anygregor)
Updated•12 years ago
|
blocking-b2g: 1.3? → -
Comment 9•12 years ago
|
||
(The missing semicolon of course is not an error because JS will happily insert the missing semicolon for you.)
| Reporter | ||
Comment 10•12 years ago
|
||
(In reply to Jason Orendorff [:jorendorff] from comment #9)
> (The missing semicolon of course is not an error because JS will happily
> insert the missing semicolon for you.)
The feedback from the contestant was that it failed to work properly without the semi-colon. So, the problem might be somewhere else if it is not a JS error, assuming it still reproduces.
Comment 11•12 years ago
|
||
All right. Can we have specific steps to reproduce please? Do I need a phone to reproduce it?
| Reporter | ||
Comment 12•12 years ago
|
||
(In reply to Jason Orendorff [:jorendorff] from comment #11)
> All right. Can we have specific steps to reproduce please? Do I need a phone
> to reproduce it?
Mark, do you remember the steps off the top of your head? (It's been some time since I last poked at B2G app manifests)
I'll take a stab at this in any case.
Jason, app manifest descriptions are found here: https://developer.mozilla.org/en-US/Apps/Build/Manifest
A phone is not strictly necessary, I think you can use App Manager (present in FxOS 1.2 and later) in the Firefox OS simulator here: https://developer.mozilla.org/en-US/docs/Tools/Firefox_OS_Simulator
Transfer a sample app to the Simulator: https://hacks.mozilla.org/2013/01/introducing-the-firefox-os-boilerplate-app/
Make the necessary changes in the manifest as per comment 0, to see if you can reproduce. The only consequence of using the Simulator is that one cannot see adb output, perhaps.
Flags: needinfo?(mgoodwin)
Flags: needinfo?(jorendorff)
Comment 13•12 years ago
|
||
I don't recall exactly.
I shall attempt to reproduce the issue on a device so we've got some STR.
Gary, we were running 1.2 on these devices, weren't we?
Flags: needinfo?(gary)
| Reporter | ||
Comment 14•12 years ago
|
||
> Gary, we were running 1.2 on these devices, weren't we?
Yes, we needed the App Manager which was in 1.2.
Flags: needinfo?(gary)
Comment 15•12 years ago
|
||
Mark says he'll investigate STR; setting needinfo? to hold him to it. ;)
Flags: needinfo?(mgoodwin)
Flags: needinfo?(jorendorff)
Comment 17•12 years ago
|
||
So I've tried this on every version of Firefox OS I can get my hands on (1.3, 1.4.ish, 2) and I can't reproduce the issue. e.g. in recent devtools I see "ReferenceError: equals is not defined" in the console.
I seem to recall the original problem was that any js file that didn't parse resulted in a failure of the app to start and that we were using early 1.2 builds. I don't have any 1.2 devices to hand. If we're really concerned about this case I can try (or find) a 1.2 build on my peak and see what happens?
Flags: needinfo?(mgoodwin)
| Reporter | ||
Comment 18•12 years ago
|
||
I'd say let's resolve this WFM and file a new bug should one arise.
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: needinfo?(anygregor)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•