mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 939294 - Change xpidl header generation code to use JS handles. r=bsmedberg
This commit is contained in:
parent
6d5b2b38a2
commit
9a2cf80406
@ -26,7 +26,6 @@ class nsAXPCNativeCallContext;
|
||||
[ptr] native JSClassPtr(JSClass);
|
||||
[ptr] native JSFreeOpPtr(JSFreeOp);
|
||||
[ptr] native JSObjectPtr(JSObject);
|
||||
[ptr] native JSValPtr(JS::Value);
|
||||
[ptr] native JSValConstPtr(const JS::Value);
|
||||
native JSPropertyOp(JSPropertyOp);
|
||||
native JSEqualityOp(JSEqualityOp);
|
||||
@ -409,7 +408,7 @@ interface nsIXPConnect : nsISupports
|
||||
* Wraps the given jsval in a nsIVariant and returns the new variant.
|
||||
*/
|
||||
nsIVariant
|
||||
jSValToVariant(in JSContextPtr cx, in JSValPtr aJSVal);
|
||||
jSValToVariant(in JSContextPtr cx, in jsval aJSVal);
|
||||
|
||||
/**
|
||||
* This only succeeds if the JSObject is a nsIXPConnectWrappedNative.
|
||||
|
@ -134,8 +134,8 @@ include = """
|
||||
#endif
|
||||
"""
|
||||
|
||||
jspubtd_include = """
|
||||
#include "jspubtd.h"
|
||||
jsvalue_include = """
|
||||
#include "js/Value.h"
|
||||
"""
|
||||
|
||||
infallible_includes = """
|
||||
@ -173,7 +173,7 @@ def print_header(idl, fd, filename):
|
||||
fd.write(include % {'basename': idl_basename(inc.filename)})
|
||||
|
||||
if idl.needsJSTypes():
|
||||
fd.write(jspubtd_include)
|
||||
fd.write(jsvalue_include)
|
||||
|
||||
# Include some extra files if any attributes are infallible.
|
||||
for iface in [p for p in idl.productions if p.kind == 'interface']:
|
||||
|
@ -429,10 +429,10 @@ class Native(object):
|
||||
return self.modifier == 'ref'
|
||||
|
||||
def isPtr(self, calltype):
|
||||
return self.modifier == 'ptr' or (self.modifier == 'ref' and self.specialtype == 'jsval' and calltype == 'out')
|
||||
return self.modifier == 'ptr'
|
||||
|
||||
def isRef(self, calltype):
|
||||
return self.modifier == 'ref' and not (self.specialtype == 'jsval' and calltype == 'out')
|
||||
return self.modifier == 'ref'
|
||||
|
||||
def nativeType(self, calltype, const=False, shared=False):
|
||||
if shared:
|
||||
@ -443,6 +443,11 @@ class Native(object):
|
||||
if self.specialtype is not None and calltype == 'in':
|
||||
const = True
|
||||
|
||||
if self.specialtype == 'jsval':
|
||||
if calltype == 'out' or calltype == 'inout':
|
||||
return "JS::MutableHandleValue "
|
||||
return "JS::HandleValue "
|
||||
|
||||
if self.isRef(calltype):
|
||||
m = '& '
|
||||
elif self.isPtr(calltype):
|
||||
|
Loading…
Reference in New Issue
Block a user