Closed Bug 570561 Opened 14 years ago Closed 14 years ago

dehydra: use JS_NewGlobalObject

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ehren.m, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Need to switch JS_NewObject to JS_NewGlobalObject due to API change in bug 570040. Waiting on review until other SM issues have been straightened out.
Attached patch patchSplinter Review
added JS_HAS_NEW_GLOBAL_OBJECT check (for old SpiderMonkey).
Attachment #449690 - Attachment is obsolete: true
Attachment #449762 - Flags: review?(tglek)
Comment on attachment 449762 [details] [diff] [review]
patch

>diff --git a/dehydra.c b/dehydra.c
>--- a/dehydra.c
>+++ b/dehydra.c
>+static JSClass global_class = {
>+  "DehydraGlobal", /* name */
>+  JSCLASS_GLOBAL_FLAGS, /* flags */
>+  JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
>+  JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
>+  JSCLASS_NO_OPTIONAL_MEMBERS
>+};
>+

No need for a new stub class. Use js_ObjectClass
Attachment #449762 - Flags: review?(tglek) → review+
isn't js_ObjectClass declared in jsobj.h? I can't include that because dehydra.c is compiled by cc.
(In reply to comment #3)
> isn't js_ObjectClass declared in jsobj.h? I can't include that because
> dehydra.c is compiled by cc.

copy the extern declaration from the header? I see no need to declare another stub.
kinda weird... nm reports js_ObjectClass is defined in both libjs_static.a and libmozjs.so but compiling this:

// blah.cpp
#include <jsapi.h>
#include <jsobj.h> // alternately, comment out and declare |extern JSClass js_ObjectClass;|

int main() {
  printf("%x\n", &js_ObjectClass);
}

g++ -I/home/ehren/SpiderMonkey/include/js/ -I/home/ehren/SpiderMonkey/lib blah.cpp

blah.cpp:(.text+0x5): undefined reference to `js_ObjectClass'
If this is causing this much trouble, just use your original patch.
It's not exported, so you can't use it.
http://hg.mozilla.org/rewriting-and-analysis/dehydra/rev/d55889f23932
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: