Closed Bug 911043 Opened 11 years ago Closed 11 years ago

Move the "inject JS:: names into js::" block into its own file, to reduce dependencies on jsapi.h.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(2 files)

I don't like having the "import JS:: names into js::" hack in jsapi.h, for two
reasons.

- Numerous files within SM include jsapi.h just for this.

- The js:: version of those names are visible outside of SpiderMonkey.
This patch moves it into js/src/NamespaceHack.h.  Note that I can't do
IsPoisonedId() in the new file because it's a function defined in jsapi.h.
But it doesn't actually need to be in JS::, so I just moved it to js::.

The patch also fixes a bunch of places in Gecko where we had js::Foo instead of
JS::Foo.  And I had to add some "using namespace JS;" declarations in xpconnect.

This change allows numerous |#include "jsapi.h"| statements to be removed, but
I'll do them in the next patch.
Attachment #797698 - Flags: review?(luke)
The majority of these were enabled by the creation of NamespaceHack.h.
Attachment #797727 - Flags: review?(luke)
Comment on attachment 797698 [details] [diff] [review]
(part 1) - Move the "inject JS:: names into js::" block into its own file, to reduce dependencies on jsapi.h.

NamespaceHack.h sounds a bit to self-deprecating for what it is doing; it's a pretty reasonable thing to do.  How about NamespaceImports.h?
Attachment #797698 - Flags: review?(luke) → review+
Attachment #797727 - Flags: review?(luke) → review+
> NamespaceHack.h sounds a bit to self-deprecating for what it is doing; it's
> a pretty reasonable thing to do.  How about NamespaceImports.h?

Sounds good, particularly because I won't have to reorder any of the include statements, which means I won't have a painful rebase for part 2 :)
https://hg.mozilla.org/mozilla-central/rev/3e60625da760
https://hg.mozilla.org/mozilla-central/rev/0dce2a6b6e3d
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Summary: (part 1) - Move the "inject JS:: names into js::" block into its own file, to reduce dependencies on jsapi.h. → Move the "inject JS:: names into js::" block into its own file, to reduce dependencies on jsapi.h.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: