Bug 25745 - JSC exposes unused offsets and sourceId on every exception
Summary: JSC exposes unused offsets and sourceId on every exception
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 25767
  Show dependency treegraph
 
Reported: 2009-05-12 23:29 PDT by Eric Seidel (no email)
Modified: 2017-07-18 08:30 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-05-12 23:29:12 PDT
JSC exposes unused offsets and sourceId on every exception


Currently JSC exposes the following "non-standard" properties on every exception:

sourceId
expressionBeginOffset
expressionCaretOffset
expressionEndOffset

Talking to oliver, they were original intended for the Inspector, but they aren't used there.  These could be really useful, but they aren't quite.

sourceId is only useful for the inspector, since random web pages have no way to get the actual script source from a sourceId handle.

expression*Offset would be *really* useful to web pages (for printing where in the line the actual erroring expression is) except that they're relative to the start of the sourceId source, instead of the start of the sourceURL resource.

This bug is asking for 2 things:
1.  remove these unused properties from exception (since we shouldn't really be exposing them).
2.  Add some *offset properties which are either relative to the line or relative to the source document (both of which a web page could use to figure out where exactly the error is ocurring).
Comment 1 Geoffrey Garen 2009-05-13 16:31:15 PDT
Let's pretend that this bug is about only one thing, since bugs work better that way.

Let's further pretend that this bug is about thing #1, since that matches the bug's title.

This data is useful to the web inspector and DashCode. Let's not remove it. Can we close this bug as invalid?
Comment 2 Eric Seidel (no email) 2009-05-13 16:38:09 PDT
It must be used by dashcode, because there is no hits of

grep -r expressionBeginOffset *

in the entire WebKit source base (besides where they are set and LayoutTests/fast/js/exception-expression-offset.html)

Oliver also got "excited" when I talked about using these values from Google Web Toolkit.  So it seemed appropriate that we remove them instead of expose them if people aren't supposed to use them.

You're welcome to close this as invalid.

Per Geoff's request, I filed https://bugs.webkit.org/show_bug.cgi?id=25767.

Comment 3 Oliver Hunt 2009-05-13 16:49:47 PDT
They were originally exposed for the inspector, the inspector does not make use of these data and so they should just be dropped from the exception info lest we get stuck needing to support them for all time.

I believe sourceId may be used?

Ideally we would not have such an inane mechanism for propagating such information
Comment 4 Eric Seidel (no email) 2009-05-13 16:52:38 PDT
Really the only thing I'm looking for in bug 25767 is that it would be nice to know what the offset of the code causing the exception is. :)  w/o stack traces, and when Google products generally remove line breaks from their JS, source + line number pairs aren't actually very useful.  Your "line number" is always the same. :(  An offset would help here.  Full stack trace support would help more, but that's a different bug.
Comment 5 Geoffrey Garen 2009-05-13 17:09:25 PDT
(In reply to comment #3)
> They were originally exposed for the inspector, the inspector does not make use
> of these data and so they should just be dropped from the exception info lest
> we get stuck needing to support them for all time.

Is it a big problem if content authors start using these values in their own error tracking? What would we be stuck with, exactly?

Also, wouldn't it be an improvement if the inspector did make use of these values?

> I believe sourceId may be used?

Yes, sourceId is used.

Maybe we should remove the non-sourceId properties until we have more clarity about what we want them to do. (See bug 25767.)

> Ideally we would not have such an inane mechanism for propagating such
> information

Is there a better way that we should consider?