Closed Bug 418491 Opened 14 years ago Closed 14 years ago

[FIX]JS component loader's line numbers are off by 1

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Attached patch Fix itSplinter Review
We should be passing 1, not 0, as the line number to JS_CompileScriptForPrincipals.
Attachment #304306 - Flags: superreview?(brendan)
Attachment #304306 - Flags: review?(brendan)
Comment on attachment 304306 [details] [diff] [review]
Fix it

Any more 0 linenos lurking?

/be
Attachment #304306 - Flags: superreview?(brendan)
Attachment #304306 - Flags: superreview+
Attachment #304306 - Flags: review?(brendan)
Attachment #304306 - Flags: review+
Attachment #304306 - Flags: approval1.9+
The following JSAPI consumers pass 0 for lineno:

* JS_CompileScriptForPrincipals
  - JSSh (compiling a memory buffer with no useful filename)
* JS_CompileUCFunctionForPrincipals
  - Event handler compilation when the event target has no associated document
    or that document has no URI.
  - <script event="..." for="..."> when the <script> didn't come from the
    parser.
* JS_EvaluteScript
  - The extensions/pref/autoconfig extension
* JS_EvaluteScriptForPrincipals
  - nsCryptoRunnable::Run (null filename here too)
* JS_EvaluteUCScriptForPrincipals
  - Liveconnect (in both places it calls this function)
  - xpc_EvalInSandbox if called when there is no nsIStackFrame on the current
    XPConnect JS stack
  - The NPAPI _evaluate callback

Your call on which of these are bogus.  I'd tend to think that the NPAPI, sandbox, liveconnect, crypto, and autoconfig callers are and that we don't care about the rest.

We also have a number of callers (e.g. event handlers) who just pass 1 for lack of anything better.
Fixed.  Please file followups on the other things that need changing as needed (per comment 2).
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Duplicate of this bug: 389370
Zero offset is gone in 1.9b4 rc. Thanks.
You need to log in before you can comment on or make changes to this bug.