dehydra: use JS_NewGlobalObject

RESOLVED FIXED

Status

()

Core
Rewriting and Analysis
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Ehren Metcalfe, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

2.39 KB, patch
(dormant account)
: review+
Details | Diff | Splinter Review
(Reporter)

Description

8 years ago
Created attachment 449690 [details] [diff] [review]
patch

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.
(Reporter)

Comment 1

8 years ago
Created attachment 449762 [details] [diff] [review]
patch

added JS_HAS_NEW_GLOBAL_OBJECT check (for old SpiderMonkey).
Attachment #449690 - Attachment is obsolete: true
Attachment #449762 - Flags: review?(tglek)

Comment 2

8 years ago
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+
(Reporter)

Comment 3

8 years ago
isn't js_ObjectClass declared in jsobj.h? I can't include that because dehydra.c is compiled by cc.

Comment 4

8 years ago
(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.
(Reporter)

Comment 5

8 years ago
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'

Comment 6

8 years ago
If this is causing this much trouble, just use your original patch.

Comment 7

8 years ago
It's not exported, so you can't use it.
(Reporter)

Comment 8

8 years ago
http://hg.mozilla.org/rewriting-and-analysis/dehydra/rev/d55889f23932
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.