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

RESOLVED FIXED

Status

()

RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

11 years ago
Created attachment 304306 [details] [diff] [review]
Fix it

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+
(Assignee)

Comment 2

11 years ago
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.
(Assignee)

Comment 3

11 years ago
Fixed.  Please file followups on the other things that need changing as needed (per comment 2).
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
(Assignee)

Updated

11 years ago
Duplicate of this bug: 389370

Comment 5

11 years ago
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.