Open Bug 967769 Opened 11 years ago Updated 2 years ago

Firefox should tell SpiderMonkey what sort of code each bit of JavaScript is

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

REOPENED

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(1 file)

Firefox should tell SpiderMonkey whether the JavaScript it has asked it to evaluate is an event handler, a script element, and so on. One bug 332176 has landed, Firefox can do so by setting CompileOptions::introductionType to the appropriate string. There's a draft spec for introductionType, below; naturally, SpiderMonkey itself takes care of "eval" and "Function". introductionType *(not yet implemented)* A string indicating how this source code was introduced into the system. This accessor returns one of the following values: - `"eval"`, for code passed to `eval`. - `"Function"`, for code passed to the `Function` constructor. - `"Worker"`, for code loaded by calling the Web worker constructor—the worker's main script. - `"importScripts"`, for code by calling `importScripts` in a web worker. - `"handler"`, for code assigned to DOM elements' event handler IDL attributes. - `"scriptElement"`, for code belonging to `<script>` elements. - `undefined`, if the implementation doesn't know how the code was introduced.
Okay, bug 332176 has landed, so this is ready to implement. (It's one of the last remaining pieces needed for removing JSD...)
Actually, we should land bug 968580, too, before working on this.
Depends on: 968580
Panos, since you've been working on bug 961325, which is in the same neighborhood as this, would you be interested in preparing a patch for this? This one should be really simple --- just passing a const char * in at each site that passes JS source to SpiderMonkey (whether it's run immediately or not) --- and I've been promising it to the Firebug people for months, as it's one of their final blockers. The two prerequisites I mentioned above are quick patches, so hopefully they won't take long to review...
OK, I'll give it a shot.
Assignee: nobody → past
Status: NEW → ASSIGNED
Blocks: 935203
WIP; doesn't compile
Assignee: past → jimb
(In reply to Jim Blandy :jimb from comment #5) > Created attachment 8375222 [details] [diff] [review] > Provide introductionType information at every place in Firefox that > evaluates JavaScript code. > > WIP; doesn't compile Yeah, I am seeing: 4:40.26 c:\src\github.com\mozilla\gecko-dev\dom\src\jsurl\nsJSProtocolHandler.c pp(296) : error C2660: 'nsIXPConnect::EvalInSandboxObject' : function does not t ake 7 arguments Is it easy to fix? Honza
I'll trim this down and re-post.

I'm going to assume this got resolved somehow as the blocking bug is fixed.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

Sadly, that got resolved when the SpiderMonkey side was done; this is still a todo.

In particular, compare https://searchfox.org/mozilla-central/search?q=setIntroductionType&case=true to the list in comment 0: some of that list is covered, but not all.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: