Closed Bug 913670 Opened 6 years ago Closed 6 years ago

Cu.evalInSandbox should use 1-based line numbering

Categories

(Core :: XPConnect, defect)

25 Branch
x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: fitzgen, Assigned: bzbarsky)

Details

Attachments

(1 file)

If you have

  <script src="foo.js"></script>

and foo.js is

  console.log(Error().lineNumber);

you get 1 in the console.

The Debugger API checks that line numbers are 1 or greater: http://mxr.mozilla.org/mozilla-central/source/js/src/vm/Debugger.cpp#2366

However, Cu.evalInSandbox will make the first line number 0 if you pass in a url parameter but not a line number parameter. This is in conflict with the other behaviors and should be fixed.
This would just need fixing in the evalInSandbox code, right?  Request an optional_argc in the IDL and default the lineNo to 1 if not passed...
Assignee: general → nobody
Component: JavaScript Engine → XPConnect
Attached patch Does this help?Splinter Review
Attachment #800996 - Flags: feedback?
Attachment #800996 - Flags: feedback? → feedback?(nfitzgerald)
Comment on attachment 800996 [details] [diff] [review]
Does this help?

Review of attachment 800996 [details] [diff] [review]:
-----------------------------------------------------------------

Tested it out and it LGTM.
Attachment #800996 - Flags: feedback?(nfitzgerald) → feedback+
Attachment #800996 - Flags: review+
Assignee: nobody → bzbarsky
https://hg.mozilla.org/integration/mozilla-inbound/rev/9ff0b038942a
Flags: in-testsuite?
Target Milestone: --- → mozilla26
https://hg.mozilla.org/mozilla-central/rev/9ff0b038942a
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.