Closed Bug 417710 Opened 16 years ago Closed 16 years ago

Use JS_GET_CLASS, not JS_GetClass

Categories

(Core :: General, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta4

People

(Reporter: jorendorff, Assigned: gyuyoung.kim)

References

()

Details

Attachments

(1 file)

Spun off from bug 412985 comment 9 thru 13.

http://mxr.mozilla.org/seamonkey/search?string=JS_GetClass&find=&findi=&filter=\bJS_GetClass\b&tree=seamonkey

We should be calling JS_GET_CLASS, which works regardless of whether JS_THREADSAFE is defined.
Attached patch v1Splinter Review
Here is a patch.  But, this patch was just changed JS_GetClass into JS_GET_CLASS.

 1. dom/src/base/nsDOMClassInfo.h
 2. dom/src/base/nsJSEnvironment.cpp
 3. caps/src/nsSecurityManagerFactory.cpp
 4. content/xbl/src/nsXBLBinding.cpp
 5. xpinstall/src/nsXPITriggerInfo.cpp
 6. embedding/components/windowwatcher/src/nsWWJSUtils.cpp
 7. js/src/liveconnect/jsj_JavaClass.c

I tested above files on Firefox 3 beta 2 and it worked.

nsInstall.cpp and nsJSInstall.cpp are not included in the patch since they are removed from the current Mozilla trunk.

And, nsScriptSecurityManager.cpp file used the JS_GetClass, but the latest firefox uses STOBJ_GET_CLASS instead of JS_GetClass. I am not sure if STOBJ_GET_CLASS also needs to be changed into JS_GET_CLASS or not. (please refer to "Bug 413767 – Make doGetObjectPrincipal() faster yet" for further info.) 

Thus, I didn’t modify a nsScriptSecurityManager.cpp in this patch.
When JS_THREADSAFE is turned off in configure file, I need to modify an additional file except for above patch.(Firefox-3 beta 2 on Linux)

  - dom/src/base/nsDOMClassInfo.cpp

The error message is as below.
================================================================================
../../../dist/include/js/jsprvtd.h:119: error: forward declaration of ‘struct JSScopeProperty’
nsDOMClassInfo.cpp:4637: error: invalid use of undefined type ‘struct JSScopeProperty’
../../../dist/include/js/jsprvtd.h:119: error: forward declaration of ‘struct JSScopeProperty’
nsDOMClassInfo.cpp:4638: error: invalid use of undefined type ‘struct JSScopeProperty’
../../../dist/include/js/jsprvtd.h:119: error: forward declaration of ‘struct JSScopeProperty’
nsDOMClassInfo.cpp: In member function ‘virtual nsresult nsWindowSH::NewResolve(nsIXPConnectWrappedNative*, JSContext*, JSObject*, jsval, PRUint32, JSObject**, PRBool*)’:
nsDOMClassInfo.cpp:5903: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object
==================================================================================
Brendan suggested that I make a nsDOMClassInfo.i file, but I don't know how make it.

For making this patch, I added temporary source code to nsDOMClassInfo.cpp file.
================================================================
 // JavaScript includes
 #include "jsapi.h"
 #include "jsnum.h"
 #include "jsdbgapi.h"
 #include "jscntxt.h"
+#ifndef JS_THREADSAFE
+#include "jsscope.h"
+#endif
===============================================================

Jason,  Could you tell me how I make nsDOMClassInfo.i file?
Sure:

  cd $OBJDIR/dom/src/base
  make nsDOMClassInfo.i
Attachment #304292 - Flags: superreview?(brendan)
Attachment #304292 - Flags: review?(jorendorff)
Attachment #304292 - Flags: approval1.9?
Comment on attachment 304292 [details] [diff] [review]
v1

I'll vouch for the technical correctness of this patch, but I don't know if my review counts for anything in these parts of the tree.
Attachment #304292 - Flags: review?(jorendorff) → review+
Comment on attachment 304292 [details] [diff] [review]
v1

Please re-request approval once reviews have been completed.
Attachment #304292 - Flags: approval1.9?
Comment on attachment 304292 [details] [diff] [review]
v1

This is fine and safe -- would like a DOM owner to r+ too just to keep up appearances ;-).

/be
Attachment #304292 - Flags: superreview?(brendan)
Attachment #304292 - Flags: superreview+
Attachment #304292 - Flags: review+
Attachment #304292 - Flags: approval1.9+
Attachment #304292 - Flags: review+ → review?(jst)
I attached a patch related to compilation error of nsDOMClassInfo.cpp file to Bug 412985 comment 26.
Assignee: nobody → gyuyoung.kim
Status: NEW → ASSIGNED
Comment on attachment 304292 [details] [diff] [review]
v1

All good, r=jst too.
Attachment #304292 - Flags: review?(jst) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta4
Bugs are not resolved until the patch(es) in the bug have been committed. So, for the next patch you author, please leave the bug open until the patch has been committed. :)

Checking in caps/src/nsSecurityManagerFactory.cpp;
/cvsroot/mozilla/caps/src/nsSecurityManagerFactory.cpp,v  <--  nsSecurityManagerFactory.cpp
new revision: 1.47; previous revision: 1.46
done
Checking in content/xbl/src/nsXBLBinding.cpp;
/cvsroot/mozilla/content/xbl/src/nsXBLBinding.cpp,v  <--  nsXBLBinding.cpp
new revision: 1.254; previous revision: 1.253
done
Checking in dom/src/base/nsDOMClassInfo.h;
/cvsroot/mozilla/dom/src/base/nsDOMClassInfo.h,v  <--  nsDOMClassInfo.h
new revision: 1.131; previous revision: 1.130
done
Checking in dom/src/base/nsJSEnvironment.cpp;
/cvsroot/mozilla/dom/src/base/nsJSEnvironment.cpp,v  <--  nsJSEnvironment.cpp
new revision: 1.392; previous revision: 1.391
done
Checking in embedding/components/windowwatcher/src/nsWWJSUtils.cpp;
/cvsroot/mozilla/embedding/components/windowwatcher/src/nsWWJSUtils.cpp,v  <--  nsWWJSUtils.cpp
new revision: 1.13; previous revision: 1.12
done
Checking in js/src/liveconnect/jsj_JavaClass.c;
/cvsroot/mozilla/js/src/liveconnect/jsj_JavaClass.c,v  <--  jsj_JavaClass.c
new revision: 1.27; previous revision: 1.26
done
Checking in xpinstall/src/nsXPITriggerInfo.cpp;
/cvsroot/mozilla/xpinstall/src/nsXPITriggerInfo.cpp,v  <--  nsXPITriggerInfo.cpp
new revision: 1.41; previous revision: 1.40
done
Keywords: checkin-needed
Oh, I'm sorry. I will do so next time I author
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: