зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
96913eceb2
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1321712096000">
|
||||
<emItems>
|
||||
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
|
||||
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
|
||||
|
@ -117,6 +117,13 @@
|
|||
<versionRange minVersion="2.2" maxVersion="2.2">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}">
|
||||
<versionRange minVersion="0.1" maxVersion="7.6.1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="8.0a1" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
|
||||
<versionRange minVersion="2.0" maxVersion="2.0">
|
||||
</versionRange>
|
||||
|
|
|
@ -701,10 +701,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
|||
// Bind it
|
||||
nsScriptObjectHolder boundHandler(context);
|
||||
context->BindCompiledEventHandler(mTarget, listener->GetEventScope(),
|
||||
handler, boundHandler);
|
||||
listener->SetHandler(
|
||||
static_cast<JSObject*>(
|
||||
static_cast<void*>(boundHandler)));
|
||||
handler.getObject(), boundHandler);
|
||||
listener->SetHandler(boundHandler.getObject());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -506,14 +506,14 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||
jsid propid = JS_IdArrayGet(cx, props, i);
|
||||
jsval propname, propval;
|
||||
if (!JS_IdToValue(cx, propid, &propname) ||
|
||||
!JS_GetPropertyById(cx, opts, propid, &propval))
|
||||
{
|
||||
!JS_GetPropertyById(cx, opts, propid, &propval)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSString *propnameString = JS_ValueToString(cx, propname);
|
||||
nsDependentJSString pstr;
|
||||
if (!propnameString || !pstr.init(cx, propnameString)) {
|
||||
JS_DestroyIdArray(cx, props);
|
||||
mCurrentContext = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -528,6 +528,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||
JSString *propvalString = JS_ValueToString(cx, propval);
|
||||
nsDependentJSString vstr;
|
||||
if (!propvalString || !vstr.init(cx, propvalString)) {
|
||||
JS_DestroyIdArray(cx, props);
|
||||
mCurrentContext = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -535,6 +536,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||
contextProps->SetPropertyAsAString(pstr, vstr);
|
||||
}
|
||||
}
|
||||
JS_DestroyIdArray(cx, props);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ DOMSVGLengthList::InternalListLengthWillChange(PRUint32 aNewLength)
|
|||
}
|
||||
|
||||
SVGLengthList&
|
||||
DOMSVGLengthList::InternalList()
|
||||
DOMSVGLengthList::InternalList() const
|
||||
{
|
||||
SVGAnimatedLengthList *alist = Element()->GetAnimatedLengthList(AttrEnum());
|
||||
return IsAnimValList() && alist->mAnimVal ? *alist->mAnimVal : alist->mBaseVal;
|
||||
|
|
|
@ -103,8 +103,7 @@ public:
|
|||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGLengthList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
|
@ -116,7 +115,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ private:
|
|||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGLengthList& InternalList();
|
||||
SVGLengthList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGLength for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
|
|
@ -144,7 +144,7 @@ DOMSVGNumberList::InternalListLengthWillChange(PRUint32 aNewLength)
|
|||
}
|
||||
|
||||
SVGNumberList&
|
||||
DOMSVGNumberList::InternalList()
|
||||
DOMSVGNumberList::InternalList() const
|
||||
{
|
||||
SVGAnimatedNumberList *alist = Element()->GetAnimatedNumberList(AttrEnum());
|
||||
return IsAnimValList() && alist->mAnimVal ? *alist->mAnimVal : alist->mBaseVal;
|
||||
|
|
|
@ -102,8 +102,7 @@ public:
|
|||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGNumberList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
|
@ -115,7 +114,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,7 @@ private:
|
|||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGNumberList& InternalList();
|
||||
SVGNumberList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGNumber for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
|
|
@ -230,18 +230,18 @@ DOMSVGPathSegList::InternalListWillChangeTo(const SVGPathData& aNewValue)
|
|||
bool
|
||||
DOMSVGPathSegList::AttrIsAnimating() const
|
||||
{
|
||||
return const_cast<DOMSVGPathSegList*>(this)->InternalAList().IsAnimating();
|
||||
return InternalAList().IsAnimating();
|
||||
}
|
||||
|
||||
SVGPathData&
|
||||
DOMSVGPathSegList::InternalList()
|
||||
DOMSVGPathSegList::InternalList() const
|
||||
{
|
||||
SVGAnimatedPathSegList *alist = mElement->GetAnimPathSegList();
|
||||
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
|
||||
}
|
||||
|
||||
SVGAnimatedPathSegList&
|
||||
DOMSVGPathSegList::InternalAList()
|
||||
DOMSVGPathSegList::InternalAList() const
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mElement->GetAnimPathSegList(), "Internal error");
|
||||
return *mElement->GetAnimPathSegList();
|
||||
|
|
|
@ -120,8 +120,7 @@ public:
|
|||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGPathSegList*>(this)->InternalList().CountItems(),
|
||||
mItems.Length() == InternalList().CountItems(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
|
@ -184,9 +183,9 @@ private:
|
|||
* get const protection, but our setter methods guard against changing
|
||||
* anim val lists.
|
||||
*/
|
||||
SVGPathData& InternalList();
|
||||
SVGPathData& InternalList() const;
|
||||
|
||||
SVGAnimatedPathSegList& InternalAList();
|
||||
SVGAnimatedPathSegList& InternalAList() const;
|
||||
|
||||
/// Creates an instance of the appropriate DOMSVGPathSeg sub-class for
|
||||
// aIndex, if it doesn't already exist.
|
||||
|
|
|
@ -175,18 +175,18 @@ DOMSVGPointList::InternalListWillChangeTo(const SVGPointList& aNewValue)
|
|||
bool
|
||||
DOMSVGPointList::AttrIsAnimating() const
|
||||
{
|
||||
return const_cast<DOMSVGPointList*>(this)->InternalAList().IsAnimating();
|
||||
return InternalAList().IsAnimating();
|
||||
}
|
||||
|
||||
SVGPointList&
|
||||
DOMSVGPointList::InternalList()
|
||||
DOMSVGPointList::InternalList() const
|
||||
{
|
||||
SVGAnimatedPointList *alist = mElement->GetAnimatedPointList();
|
||||
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
|
||||
}
|
||||
|
||||
SVGAnimatedPointList&
|
||||
DOMSVGPointList::InternalAList()
|
||||
DOMSVGPointList::InternalAList() const
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mElement->GetAnimatedPointList(), "Internal error");
|
||||
return *mElement->GetAnimatedPointList();
|
||||
|
|
|
@ -120,8 +120,7 @@ public:
|
|||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGPointList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
|
@ -184,9 +183,9 @@ private:
|
|||
* get const protection, but our setter methods guard against changing
|
||||
* anim val lists.
|
||||
*/
|
||||
SVGPointList& InternalList();
|
||||
SVGPointList& InternalList() const;
|
||||
|
||||
SVGAnimatedPointList& InternalAList();
|
||||
SVGAnimatedPointList& InternalAList() const;
|
||||
|
||||
/// Creates a DOMSVGPoint for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
|
|
@ -146,7 +146,7 @@ DOMSVGTransformList::InternalListLengthWillChange(PRUint32 aNewLength)
|
|||
}
|
||||
|
||||
SVGTransformList&
|
||||
DOMSVGTransformList::InternalList()
|
||||
DOMSVGTransformList::InternalList() const
|
||||
{
|
||||
SVGAnimatedTransformList *alist = Element()->GetAnimatedTransformList();
|
||||
return IsAnimValList() && alist->mAnimVal ?
|
||||
|
|
|
@ -97,8 +97,7 @@ public:
|
|||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.IsEmpty() ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGTransformList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
|
@ -110,7 +109,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
|
@ -129,7 +128,7 @@ private:
|
|||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGTransformList& InternalList();
|
||||
SVGTransformList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGTransform for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
const nsCString& aClassStr) = 0;
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
void* aClassObject)=0;
|
||||
JSObject* aClassObject) = 0;
|
||||
|
||||
virtual void Trace(TraceCallback aCallback, void *aClosure) const = 0;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
|
|||
|
||||
nsresult
|
||||
nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr,
|
||||
void* aClassObject)
|
||||
JSObject* aClassObject)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(5);
|
||||
NS_PRECONDITION(!IsCompiled(),
|
||||
|
@ -239,13 +239,13 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
|
|||
nsresult rv = aContext->CompileFunction(aClassObject,
|
||||
cname,
|
||||
paramCount,
|
||||
(const char**)args,
|
||||
const_cast<const char**>(args),
|
||||
body,
|
||||
functionUri.get(),
|
||||
uncompiledMethod->mBodyText.GetLineNumber(),
|
||||
JSVERSION_LATEST,
|
||||
true,
|
||||
(void **) &methodObject);
|
||||
&methodObject);
|
||||
|
||||
// Destroy our uncompiled method and delete our arg list.
|
||||
delete uncompiledMethod;
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
const nsCString& aClassStr);
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
void* aClassObject);
|
||||
JSObject* aClassObject);
|
||||
|
||||
virtual void Trace(TraceCallback aCallback, void *aClosure) const;
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
|
|||
|
||||
nsresult
|
||||
nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr,
|
||||
void* aClassObject)
|
||||
JSObject* aClassObject)
|
||||
{
|
||||
NS_PRECONDITION(!mIsCompiled,
|
||||
"Trying to compile an already-compiled property");
|
||||
|
@ -260,7 +260,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
|
|||
mGetterText->GetLineNumber(),
|
||||
JSVERSION_LATEST,
|
||||
true,
|
||||
(void **) &getterObject);
|
||||
&getterObject);
|
||||
|
||||
// Make sure we free mGetterText here before setting mJSGetterObject, since
|
||||
// that'll overwrite mGetterText
|
||||
|
@ -310,7 +310,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
|
|||
mSetterText->GetLineNumber(),
|
||||
JSVERSION_LATEST,
|
||||
true,
|
||||
(void **) &setterObject);
|
||||
&setterObject);
|
||||
|
||||
// Make sure we free mSetterText here before setting mJSGetterObject, since
|
||||
// that'll overwrite mSetterText
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
const nsCString& aClassStr);
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
void* aClassObject);
|
||||
JSObject* aClassObject);
|
||||
|
||||
virtual void Trace(TraceCallback aCallback, void *aClosure) const;
|
||||
|
||||
|
|
|
@ -323,15 +323,14 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget,
|
|||
JSObject* scope = boundGlobal->GetGlobalJSObject();
|
||||
nsScriptObjectHolder boundHandler(boundContext);
|
||||
rv = boundContext->BindCompiledEventHandler(scriptTarget, scope,
|
||||
handler, boundHandler);
|
||||
handler.getObject(), boundHandler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Execute it.
|
||||
nsCOMPtr<nsIDOMEventListener> eventListener;
|
||||
rv = NS_NewJSEventListener(boundContext, scope,
|
||||
scriptTarget, onEventAtom,
|
||||
static_cast<JSObject*>(
|
||||
static_cast<void*>(boundHandler)),
|
||||
boundHandler.getObject(),
|
||||
getter_AddRefs(eventListener));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -349,9 +348,9 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
|
|||
// Check to see if we've already compiled this
|
||||
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(aGlobal);
|
||||
if (pWindow) {
|
||||
void* cachedHandler = pWindow->GetCachedXBLPrototypeHandler(this);
|
||||
JSObject* cachedHandler = pWindow->GetCachedXBLPrototypeHandler(this);
|
||||
if (cachedHandler) {
|
||||
aHandler.set(cachedHandler);
|
||||
aHandler.setObject(cachedHandler);
|
||||
return aHandler ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -727,7 +727,7 @@ nsScriptEventHandlerOwnerTearoff::GetCompiledEventHandler(
|
|||
mElement->FindPrototypeAttribute(kNameSpaceID_None, aName);
|
||||
if (attr) {
|
||||
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumCacheHits);
|
||||
aHandler.set(attr->mEventHandler);
|
||||
aHandler.setObject(attr->mEventHandler);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -815,7 +815,7 @@ nsScriptEventHandlerOwnerTearoff::CompileEventHandler(
|
|||
|
||||
elem->mHoldsScriptObject = true;
|
||||
}
|
||||
attr->mEventHandler = (void *)aHandler;
|
||||
attr->mEventHandler = aHandler.getObject();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -2567,7 +2567,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(nsXULPrototypeNode)
|
|||
if (elem->mHoldsScriptObject) {
|
||||
PRUint32 i;
|
||||
for (i = 0; i < elem->mNumAttributes; ++i) {
|
||||
void *handler = elem->mAttributes[i].mEventHandler;
|
||||
JSObject* handler = elem->mAttributes[i].mEventHandler;
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_CALLBACK(elem->mScriptTypeID,
|
||||
handler,
|
||||
"mAttributes[i].mEventHandler")
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
// mEventHandler is only valid for the language ID specified in the
|
||||
// containing nsXULPrototypeElement. We would ideally use
|
||||
// nsScriptObjectHolder, but want to avoid the extra lang ID.
|
||||
void* mEventHandler;
|
||||
JSObject* mEventHandler;
|
||||
|
||||
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
|
||||
/**
|
||||
|
|
|
@ -86,6 +86,9 @@ public:
|
|||
JSScript* getScript() const {
|
||||
return static_cast<JSScript*>(mObject);
|
||||
}
|
||||
JSObject* getObject() const {
|
||||
return static_cast<JSObject*>(mObject);
|
||||
}
|
||||
|
||||
// Drop the script object - but *not* the nsIScriptContext.
|
||||
nsresult drop() {
|
||||
|
@ -96,6 +99,13 @@ public:
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult setScript(JSScript* aScript) {
|
||||
return set(aScript);
|
||||
}
|
||||
nsresult setObject(JSObject* aObject) {
|
||||
return set(aObject);
|
||||
}
|
||||
nsresult set(void *object) {
|
||||
NS_ASSERTION(getScriptTypeID() != nsIProgrammingLanguage::UNKNOWN,
|
||||
"Must know the language!");
|
||||
|
|
|
@ -1492,7 +1492,7 @@ struct TraceData
|
|||
};
|
||||
|
||||
static PLDHashOperator
|
||||
TraceXBLHandlers(const void* aKey, void* aData, void* aClosure)
|
||||
TraceXBLHandlers(const void* aKey, JSObject* aData, void* aClosure)
|
||||
{
|
||||
TraceData* data = static_cast<TraceData*>(aClosure);
|
||||
data->callback(nsIProgrammingLanguage::JAVASCRIPT, aData,
|
||||
|
@ -2077,13 +2077,12 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
mCreatingInnerWindow = true;
|
||||
// Every script context we are initialized with must create a
|
||||
// new global.
|
||||
void *&newGlobal = (void *&)newInnerWindow->mJSObject;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> &holder = mInnerWindowHolder;
|
||||
rv = mContext->CreateNativeGlobalForInner(sgo, isChrome,
|
||||
aDocument->NodePrincipal(),
|
||||
&newGlobal,
|
||||
&newInnerWindow->mJSObject,
|
||||
getter_AddRefs(holder));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && newGlobal && holder,
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && newInnerWindow->mJSObject && holder,
|
||||
"Failed to get script global and holder");
|
||||
|
||||
mCreatingInnerWindow = false;
|
||||
|
@ -5560,15 +5559,23 @@ nsGlobalWindow::ScrollByPages(PRInt32 numPages)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::ClearTimeout()
|
||||
nsGlobalWindow::ClearTimeout(PRInt32 aHandle)
|
||||
{
|
||||
return ClearTimeoutOrInterval();
|
||||
if (aHandle <= 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ClearTimeoutOrInterval(aHandle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::ClearInterval()
|
||||
nsGlobalWindow::ClearInterval(PRInt32 aHandle)
|
||||
{
|
||||
return ClearTimeoutOrInterval();
|
||||
if (aHandle <= 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ClearTimeoutOrInterval(aHandle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -6930,10 +6937,10 @@ nsGlobalWindow::InitJavaProperties()
|
|||
mDummyJavaPluginOwner = nsnull;
|
||||
}
|
||||
|
||||
void*
|
||||
JSObject*
|
||||
nsGlobalWindow::GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey)
|
||||
{
|
||||
void* handler = nsnull;
|
||||
JSObject* handler = nsnull;
|
||||
if (mCachedXBLPrototypeHandlers.IsInitialized()) {
|
||||
mCachedXBLPrototypeHandlers.Get(aKey, &handler);
|
||||
}
|
||||
|
@ -6970,7 +6977,7 @@ nsGlobalWindow::CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
|||
}
|
||||
}
|
||||
|
||||
mCachedXBLPrototypeHandlers.Put(aKey, aHandler);
|
||||
mCachedXBLPrototypeHandlers.Put(aKey, aHandler.getObject());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -9305,7 +9312,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIScriptTimeoutHandler> handler(timeout->mScriptHandler);
|
||||
void *scriptObject = handler->GetScriptObject();
|
||||
JSObject* scriptObject = static_cast<JSObject*>(handler->GetScriptObject());
|
||||
if (!scriptObject) {
|
||||
// Evaluate the timeout expression.
|
||||
const PRUnichar *script = handler->GetHandlerText();
|
||||
|
@ -9649,58 +9656,6 @@ nsresult nsGlobalWindow::ResetTimersForNonBackgroundWindow()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// A JavaScript specific version.
|
||||
nsresult
|
||||
nsGlobalWindow::ClearTimeoutOrInterval()
|
||||
{
|
||||
FORWARD_TO_INNER(ClearTimeoutOrInterval, (), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
|
||||
rv = ncc->GetJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 argc;
|
||||
|
||||
ncc->GetArgc(&argc);
|
||||
|
||||
if (argc < 1) {
|
||||
// No arguments, return early.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
jsval *argv = nsnull;
|
||||
|
||||
ncc->GetArgvPtr(&argv);
|
||||
|
||||
int32 timer_id;
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
// XXXjst: Can we deal with this w/o using GetCurrentNativeCallContext()
|
||||
if (argv[0] == JSVAL_VOID || !::JS_ValueToInt32(cx, argv[0], &timer_id) ||
|
||||
timer_id <= 0) {
|
||||
// Undefined or non-positive number passed as argument, return
|
||||
// early. Make sure that JS_ValueToInt32 didn't set an exception.
|
||||
|
||||
::JS_ClearPendingException(cx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ClearTimeoutOrInterval(timer_id);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ClearAllTimeouts()
|
||||
{
|
||||
|
|
|
@ -513,7 +513,7 @@ public:
|
|||
|
||||
void InitJavaProperties();
|
||||
|
||||
virtual NS_HIDDEN_(void*)
|
||||
virtual NS_HIDDEN_(JSObject*)
|
||||
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
||||
|
||||
virtual NS_HIDDEN_(void)
|
||||
|
@ -684,7 +684,6 @@ protected:
|
|||
|
||||
// JS specific timeout functions (JS args grabbed from context).
|
||||
nsresult SetTimeoutOrInterval(bool aIsInterval, PRInt32* aReturn);
|
||||
nsresult ClearTimeoutOrInterval();
|
||||
nsresult ResetTimersForNonBackgroundWindow();
|
||||
|
||||
// The timeout implementation functions.
|
||||
|
@ -976,7 +975,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
||||
|
||||
nsDataHashtable<nsVoidPtrHashKey, void*> mCachedXBLPrototypeHandlers;
|
||||
nsDataHashtable<nsVoidPtrHashKey, JSObject*> mCachedXBLPrototypeHandlers;
|
||||
|
||||
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
|||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ 0x164ea909, 0x5cee, 0x4e20, \
|
||||
{ 0x9f, 0xed, 0x43, 0x13, 0xab, 0xac, 0x1c, 0xd3 } }
|
||||
{ 0x39b3ea7c, 0xdc26, 0x4756, \
|
||||
{ 0xa0, 0x3c, 0x13, 0xa0, 0x42, 0x03, 0x07, 0x6a } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
|
@ -221,7 +221,7 @@ public:
|
|||
* @param rval out parameter returning result
|
||||
**/
|
||||
virtual nsresult CallEventHandler(nsISupports* aTarget,
|
||||
JSObject* aScope, void* aHandler,
|
||||
JSObject* aScope, JSObject* aHandler,
|
||||
nsIArray *argv, nsIVariant **rval) = 0;
|
||||
|
||||
/**
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
*/
|
||||
virtual nsresult BindCompiledEventHandler(nsISupports* aTarget,
|
||||
JSObject* aScope,
|
||||
void* aHandler,
|
||||
JSObject* aHandler,
|
||||
nsScriptObjectHolder& aBoundHandler) = 0;
|
||||
|
||||
/**
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
* Caller must make sure aFunctionObject is a JS GC root.
|
||||
*
|
||||
**/
|
||||
virtual nsresult CompileFunction(void* aTarget,
|
||||
virtual nsresult CompileFunction(JSObject* aTarget,
|
||||
const nsACString& aName,
|
||||
PRUint32 aArgCount,
|
||||
const char** aArgArray,
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
PRUint32 aLineNo,
|
||||
PRUint32 aVersion,
|
||||
bool aShared,
|
||||
void **aFunctionObject) = 0;
|
||||
JSObject** aFunctionObject) = 0;
|
||||
|
||||
/**
|
||||
* Set the default scripting language version for this context, which must
|
||||
|
@ -302,7 +302,7 @@ public:
|
|||
nsIScriptGlobalObject *aNewInner,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal,
|
||||
JSObject** aNativeGlobal,
|
||||
nsISupports **aHolder) = 0;
|
||||
|
||||
/**
|
||||
|
@ -311,7 +311,7 @@ public:
|
|||
* Called after both the the inner and outer windows are initialized
|
||||
**/
|
||||
virtual nsresult ConnectToInner(nsIScriptGlobalObject *aNewInner,
|
||||
void *aOuterGlobal) = 0;
|
||||
JSObject *aOuterGlobal) = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -330,7 +330,7 @@ public:
|
|||
/**
|
||||
* Given an outer object, updates this context with that outer object.
|
||||
*/
|
||||
virtual nsresult SetOuterObject(void *aOuterObject) = 0;
|
||||
virtual nsresult SetOuterObject(JSObject* aOuterObject) = 0;
|
||||
|
||||
/**
|
||||
* Prepares this context for use with the current inner window for the
|
||||
|
@ -428,7 +428,7 @@ public:
|
|||
* call DidInitializeContext() when a context is fully
|
||||
* (successfully) initialized.
|
||||
*/
|
||||
virtual nsresult InitClasses(void *aGlobalObj) = 0;
|
||||
virtual nsresult InitClasses(JSObject* aGlobalObj) = 0;
|
||||
|
||||
/**
|
||||
* Clear the scope object - may be called either as we are being torn down,
|
||||
|
|
|
@ -1578,7 +1578,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
|
|||
if (script) {
|
||||
NS_ASSERTION(aScriptObject.getScriptTypeID()==JAVASCRIPT,
|
||||
"Expecting JS script object holder");
|
||||
rv = aScriptObject.set(script);
|
||||
rv = aScriptObject.setScript(script);
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1778,13 +1778,13 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
|||
JSObject *handler = ::JS_GetFunctionObject(fun);
|
||||
NS_ASSERTION(aHandler.getScriptTypeID()==JAVASCRIPT,
|
||||
"Expecting JS script object holder");
|
||||
return aHandler.set((void *)handler);
|
||||
return aHandler.setObject(handler);
|
||||
}
|
||||
|
||||
// XXX - note that CompileFunction doesn't yet play the nsScriptObjectHolder
|
||||
// game - caller must still ensure JS GC root.
|
||||
nsresult
|
||||
nsJSContext::CompileFunction(void* aTarget,
|
||||
nsJSContext::CompileFunction(JSObject* aTarget,
|
||||
const nsACString& aName,
|
||||
PRUint32 aArgCount,
|
||||
const char** aArgArray,
|
||||
|
@ -1793,11 +1793,14 @@ nsJSContext::CompileFunction(void* aTarget,
|
|||
PRUint32 aLineNo,
|
||||
PRUint32 aVersion,
|
||||
bool aShared,
|
||||
void** aFunctionObject)
|
||||
JSObject** aFunctionObject)
|
||||
{
|
||||
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s, url: %s, line: %d)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, aName.BeginReading(), aURL, aLineNo);
|
||||
|
||||
NS_ABORT_IF_FALSE(aFunctionObject,
|
||||
"Shouldn't call CompileFunction with null return value.");
|
||||
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Don't compile if aVersion is unknown. Since the caller is responsible for
|
||||
|
@ -1820,7 +1823,7 @@ nsJSContext::CompileFunction(void* aTarget,
|
|||
}
|
||||
}
|
||||
|
||||
JSObject *target = (JSObject*)aTarget;
|
||||
JSObject *target = aTarget;
|
||||
|
||||
JSAutoRequest ar(mContext);
|
||||
|
||||
|
@ -1829,7 +1832,7 @@ nsJSContext::CompileFunction(void* aTarget,
|
|||
aShared ? nsnull : target, jsprin,
|
||||
PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
(jschar*)PromiseFlatString(aBody).get(),
|
||||
static_cast<const jschar*>(PromiseFlatString(aBody).get()),
|
||||
aBody.Length(),
|
||||
aURL, aLineNo,
|
||||
JSVersion(aVersion));
|
||||
|
@ -1839,15 +1842,14 @@ nsJSContext::CompileFunction(void* aTarget,
|
|||
if (!fun)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JSObject *handler = ::JS_GetFunctionObject(fun);
|
||||
if (aFunctionObject)
|
||||
*aFunctionObject = (void*) handler;
|
||||
*aFunctionObject = JS_GetFunctionObject(fun);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
||||
void *aHandler, nsIArray *aargv, nsIVariant **arv)
|
||||
JSObject* aHandler, nsIArray* aargv,
|
||||
nsIVariant** arv)
|
||||
{
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -1857,7 +1859,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
|||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
{
|
||||
JSObject *obj = static_cast<JSObject *>(aHandler);
|
||||
JSObject *obj = aHandler;
|
||||
if (js::IsFunctionProxy(obj))
|
||||
obj = js::UnwrapObject(obj);
|
||||
JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(mContext, obj)));
|
||||
|
@ -1894,7 +1896,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
|||
PRUint32 argc = 0;
|
||||
jsval *argv = nsnull;
|
||||
|
||||
JSObject *funobj = static_cast<JSObject *>(aHandler);
|
||||
JSObject *funobj = aHandler;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = sSecurityManager->GetObjectPrincipal(mContext, funobj,
|
||||
getter_AddRefs(principal));
|
||||
|
@ -1964,7 +1966,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
|||
|
||||
nsresult
|
||||
nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, JSObject* aScope,
|
||||
void *aHandler,
|
||||
JSObject* aHandler,
|
||||
nsScriptObjectHolder& aBoundHandler)
|
||||
{
|
||||
NS_ENSURE_ARG(aHandler);
|
||||
|
@ -1978,17 +1980,15 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, JSObject* aScope,
|
|||
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject *funobj = (JSObject*) aHandler;
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(mContext, funobj)) {
|
||||
if (!ac.enter(mContext, aHandler)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(JS_TypeOfValue(mContext,
|
||||
OBJECT_TO_JSVAL(funobj)) == JSTYPE_FUNCTION,
|
||||
OBJECT_TO_JSVAL(aHandler)) == JSTYPE_FUNCTION,
|
||||
"Event handler object not a function");
|
||||
}
|
||||
#endif
|
||||
|
@ -1998,14 +1998,18 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, JSObject* aScope,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject* funobj;
|
||||
// Make sure the handler function is parented by its event target object
|
||||
if (funobj) { // && ::JS_GetParent(mContext, funobj) != target) {
|
||||
funobj = ::JS_CloneFunctionObject(mContext, funobj, target);
|
||||
if (!funobj)
|
||||
if (aHandler) {
|
||||
funobj = JS_CloneFunctionObject(mContext, aHandler, target);
|
||||
if (!funobj) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
funobj = NULL;
|
||||
}
|
||||
|
||||
aBoundHandler.set(funobj);
|
||||
aBoundHandler.setObject(funobj);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -2063,13 +2067,10 @@ nsresult
|
|||
nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
||||
nsScriptObjectHolder &aResult)
|
||||
{
|
||||
JSScript *result = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
PRUint32 size;
|
||||
rv = aStream->Read32(&size);
|
||||
nsresult rv = aStream->Read32(&size);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char* data;
|
||||
|
@ -2079,6 +2080,7 @@ nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
|||
JSContext* cx = mContext;
|
||||
|
||||
JSXDRState *xdr = ::JS_XDRNewMem(cx, JSXDR_DECODE);
|
||||
JSScript *result = nsnull;
|
||||
if (! xdr) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
|
@ -2128,7 +2130,7 @@ nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
|||
// code, which could happen for all sorts of reasons above.
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aResult.set(result);
|
||||
return aResult.setScript(result);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2197,11 +2199,10 @@ nsJSContext::CreateNativeGlobalForInner(
|
|||
nsIScriptGlobalObject *aNewInner,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal, nsISupports **aHolder)
|
||||
JSObject** aNativeGlobal, nsISupports **aHolder)
|
||||
{
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
PRUint32 flags = aIsChrome? nsIXPConnect::FLAG_SYSTEM_GLOBAL_OBJECT : 0;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> jsholder;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> systemPrincipal;
|
||||
if (aIsChrome) {
|
||||
|
@ -2209,35 +2210,35 @@ nsJSContext::CreateNativeGlobalForInner(
|
|||
ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
|
||||
}
|
||||
|
||||
nsRefPtr<nsIXPConnectJSObjectHolder> jsholder;
|
||||
nsresult rv = xpc->
|
||||
InitClassesWithNewWrappedGlobal(mContext,
|
||||
aNewInner, NS_GET_IID(nsISupports),
|
||||
aIsChrome ? systemPrincipal.get() : aPrincipal,
|
||||
nsnull, flags,
|
||||
getter_AddRefs(jsholder));
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
jsholder->GetJSObject(reinterpret_cast<JSObject **>(aNativeGlobal));
|
||||
*aHolder = jsholder.get();
|
||||
NS_ADDREF(*aHolder);
|
||||
}
|
||||
jsholder->GetJSObject(aNativeGlobal);
|
||||
jsholder.forget(aHolder);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSContext::ConnectToInner(nsIScriptGlobalObject *aNewInner, void *aOuterGlobal)
|
||||
nsJSContext::ConnectToInner(nsIScriptGlobalObject *aNewInner, JSObject *aOuterGlobal)
|
||||
{
|
||||
NS_ENSURE_ARG(aNewInner);
|
||||
#ifdef DEBUG
|
||||
JSObject *newInnerJSObject = aNewInner->GetGlobalJSObject();
|
||||
#endif
|
||||
JSObject *outerGlobal = (JSObject *)aOuterGlobal;
|
||||
|
||||
// Now that we're connecting the outer global to the inner one,
|
||||
// we must have transplanted it. The JS engine tries to maintain
|
||||
// the global object's compartment as its default compartment,
|
||||
// so update that now since it might have changed.
|
||||
JS_SetGlobalObject(mContext, outerGlobal);
|
||||
NS_ASSERTION(JS_GetPrototype(mContext, outerGlobal) ==
|
||||
JS_SetGlobalObject(mContext, aOuterGlobal);
|
||||
NS_ASSERTION(JS_GetPrototype(mContext, aOuterGlobal) ==
|
||||
JS_GetPrototype(mContext, newInnerJSObject),
|
||||
"outer and inner globals should have the same prototype");
|
||||
|
||||
|
@ -2293,15 +2294,13 @@ nsJSContext::CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsJSContext::SetOuterObject(void *aOuterObject)
|
||||
nsJSContext::SetOuterObject(JSObject* aOuterObject)
|
||||
{
|
||||
JSObject *outer = static_cast<JSObject *>(aOuterObject);
|
||||
|
||||
// Force our context's global object to be the outer.
|
||||
JS_SetGlobalObject(mContext, outer);
|
||||
JS_SetGlobalObject(mContext, aOuterObject);
|
||||
|
||||
// NB: JS_SetGlobalObject sets mContext->compartment.
|
||||
JSObject *inner = JS_GetParent(mContext, outer);
|
||||
JSObject *inner = JS_GetParent(mContext, aOuterObject);
|
||||
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||
|
@ -2311,7 +2310,7 @@ nsJSContext::SetOuterObject(void *aOuterObject)
|
|||
NS_ABORT_IF_FALSE(wrapper, "bad wrapper");
|
||||
|
||||
wrapper->RefreshPrototype();
|
||||
JS_SetPrototype(mContext, outer, JS_GetPrototype(mContext, inner));
|
||||
JS_SetPrototype(mContext, aOuterObject, JS_GetPrototype(mContext, inner));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2960,13 +2959,9 @@ static JSFunctionSpec EthogramFunctions[] = {
|
|||
#endif
|
||||
|
||||
nsresult
|
||||
nsJSContext::InitClasses(void *aGlobalObj)
|
||||
nsJSContext::InitClasses(JSObject* aGlobalObj)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
JSObject *globalObj = static_cast<JSObject *>(aGlobalObj);
|
||||
|
||||
rv = InitializeExternalClasses();
|
||||
nsresult rv = InitializeExternalClasses();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSAutoRequest ar(mContext);
|
||||
|
@ -2974,21 +2969,21 @@ nsJSContext::InitClasses(void *aGlobalObj)
|
|||
::JS_SetOptions(mContext, mDefaultJSOptions);
|
||||
|
||||
// Attempt to initialize profiling functions
|
||||
::JS_DefineProfilingFunctions(mContext, globalObj);
|
||||
::JS_DefineProfilingFunctions(mContext, aGlobalObj);
|
||||
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
// Attempt to initialize TraceMalloc functions
|
||||
::JS_DefineFunctions(mContext, globalObj, TraceMallocFunctions);
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, TraceMallocFunctions);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
// Attempt to initialize JProf functions
|
||||
::JS_DefineFunctions(mContext, globalObj, JProfFunctions);
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, JProfFunctions);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_TRACEVIS
|
||||
// Attempt to initialize Ethogram functions
|
||||
::JS_DefineFunctions(mContext, globalObj, EthogramFunctions);
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, EthogramFunctions);
|
||||
#endif
|
||||
|
||||
JSOptionChangedCallback(js_options_dot_str, this);
|
||||
|
|
|
@ -109,13 +109,13 @@ public:
|
|||
PRUint32 aVersion,
|
||||
nsScriptObjectHolder &aHandler);
|
||||
virtual nsresult CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
||||
void* aHandler,
|
||||
JSObject* aHandler,
|
||||
nsIArray *argv, nsIVariant **rv);
|
||||
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
|
||||
JSObject *aScope,
|
||||
void *aHandler,
|
||||
JSObject* aHandler,
|
||||
nsScriptObjectHolder& aBoundHandler);
|
||||
virtual nsresult CompileFunction(void* aTarget,
|
||||
virtual nsresult CompileFunction(JSObject* aTarget,
|
||||
const nsACString& aName,
|
||||
PRUint32 aArgCount,
|
||||
const char** aArgArray,
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
PRUint32 aLineNo,
|
||||
PRUint32 aVersion,
|
||||
bool aShared,
|
||||
void** aFunctionObject);
|
||||
JSObject** aFunctionObject);
|
||||
|
||||
virtual void SetDefaultLanguageVersion(PRUint32 aVersion);
|
||||
virtual nsIScriptGlobalObject *GetGlobalObject();
|
||||
|
@ -134,14 +134,14 @@ public:
|
|||
nsIScriptGlobalObject *aGlobal,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal,
|
||||
JSObject** aNativeGlobal,
|
||||
nsISupports **aHolder);
|
||||
virtual nsresult ConnectToInner(nsIScriptGlobalObject *aNewInner,
|
||||
void *aOuterGlobal);
|
||||
JSObject *aOuterGlobal);
|
||||
virtual nsresult InitContext();
|
||||
virtual nsresult CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
||||
nsIScriptGlobalObject *aCurrentInner);
|
||||
virtual nsresult SetOuterObject(void *aOuterObject);
|
||||
virtual nsresult SetOuterObject(JSObject* aOuterObject);
|
||||
virtual nsresult InitOuterWindow();
|
||||
virtual bool IsContextInitialized();
|
||||
virtual void FinalizeContext();
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
|
||||
virtual void SetGCOnDestruction(bool aGCOnDestruction);
|
||||
|
||||
virtual nsresult InitClasses(void *aGlobalObj);
|
||||
virtual nsresult InitClasses(JSObject* aGlobalObj);
|
||||
virtual void ClearScope(void* aGlobalObj, bool bClearPolluters);
|
||||
|
||||
virtual void WillInitializeContext();
|
||||
|
|
|
@ -80,8 +80,8 @@ class nsIArray;
|
|||
class nsPIWindowRoot;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x9db588f7, 0x3472, 0x45d0, \
|
||||
{ 0x9f, 0x9b, 0x95, 0xca, 0xf6, 0x4d, 0x1a, 0xb1 } }
|
||||
{ 0x29e6cc54, 0x10da, 0x4a68, \
|
||||
{ 0xb7, 0x68, 0xfe, 0xa7, 0x71, 0x17, 0x93, 0x81 } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
|
@ -486,7 +486,7 @@ public:
|
|||
*/
|
||||
virtual void InitJavaProperties() = 0;
|
||||
|
||||
virtual void* GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) = 0;
|
||||
virtual JSObject* GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) = 0;
|
||||
virtual void CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
||||
nsScriptObjectHolder& aHandler) = 0;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(14efb76c-5bd6-449e-b36f-0cbd22981f20)]
|
||||
[scriptable, uuid(6652c4d2-6b49-424b-aaf9-91f91006fab7)]
|
||||
interface nsIDOMJSWindow : nsISupports
|
||||
{
|
||||
void dump(in DOMString str);
|
||||
|
@ -57,8 +57,8 @@ interface nsIDOMJSWindow : nsISupports
|
|||
* clear. Often in existing code these methods are passed undefined,
|
||||
* which is a nop so we need to support that as well.
|
||||
*/
|
||||
void clearTimeout();
|
||||
void clearInterval();
|
||||
void clearTimeout([optional] in long handle);
|
||||
void clearInterval([optional] in long handle);
|
||||
|
||||
/**
|
||||
* This method is here for backwards compatibility with 4.x only,
|
||||
|
|
|
@ -48,7 +48,7 @@ interface nsIScriptGlobalObject;
|
|||
/**
|
||||
* Encode and decode JSON text.
|
||||
*/
|
||||
[scriptable, uuid(a4d68b4e-0c0b-4c7c-b540-ef2f9834171f)]
|
||||
[scriptable, uuid(43845d58-1054-47fb-8be3-970b3f7bd7ea)]
|
||||
interface nsIJSON : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -56,7 +56,8 @@ interface nsIJSON : nsISupports
|
|||
* The encode() method is only present for backward compatibility.
|
||||
* encode() is not a conforming JSON stringify implementation!
|
||||
*/
|
||||
[deprecated] AString encode(/* in JSObject value */);
|
||||
[deprecated,implicit_jscontext,optional_argc]
|
||||
AString encode([optional] in jsval value);
|
||||
|
||||
/**
|
||||
* New users should use JSON.stringify.
|
||||
|
@ -65,18 +66,21 @@ interface nsIJSON : nsISupports
|
|||
* The encodeToStream() method is only present for backward compatibility.
|
||||
* encodeToStream() is not a conforming JSON stringify implementation!
|
||||
*/
|
||||
[deprecated] void encodeToStream(in nsIOutputStream stream,
|
||||
[deprecated,implicit_jscontext,optional_argc]
|
||||
void encodeToStream(in nsIOutputStream stream,
|
||||
in string charset,
|
||||
in boolean writeBOM
|
||||
/* in JSObject value */);
|
||||
in boolean writeBOM,
|
||||
[optional] in jsval value);
|
||||
|
||||
/**
|
||||
* New users should use JSON.parse!
|
||||
* The decode() method is only present for backward compatibility.
|
||||
*/
|
||||
[deprecated] void /* JSObject */ decode(in AString str);
|
||||
[deprecated,implicit_jscontext]
|
||||
jsval decode(in AString str);
|
||||
|
||||
void /* JSObject */ decodeFromStream(in nsIInputStream stream,
|
||||
[implicit_jscontext]
|
||||
jsval decodeFromStream(in nsIInputStream stream,
|
||||
in long contentLength);
|
||||
|
||||
[noscript] AString encodeFromJSVal(in JSValPtr value, in JSContext cx);
|
||||
|
@ -97,10 +101,12 @@ interface nsIJSON : nsISupports
|
|||
*
|
||||
* @param str the string to parse
|
||||
*/
|
||||
void /* jsval */ legacyDecode(in AString str);
|
||||
[implicit_jscontext]
|
||||
jsval legacyDecode(in AString str);
|
||||
|
||||
/* Identical to legacyDecode, but decode the contents of stream. */
|
||||
void /* jsval */ legacyDecodeFromStream(in nsIInputStream stream,
|
||||
[implicit_jscontext]
|
||||
jsval legacyDecodeFromStream(in nsIInputStream stream,
|
||||
in long contentLength);
|
||||
|
||||
/* Identical to legacyDecode, but decode into a jsval. */
|
||||
|
|
|
@ -94,15 +94,21 @@ WarnDeprecatedMethod(DeprecationWarning warning)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSON::Encode(nsAString &aJSON)
|
||||
nsJSON::Encode(const JS::Value& aValue, JSContext* cx, PRUint8 aArgc, nsAString &aJSON)
|
||||
{
|
||||
// This function should only be called from JS.
|
||||
nsresult rv = WarnDeprecatedMethod(EncodeWarning);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (aArgc == 0) {
|
||||
aJSON.Truncate();
|
||||
aJSON.SetIsVoid(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsJSONWriter writer;
|
||||
rv = EncodeInternal(&writer);
|
||||
rv = EncodeInternal(cx, aValue, &writer);
|
||||
|
||||
// FIXME: bug 408838. Get exception types sorted out
|
||||
if (NS_SUCCEEDED(rv) || rv == NS_ERROR_INVALID_ARG) {
|
||||
|
@ -139,7 +145,10 @@ static nsresult CheckCharset(const char* aCharset)
|
|||
NS_IMETHODIMP
|
||||
nsJSON::EncodeToStream(nsIOutputStream *aStream,
|
||||
const char* aCharset,
|
||||
const bool aWriteBOM)
|
||||
const bool aWriteBOM,
|
||||
const JS::Value& val,
|
||||
JSContext* cx,
|
||||
PRUint8 aArgc)
|
||||
{
|
||||
// This function should only be called from JS.
|
||||
NS_ENSURE_ARG(aStream);
|
||||
|
@ -174,7 +183,11 @@ nsJSON::EncodeToStream(nsIOutputStream *aStream,
|
|||
rv = writer.SetCharset(aCharset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = EncodeInternal(&writer);
|
||||
if (aArgc == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = EncodeInternal(cx, val, &writer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = bufferedStream->Flush();
|
||||
|
@ -238,52 +251,22 @@ nsJSON::EncodeFromJSVal(jsval *value, JSContext *cx, nsAString &result)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsJSON::EncodeInternal(nsJSONWriter *writer)
|
||||
nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue, nsJSONWriter* writer)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
if (!xpc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Now fish for the JS argument. If it's a call to encode, we'll
|
||||
// want the first argument. If it's a call to encodeToStream,
|
||||
// we'll want the forth.
|
||||
const PRUint32 firstArg = writer->mStream ? 3 : 0;
|
||||
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 argc = 0;
|
||||
rv = cc->GetArgc(&argc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If the argument wasn't provided, there's nothing to serialize.
|
||||
if (argc <= firstArg)
|
||||
return NS_OK;
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
rv = cc->GetJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
// Get the object we're going to serialize.
|
||||
jsval *argv = nsnull;
|
||||
rv = cc->GetArgvPtr(&argv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If the argument wasn't provided, there's nothing to serialize.
|
||||
if (argc <= firstArg)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
jsval *vp = &argv[firstArg];
|
||||
|
||||
// Backward compatibility:
|
||||
// nsIJSON does not allow to serialize anything other than objects
|
||||
JSObject *obj;
|
||||
if (!JSVAL_IS_OBJECT(*vp) || !(obj = JSVAL_TO_OBJECT(*vp)))
|
||||
if (!JSVAL_IS_OBJECT(aValue)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JSObject* obj = JSVAL_TO_OBJECT(aValue);
|
||||
if (!obj) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JS::Value val = aValue;
|
||||
|
||||
/* Backward compatibility:
|
||||
* Manually call toJSON if implemented by the object and check that
|
||||
|
@ -295,9 +278,8 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
|
|||
if (JS_GetMethod(cx, obj, "toJSON", NULL, &toJSON) &&
|
||||
!JSVAL_IS_PRIMITIVE(toJSON) &&
|
||||
JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(toJSON))) {
|
||||
|
||||
// If toJSON is implemented, it must not throw
|
||||
if (!JS_CallFunctionValue(cx, obj, toJSON, 0, NULL, vp)) {
|
||||
if (!JS_CallFunctionValue(cx, obj, toJSON, 0, NULL, &val)) {
|
||||
if (JS_IsExceptionPending(cx))
|
||||
// passing NS_OK will throw the pending exception
|
||||
return NS_OK;
|
||||
|
@ -308,7 +290,7 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
|
|||
|
||||
// Backward compatibility:
|
||||
// nsIJSON does not allow to serialize anything other than objects
|
||||
if (JSVAL_IS_PRIMITIVE(*vp))
|
||||
if (JSVAL_IS_PRIMITIVE(val))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
// GetMethod may have thrown
|
||||
|
@ -318,12 +300,12 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
|
|||
|
||||
// Backward compatibility:
|
||||
// function/xml shall not pass, just "plain" objects and arrays
|
||||
JSType type = JS_TypeOfValue(cx, *vp);
|
||||
JSType type = JS_TypeOfValue(cx, val);
|
||||
if (type == JSTYPE_FUNCTION || type == JSTYPE_XML)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// We're good now; try to stringify
|
||||
if (!JS_Stringify(cx, vp, NULL, JSVAL_NULL, WriteCallback, writer))
|
||||
if (!JS_Stringify(cx, &val, NULL, JSVAL_NULL, WriteCallback, writer))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -441,7 +423,7 @@ nsJSONWriter::WriteToStream(nsIOutputStream *aStream,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSON::Decode(const nsAString& json)
|
||||
nsJSON::Decode(const nsAString& json, JSContext* cx, JS::Value* aRetval)
|
||||
{
|
||||
nsresult rv = WarnDeprecatedMethod(DecodeWarning);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -455,13 +437,14 @@ nsJSON::Decode(const nsAString& json)
|
|||
len * sizeof(PRUnichar),
|
||||
NS_ASSIGNMENT_DEPEND);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return DecodeInternal(stream, len, false);
|
||||
return DecodeInternal(cx, stream, len, false, aRetval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSON::DecodeFromStream(nsIInputStream *aStream, PRInt32 aContentLength)
|
||||
nsJSON::DecodeFromStream(nsIInputStream *aStream, PRInt32 aContentLength,
|
||||
JSContext* cx, JS::Value* aRetval)
|
||||
{
|
||||
return DecodeInternal(aStream, aContentLength, true);
|
||||
return DecodeInternal(cx, aStream, aContentLength, true, aRetval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -469,8 +452,8 @@ nsJSON::DecodeToJSVal(const nsAString &str, JSContext *cx, jsval *result)
|
|||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
if (!JS_ParseJSON(cx, (jschar*)PromiseFlatString(str).get(),
|
||||
(uint32)str.Length(), result)) {
|
||||
if (!JS_ParseJSON(cx, static_cast<const jschar*>(PromiseFlatString(str).get()),
|
||||
str.Length(), result)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -478,28 +461,13 @@ nsJSON::DecodeToJSVal(const nsAString &str, JSContext *cx, jsval *result)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsJSON::DecodeInternal(nsIInputStream *aStream,
|
||||
nsJSON::DecodeInternal(JSContext* cx,
|
||||
nsIInputStream *aStream,
|
||||
PRInt32 aContentLength,
|
||||
bool aNeedsConverter,
|
||||
JS::Value* aRetval,
|
||||
DecodingMode mode /* = STRICT */)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
if (!xpc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
jsval *retvalPtr;
|
||||
rv = cc->GetRetValPtr(&retvalPtr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
rv = cc->GetJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
// Consume the stream
|
||||
|
@ -510,16 +478,14 @@ nsJSON::DecodeInternal(nsIInputStream *aStream,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(jsonChannel), mURI, aStream,
|
||||
nsresult rv =
|
||||
NS_NewInputStreamChannel(getter_AddRefs(jsonChannel), mURI, aStream,
|
||||
NS_LITERAL_CSTRING("application/json"));
|
||||
if (!jsonChannel || NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<nsJSONListener>
|
||||
jsonListener(new nsJSONListener(cx, retvalPtr, aNeedsConverter, mode));
|
||||
|
||||
if (!jsonListener)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsRefPtr<nsJSONListener> jsonListener =
|
||||
new nsJSONListener(cx, aRetval, aNeedsConverter, mode);
|
||||
|
||||
//XXX this stream pattern should be consolidated in netwerk
|
||||
rv = jsonListener->OnStartRequest(jsonChannel, nsnull);
|
||||
|
@ -560,15 +526,12 @@ nsJSON::DecodeInternal(nsIInputStream *aStream,
|
|||
rv = jsonListener->OnStopRequest(jsonChannel, nsnull, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = cc->SetReturnValueWasSet(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSON::LegacyDecode(const nsAString& json)
|
||||
nsJSON::LegacyDecode(const nsAString& json, JSContext* cx, JS::Value* aRetval)
|
||||
{
|
||||
const PRUnichar *data;
|
||||
PRUint32 len = NS_StringGetData(json, &data);
|
||||
|
@ -578,13 +541,14 @@ nsJSON::LegacyDecode(const nsAString& json)
|
|||
len * sizeof(PRUnichar),
|
||||
NS_ASSIGNMENT_DEPEND);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return DecodeInternal(stream, len, false, LEGACY);
|
||||
return DecodeInternal(cx, stream, len, false, aRetval, LEGACY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSON::LegacyDecodeFromStream(nsIInputStream *aStream, PRInt32 aContentLength)
|
||||
nsJSON::LegacyDecodeFromStream(nsIInputStream *aStream, PRInt32 aContentLength,
|
||||
JSContext* cx, JS::Value* aRetval)
|
||||
{
|
||||
return DecodeInternal(aStream, aContentLength, true, LEGACY);
|
||||
return DecodeInternal(cx, aStream, aContentLength, true, aRetval, LEGACY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -592,8 +556,8 @@ nsJSON::LegacyDecodeToJSVal(const nsAString &str, JSContext *cx, jsval *result)
|
|||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
if (!js::ParseJSONWithReviver(cx, (jschar*)PromiseFlatString(str).get(),
|
||||
(uint32)str.Length(), js::NullValue(),
|
||||
if (!js::ParseJSONWithReviver(cx, static_cast<const jschar*>(PromiseFlatString(str).get()),
|
||||
str.Length(), JS::NullValue(),
|
||||
result, LEGACY)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
|
|
@ -86,11 +86,15 @@ public:
|
|||
NS_DECL_NSIJSON
|
||||
|
||||
protected:
|
||||
nsresult EncodeInternal(nsJSONWriter *writer);
|
||||
nsresult EncodeInternal(JSContext* cx,
|
||||
const JS::Value& val,
|
||||
nsJSONWriter* writer);
|
||||
|
||||
nsresult DecodeInternal(nsIInputStream *aStream,
|
||||
nsresult DecodeInternal(JSContext* cx,
|
||||
nsIInputStream* aStream,
|
||||
PRInt32 aContentLength,
|
||||
bool aNeedsConverter,
|
||||
JS::Value* aRetVal,
|
||||
DecodingMode mode = STRICT);
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ class nsIntRegion;
|
|||
native nsIntRegion(nsIntRegion);
|
||||
|
||||
|
||||
[scriptable, uuid(f390b97c-a0cf-4cb4-b9e8-bfc15df76ab5)]
|
||||
[scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)]
|
||||
interface nsIScriptableRegion : nsISupports
|
||||
{
|
||||
void init ( ) ;
|
||||
|
@ -192,7 +192,7 @@ interface nsIScriptableRegion : nsISupports
|
|||
* @return flat array of rects,ie [x1,y1,width1,height1,x2...].
|
||||
* The result will contain bogus data if values don't fit in 31 bit
|
||||
**/
|
||||
void getRects();
|
||||
[implicit_jscontext] jsval getRects();
|
||||
|
||||
/**
|
||||
* does the region intersect the rectangle?
|
||||
|
@ -207,8 +207,3 @@ interface nsIScriptableRegion : nsISupports
|
|||
[noscript] readonly attribute nsIntRegion region;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
|
|
|
@ -152,37 +152,17 @@ NS_IMETHODIMP nsScriptableRegion::GetRegion(nsIntRegion* outRgn)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScriptableRegion::GetRects() {
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpConnect = do_GetService(nsIXPConnect::GetCID(), &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = xpConnect->GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
jsval *retvalPtr;
|
||||
ncc->GetRetValPtr(&retvalPtr);
|
||||
|
||||
NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::Value* aRects)
|
||||
{
|
||||
PRUint32 numRects = mRegion.GetNumRects();
|
||||
|
||||
if (!numRects) {
|
||||
*retvalPtr = JSVAL_NULL;
|
||||
ncc->SetReturnValueWasSet(true);
|
||||
*aRects = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
|
||||
rv = ncc->GetJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject *destArray = JS_NewArrayObject(cx, numRects*4, NULL);
|
||||
*retvalPtr = OBJECT_TO_JSVAL(destArray);
|
||||
ncc->SetReturnValueWasSet(true);
|
||||
JSObject* destArray = JS_NewArrayObject(aCx, numRects * 4, NULL);
|
||||
*aRects = OBJECT_TO_JSVAL(destArray);
|
||||
|
||||
uint32 n = 0;
|
||||
nsIntRegionRectIterator iter(mRegion);
|
||||
|
@ -190,14 +170,14 @@ NS_IMETHODIMP nsScriptableRegion::GetRects() {
|
|||
|
||||
while ((rect = iter.Next())) {
|
||||
// This will contain bogus data if values don't fit in 31 bit
|
||||
JS_DefineElement(cx, destArray, n, INT_TO_JSVAL(rect->x), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(cx, destArray, n+1, INT_TO_JSVAL(rect->y), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(cx, destArray, n+2, INT_TO_JSVAL(rect->width), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(cx, destArray, n+3, INT_TO_JSVAL(rect->height), NULL, NULL, JSPROP_ENUMERATE);
|
||||
// TODO: Bug 705414 - check for failure
|
||||
JS_DefineElement(aCx, destArray, n, INT_TO_JSVAL(rect->x), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(aCx, destArray, n + 1, INT_TO_JSVAL(rect->y), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(aCx, destArray, n + 2, INT_TO_JSVAL(rect->width), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JS_DefineElement(aCx, destArray, n + 3, INT_TO_JSVAL(rect->height), NULL, NULL, JSPROP_ENUMERATE);
|
||||
|
||||
n += 4;
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(5b776cd4-952b-45a2-b363-84e99e8fe608)]
|
||||
[scriptable, uuid(75767928-ecb1-4e6c-9f55-c118b297fcef)]
|
||||
interface xpcIJSWeakReference : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -45,5 +45,5 @@ interface xpcIJSWeakReference : nsISupports
|
|||
* Returns the referenced JS object or null if the JS object has
|
||||
* been garbage collected.
|
||||
*/
|
||||
void /* JSObject */ get();
|
||||
[implicit_jscontext] jsval get();
|
||||
};
|
||||
|
|
|
@ -196,16 +196,16 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSString *str;
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast<const PRUnichar*>(chars));
|
||||
#ifdef ANDROID
|
||||
|
@ -213,7 +213,7 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
|
|||
#endif
|
||||
fputs(utf8str.get(), stdout);
|
||||
fflush(stdout);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -222,7 +222,7 @@ Debug(JSContext *cx, uintN argc, jsval *vp)
|
|||
#ifdef DEBUG
|
||||
return Dump(cx, argc, vp);
|
||||
#else
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ static JSBool
|
|||
Atob(JSContext *cx, uintN argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
return nsXPConnect::Base64Decode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static JSBool
|
|||
Btoa(JSContext *cx, uintN argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
return nsXPConnect::Base64Encode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
@ -251,14 +251,14 @@ File(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
if (!argc) {
|
||||
XPCThrower::Throw(NS_ERROR_UNEXPECTED, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> native;
|
||||
rv = nsDOMFileFile::NewFile(getter_AddRefs(native));
|
||||
if (NS_FAILED(rv)) {
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
|
||||
|
@ -267,13 +267,13 @@ File(JSContext *cx, uintN argc, jsval *vp)
|
|||
rv = initializer->Initialize(nsnull, cx, nsnull, argc, JS_ARGV(cx, vp));
|
||||
if (NS_FAILED(rv)) {
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if (!xpc) {
|
||||
XPCThrower::Throw(NS_ERROR_UNEXPECTED, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject* glob = JS_GetGlobalForScopeChain(cx);
|
||||
|
@ -285,11 +285,11 @@ File(JSContext *cx, uintN argc, jsval *vp)
|
|||
true, &retval, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, retval);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSFunctionSpec gGlobalFun[] = {
|
||||
|
|
|
@ -154,9 +154,9 @@ FILE *gErrFile = NULL;
|
|||
FILE *gInFile = NULL;
|
||||
|
||||
int gExitCode = 0;
|
||||
JSBool gQuitting = JS_FALSE;
|
||||
static JSBool reportWarnings = JS_TRUE;
|
||||
static JSBool compileOnly = JS_FALSE;
|
||||
JSBool gQuitting = false;
|
||||
static JSBool reportWarnings = true;
|
||||
static JSBool compileOnly = false;
|
||||
|
||||
JSPrincipals *gJSPrincipals = nsnull;
|
||||
nsAutoString *gWorkingDirectory = nsnull;
|
||||
|
@ -166,7 +166,7 @@ GetLocationProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
{
|
||||
#if !defined(XP_WIN) && !defined(XP_UNIX)
|
||||
//XXX: your platform should really implement this
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
#else
|
||||
JSStackFrame *fp = JS_GetScriptedCaller(cx, NULL);
|
||||
JSScript *script = JS_GetFrameScript(cx, fp);
|
||||
|
@ -240,7 +240,7 @@ GetLocationProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ GetLine(JSContext *cx, char *bufp, FILE *file, const char *prompt) {
|
|||
if (file == stdin) {
|
||||
char *linep = readline(prompt);
|
||||
if (!linep)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
if (*linep)
|
||||
add_history(linep);
|
||||
strcpy(bufp, linep);
|
||||
|
@ -276,10 +276,10 @@ GetLine(JSContext *cx, char *bufp, FILE *file, const char *prompt) {
|
|||
fputs(prompt, gOutFile);
|
||||
fflush(gOutFile);
|
||||
if ((!fgets(line, sizeof line, file) && errno != EINTR) || feof(file))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
strcpy(bufp, line);
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -388,7 +388,7 @@ ReadLine(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (argc > 0) {
|
||||
str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
} else {
|
||||
str = JSVAL_TO_STRING(JS_GetEmptyStringValue(cx));
|
||||
}
|
||||
|
@ -396,14 +396,14 @@ ReadLine(JSContext *cx, uintN argc, jsval *vp)
|
|||
/* Get a line from the infile */
|
||||
JSAutoByteString strBytes(cx, str);
|
||||
if (!strBytes || !GetLine(cx, buf, gInFile, strBytes.ptr()))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
/* Strip newline character added by GetLine() */
|
||||
unsigned int buflen = strlen(buf);
|
||||
if (buflen == 0) {
|
||||
if (feof(gInFile)) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
} else if (buf[buflen - 1] == '\n') {
|
||||
--buflen;
|
||||
|
@ -412,10 +412,10 @@ ReadLine(JSContext *cx, uintN argc, jsval *vp)
|
|||
/* Turn buf into a JSString */
|
||||
str = JS_NewStringCopyN(cx, buf, buflen);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -428,10 +428,10 @@ Print(JSContext *cx, uintN argc, jsval *vp)
|
|||
for (i = n = 0; i < argc; i++) {
|
||||
str = JS_ValueToString(cx, argv[i]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSAutoByteString strBytes(cx, str);
|
||||
if (!strBytes)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
fprintf(gOutFile, "%s%s", i ? " " : "", strBytes.ptr());
|
||||
fflush(gOutFile);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ Print(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (n)
|
||||
fputc('\n', gOutFile);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -449,22 +449,22 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
JSString *str;
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSAutoByteString bytes(cx, str);
|
||||
if (!bytes)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
#ifdef ANDROID
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko", bytes.ptr());
|
||||
#endif
|
||||
fputs(bytes.ptr(), gOutFile);
|
||||
fflush(gOutFile);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -510,7 +510,7 @@ Version(JSContext *cx, uintN argc, jsval *vp)
|
|||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(JS_SetVersion(cx, JSVersion(JSVAL_TO_INT(JS_ARGV(cx, vp)[0])))));
|
||||
else
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(JS_GetVersion(cx)));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -518,7 +518,7 @@ BuildDate(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
fprintf(gOutFile, "built on %s at %s\n", __DATE__, __TIME__);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -527,9 +527,9 @@ Quit(JSContext *cx, uintN argc, jsval *vp)
|
|||
gExitCode = 0;
|
||||
JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp),"/ i", &gExitCode);
|
||||
|
||||
gQuitting = JS_TRUE;
|
||||
gQuitting = true;
|
||||
// exit(0);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -539,14 +539,14 @@ DumpXPC(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
if (argc > 0) {
|
||||
if (!JS_ValueToInt32(cx, JS_ARGV(cx, vp)[0], &depth))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
if (xpc)
|
||||
xpc->DebugDump((int16)depth);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -557,7 +557,7 @@ GC(JSContext *cx, uintN argc, jsval *vp)
|
|||
js_DumpGCStats(cx->runtime, stdout);
|
||||
#endif
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
|
@ -566,11 +566,11 @@ GCZeal(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
uint32 zeal;
|
||||
if (!JS_ValueToECMAUint32(cx, argc ? JS_ARGV(cx, vp)[0] : JSVAL_VOID, &zeal))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_SetGCZeal(cx, (PRUint8)zeal, JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
JS_SetGCZeal(cx, (PRUint8)zeal, JS_DEFAULT_ZEAL_FREQ, false);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -597,10 +597,10 @@ DumpHeap(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
str = JS_ValueToString(cx, *vp);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*vp = STRING_TO_JSVAL(str);
|
||||
if (!fileName.encode(cx, str))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
vp = argv + 1;
|
||||
|
@ -623,7 +623,7 @@ DumpHeap(JSContext *cx, uintN argc, jsval *vp)
|
|||
uint32 depth;
|
||||
|
||||
if (!JS_ValueToECMAUint32(cx, *vp, &depth))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
maxDepth = depth;
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ DumpHeap(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (!dumpFile) {
|
||||
fprintf(gErrFile, "dumpHeap: can't open %s: %s\n",
|
||||
fileName.ptr(), strerror(errno));
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ DumpHeap(JSContext *cx, uintN argc, jsval *vp)
|
|||
fprintf(gErrFile,
|
||||
"dumpHeap: argument %u is not null or a heap-allocated thing\n",
|
||||
(unsigned)(vp - argv));
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
@ -667,10 +667,10 @@ Clear(JSContext *cx, uintN argc, jsval *vp)
|
|||
JS_ClearScope(cx, JSVAL_TO_OBJECT(JS_ARGV(cx, vp)[0]));
|
||||
} else {
|
||||
JS_ReportError(cx, "'clear' requires an object");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -680,28 +680,28 @@ SendCommand(JSContext* cx,
|
|||
{
|
||||
if (argc == 0) {
|
||||
JS_ReportError(cx, "Function takes at least one argument!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
jsval *argv = JS_ARGV(cx, vp);
|
||||
JSString* str = JS_ValueToString(cx, argv[0]);
|
||||
if (!str) {
|
||||
JS_ReportError(cx, "Could not convert argument 1 to string!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (argc > 1 && JS_TypeOfValue(cx, argv[1]) != JSTYPE_FUNCTION) {
|
||||
JS_ReportError(cx, "Could not convert argument 2 to function!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!XRE_SendTestShellCommand(cx, str, argc > 1 ? &argv[1] : nsnull)) {
|
||||
JS_ReportError(cx, "Couldn't send command!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -712,9 +712,9 @@ GetChildGlobalObject(JSContext* cx,
|
|||
JSObject* global;
|
||||
if (XRE_GetChildGlobalObject(cx, &global)) {
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(global));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -776,23 +776,23 @@ Options(JSContext *cx, uintN argc, jsval *vp)
|
|||
for (uintN i = 0; i < argc; i++) {
|
||||
str = JS_ValueToString(cx, argv[i]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
argv[i] = STRING_TO_JSVAL(str);
|
||||
JSAutoByteString opt(cx, str);
|
||||
if (!opt)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
flag = MapContextOptionNameToFlag(cx, opt.ptr());
|
||||
if (!flag)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
optset |= flag;
|
||||
}
|
||||
optset = JS_ToggleOptions(cx, optset);
|
||||
|
||||
names = NULL;
|
||||
found = JS_FALSE;
|
||||
found = false;
|
||||
for (size_t i = 0; i < ArrayLength(js_options); i++) {
|
||||
if (js_options[i].flag & optset) {
|
||||
found = JS_TRUE;
|
||||
found = true;
|
||||
names = JS_sprintf_append(names, "%s%s",
|
||||
names ? "," : "", js_options[i].name);
|
||||
if (!names)
|
||||
|
@ -803,14 +803,14 @@ Options(JSContext *cx, uintN argc, jsval *vp)
|
|||
names = strdup("");
|
||||
if (!names) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
str = JS_NewStringCopyZ(cx, names);
|
||||
free(names);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -818,17 +818,17 @@ Parent(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
if (argc != 1) {
|
||||
JS_ReportError(cx, "Wrong number of arguments");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
jsval v = JS_ARGV(cx, vp)[0];
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
JS_ReportError(cx, "Only objects have parents!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(JS_GetParent(cx, JSVAL_TO_OBJECT(v)));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSFunctionSpec glob_functions[] = {
|
||||
|
@ -871,24 +871,24 @@ env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
|||
|
||||
jsval idval;
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
idstr = JS_ValueToString(cx, idval);
|
||||
valstr = JS_ValueToString(cx, *vp);
|
||||
if (!idstr || !valstr)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSAutoByteString name(cx, idstr);
|
||||
if (!name)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSAutoByteString value(cx, valstr);
|
||||
if (!value)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
#if defined XP_WIN || defined HPUX || defined OSF1 || defined SCO
|
||||
{
|
||||
char *waste = JS_smprintf("%s=%s", name.ptr(), value.ptr());
|
||||
if (!waste) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
rv = putenv(waste);
|
||||
#ifdef XP_WIN
|
||||
|
@ -907,11 +907,11 @@ env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
|||
#endif
|
||||
if (rv < 0) {
|
||||
JS_ReportError(cx, "can't set envariable %s to %s", name.ptr(), value.ptr());
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
*vp = STRING_TO_JSVAL(valstr);
|
||||
#endif /* !defined XP_OS2 && !defined SOLARIS */
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -923,7 +923,7 @@ env_enumerate(JSContext *cx, JSObject *obj)
|
|||
JSBool ok;
|
||||
|
||||
if (reflected)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
for (evp = (char **)JS_GetPrivate(cx, obj); (name = *evp) != NULL; evp++) {
|
||||
value = strchr(name, '=');
|
||||
|
@ -932,18 +932,18 @@ env_enumerate(JSContext *cx, JSObject *obj)
|
|||
*value++ = '\0';
|
||||
valstr = JS_NewStringCopyZ(cx, value);
|
||||
if (!valstr) {
|
||||
ok = JS_FALSE;
|
||||
ok = false;
|
||||
} else {
|
||||
ok = JS_DefineProperty(cx, obj, name, STRING_TO_JSVAL(valstr),
|
||||
NULL, NULL, JSPROP_ENUMERATE);
|
||||
}
|
||||
value[-1] = '=';
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
reflected = JS_TRUE;
|
||||
return JS_TRUE;
|
||||
reflected = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -953,30 +953,30 @@ env_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
JSString *idstr, *valstr;
|
||||
|
||||
if (flags & JSRESOLVE_ASSIGNING)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
jsval idval;
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
idstr = JS_ValueToString(cx, idval);
|
||||
if (!idstr)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSAutoByteString name(cx, idstr);
|
||||
if (!name)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
const char *value = getenv(name.ptr());
|
||||
if (value) {
|
||||
valstr = JS_NewStringCopyZ(cx, value);
|
||||
if (!valstr)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
if (!JS_DefinePropertyById(cx, obj, id, STRING_TO_JSVAL(valstr),
|
||||
NULL, NULL, JSPROP_ENUMERATE)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
*objp = obj;
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSClass env_class = {
|
||||
|
@ -1062,7 +1062,7 @@ ProcessFile(JSContext *cx, JSObject *obj, const char *filename, FILE *file,
|
|||
|
||||
/* It's an interactive filehandle; drop into read-eval-print loop. */
|
||||
lineno = 1;
|
||||
hitEOF = JS_FALSE;
|
||||
hitEOF = false;
|
||||
do {
|
||||
bufp = buffer;
|
||||
*bufp = '\0';
|
||||
|
@ -1076,12 +1076,12 @@ ProcessFile(JSContext *cx, JSObject *obj, const char *filename, FILE *file,
|
|||
startline = lineno;
|
||||
do {
|
||||
if (!GetLine(cx, bufp, file, startline == lineno ? "js> " : "")) {
|
||||
hitEOF = JS_TRUE;
|
||||
hitEOF = true;
|
||||
break;
|
||||
}
|
||||
bufp += strlen(bufp);
|
||||
lineno++;
|
||||
} while (!JS_BufferIsCompilableUnit(cx, JS_FALSE, obj, buffer, strlen(buffer)));
|
||||
} while (!JS_BufferIsCompilableUnit(cx, false, obj, buffer, strlen(buffer)));
|
||||
|
||||
DoBeginRequest(cx);
|
||||
/* Clear any pending exception from previous failed compiles. */
|
||||
|
@ -1102,7 +1102,7 @@ ProcessFile(JSContext *cx, JSObject *obj, const char *filename, FILE *file,
|
|||
if (str && bytes.encode(cx, str))
|
||||
fprintf(gOutFile, "%s\n", bytes.ptr());
|
||||
else
|
||||
ok = JS_FALSE;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1153,13 +1153,13 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
int i;
|
||||
JSObject *argsObj;
|
||||
char *filename = NULL;
|
||||
JSBool isInteractive = JS_TRUE;
|
||||
JSBool forceTTY = JS_FALSE;
|
||||
JSBool isInteractive = true;
|
||||
JSBool forceTTY = false;
|
||||
|
||||
rcfile = fopen(rcfilename, "r");
|
||||
if (rcfile) {
|
||||
printf("[loading '%s'...]\n", rcfilename);
|
||||
ProcessFile(cx, obj, rcfilename, rcfile, JS_FALSE);
|
||||
ProcessFile(cx, obj, rcfilename, rcfile, false);
|
||||
fclose(rcfile);
|
||||
}
|
||||
|
||||
|
@ -1209,7 +1209,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
for (i = 0; i < argc; i++) {
|
||||
if (argv[i][0] != '-' || argv[i][1] == '\0') {
|
||||
filename = argv[i++];
|
||||
isInteractive = JS_FALSE;
|
||||
isInteractive = false;
|
||||
break;
|
||||
}
|
||||
switch (argv[i][1]) {
|
||||
|
@ -1220,10 +1220,10 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
JS_SetVersion(cx, JSVersion(atoi(argv[i])));
|
||||
break;
|
||||
case 'W':
|
||||
reportWarnings = JS_FALSE;
|
||||
reportWarnings = false;
|
||||
break;
|
||||
case 'w':
|
||||
reportWarnings = JS_TRUE;
|
||||
reportWarnings = true;
|
||||
break;
|
||||
case 'S':
|
||||
JS_ToggleOptions(cx, JSOPTION_WERROR);
|
||||
|
@ -1241,10 +1241,10 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
JSObject *gobj;
|
||||
|
||||
if (!JS_DeepFreezeObject(cx, obj))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
gobj = JS_NewGlobalObject(cx, &global_class);
|
||||
if (!gobj || !JS_SplicePrototype(cx, gobj, obj))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JS_SetParent(cx, gobj, NULL);
|
||||
JS_SetGlobalObject(cx, gobj);
|
||||
obj = gobj;
|
||||
|
@ -1254,16 +1254,16 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
if (++i == argc) {
|
||||
return usage();
|
||||
}
|
||||
Process(cx, obj, argv[i], JS_FALSE);
|
||||
Process(cx, obj, argv[i], false);
|
||||
/*
|
||||
* XXX: js -f foo.js should interpret foo.js and then
|
||||
* drop into interactive mode, but that breaks test
|
||||
* harness. Just execute foo.js for now.
|
||||
*/
|
||||
isInteractive = JS_FALSE;
|
||||
isInteractive = false;
|
||||
break;
|
||||
case 'i':
|
||||
isInteractive = forceTTY = JS_TRUE;
|
||||
isInteractive = forceTTY = true;
|
||||
break;
|
||||
case 'e':
|
||||
{
|
||||
|
@ -1276,12 +1276,12 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
JS_EvaluateScriptForPrincipals(cx, obj, gJSPrincipals, argv[i],
|
||||
strlen(argv[i]), "-e", 1, &rval);
|
||||
|
||||
isInteractive = JS_FALSE;
|
||||
isInteractive = false;
|
||||
break;
|
||||
}
|
||||
case 'C':
|
||||
compileOnly = JS_TRUE;
|
||||
isInteractive = JS_FALSE;
|
||||
compileOnly = true;
|
||||
isInteractive = false;
|
||||
break;
|
||||
case 'j':
|
||||
JS_ToggleOptions(cx, JSOPTION_JIT);
|
||||
|
@ -1684,7 +1684,7 @@ nsXPCFunctionThisTranslator::TranslateThis(nsISupports *aInitialThis,
|
|||
{
|
||||
NS_IF_ADDREF(aInitialThis);
|
||||
*_retval = aInitialThis;
|
||||
*aHideFirstParamFromJS = JS_FALSE;
|
||||
*aHideFirstParamFromJS = false;
|
||||
*aIIDOfResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1698,13 +1698,13 @@ static JSBool
|
|||
ContextCallback(JSContext *cx, uintN contextOp)
|
||||
{
|
||||
if (gOldJSContextCallback && !gOldJSContextCallback(cx, contextOp))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (contextOp == JSCONTEXT_NEW) {
|
||||
JS_SetErrorReporter(cx, my_ErrorReporter);
|
||||
JS_SetVersion(cx, JSVERSION_LATEST);
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -55,8 +55,8 @@ XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
|
|||
mThreadData(nsnull),
|
||||
mXPCContext(nsnull),
|
||||
mJSContext(cx),
|
||||
mContextPopRequired(JS_FALSE),
|
||||
mDestroyJSContextInDestructor(JS_FALSE),
|
||||
mContextPopRequired(false),
|
||||
mDestroyJSContextInDestructor(false),
|
||||
mCallerLanguage(callerLanguage)
|
||||
{
|
||||
Init(callerLanguage, callerLanguage == NATIVE_CALLER, obj, funobj,
|
||||
|
@ -75,8 +75,8 @@ XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
|
|||
mThreadData(nsnull),
|
||||
mXPCContext(nsnull),
|
||||
mJSContext(cx),
|
||||
mContextPopRequired(JS_FALSE),
|
||||
mDestroyJSContextInDestructor(JS_FALSE),
|
||||
mContextPopRequired(false),
|
||||
mDestroyJSContextInDestructor(false),
|
||||
mCallerLanguage(callerLanguage),
|
||||
mFlattenedJSObject(flattenedJSObject),
|
||||
mWrapper(wrapper),
|
||||
|
@ -136,7 +136,7 @@ XPCCallContext::Init(XPCContext::LangType callerLanguage,
|
|||
NS_ERROR("bad!");
|
||||
return;
|
||||
}
|
||||
mContextPopRequired = JS_TRUE;
|
||||
mContextPopRequired = true;
|
||||
}
|
||||
|
||||
// Get into the request as early as we can to avoid problems with scanning
|
||||
|
@ -212,7 +212,7 @@ XPCCallContext::SetName(jsid name)
|
|||
mSet = nsnull;
|
||||
mInterface = mTearOff->GetInterface();
|
||||
mMember = mInterface->FindMember(name);
|
||||
mStaticMemberIsLocal = JS_TRUE;
|
||||
mStaticMemberIsLocal = true;
|
||||
if (mMember && !mMember->IsConstant())
|
||||
mMethodIndex = mMember->GetIndex();
|
||||
} else {
|
||||
|
@ -229,7 +229,7 @@ XPCCallContext::SetName(jsid name)
|
|||
} else {
|
||||
mMember = nsnull;
|
||||
mInterface = nsnull;
|
||||
mStaticMemberIsLocal = JS_FALSE;
|
||||
mStaticMemberIsLocal = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,14 +270,14 @@ XPCCallContext::SetArgsAndResultPtr(uintN argc,
|
|||
mSet = nsnull;
|
||||
mInterface = nsnull;
|
||||
mMember = nsnull;
|
||||
mStaticMemberIsLocal = JS_FALSE;
|
||||
mStaticMemberIsLocal = false;
|
||||
}
|
||||
|
||||
mArgc = argc;
|
||||
mArgv = argv;
|
||||
mRetVal = rval;
|
||||
|
||||
mReturnValueWasSet = JS_FALSE;
|
||||
mReturnValueWasSet = false;
|
||||
mState = HAVE_ARGS;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ XPCCallContext::CanCallNow()
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (!mTearOff) {
|
||||
mTearOff = mWrapper->FindTearOff(*this, mInterface, JS_FALSE, &rv);
|
||||
mTearOff = mWrapper->FindTearOff(*this, mInterface, false, &rv);
|
||||
if (!mTearOff || mTearOff->GetInterface() != mInterface) {
|
||||
mTearOff = nsnull;
|
||||
return NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -65,7 +65,7 @@ using namespace js;
|
|||
static nsresult ThrowAndFail(uintN errNum, JSContext* cx, bool* retval)
|
||||
{
|
||||
XPCThrower::Throw(errNum, cx);
|
||||
*retval = JS_FALSE;
|
||||
*retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,9 @@ JSValIsInterfaceOfType(JSContext *cx, jsval v, REFNSIID iid)
|
|||
getter_AddRefs(wn))) && wn &&
|
||||
NS_SUCCEEDED(wn->Native()->QueryInterface(iid, (void**)&iface)) && iface) {
|
||||
NS_RELEASE(iface);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
char* xpc_CloneAllAccess()
|
||||
|
@ -1625,7 +1625,7 @@ nsXPCComponents_ID::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
|||
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
|
||||
if (sm && NS_FAILED(sm->CanCreateInstance(cx, nsJSID::GetCID()))) {
|
||||
// the security manager vetoed. It should have set an exception.
|
||||
*_retval = JS_FALSE;
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1845,7 +1845,7 @@ nsXPCComponents_Exception::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
|||
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
|
||||
if (sm && NS_FAILED(sm->CanCreateInstance(cx, nsXPCException::GetCID()))) {
|
||||
// the security manager vetoed. It should have set an exception.
|
||||
*_retval = JS_FALSE;
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2177,7 +2177,7 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
|||
if (!JS_CallFunctionName(cx, cidObj, "createInstance", 1, ctorArgs, &val) ||
|
||||
JSVAL_IS_PRIMITIVE(val)) {
|
||||
// createInstance will have thrown an exception
|
||||
*_retval = JS_FALSE;
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2199,7 +2199,7 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
|||
|
||||
if (!JS_CallFunctionValue(cx, newObj, fun, argc, argv, &ignored)) {
|
||||
// function should have thrown an exception
|
||||
*_retval = JS_FALSE;
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -2401,7 +2401,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
|||
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
|
||||
if (sm && NS_FAILED(sm->CanCreateInstance(cx, nsXPCConstructor::GetCID()))) {
|
||||
// the security manager vetoed. It should have set an exception.
|
||||
*_retval = JS_FALSE;
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2876,21 +2876,21 @@ SandboxDump(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSString *str;
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsZAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsDependentString wstr(chars, length);
|
||||
char *cstr = ToNewUTF8String(wstr);
|
||||
if (!cstr)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// Be nice and convert all \r to \n.
|
||||
|
@ -2906,7 +2906,7 @@ SandboxDump(JSContext *cx, uintN argc, jsval *vp)
|
|||
fflush(stderr);
|
||||
NS_Free(cstr);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -2915,7 +2915,7 @@ SandboxDebug(JSContext *cx, uintN argc, jsval *vp)
|
|||
#ifdef DEBUG
|
||||
return SandboxDump(cx, argc, vp);
|
||||
#else
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2924,12 +2924,12 @@ SandboxImport(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSObject *thisobj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!thisobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
jsval *argv = JS_ARGV(cx, vp);
|
||||
if (argc < 1 || JSVAL_IS_PRIMITIVE(argv[0])) {
|
||||
XPCThrower::Throw(NS_ERROR_INVALID_ARG, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString *funname;
|
||||
|
@ -2937,7 +2937,7 @@ SandboxImport(JSContext *cx, uintN argc, jsval *vp)
|
|||
// Use the second parameter as the function name.
|
||||
funname = JS_ValueToString(cx, argv[1]);
|
||||
if (!funname)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
argv[1] = STRING_TO_JSVAL(funname);
|
||||
} else {
|
||||
// NB: funobj must only be used to get the JSFunction out.
|
||||
|
@ -2948,26 +2948,26 @@ SandboxImport(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, funobj)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSFunction *fun = JS_ValueToFunction(cx, OBJECT_TO_JSVAL(funobj));
|
||||
if (!fun) {
|
||||
XPCThrower::Throw(NS_ERROR_INVALID_ARG, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use the actual function name as the name.
|
||||
funname = JS_GetFunctionId(fun);
|
||||
if (!funname) {
|
||||
XPCThrower::Throw(NS_ERROR_INVALID_ARG, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
jsid id;
|
||||
if (!JS_ValueToId(cx, STRING_TO_JSVAL(funname), &id))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_SetPropertyById(cx, thisobj, id, &argv[0]);
|
||||
|
@ -2999,7 +2999,7 @@ sandbox_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
{
|
||||
if (type == JSTYPE_OBJECT) {
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return JS_ConvertStub(cx, obj, type, vp);
|
||||
|
@ -3410,7 +3410,7 @@ ContextHolder::ContextHolderOperationCallback(JSContext *cx)
|
|||
|
||||
JSContext *origCx = thisObject->mOrigCx;
|
||||
JSOperationCallback callback = JS_GetOperationCallback(origCx);
|
||||
JSBool ok = JS_TRUE;
|
||||
JSBool ok = true;
|
||||
if (callback)
|
||||
ok = callback(origCx);
|
||||
return ok;
|
||||
|
@ -3901,7 +3901,7 @@ FunctionWrapper(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
jsval v;
|
||||
if (!JS_GetReservedSlot(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)), 0, &v))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
NS_ASSERTION(JSVAL_IS_OBJECT(v), "weird function");
|
||||
|
||||
return JS_CallFunctionValue(cx, JS_THIS_OBJECT(cx, vp), v,
|
||||
|
@ -3914,13 +3914,13 @@ WrapCallable(JSContext *cx, JSObject *obj, jsid id, JSObject *propobj, jsval *vp
|
|||
JSFunction *fun = JS_NewFunctionById(cx, FunctionWrapper, 0, 0,
|
||||
JS_GetGlobalForObject(cx, obj), id);
|
||||
if (!fun)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
if (!JS_SetReservedSlot(cx, funobj, 0, OBJECT_TO_JSVAL(propobj)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*vp = OBJECT_TO_JSVAL(funobj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* void makeObjectPropsNormal(jsval vobj); */
|
||||
|
@ -4079,7 +4079,7 @@ NS_IMETHODIMP
|
|||
nsXPCComponents_Utils::SetGCZeal(PRInt32 aValue, JSContext* cx)
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_SetGCZeal(cx, PRUint8(aValue), JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
JS_SetGCZeal(cx, PRUint8(aValue), JS_DEFAULT_ZEAL_FREQ, false);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4326,15 +4326,15 @@ nsXPCComponents::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
|||
if (!xpcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
bool doResult = JS_FALSE;
|
||||
bool doResult = false;
|
||||
nsresult res;
|
||||
XPCJSRuntime* rt = xpcc->GetRuntime();
|
||||
if (id == rt->GetStringID(XPCJSRuntime::IDX_LAST_RESULT)) {
|
||||
res = xpcc->GetLastResult();
|
||||
doResult = JS_TRUE;
|
||||
doResult = true;
|
||||
} else if (id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE)) {
|
||||
res = xpcc->GetPendingResult();
|
||||
doResult = JS_TRUE;
|
||||
doResult = true;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -4381,11 +4381,11 @@ nsXPCComponents::AttachNewComponentsObject(XPCCallContext& ccx,
|
|||
JSObject* aGlobal)
|
||||
{
|
||||
if (!aGlobal)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsXPCComponents* components = new nsXPCComponents();
|
||||
if (!components)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIXPCComponents> cholder(components);
|
||||
|
||||
|
@ -4393,14 +4393,14 @@ nsXPCComponents::AttachNewComponentsObject(XPCCallContext& ccx,
|
|||
iface = XPCNativeInterface::GetNewOrUsed(ccx, &NS_GET_IID(nsIXPCComponents));
|
||||
|
||||
if (!iface)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCOMPtr<XPCWrappedNative> wrapper;
|
||||
xpcObjectHelper helper(cholder);
|
||||
XPCWrappedNative::GetNewOrUsed(ccx, helper, aScope, iface,
|
||||
OBJ_IS_NOT_GLOBAL, getter_AddRefs(wrapper));
|
||||
if (!wrapper)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
aScope->SetComponents(components);
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -70,7 +70,7 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
|
|||
{
|
||||
JSPropertyDescArray callProps = {0, nsnull};
|
||||
JSPropertyDescArray thisProps = {0, nsnull};
|
||||
JSBool gotThisVal = JS_FALSE;
|
||||
JSBool gotThisVal = false;
|
||||
jsval thisVal;
|
||||
JSObject* callObj = nsnull;
|
||||
JSString* funname = nsnull;
|
||||
|
@ -283,7 +283,7 @@ xpc_DumpJSStack(JSContext* cx, JSBool showArgs, JSBool showLocals, JSBool showTh
|
|||
fputs(buf, stdout);
|
||||
JS_smprintf_free(buf);
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
char*
|
||||
|
@ -323,7 +323,7 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx, JSUint32 frameno, const char* text)
|
|||
|
||||
if (!cx || !text) {
|
||||
puts("invalid params passed to xpc_DumpEvalInJSStackFrame!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("js[%d]> %s\n", frameno, text);
|
||||
|
@ -336,7 +336,7 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx, JSUint32 frameno, const char* text)
|
|||
|
||||
if (!fp) {
|
||||
puts("invalid frame number!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
@ -355,7 +355,7 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx, JSUint32 frameno, const char* text)
|
|||
puts("eval failed!");
|
||||
JS_SetErrorReporter(cx, older);
|
||||
JS_RestoreExceptionState(cx, exceptionState);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -368,7 +368,7 @@ xpc_DebuggerKeywordHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
|
|||
"------------------------------------------------------------------------";
|
||||
puts(line);
|
||||
puts("Hit JavaScript \"debugger\" keyword. JS call stack...");
|
||||
xpc_DumpJSStack(cx, JS_TRUE, JS_TRUE, JS_FALSE);
|
||||
xpc_DumpJSStack(cx, true, true, false);
|
||||
puts(line);
|
||||
return JSTRAP_CONTINUE;
|
||||
}
|
||||
|
@ -473,5 +473,5 @@ xpc_DumpJSObject(JSObject* obj)
|
|||
else
|
||||
puts("xpc_DumpJSObject passed null!");
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@ nsXPCException::NameAndFormatForNSResult(nsresult rv,
|
|||
if (rv == p->rv) {
|
||||
if (name) *name = p->name;
|
||||
if (format) *format = p->format;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -404,7 +404,7 @@ nsXPCException::ToString(char **_retval)
|
|||
return final ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
JSBool nsXPCException::sEverMadeOneFromFactory = JS_FALSE;
|
||||
JSBool nsXPCException::sEverMadeOneFromFactory = false;
|
||||
|
||||
// static
|
||||
nsresult
|
||||
|
@ -424,7 +424,7 @@ nsXPCException::NewException(const char *aMessage,
|
|||
if (!sEverMadeOneFromFactory) {
|
||||
nsCOMPtr<nsIXPCException> e =
|
||||
do_CreateInstance(XPC_EXCEPTION_CONTRACTID);
|
||||
sEverMadeOneFromFactory = JS_TRUE;
|
||||
sEverMadeOneFromFactory = true;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
@ -423,7 +423,7 @@ XPCNativeSet::FindMember(jsid name, XPCNativeMember** pMember,
|
|||
*pMember = nsnull;
|
||||
if (pInterfaceIndex)
|
||||
*pInterfaceIndex = (PRUint16) i;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,10 +435,10 @@ XPCNativeSet::FindMember(jsid name, XPCNativeMember** pMember,
|
|||
*pMember = member;
|
||||
if (pInterfaceIndex)
|
||||
*pInterfaceIndex = (PRUint16) i;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -447,9 +447,9 @@ XPCNativeSet::FindMember(jsid name, XPCNativeMember** pMember,
|
|||
{
|
||||
PRUint16 index;
|
||||
if (!FindMember(name, pMember, &index))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pInterface = mInterfaces[index];
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -464,7 +464,7 @@ XPCNativeSet::FindMember(jsid name,
|
|||
XPCNativeMember* protoMember;
|
||||
|
||||
if (!FindMember(name, &Member, &Interface))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*pMember = Member;
|
||||
*pInterface = Interface;
|
||||
|
@ -477,7 +477,7 @@ XPCNativeSet::FindMember(jsid name,
|
|||
(!protoSet->FindMember(name, &protoMember, (PRUint16*)nsnull) ||
|
||||
protoMember != Member));
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline XPCNativeInterface*
|
||||
|
@ -515,9 +515,9 @@ XPCNativeSet::HasInterface(XPCNativeInterface* aInterface) const
|
|||
|
||||
for (int i = (int) mInterfaceCount; i > 0; i--, pp++) {
|
||||
if (aInterface == *pp)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -533,13 +533,13 @@ XPCNativeSet::HasInterfaceWithAncestor(const nsIID* iid) const
|
|||
XPCNativeInterface* const * pp = mInterfaces+1;
|
||||
for (int i = (int) mInterfaceCount; i > 1; i--, pp++)
|
||||
if ((*pp)->HasAncestor(iid))
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
// This is rare, so check last.
|
||||
if (iid == &NS_GET_IID(nsISupports))
|
||||
return true;
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -554,11 +554,11 @@ XPCNativeSet::MatchesSetUpToInterface(const XPCNativeSet* other,
|
|||
for (int i = (int) count; i > 0; i--, pp1++, pp2++) {
|
||||
XPCNativeInterface* cur = (*pp1);
|
||||
if (cur != (*pp2))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
if (cur == iface)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void XPCNativeSet::Mark()
|
||||
|
@ -648,8 +648,8 @@ xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id)
|
|||
jsval prop;
|
||||
|
||||
if (!JS_LookupPropertyById(cx, obj, id, &prop))
|
||||
return JS_FALSE;
|
||||
return JS_TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline JSObject*
|
||||
|
@ -690,7 +690,7 @@ inline
|
|||
JSBool ThrowBadParam(nsresult rv, uintN paramNum, XPCCallContext& ccx)
|
||||
{
|
||||
XPCThrower::ThrowBadParam(rv, paramNum, ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
|
@ -274,7 +274,7 @@ NS_METHOD GetSharedScriptableHelperForJSIID(PRUint32 language,
|
|||
|
||||
/******************************************************/
|
||||
|
||||
static JSBool gClassObjectsWereInited = JS_FALSE;
|
||||
static JSBool gClassObjectsWereInited = false;
|
||||
|
||||
#define NULL_CID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
|
@ -293,7 +293,7 @@ void xpc_InitJSxIDClassObjects()
|
|||
gSharedScriptableHelperForJSIID = new SharedScriptableHelperForJSIID();
|
||||
NS_ADDREF(gSharedScriptableHelperForJSIID);
|
||||
}
|
||||
gClassObjectsWereInited = JS_TRUE;
|
||||
gClassObjectsWereInited = true;
|
||||
}
|
||||
|
||||
void xpc_DestroyJSxIDClassObjects()
|
||||
|
@ -302,7 +302,7 @@ void xpc_DestroyJSxIDClassObjects()
|
|||
NS_IF_RELEASE(NS_CLASSINFO_NAME(nsJSCID));
|
||||
NS_IF_RELEASE(gSharedScriptableHelperForJSIID);
|
||||
|
||||
gClassObjectsWereInited = JS_FALSE;
|
||||
gClassObjectsWereInited = false;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -481,7 +481,7 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
JSContext * cx, JSObject * obj,
|
||||
const jsval &val, bool *bp, bool *_retval)
|
||||
{
|
||||
*bp = JS_FALSE;
|
||||
*bp = false;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
|
@ -497,7 +497,7 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
if (IS_SLIM_WRAPPER(obj)) {
|
||||
XPCWrappedNativeProto* proto = GetSlimWrapperProto(obj);
|
||||
if (proto->GetSet()->HasInterfaceWithAncestor(iid)) {
|
||||
*bp = JS_TRUE;
|
||||
*bp = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
// to be an interface that the objects *expects* to be able to
|
||||
// handle.
|
||||
if (other_wrapper->HasInterfaceNoQI(*iid)) {
|
||||
*bp = JS_TRUE;
|
||||
*bp = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -546,8 +546,8 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
iface = XPCNativeInterface::GetNewOrUsed(ccx, iid);
|
||||
|
||||
nsresult findResult = NS_OK;
|
||||
if (iface && other_wrapper->FindTearOff(ccx, iface, JS_FALSE, &findResult))
|
||||
*bp = JS_TRUE;
|
||||
if (iface && other_wrapper->FindTearOff(ccx, iface, false, &findResult))
|
||||
*bp = true;
|
||||
if (NS_FAILED(findResult) && findResult != NS_ERROR_NO_INTERFACE)
|
||||
rv = findResult;
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ nsJSCID::CreateInstance(nsISupports **_retval)
|
|||
rv = xpc->WrapNativeToJSVal(cx, obj, inst, nsnull, iid, true, vp, nsnull);
|
||||
if (NS_FAILED(rv) || JSVAL_IS_PRIMITIVE(*vp))
|
||||
return NS_ERROR_XPC_CANT_CREATE_WN;
|
||||
ccxp->SetReturnValueWasSet(JS_TRUE);
|
||||
ccxp->SetReturnValueWasSet(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -830,7 +830,7 @@ nsJSCID::GetService(nsISupports **_retval)
|
|||
return NS_ERROR_XPC_CANT_CREATE_WN;
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(instJSObj);
|
||||
ccxp->SetReturnValueWasSet(JS_TRUE);
|
||||
ccxp->SetReturnValueWasSet(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -860,7 +860,7 @@ nsJSCID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
JSContext * cx, JSObject * obj,
|
||||
const jsval &val, bool *bp, bool *_retval)
|
||||
{
|
||||
*bp = JS_FALSE;
|
||||
*bp = false;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
|
|
|
@ -242,12 +242,12 @@ ContextCallback(JSContext *cx, uintN operation)
|
|||
if (self) {
|
||||
if (operation == JSCONTEXT_NEW) {
|
||||
if (!self->OnJSContextNew(cx))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
} else if (operation == JSCONTEXT_DESTROY) {
|
||||
delete XPCContext::GetXPCContext(cx);
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
xpc::CompartmentPrivate::~CompartmentPrivate()
|
||||
|
@ -262,11 +262,11 @@ CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
|
|||
|
||||
XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
|
||||
if (!self)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
nsAutoPtr<xpc::CompartmentPrivate> priv(static_cast<xpc::CompartmentPrivate*>(JS_SetCompartmentPrivate(cx, compartment, nsnull)));
|
||||
if (!priv)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
if (xpc::PtrAndPrincipalHashKey *key = priv->key) {
|
||||
XPCCompartmentMap &map = self->GetCompartmentMap();
|
||||
|
@ -291,7 +291,7 @@ CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
|
|||
map.Remove(ptr);
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
struct ObjectHolder : public JSDHashEntryHdr
|
||||
|
@ -654,13 +654,13 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
|
|||
{
|
||||
XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
|
||||
if (!self)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
switch (status) {
|
||||
case JSGC_BEGIN:
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// We seem to sometime lose the unrooted global flag. Restore it
|
||||
|
@ -707,13 +707,13 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
|
|||
self->GetCompartmentMap().EnumerateRead((XPCCompartmentMap::EnumReadFunction)
|
||||
SweepCompartment, cx);
|
||||
|
||||
self->mDoingFinalization = JS_TRUE;
|
||||
self->mDoingFinalization = true;
|
||||
break;
|
||||
}
|
||||
case JSGC_FINALIZE_END:
|
||||
{
|
||||
NS_ASSERTION(self->mDoingFinalization, "bad state");
|
||||
self->mDoingFinalization = JS_FALSE;
|
||||
self->mDoingFinalization = false;
|
||||
|
||||
// Release all the members whose JSObjects are now known
|
||||
// to be dead.
|
||||
|
@ -921,10 +921,10 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
|
|||
nsTArray<JSGCCallback> callbacks(self->extraGCCallbacks);
|
||||
for (PRUint32 i = 0; i < callbacks.Length(); ++i) {
|
||||
if (!callbacks[i](cx, status))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Auto JS GC lock helper.
|
||||
|
@ -2058,7 +2058,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
mThreadRunningGC(nsnull),
|
||||
mWrappedJSToReleaseArray(),
|
||||
mNativesToReleaseArray(),
|
||||
mDoingFinalization(JS_FALSE),
|
||||
mDoingFinalization(false),
|
||||
mVariantRoots(nsnull),
|
||||
mWrappedJSRoots(nsnull),
|
||||
mObjectHolderRoots(nsnull),
|
||||
|
@ -2076,7 +2076,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
|
||||
DOM_InitInterfaces();
|
||||
Preferences::AddBoolVarCache(&gNewDOMBindingsEnabled, "dom.new_bindings",
|
||||
JS_FALSE);
|
||||
false);
|
||||
|
||||
|
||||
// these jsids filled in later when we have a JSContext to work with.
|
||||
|
@ -2178,7 +2178,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
|||
NS_TIME_FUNCTION;
|
||||
|
||||
// if it is our first context then we need to generate our string ids
|
||||
JSBool ok = JS_TRUE;
|
||||
JSBool ok = true;
|
||||
if (JSID_IS_VOID(mStrIDs[0])) {
|
||||
JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
|
||||
{
|
||||
|
@ -2189,7 +2189,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
|||
JSString* str = JS_InternString(cx, mStrings[i]);
|
||||
if (!str || !JS_ValueToId(cx, STRING_TO_JSVAL(str), &mStrIDs[i])) {
|
||||
mStrIDs[0] = JSID_VOID;
|
||||
ok = JS_FALSE;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
mStrJSVals[i] = STRING_TO_JSVAL(str);
|
||||
|
@ -2199,22 +2199,22 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
|||
ok = mozilla::dom::binding::DefineStaticJSVals(cx);
|
||||
}
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCPerThreadData* tls = XPCPerThreadData::GetData(cx);
|
||||
if (!tls)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCContext* xpc = new XPCContext(this, cx);
|
||||
if (!xpc)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024);
|
||||
|
||||
// we want to mark the global object ourselves since we use a different color
|
||||
JS_ToggleOptions(cx, JSOPTION_UNROOTED_GLOBAL);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -93,50 +93,34 @@ nsresult xpcJSWeakReference::Init()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcJSWeakReference::Get()
|
||||
xpcJSWeakReference::Get(JSContext* aCx, JS::Value* aRetval)
|
||||
{
|
||||
nsresult rv;
|
||||
*aRetval = JSVAL_NULL;
|
||||
|
||||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if (!xpc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
if (!mWrappedJSObject) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAXPCNativeCallContext* cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryReferent(mWrappedJSObject);
|
||||
if (!wrappedObj) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSContext *cx;
|
||||
cc->GetJSContext(&cx);
|
||||
if (!cx)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
jsval *retval = nsnull;
|
||||
cc->GetRetValPtr(&retval);
|
||||
if (!retval)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
*retval = JSVAL_NULL;
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj;
|
||||
|
||||
if (mWrappedJSObject &&
|
||||
NS_SUCCEEDED(mWrappedJSObject->QueryReferent(NS_GET_IID(nsIXPConnectWrappedJS), getter_AddRefs(wrappedObj))) &&
|
||||
wrappedObj) {
|
||||
JSObject *obj;
|
||||
wrappedObj->GetJSObject(&obj);
|
||||
if (obj) {
|
||||
if (!obj) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Most users of XPCWrappedJS don't need to worry about
|
||||
// re-wrapping because things are implicitly rewrapped by
|
||||
// xpcconvert. However, because we're doing this directly
|
||||
// through the native call context, we need to call
|
||||
// JS_WrapObject().
|
||||
|
||||
if (!JS_WrapObject(cx, &obj)) {
|
||||
if (!JS_WrapObject(aCx, &obj)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*retval = OBJECT_TO_JSVAL(obj);
|
||||
}
|
||||
}
|
||||
|
||||
*aRetval = OBJECT_TO_JSVAL(obj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
|
|||
{
|
||||
nsDependentJSString depStr;
|
||||
if (!depStr.init(cx, src)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString result;
|
||||
|
@ -104,12 +104,12 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
|
|||
JSString *ucstr =
|
||||
JS_NewUCStringCopyN(cx, (jschar*)result.get(), result.Length());
|
||||
if (!ucstr) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
*rval = STRING_TO_JSVAL(ucstr);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -242,11 +242,11 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
|
|||
|
||||
if (!str) {
|
||||
nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_OUT_OF_MEMORY);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -275,13 +275,13 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
|
|||
if (NS_FAILED(rv)) {
|
||||
nsDOMClassInfo::ThrowJSException(cx, rv);
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsDependentJSString depStr1, depStr2;
|
||||
if (!depStr1.init(cx, src1) || !depStr2.init(cx, src2)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
PRInt32 result;
|
||||
|
@ -291,12 +291,12 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
|
|||
if (NS_FAILED(rv)) {
|
||||
nsDOMClassInfo::ThrowJSException(cx, rv);
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
*rval = INT_TO_JSVAL(result);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICollation> mCollation;
|
||||
|
@ -343,9 +343,9 @@ DelocalizeContextCallback(JSContext *cx, uintN contextOp)
|
|||
{
|
||||
NS_ABORT_IF_FALSE(JS_GetRuntime(cx) == sHookedRuntime, "unknown runtime!");
|
||||
|
||||
JSBool ok = JS_TRUE;
|
||||
JSBool ok = true;
|
||||
if (sOldContextCallback && !sOldContextCallback(cx, contextOp)) {
|
||||
ok = JS_FALSE;
|
||||
ok = false;
|
||||
// Even if the old callback fails, we still have to march on or
|
||||
// else we might leak the intl stuff hooked onto |cx|
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ LogSlimWrapperWillMorph(JSContext *cx, JSObject *obj, const char *propname,
|
|||
printf(" for %s", propname);
|
||||
printf(" (%p, %p)\n", obj,
|
||||
static_cast<nsISupports*>(xpc_GetJSPrivate(obj)));
|
||||
xpc_DumpJSStack(cx, JS_FALSE, JS_FALSE, JS_FALSE);
|
||||
xpc_DumpJSStack(cx, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,6 @@ LogSlimWrapperNotCreated(JSContext *cx, nsISupports *obj, const char *reason)
|
|||
if (className)
|
||||
PR_Free(className);
|
||||
JSAutoRequest autoRequest(cx);
|
||||
xpc_DumpJSStack(cx, JS_FALSE, JS_FALSE, JS_FALSE);
|
||||
xpc_DumpJSStack(cx, false, false, false);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -302,20 +302,20 @@ NativeSetMap::Entry::Match(JSDHashTable *table,
|
|||
XPCNativeSet* Set2 = ((Entry*)entry)->key_value;
|
||||
|
||||
if (Set1 == Set2)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
PRUint16 count = Set1->GetInterfaceCount();
|
||||
if (count != Set2->GetInterfaceCount())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCNativeInterface** Current1 = Set1->GetInterfaceArray();
|
||||
XPCNativeInterface** Current2 = Set2->GetInterfaceArray();
|
||||
for (PRUint16 i = 0; i < count; i++) {
|
||||
if (*(Current1++) != *(Current2++))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
XPCNativeSet* SetInTable = ((Entry*)entry)->key_value;
|
||||
|
@ -339,11 +339,11 @@ NativeSetMap::Entry::Match(JSDHashTable *table,
|
|||
}
|
||||
|
||||
if (!Addition && Set == SetInTable)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
PRUint16 count = Set->GetInterfaceCount() + (Addition ? 1 : 0);
|
||||
if (count != SetInTable->GetInterfaceCount())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
PRUint16 Position = Key->GetPosition();
|
||||
XPCNativeInterface** CurrentInTable = SetInTable->GetInterfaceArray();
|
||||
|
@ -351,14 +351,14 @@ NativeSetMap::Entry::Match(JSDHashTable *table,
|
|||
for (PRUint16 i = 0; i < count; i++) {
|
||||
if (Addition && i == Position) {
|
||||
if (Addition != *(CurrentInTable++))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
} else {
|
||||
if (*(Current++) != *(CurrentInTable++))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
struct JSDHashTableOps NativeSetMap::Entry::sOps =
|
||||
|
@ -481,7 +481,7 @@ XPCNativeScriptableSharedMap::Entry::Match(JSDHashTable *table,
|
|||
|
||||
if (obj1->GetFlags() != obj2->GetFlags() ||
|
||||
obj1->GetInterfacesBitmap() != obj2->GetInterfacesBitmap())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
const char* name1 = obj1->GetJSClass()->name;
|
||||
const char* name2 = obj2->GetJSClass()->name;
|
||||
|
@ -540,7 +540,7 @@ XPCNativeScriptableSharedMap::GetNewOrUsed(JSUint32 flags,
|
|||
Entry* entry = (Entry*)
|
||||
JS_DHashTableOperate(mTable, &key, JS_DHASH_ADD);
|
||||
if (!entry)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCNativeScriptableShared* shared = entry->key;
|
||||
|
||||
|
@ -549,11 +549,11 @@ XPCNativeScriptableSharedMap::GetNewOrUsed(JSUint32 flags,
|
|||
new XPCNativeScriptableShared(flags, key.TransferNameOwnership(),
|
||||
interfacesBitmap);
|
||||
if (!shared)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
shared->PopulateJSClass(isGlobal);
|
||||
}
|
||||
si->SetScriptableShared(shared);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -146,21 +146,21 @@ PropertyOpForwarder(JSContext *cx, uintN argc, jsval *vp)
|
|||
JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
jsval v;
|
||||
|
||||
if (!JS_GetReservedSlot(cx, callee, 0, &v))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSObject *ptrobj = JSVAL_TO_OBJECT(v);
|
||||
Op *popp = static_cast<Op *>(JS_GetPrivate(cx, ptrobj));
|
||||
|
||||
if (!JS_GetReservedSlot(cx, callee, 1, &v))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
jsval argval = (argc > 0) ? JS_ARGV(cx, vp)[0] : JSVAL_VOID;
|
||||
jsid id;
|
||||
if (!JS_ValueToId(cx, argval, &id))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JS_SET_RVAL(cx, vp, argval);
|
||||
return ApplyPropertyOp<Op>(cx, *popp, obj, id, vp);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ GeneratePropertyOp(JSContext *cx, JSObject *obj, jsid id, uintN argc, Op pop)
|
|||
JSFunction *fun =
|
||||
JS_NewFunctionById(cx, PropertyOpForwarder<Op>, argc, 0, obj, id);
|
||||
if (!fun)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
|
||||
|
@ -199,10 +199,10 @@ GeneratePropertyOp(JSContext *cx, JSObject *obj, jsid id, uintN argc, Op pop)
|
|||
// second object to work around this.
|
||||
JSObject *ptrobj = JS_NewObject(cx, &PointerHolderClass, nsnull, funobj);
|
||||
if (!ptrobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
Op *popp = new Op;
|
||||
if (!popp)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*popp = pop;
|
||||
JS_SetPrivate(cx, ptrobj, popp);
|
||||
|
||||
|
@ -225,7 +225,7 @@ ReifyPropertyOps(JSContext *cx, JSObject *obj, jsid id, uintN orig_attrs,
|
|||
if (getter) {
|
||||
getterobj = GeneratePropertyOp(cx, obj, id, 0, getter);
|
||||
if (!getterobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
roots[0] = OBJECT_TO_JSVAL(getterobj);
|
||||
attrs |= JSPROP_GETTER;
|
||||
} else
|
||||
|
@ -235,7 +235,7 @@ ReifyPropertyOps(JSContext *cx, JSObject *obj, jsid id, uintN orig_attrs,
|
|||
if (setter) {
|
||||
setterobj = GeneratePropertyOp(cx, obj, id, 1, setter);
|
||||
if (!setterobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
roots[1] = OBJECT_TO_JSVAL(setterobj);
|
||||
attrs |= JSPROP_SETTER;
|
||||
} else
|
||||
|
@ -258,24 +258,24 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, uintN argc, jsval *vp)
|
|||
|
||||
if (argc == 0) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
jsval idval = JS_ARGV(cx, vp)[0];
|
||||
jsid id;
|
||||
JSPropertyDescriptor desc;
|
||||
if (!JS_ValueToId(cx, idval, &id) ||
|
||||
!JS_GetPropertyDescriptorById(cx, obj, id, JSRESOLVE_QUALIFIED, &desc))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// No property at all means no getters or setters possible.
|
||||
if (!desc.obj) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Inline obj_lookup[GS]etter here.
|
||||
|
@ -283,13 +283,13 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, uintN argc, jsval *vp)
|
|||
if (desc.attrs & JSPROP_GETTER) {
|
||||
JS_SET_RVAL(cx, vp,
|
||||
OBJECT_TO_JSVAL(JS_FUNC_TO_DATA_PTR(JSObject *, desc.getter)));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (desc.attrs & JSPROP_SETTER) {
|
||||
JS_SET_RVAL(cx, vp,
|
||||
OBJECT_TO_JSVAL(JS_FUNC_TO_DATA_PTR(JSObject *, desc.setter)));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,19 +304,19 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, uintN argc, jsval *vp)
|
|||
!(desc.getter || desc.setter) ||
|
||||
desc.setter == js::GetObjectJSClass(desc.obj)->setProperty) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject *getterobj, *setterobj;
|
||||
if (!ReifyPropertyOps(cx, desc.obj, id, desc.attrs, desc.getter, desc.setter,
|
||||
&getterobj, &setterobj)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject *wantedobj = wantGetter ? getterobj : setterobj;
|
||||
jsval v = wantedobj ? OBJECT_TO_JSVAL(wantedobj) : JSVAL_VOID;
|
||||
JS_SET_RVAL(cx, vp, v);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -345,7 +345,7 @@ DefineGetterOrSetter(JSContext *cx, uintN argc, JSBool wantGetter, jsval *vp)
|
|||
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSNative forward = wantGetter ? js::obj_defineGetter : js::obj_defineSetter;
|
||||
jsval idval = (argc >= 1) ? JS_ARGV(cx, vp)[0] : JSVAL_VOID;
|
||||
if (!JSVAL_IS_STRING(idval))
|
||||
|
@ -357,7 +357,7 @@ DefineGetterOrSetter(JSContext *cx, uintN argc, JSBool wantGetter, jsval *vp)
|
|||
(obj2 &&
|
||||
!JS_GetPropertyAttrsGetterAndSetterById(cx, obj2, id, &attrs,
|
||||
&found, &getter, &setter)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// The property didn't exist, already has a getter or setter, or is not
|
||||
// our property, then just forward now.
|
||||
|
@ -369,7 +369,7 @@ DefineGetterOrSetter(JSContext *cx, uintN argc, JSBool wantGetter, jsval *vp)
|
|||
|
||||
// Reify the getter and setter...
|
||||
if (!ReifyPropertyOps(cx, obj2, id, attrs, getter, setter, nsnull, nsnull))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
return forward(cx, argc, vp);
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN flags,
|
|||
if (!JS_DefineProperty(cx, proto, ps->name, JSVAL_VOID,
|
||||
ps->getter, ps->setter,
|
||||
flags | JSPROP_SHARED))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN flags,
|
|||
if (!JS_DefineFunction(cx, proto, fs->name,
|
||||
reinterpret_cast<JSNative>(fs->native),
|
||||
fs->arity, flags))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,16 +449,16 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN flags,
|
|||
};
|
||||
|
||||
if (definedProperty && !JS_DefineFunctions(cx, proto, getterfns))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
xpc_qsThrow(JSContext *cx, nsresult rv)
|
||||
{
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,7 +533,7 @@ ThrowCallFailed(JSContext *cx, nsresult rv,
|
|||
* call. So we'll just throw that exception into our JS.
|
||||
*/
|
||||
if (XPCThrower::CheckForPendingException(rv, cx))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// else...
|
||||
|
||||
|
@ -562,7 +562,7 @@ ThrowCallFailed(JSContext *cx, nsresult rv,
|
|||
if (sz)
|
||||
JS_smprintf_free(sz);
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -587,7 +587,7 @@ JSBool
|
|||
xpc_qsThrowMethodFailedWithCcx(XPCCallContext &ccx, nsresult rv)
|
||||
{
|
||||
ThrowBadResult(rv, ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -682,12 +682,12 @@ xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, jsval v, jsval *pval,
|
|||
size_t len;
|
||||
const jschar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
|
||||
if (!chars) {
|
||||
mValid = JS_FALSE;
|
||||
mValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
new(mBuf) implementation_type(chars, len);
|
||||
mValid = JS_TRUE;
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
xpc_qsACString::xpc_qsACString(JSContext *cx, jsval v, jsval *pval,
|
||||
|
@ -703,18 +703,18 @@ xpc_qsACString::xpc_qsACString(JSContext *cx, jsval v, jsval *pval,
|
|||
|
||||
size_t len = JS_GetStringEncodingLength(cx, s);
|
||||
if (len == size_t(-1)) {
|
||||
mValid = JS_FALSE;
|
||||
mValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
JSAutoByteString bytes(cx, s);
|
||||
if (!bytes) {
|
||||
mValid = JS_FALSE;
|
||||
mValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
new(mBuf) implementation_type(bytes.ptr(), len);
|
||||
mValid = JS_TRUE;
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
xpc_qsAUTF8String::xpc_qsAUTF8String(JSContext *cx, jsval v, jsval *pval)
|
||||
|
@ -728,12 +728,12 @@ xpc_qsAUTF8String::xpc_qsAUTF8String(JSContext *cx, jsval v, jsval *pval)
|
|||
size_t len;
|
||||
const PRUnichar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
|
||||
if (!chars) {
|
||||
mValid = JS_FALSE;
|
||||
mValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
new(mBuf) implementation_type(chars, len);
|
||||
mValid = JS_TRUE;
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -866,7 +866,7 @@ xpc_qsUnwrapThisFromCcxImpl(XPCCallContext &ccx,
|
|||
vp);
|
||||
if (NS_FAILED(rv))
|
||||
return xpc_qsThrow(ccx.GetJSContext(), rv);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
@ -999,19 +999,19 @@ xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pst
|
|||
str = JSVAL_TO_STRING(v);
|
||||
} else if (JSVAL_IS_VOID(v) || JSVAL_IS_NULL(v)) {
|
||||
*pstr = NULL;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
} else {
|
||||
if (!(str = JS_ValueToString(cx, v)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pval = STRING_TO_JSVAL(str); // Root the new string.
|
||||
}
|
||||
|
||||
const jschar *chars = JS_GetStringCharsZ(cx, str);
|
||||
if (!chars)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*pstr = static_cast<const PRUnichar *>(chars);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -1020,20 +1020,20 @@ xpc_qsStringToJsval(JSContext *cx, nsString &str, jsval *rval)
|
|||
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
|
||||
if (str.IsVoid()) {
|
||||
*rval = JSVAL_NULL;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsStringBuffer* sharedBuffer;
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(cx, str, &sharedBuffer);
|
||||
if (JSVAL_IS_NULL(jsstr))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*rval = jsstr;
|
||||
if (sharedBuffer) {
|
||||
// The string was shared but ReadableToJSVal didn't addref it.
|
||||
// Move the ownership from str to jsstr.
|
||||
str.ForgetSharedBuffer();
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -1042,20 +1042,20 @@ xpc_qsStringToJsstring(JSContext *cx, nsString &str, JSString **rval)
|
|||
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
|
||||
if (str.IsVoid()) {
|
||||
*rval = nsnull;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsStringBuffer* sharedBuffer;
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(cx, str, &sharedBuffer);
|
||||
if (JSVAL_IS_NULL(jsstr))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*rval = JSVAL_TO_STRING(jsstr);
|
||||
if (sharedBuffer) {
|
||||
// The string was shared but ReadableToJSVal didn't addref it.
|
||||
// Move the ownership from str to jsstr.
|
||||
str.ForgetSharedBuffer();
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -1085,7 +1085,7 @@ xpc_qsXPCOMObjectToJsval(XPCLazyCallContext &lccx, qsObjectHelper &aHelper,
|
|||
// method really ought to be fixed to behave consistently.
|
||||
if (!JS_IsExceptionPending(cx))
|
||||
xpc_qsThrow(cx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1095,7 +1095,7 @@ xpc_qsXPCOMObjectToJsval(XPCLazyCallContext &lccx, qsObjectHelper &aHelper,
|
|||
"Why did we recreate this wrapper?");
|
||||
#endif
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -1113,7 +1113,7 @@ xpc_qsVariantToJsval(XPCLazyCallContext &lccx,
|
|||
return ok;
|
||||
}
|
||||
*rval = JSVAL_NULL;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -163,7 +163,7 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN extraFlags,
|
|||
PRUint32 ifacec, const nsIID **interfaces,
|
||||
PRUint32 tableSize, const xpc_qsHashEntry *table);
|
||||
|
||||
/** Raise an exception on @a cx and return JS_FALSE. */
|
||||
/** Raise an exception on @a cx and return false. */
|
||||
JSBool
|
||||
xpc_qsThrow(JSContext *cx, nsresult rv);
|
||||
|
||||
|
@ -234,7 +234,7 @@ inline JSBool
|
|||
xpc_qsInt32ToJsval(JSContext *cx, PRInt32 i, jsval *rv)
|
||||
{
|
||||
*rv = INT_TO_JSVAL(i);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -244,7 +244,7 @@ xpc_qsUint32ToJsval(JSContext *cx, PRUint32 u, jsval *rv)
|
|||
*rv = INT_TO_JSVAL(u);
|
||||
else
|
||||
*rv = DOUBLE_TO_JSVAL(u);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
|
@ -370,13 +370,13 @@ protected:
|
|||
// eStringify should end up with void strings.
|
||||
(new(mBuf) implementation_type(traits::sEmptyBuffer, PRUint32(0)))->
|
||||
SetIsVoid(behavior != eEmpty);
|
||||
mValid = JS_TRUE;
|
||||
mValid = true;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
s = JS_ValueToString(cx, v);
|
||||
if (!s) {
|
||||
mValid = JS_FALSE;
|
||||
mValid = false;
|
||||
return nsnull;
|
||||
}
|
||||
*pval = STRING_TO_JSVAL(s); // Root the new string.
|
||||
|
@ -391,7 +391,7 @@ protected:
|
|||
*
|
||||
* xpc_qsDOMString arg0(cx, &argv[0]);
|
||||
* if (!arg0.IsValid())
|
||||
* return JS_FALSE;
|
||||
* return false;
|
||||
*
|
||||
* The second argument to the constructor is an in-out parameter. It must
|
||||
* point to a rooted jsval, such as a JSNative argument or return value slot.
|
||||
|
@ -452,7 +452,7 @@ struct xpc_qsSelfRef
|
|||
};
|
||||
|
||||
/**
|
||||
* Convert a jsval to char*, returning JS_TRUE on success.
|
||||
* Convert a jsval to char*, returning true on success.
|
||||
*
|
||||
* @param cx
|
||||
* A context.
|
||||
|
@ -469,14 +469,14 @@ JSBool
|
|||
xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pstr);
|
||||
|
||||
|
||||
/** Convert an nsString to jsval, returning JS_TRUE on success.
|
||||
/** Convert an nsString to jsval, returning true on success.
|
||||
* Note, the ownership of the string buffer may be moved from str to rval.
|
||||
* If that happens, str will point to an empty string after this call.
|
||||
*/
|
||||
JSBool
|
||||
xpc_qsStringToJsval(JSContext *cx, nsString &str, jsval *rval);
|
||||
|
||||
/** Convert an nsString to JSString, returning JS_TRUE on success. This will sometimes modify |str| to be empty. */
|
||||
/** Convert an nsString to JSString, returning true on success. This will sometimes modify |str| to be empty. */
|
||||
JSBool
|
||||
xpc_qsStringToJsstring(JSContext *cx, nsString &str, JSString **rval);
|
||||
|
||||
|
@ -505,7 +505,7 @@ castNative(JSContext *cx,
|
|||
*
|
||||
* If an object implementing T is found, store a reference to the wrapper
|
||||
* JSObject in @a *pThisVal, store a pointer to the T in @a *ppThis, and return
|
||||
* JS_TRUE. Otherwise, raise an exception on @a cx and return JS_FALSE.
|
||||
* true. Otherwise, raise an exception on @a cx and return false.
|
||||
*
|
||||
* @a *pThisRef receives the same pointer as *ppThis if the T was AddRefed.
|
||||
* Otherwise it receives null (even on error).
|
||||
|
@ -539,7 +539,7 @@ xpc_qsUnwrapThis(JSContext *cx,
|
|||
|
||||
if (NS_FAILED(rv))
|
||||
*ppThis = nsnull;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline nsISupports*
|
||||
|
@ -680,7 +680,7 @@ xpc_qsGetWrapperCache(void *p)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
/** Convert an XPCOM pointer to jsval. Return JS_TRUE on success.
|
||||
/** Convert an XPCOM pointer to jsval. Return true on success.
|
||||
* aIdentity is a performance optimization. Set it to true,
|
||||
* only if p is the identity pointer.
|
||||
*/
|
||||
|
@ -692,7 +692,7 @@ xpc_qsXPCOMObjectToJsval(XPCLazyCallContext &lccx,
|
|||
jsval *rval);
|
||||
|
||||
/**
|
||||
* Convert a variant to jsval. Return JS_TRUE on success.
|
||||
* Convert a variant to jsval. Return true on success.
|
||||
*/
|
||||
JSBool
|
||||
xpc_qsVariantToJsval(XPCLazyCallContext &ccx,
|
||||
|
@ -700,7 +700,7 @@ xpc_qsVariantToJsval(XPCLazyCallContext &ccx,
|
|||
jsval *rval);
|
||||
|
||||
/**
|
||||
* Convert a jsval to PRInt64. Return JS_TRUE on success.
|
||||
* Convert a jsval to PRInt64. Return true on success.
|
||||
*/
|
||||
inline JSBool
|
||||
xpc_qsValueToInt64(JSContext *cx,
|
||||
|
@ -710,15 +710,15 @@ xpc_qsValueToInt64(JSContext *cx,
|
|||
if (JSVAL_IS_INT(v)) {
|
||||
int32 intval;
|
||||
if (!JS_ValueToECMAInt32(cx, v, &intval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = static_cast<PRInt64>(intval);
|
||||
} else {
|
||||
jsdouble doubleval;
|
||||
if (!JS_ValueToNumber(cx, v, &doubleval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = static_cast<PRInt64>(doubleval);
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -736,7 +736,7 @@ xpc_qsDoubleToUint64(jsdouble doubleval)
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a jsval to PRUint64. Return JS_TRUE on success.
|
||||
* Convert a jsval to PRUint64. Return true on success.
|
||||
*/
|
||||
inline JSBool
|
||||
xpc_qsValueToUint64(JSContext *cx,
|
||||
|
@ -746,15 +746,15 @@ xpc_qsValueToUint64(JSContext *cx,
|
|||
if (JSVAL_IS_INT(v)) {
|
||||
uint32 intval;
|
||||
if (!JS_ValueToECMAUint32(cx, v, &intval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = static_cast<PRUint64>(intval);
|
||||
} else {
|
||||
jsdouble doubleval;
|
||||
if (!JS_ValueToNumber(cx, v, &doubleval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = xpc_qsDoubleToUint64(doubleval);
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -197,12 +197,12 @@ XPCJSStackFrame::CreateStackFrameLocation(PRUint32 aLanguage,
|
|||
nsIStackFrame* aCaller,
|
||||
XPCJSStackFrame** stack)
|
||||
{
|
||||
JSBool failed = JS_FALSE;
|
||||
JSBool failed = false;
|
||||
XPCJSStackFrame* self = new XPCJSStackFrame();
|
||||
if (self)
|
||||
NS_ADDREF(self);
|
||||
else
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
|
||||
if (!failed) {
|
||||
self->mLanguage = aLanguage;
|
||||
|
@ -214,7 +214,7 @@ XPCJSStackFrame::CreateStackFrameLocation(PRUint32 aLanguage,
|
|||
nsMemory::Clone(aFilename,
|
||||
sizeof(char)*(strlen(aFilename)+1));
|
||||
if (!self->mFilename)
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (!failed && aFunctionName) {
|
||||
|
@ -222,7 +222,7 @@ XPCJSStackFrame::CreateStackFrameLocation(PRUint32 aLanguage,
|
|||
nsMemory::Clone(aFunctionName,
|
||||
sizeof(char)*(strlen(aFunctionName)+1));
|
||||
if (!self->mFunname)
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (!failed && aCaller) {
|
||||
|
|
|
@ -178,8 +178,8 @@ XPCJSContextStack::DEBUG_StackHasJSContext(JSContext* aJSContext)
|
|||
{
|
||||
for (PRUint32 i = 0; i < mStack.Length(); i++)
|
||||
if (aJSContext == mStack[i].cx)
|
||||
return JS_TRUE;
|
||||
return JS_FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -304,7 +304,7 @@ XPCPerThreadData::XPCPerThreadData()
|
|||
mResolvingWrapper(nsnull),
|
||||
mExceptionManager(nsnull),
|
||||
mException(nsnull),
|
||||
mExceptionManagerNotAvailable(JS_FALSE),
|
||||
mExceptionManagerNotAvailable(false),
|
||||
mAutoRoots(nsnull)
|
||||
#ifdef XPC_CHECK_WRAPPER_THREADSAFETY
|
||||
, mWrappedNativeThreadsafetyReportDepth(0)
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "xpcprivate.h"
|
||||
#include "XPCWrapper.h"
|
||||
|
||||
JSBool XPCThrower::sVerbose = JS_TRUE;
|
||||
JSBool XPCThrower::sVerbose = true;
|
||||
|
||||
// static
|
||||
void
|
||||
|
@ -68,21 +68,21 @@ XPCThrower::CheckForPendingException(nsresult result, JSContext *cx)
|
|||
{
|
||||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if (!xpc)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIException> e;
|
||||
xpc->GetPendingException(getter_AddRefs(e));
|
||||
if (!e)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpc->SetPendingException(nsnull);
|
||||
|
||||
nsresult e_result;
|
||||
if (NS_FAILED(e->GetResult(&e_result)) || e_result != result)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (!ThrowExceptionObject(cx, e))
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -198,7 +198,7 @@ XPCThrower::Verbosify(XPCCallContext& ccx,
|
|||
void
|
||||
XPCThrower::BuildAndThrowException(JSContext* cx, nsresult rv, const char* sz)
|
||||
{
|
||||
JSBool success = JS_FALSE;
|
||||
JSBool success = false;
|
||||
|
||||
/* no need to set an expection if the security manager already has */
|
||||
if (rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO && JS_IsExceptionPending(cx))
|
||||
|
@ -267,7 +267,7 @@ IsCallerChrome(JSContext* cx)
|
|||
JSBool
|
||||
XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
||||
{
|
||||
JSBool success = JS_FALSE;
|
||||
JSBool success = false;
|
||||
if (e) {
|
||||
nsCOMPtr<nsIXPCException> xpcEx;
|
||||
jsval thrown;
|
||||
|
@ -280,13 +280,13 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
|||
(xpcEx = do_QueryInterface(e)) &&
|
||||
NS_SUCCEEDED(xpcEx->StealJSVal(&thrown))) {
|
||||
if (!JS_WrapValue(cx, &thrown))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JS_SetPendingException(cx, thrown);
|
||||
success = JS_TRUE;
|
||||
success = true;
|
||||
} else if ((xpc = nsXPConnect::GetXPConnect())) {
|
||||
JSObject* glob = JS_GetGlobalForScopeChain(cx);
|
||||
if (!glob)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
nsresult rv = xpc->WrapNative(cx, glob, e,
|
||||
|
@ -296,7 +296,7 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
|||
JSObject* obj;
|
||||
if (NS_SUCCEEDED(holder->GetJSObject(&obj))) {
|
||||
JS_SetPendingException(cx, OBJECT_TO_JSVAL(obj));
|
||||
success = JS_TRUE;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ XPCVariant::XPCVariant(XPCCallContext& ccx, jsval aJSVal)
|
|||
&proto);
|
||||
mReturnRawObject = !wn && !proto;
|
||||
} else
|
||||
mReturnRawObject = JS_FALSE;
|
||||
mReturnRawObject = false;
|
||||
}
|
||||
|
||||
XPCTraceableVariant::~XPCTraceableVariant()
|
||||
|
@ -220,7 +220,7 @@ XPCArrayHomogenizer::GetTypeForArray(XPCCallContext& ccx, JSObject* array,
|
|||
for (jsuint i = 0; i < length; i++) {
|
||||
jsval val;
|
||||
if (!JS_GetElement(ccx, array, i, &val))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (JSVAL_IS_INT(val))
|
||||
type = tInt;
|
||||
|
@ -294,14 +294,14 @@ XPCArrayHomogenizer::GetTypeForArray(XPCCallContext& ccx, JSObject* array,
|
|||
// FALL THROUGH
|
||||
default:
|
||||
NS_ERROR("bad state");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
||||
{
|
||||
JS_CHECK_RECURSION(ccx.GetJSContext(), return JS_FALSE);
|
||||
JS_CHECK_RECURSION(ccx.GetJSContext(), return false);
|
||||
|
||||
jsval val = GetJSVal();
|
||||
|
||||
|
@ -322,7 +322,7 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
|||
// which nsVariant assumes for its PRUnichar* stuff.
|
||||
JSString* str = JSVAL_TO_STRING(val);
|
||||
if (!JS_MakeStringImmutable(ccx, str))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// Don't use nsVariant::SetFromWStringWithSize, because that will copy
|
||||
// the data. Just handle this ourselves. Note that it's ok to not
|
||||
|
@ -335,7 +335,7 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
|||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsZAndLength(ccx, str, &length);
|
||||
if (!chars)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
mData.u.wstr.mWStringValue = const_cast<jschar *>(chars);
|
||||
// Use C-style cast, because reinterpret cast from size_t to
|
||||
|
@ -343,7 +343,7 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
|||
mData.u.wstr.mWStringLength = (PRUint32)length;
|
||||
mData.mType = nsIDataType::VTYPE_WSTRING_SIZE_IS;
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// leaving only JSObject...
|
||||
|
@ -365,18 +365,18 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
|||
if (!len) {
|
||||
// Zero length array
|
||||
nsVariant::SetToEmptyArray(&mData);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsXPTType type;
|
||||
nsID id;
|
||||
|
||||
if (!XPCArrayHomogenizer::GetTypeForArray(ccx, jsobj, len, &type, &id))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (!XPCConvert::JSArray2Native(ccx, &mData.u.array.mArrayValue,
|
||||
val, len, type, &id, nsnull))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
mData.mType = nsIDataType::VTYPE_ARRAY;
|
||||
if (type.IsInterfacePointer())
|
||||
|
@ -384,7 +384,7 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
|||
mData.u.array.mArrayCount = len;
|
||||
mData.u.array.mArrayType = type.TagPart();
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// XXX This could be smarter and pick some more interesting iface.
|
||||
|
@ -416,7 +416,7 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
// Get the type early because we might need to spoof it below.
|
||||
PRUint16 type;
|
||||
if (NS_FAILED(variant->GetDataType(&type)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
jsval realVal;
|
||||
nsresult rv = variant->GetAsJSVal(&realVal);
|
||||
|
@ -428,9 +428,9 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
type == nsIDataType::VTYPE_ID)) {
|
||||
JSContext *cx = lccx.GetJSContext();
|
||||
if (!JS_WrapValue(cx, &realVal))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pJSVal = realVal;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<XPCVariant> xpcvariant = do_QueryInterface(variant);
|
||||
|
@ -441,9 +441,9 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
|
||||
JSContext *cx = lccx.GetJSContext();
|
||||
if (!JS_WrapValue(cx, &realVal))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pJSVal = realVal;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// else, it's an object and we really need to double wrap it if we've
|
||||
|
@ -483,80 +483,80 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
{
|
||||
// Easy. Handle inline.
|
||||
if (NS_FAILED(variant->GetAsDouble(&xpctvar.val.d)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
return JS_NewNumberValue(cx, xpctvar.val.d, pJSVal);
|
||||
}
|
||||
case nsIDataType::VTYPE_BOOL:
|
||||
{
|
||||
// Easy. Handle inline.
|
||||
if (NS_FAILED(variant->GetAsBool(&xpctvar.val.b)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pJSVal = BOOLEAN_TO_JSVAL(xpctvar.val.b);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
case nsIDataType::VTYPE_CHAR:
|
||||
if (NS_FAILED(variant->GetAsChar(&xpctvar.val.c)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)TD_CHAR;
|
||||
break;
|
||||
case nsIDataType::VTYPE_WCHAR:
|
||||
if (NS_FAILED(variant->GetAsWChar(&xpctvar.val.wc)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)TD_WCHAR;
|
||||
break;
|
||||
case nsIDataType::VTYPE_ID:
|
||||
if (NS_FAILED(variant->GetAsID(&iid)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_PNSIID | XPT_TDP_POINTER);
|
||||
xpctvar.val.p = &iid;
|
||||
break;
|
||||
case nsIDataType::VTYPE_ASTRING:
|
||||
if (NS_FAILED(variant->GetAsAString(astring)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_ASTRING | XPT_TDP_POINTER);
|
||||
xpctvar.val.p = &astring;
|
||||
break;
|
||||
case nsIDataType::VTYPE_DOMSTRING:
|
||||
if (NS_FAILED(variant->GetAsAString(astring)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_DOMSTRING | XPT_TDP_POINTER);
|
||||
xpctvar.val.p = &astring;
|
||||
break;
|
||||
case nsIDataType::VTYPE_CSTRING:
|
||||
if (NS_FAILED(variant->GetAsACString(cString)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_CSTRING | XPT_TDP_POINTER);
|
||||
xpctvar.val.p = &cString;
|
||||
break;
|
||||
case nsIDataType::VTYPE_UTF8STRING:
|
||||
if (NS_FAILED(variant->GetAsAUTF8String(utf8String)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_UTF8STRING | XPT_TDP_POINTER);
|
||||
xpctvar.val.p = &utf8String;
|
||||
break;
|
||||
case nsIDataType::VTYPE_CHAR_STR:
|
||||
if (NS_FAILED(variant->GetAsString((char**)&xpctvar.val.p)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_PSTRING | XPT_TDP_POINTER);
|
||||
xpctvar.SetValNeedsCleanup();
|
||||
break;
|
||||
case nsIDataType::VTYPE_STRING_SIZE_IS:
|
||||
if (NS_FAILED(variant->GetAsStringWithSize(&size,
|
||||
(char**)&xpctvar.val.p)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_PSTRING_SIZE_IS | XPT_TDP_POINTER);
|
||||
xpctvar.SetValNeedsCleanup();
|
||||
break;
|
||||
case nsIDataType::VTYPE_WCHAR_STR:
|
||||
if (NS_FAILED(variant->GetAsWString((PRUnichar**)&xpctvar.val.p)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_PWSTRING | XPT_TDP_POINTER);
|
||||
xpctvar.SetValNeedsCleanup();
|
||||
break;
|
||||
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
|
||||
if (NS_FAILED(variant->GetAsWStringWithSize(&size,
|
||||
(PRUnichar**)&xpctvar.val.p)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
xpctvar.type = (uint8)(TD_PWSTRING_SIZE_IS | XPT_TDP_POINTER);
|
||||
xpctvar.SetValNeedsCleanup();
|
||||
break;
|
||||
|
@ -565,7 +565,7 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
{
|
||||
nsID* piid;
|
||||
if (NS_FAILED(variant->GetAsInterface(&piid, &xpctvar.val.p)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
iid = *piid;
|
||||
nsMemory::Free((char*)piid);
|
||||
|
@ -586,11 +586,11 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
|
|||
&du.u.array.mArrayCount,
|
||||
&du.u.array.mArrayValue);
|
||||
if (NS_FAILED(rv))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// must exit via VARIANT_DONE from here on...
|
||||
du.mType = nsIDataType::VTYPE_ARRAY;
|
||||
success = JS_FALSE;
|
||||
success = false;
|
||||
|
||||
nsXPTType conversionType;
|
||||
PRUint16 elementType = du.u.array.mArrayType;
|
||||
|
@ -659,19 +659,19 @@ VARIANT_DONE:
|
|||
{
|
||||
JSObject* array = JS_NewArrayObject(cx, 0, nsnull);
|
||||
if (!array)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*pJSVal = OBJECT_TO_JSVAL(array);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
case nsIDataType::VTYPE_VOID:
|
||||
*pJSVal = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
case nsIDataType::VTYPE_EMPTY:
|
||||
*pJSVal = JSVAL_NULL;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
default:
|
||||
NS_ERROR("bad type in variant!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we are here then we need to convert the data in the xpctvar.
|
||||
|
|
|
@ -316,7 +316,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
|||
nsXPCWrappedJS* wrapper = nsnull;
|
||||
nsXPCWrappedJSClass* clazz = nsnull;
|
||||
XPCJSRuntime* rt = ccx.GetRuntime();
|
||||
JSBool release_root = JS_FALSE;
|
||||
JSBool release_root = false;
|
||||
|
||||
map = rt->GetWrappedJSMap();
|
||||
if (!map) {
|
||||
|
@ -389,7 +389,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
|||
if (!root)
|
||||
goto return_wrapper;
|
||||
|
||||
release_root = JS_TRUE;
|
||||
release_root = true;
|
||||
|
||||
{ // scoped lock
|
||||
#if DEBUG_xpc_leaks
|
||||
|
|
|
@ -128,17 +128,17 @@ AutoScriptEvaluate::~AutoScriptEvaluate()
|
|||
JSBool xpc_IsReportableErrorCode(nsresult code)
|
||||
{
|
||||
if (NS_SUCCEEDED(code))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
switch (code) {
|
||||
// Error codes that we don't want to report as errors...
|
||||
// These generally indicate bad interface design AFAIC.
|
||||
case NS_ERROR_FACTORY_REGISTER_AGAIN:
|
||||
case NS_BASE_STREAM_WOULD_BLOCK:
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -240,7 +240,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(XPCCallContext& ccx,
|
|||
JSObject* id;
|
||||
jsval retval;
|
||||
JSObject* retObj;
|
||||
JSBool success = JS_FALSE;
|
||||
JSBool success = false;
|
||||
jsid funid;
|
||||
jsval fun;
|
||||
|
||||
|
@ -368,7 +368,7 @@ GetNamedPropertyAsVariantRaw(XPCCallContext& ccx,
|
|||
// Note that this always takes the T_INTERFACE path through
|
||||
// JSData2Native, so the value passed for useAllocator
|
||||
// doesn't really matter. We pass true for consistency.
|
||||
XPCConvert::JSData2Native(ccx, aResult, val, type, JS_TRUE,
|
||||
XPCConvert::JSData2Native(ccx, aResult, val, type, true,
|
||||
&NS_GET_IID(nsIVariant), pErr);
|
||||
}
|
||||
|
||||
|
@ -878,7 +878,7 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
|
|||
|
||||
rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
if (NS_FAILED(rv))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
const nsXPTParamInfo& arg_param = method->params[argnum];
|
||||
const nsXPTType& arg_type = arg_param.GetType();
|
||||
|
@ -893,7 +893,7 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
|
|||
else
|
||||
*result = nativeParams[argnum].val.u32;
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -910,7 +910,7 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
|
|||
if (type_tag == nsXPTType::T_INTERFACE) {
|
||||
if (NS_SUCCEEDED(GetInterfaceInfo()->
|
||||
GetIIDForParamNoAlloc(methodIndex, ¶m, result))) {
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
} else if (type_tag == nsXPTType::T_INTERFACE_IS) {
|
||||
uint8 argnum;
|
||||
|
@ -918,7 +918,7 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
|
|||
rv = mInfo->GetInterfaceIsArgNumberForParam(methodIndex,
|
||||
¶m, &argnum);
|
||||
if (NS_FAILED(rv))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
const nsXPTParamInfo& arg_param = method->params[argnum];
|
||||
const nsXPTType& arg_type = arg_param.GetType();
|
||||
|
@ -927,18 +927,18 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
|
|||
if (arg_param.IsIndirect()) {
|
||||
nsID** p = (nsID**) nativeParams[argnum].val.p;
|
||||
if (!p || !*p)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = **p;
|
||||
} else {
|
||||
nsID* p = (nsID*) nativeParams[argnum].val.p;
|
||||
if (!p)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*result = *p;
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1190,7 +1190,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
|||
nsresult retval = NS_ERROR_FAILURE;
|
||||
nsresult pending_result = NS_OK;
|
||||
JSBool success;
|
||||
JSBool readyToDoTheCall = JS_FALSE;
|
||||
JSBool readyToDoTheCall = false;
|
||||
nsID param_iid;
|
||||
JSObject* obj;
|
||||
const char* name = info->name;
|
||||
|
@ -1383,7 +1383,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
|||
jsval val = JSVAL_NULL;
|
||||
AUTO_MARK_JSVAL(ccx, &val);
|
||||
bool isSizedString = isArray ?
|
||||
JS_FALSE :
|
||||
false :
|
||||
type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
|
||||
type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
|||
*sp++ = val;
|
||||
}
|
||||
|
||||
readyToDoTheCall = JS_TRUE;
|
||||
readyToDoTheCall = true;
|
||||
|
||||
pre_call_clean_up:
|
||||
// clean up any 'out' params handed in
|
||||
|
@ -1550,7 +1550,7 @@ pre_call_clean_up:
|
|||
xpcc->SetException(e);
|
||||
if (sz)
|
||||
JS_smprintf_free(sz);
|
||||
success = JS_FALSE;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ pre_call_clean_up:
|
|||
// the params upon which they depend will have already been converted -
|
||||
// regardless of ordering.
|
||||
|
||||
foundDependentParam = JS_FALSE;
|
||||
foundDependentParam = false;
|
||||
for (i = 0; i < paramCount; i++) {
|
||||
const nsXPTParamInfo& param = info->params[i];
|
||||
NS_ABORT_IF_FALSE(!param.IsShared(), "[shared] implies [noscript]!");
|
||||
|
@ -1583,7 +1583,7 @@ pre_call_clean_up:
|
|||
|
||||
const nsXPTType& type = param.GetType();
|
||||
if (type.IsDependent()) {
|
||||
foundDependentParam = JS_TRUE;
|
||||
foundDependentParam = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1635,7 +1635,7 @@ pre_call_clean_up:
|
|||
JSUint32 array_count;
|
||||
bool isArray = type.IsArray();
|
||||
bool isSizedString = isArray ?
|
||||
JS_FALSE :
|
||||
false :
|
||||
type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
|
||||
type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
|
||||
|
||||
|
@ -1684,7 +1684,7 @@ pre_call_clean_up:
|
|||
break;
|
||||
} else {
|
||||
if (!XPCConvert::JSData2Native(ccx, &pv->val, val, type,
|
||||
JS_TRUE, ¶m_iid,
|
||||
true, ¶m_iid,
|
||||
nsnull))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
|
||||
if (wrapper) {
|
||||
if (Interface &&
|
||||
!wrapper->FindTearOff(ccx, Interface, JS_FALSE, &rv)) {
|
||||
!wrapper->FindTearOff(ccx, Interface, false, &rv)) {
|
||||
NS_RELEASE(wrapper);
|
||||
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
|
@ -431,8 +431,8 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
jsval newParentVal = JSVAL_NULL;
|
||||
XPCMarkableJSVal newParentVal_markable(&newParentVal);
|
||||
AutoMarkingJSVal newParentVal_automarker(ccx, &newParentVal_markable);
|
||||
JSBool needsSOW = JS_FALSE;
|
||||
JSBool needsCOW = JS_FALSE;
|
||||
JSBool needsSOW = false;
|
||||
JSBool needsCOW = false;
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
|
||||
|
@ -444,7 +444,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
return rv;
|
||||
|
||||
if (rv == NS_SUCCESS_CHROME_ACCESS_ONLY)
|
||||
needsSOW = JS_TRUE;
|
||||
needsSOW = true;
|
||||
rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent),
|
||||
|
@ -493,7 +493,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
}
|
||||
|
||||
if (wrapper) {
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, JS_FALSE, &rv)) {
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, false, &rv)) {
|
||||
NS_RELEASE(wrapper);
|
||||
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
|
@ -513,7 +513,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
wrappedjs->GetJSObject(&obj);
|
||||
if (xpc::AccessCheck::isChrome(js::GetObjectCompartment(obj)) &&
|
||||
!xpc::AccessCheck::isChrome(js::GetObjectCompartment(Scope->GetGlobalJSObject()))) {
|
||||
needsCOW = JS_TRUE;
|
||||
needsCOW = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
|
||||
if (info && !isClassInfo) {
|
||||
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, Scope, info, &sciProto,
|
||||
JS_FALSE, isGlobal);
|
||||
false, isGlobal);
|
||||
if (!proto)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -569,7 +569,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, JS_FALSE, &rv)) {
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, false, &rv)) {
|
||||
// Second reference will be released by the FlatJSObject's finalizer.
|
||||
wrapper->Release();
|
||||
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
|
@ -739,7 +739,7 @@ XPCWrappedNative::Morph(XPCCallContext& ccx,
|
|||
}
|
||||
|
||||
nsresult rv;
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, JS_FALSE, &rv)) {
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, false, &rv)) {
|
||||
// Second reference will be released by the FlatJSObject's finalizer.
|
||||
wrapper->Release();
|
||||
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
|
@ -799,7 +799,7 @@ XPCWrappedNative::GetUsedOnly(XPCCallContext& ccx,
|
|||
}
|
||||
|
||||
nsresult rv;
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, JS_FALSE, &rv)) {
|
||||
if (Interface && !wrapper->FindTearOff(ccx, Interface, false, &rv)) {
|
||||
NS_RELEASE(wrapper);
|
||||
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
|
@ -1100,7 +1100,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
|
|||
XPCNativeScriptableInfo::Construct(ccx, isGlobal, sci);
|
||||
|
||||
if (!mScriptableInfo)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// If we have a one-off proto, then it should share our scriptable.
|
||||
// This allows the proto's JSClass callbacks to do the right things
|
||||
|
@ -1143,12 +1143,12 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
|
|||
GetScope()->GetPrototypeNoHelper(ccx);
|
||||
|
||||
if (!protoJSObject) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
mFlatJSObject = xpc_NewSystemInheritingJSObject(ccx, jsclazz, protoJSObject, false, parent);
|
||||
if (!mFlatJSObject)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// In the current JS engine JS_SetPrivate can't fail. But if it *did*
|
||||
// fail then we would not receive our finalizer call and would not be
|
||||
|
@ -1156,7 +1156,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
|
|||
// to indicate the invalid state of this object and return false.
|
||||
if (!JS_SetPrivate(ccx, mFlatJSObject, this)) {
|
||||
mFlatJSObject = nsnull;
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return FinishInit(ccx);
|
||||
|
@ -1171,12 +1171,12 @@ XPCWrappedNative::Init(XPCCallContext &ccx, JSObject *existingJSObject)
|
|||
// to indicate the invalid state of this object and return false.
|
||||
if (!JS_SetPrivate(ccx, existingJSObject, this)) {
|
||||
mFlatJSObject = nsnull;
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Morph the existing object.
|
||||
if (!JS_SetReservedSlot(ccx, existingJSObject, 0, JSVAL_VOID))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
mScriptableInfo = GetProto()->GetScriptableInfo();
|
||||
mFlatJSObject = existingJSObject;
|
||||
|
@ -1200,7 +1200,7 @@ XPCWrappedNative::FinishInit(XPCCallContext &ccx)
|
|||
if (mScriptableInfo && mScriptableInfo->GetFlags().WantCreate() &&
|
||||
NS_FAILED(mScriptableInfo->GetCallback()->Create(this, ccx,
|
||||
mFlatJSObject))) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef XPC_CHECK_WRAPPER_THREADSAFETY
|
||||
|
@ -1209,14 +1209,14 @@ XPCWrappedNative::FinishInit(XPCCallContext &ccx)
|
|||
if (HasProto() && GetProto()->ClassIsMainThreadOnly() && !NS_IsMainThread()) {
|
||||
DEBUG_ReportWrapperThreadSafetyError(ccx,
|
||||
"MainThread only wrapper created on the wrong thread", this);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// A hack for bug 517665, increase the probability for GC.
|
||||
JS_updateMallocCounter(ccx.GetJSContext(), 2 * sizeof(XPCWrappedNative));
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1760,13 +1760,13 @@ XPCWrappedNative::ExtendSet(XPCCallContext& ccx, XPCNativeInterface* aInterface)
|
|||
newSet = XPCNativeSet::GetNewOrUsed(ccx, mSet, aInterface,
|
||||
mSet->GetInterfaceCount());
|
||||
if (!newSet)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
mSet = newSet;
|
||||
|
||||
DEBUG_ReportShadowedMembers(newSet, this, GetProto());
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
XPCWrappedNativeTearOff*
|
||||
|
@ -1795,7 +1795,7 @@ XPCWrappedNative::LocateTearOff(XPCCallContext& ccx,
|
|||
XPCWrappedNativeTearOff*
|
||||
XPCWrappedNative::FindTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface,
|
||||
JSBool needJSObject /* = JS_FALSE */,
|
||||
JSBool needJSObject /* = false */,
|
||||
nsresult* pError /* = nsnull */)
|
||||
{
|
||||
XPCAutoLock al(GetLock()); // hold the lock throughout
|
||||
|
@ -2054,10 +2054,10 @@ XPCWrappedNative::InitTearOffJSObject(XPCCallContext& ccx,
|
|||
false, mFlatJSObject);
|
||||
|
||||
if (!obj || !JS_SetPrivate(ccx, obj, to))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
to->SetJSObject(obj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -2065,7 +2065,7 @@ XPCWrappedNative::InitTearOffJSObject(XPCCallContext& ccx,
|
|||
static JSBool Throw(uintN errNum, XPCCallContext& ccx)
|
||||
{
|
||||
XPCThrower::Throw(errNum, ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -2198,7 +2198,7 @@ XPCWrappedNative::CallMethod(XPCCallContext& ccx,
|
|||
break;
|
||||
default:
|
||||
NS_ERROR("bad value");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIXPCSecurityManager* sm =
|
||||
|
@ -2210,7 +2210,7 @@ XPCWrappedNative::CallMethod(XPCCallContext& ccx,
|
|||
ccx.GetMember()->GetName(),
|
||||
ccx.GetWrapper()->GetSecurityInfoAddr()))) {
|
||||
// the security manager vetoed. It should have set an exception.
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return CallMethodHelper(ccx).Call();
|
||||
|
@ -2230,22 +2230,22 @@ CallMethodHelper::Call()
|
|||
|
||||
if (!mMethodInfo) {
|
||||
Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitializeDispatchParams())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// Iterate through the params doing conversions of independent params only.
|
||||
// When we later convert the dependent params (if any) we will know that
|
||||
// the params upon which they depend will have already been converted -
|
||||
// regardless of ordering.
|
||||
JSBool foundDependentParam = JS_FALSE;
|
||||
JSBool foundDependentParam = false;
|
||||
if (!ConvertIndependentParams(&foundDependentParam))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (foundDependentParam && !ConvertDependentParams())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsresult invokeResult = Invoke();
|
||||
|
||||
|
@ -2253,11 +2253,11 @@ CallMethodHelper::Call()
|
|||
|
||||
if (NS_FAILED(invokeResult)) {
|
||||
ThrowBadResult(invokeResult, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (JS_IsExceptionPending(mCallContext)) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return GatherAndConvertResults();
|
||||
|
@ -2329,7 +2329,7 @@ CallMethodHelper::GetArraySizeFromParam(uint8 paramIndex,
|
|||
|
||||
*result = GetDispatchParam(paramIndex)->val.u32;
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2362,7 +2362,7 @@ CallMethodHelper::GetInterfaceTypeFromParam(uint8 paramIndex,
|
|||
paramIndex, mCallContext);
|
||||
*result = *p;
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2386,11 +2386,11 @@ CallMethodHelper::GetOutParamSource(uint8 paramIndex, jsval* srcp) const
|
|||
// and that's ok.
|
||||
ThrowBadParam(NS_ERROR_XPC_NEED_OUT_OBJECT, paramIndex,
|
||||
mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2411,7 +2411,7 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
nsXPTType datum_type;
|
||||
bool isArray = type.IsArray();
|
||||
bool isSizedString = isArray ?
|
||||
JS_FALSE :
|
||||
false :
|
||||
type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
|
||||
type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
|
||||
|
||||
|
@ -2419,20 +2419,20 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
if (NS_FAILED(mIFaceInfo->GetTypeForParam(mVTableIndex, ¶mInfo, 1,
|
||||
&datum_type))) {
|
||||
Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
datum_type = type;
|
||||
|
||||
if (isArray || isSizedString) {
|
||||
if (!GetArraySizeFromParam(i, &array_count))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsID param_iid;
|
||||
if (datum_type.IsInterfacePointer() &&
|
||||
!GetInterfaceTypeFromParam(i, datum_type, ¶m_iid))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
uintN err;
|
||||
|
||||
|
@ -2443,7 +2443,7 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
array_count, &err)) {
|
||||
// XXX need exception scheme for arrays to indicate bad element
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
} else if (isSizedString) {
|
||||
if (!XPCConvert::NativeStringWithSize2JS(mCallContext, &v,
|
||||
|
@ -2451,13 +2451,13 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
datum_type,
|
||||
array_count, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!XPCConvert::NativeData2JS(mCallContext, &v, &dp->val, datum_type,
|
||||
¶m_iid, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2476,7 +2476,7 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
JSVAL_TO_OBJECT(mArgv[i]),
|
||||
mIdxValueId, &v)) {
|
||||
ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
NS_ASSERTION(paramInfo.IsOptional(),
|
||||
|
@ -2484,7 +2484,7 @@ CallMethodHelper::GatherAndConvertResults()
|
|||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2495,7 +2495,7 @@ CallMethodHelper::QueryInterfaceFastPath() const
|
|||
|
||||
if (mArgc < 1) {
|
||||
Throw(NS_ERROR_XPC_NOT_ENOUGH_ARGS, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
const nsID* iid;
|
||||
JSObject* obj;
|
||||
|
@ -2503,7 +2503,7 @@ CallMethodHelper::QueryInterfaceFastPath() const
|
|||
(!(obj = JSVAL_TO_OBJECT(mArgv[0]))) ||
|
||||
(!(iid = xpc_JSObjectToID(mCallContext, obj)))) {
|
||||
ThrowBadParam(NS_ERROR_XPC_BAD_CONVERT_JS, 0, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult invokeResult;
|
||||
|
@ -2519,7 +2519,7 @@ CallMethodHelper::QueryInterfaceFastPath() const
|
|||
|
||||
if (NS_FAILED(invokeResult)) {
|
||||
ThrowBadResult(invokeResult, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
jsval v = JSVAL_NULL;
|
||||
|
@ -2532,11 +2532,11 @@ CallMethodHelper::QueryInterfaceFastPath() const
|
|||
|
||||
if (!success) {
|
||||
ThrowBadParam(err, 0, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
mCallContext.SetRetVal(v);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2564,7 +2564,7 @@ CallMethodHelper::InitializeDispatchParams()
|
|||
|
||||
if (mArgc < requiredArgs) {
|
||||
Throw(NS_ERROR_XPC_NOT_ENOUGH_ARGS, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2600,7 +2600,7 @@ CallMethodHelper::InitializeDispatchParams()
|
|||
dp->val.u8 = NS_MIN<PRUint32>(mArgc, paramCount) - requiredArgs;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2611,13 +2611,13 @@ CallMethodHelper::ConvertIndependentParams(JSBool* foundDependentParam)
|
|||
const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(i);
|
||||
|
||||
if (paramInfo.GetType().IsDependent())
|
||||
*foundDependentParam = JS_TRUE;
|
||||
*foundDependentParam = true;
|
||||
else if (!ConvertIndependentParam(i))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2644,7 +2644,7 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
// Root the value.
|
||||
dp->val.j = JSVAL_VOID;
|
||||
if (!JS_AddValueRoot(mCallContext, &dp->val.j))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Flag cleanup for anything that isn't self-contained.
|
||||
|
@ -2658,12 +2658,12 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
// This is a no-op for 'in' params.
|
||||
jsval src;
|
||||
if (!GetOutParamSource(i, &src))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// All that's left to do is value conversion. Bail early if we don't need
|
||||
// to do that.
|
||||
if (!paramInfo.IsIn())
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
// We're definitely some variety of 'in' now, so there's something to
|
||||
// convert. The source value for conversion depends on whether we're
|
||||
|
@ -2686,17 +2686,17 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
NS_FAILED(mIFaceInfo->GetIIDForParamNoAlloc(mVTableIndex, ¶mInfo,
|
||||
¶m_iid))) {
|
||||
ThrowBadParam(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
uintN err;
|
||||
if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type,
|
||||
JS_TRUE, ¶m_iid, &err)) {
|
||||
true, ¶m_iid, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2709,10 +2709,10 @@ CallMethodHelper::ConvertDependentParams()
|
|||
if (!paramInfo.GetType().IsDependent())
|
||||
continue;
|
||||
if (!ConvertDependentParam(i))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -2725,7 +2725,7 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
bool isArray = type.IsArray();
|
||||
|
||||
bool isSizedString = isArray ?
|
||||
JS_FALSE :
|
||||
false :
|
||||
type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
|
||||
type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
|
||||
|
||||
|
@ -2736,7 +2736,7 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
if (NS_FAILED(mIFaceInfo->GetTypeForParam(mVTableIndex, ¶mInfo, 1,
|
||||
&datum_type))) {
|
||||
Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
NS_ABORT_IF_FALSE(datum_type.TagPart() != nsXPTType::T_JSVAL,
|
||||
"Arrays of JSVals not currently supported - "
|
||||
|
@ -2764,12 +2764,12 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
// This is a no-op for 'in' params.
|
||||
jsval src;
|
||||
if (!GetOutParamSource(i, &src))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// All that's left to do is value conversion. Bail early if we don't need
|
||||
// to do that.
|
||||
if (!paramInfo.IsIn())
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
// We're definitely some variety of 'in' now, so there's something to
|
||||
// convert. The source value for conversion depends on whether we're
|
||||
|
@ -2785,13 +2785,13 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
nsID param_iid;
|
||||
if (datum_type.IsInterfacePointer() &&
|
||||
!GetInterfaceTypeFromParam(i, datum_type, ¶m_iid))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
uintN err;
|
||||
|
||||
if (isArray || isSizedString) {
|
||||
if (!GetArraySizeFromParam(i, &array_count))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (isArray) {
|
||||
if (array_count &&
|
||||
|
@ -2800,7 +2800,7 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
&err)) {
|
||||
// XXX need exception scheme for arrays to indicate bad element
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
} else // if (isSizedString)
|
||||
{
|
||||
|
@ -2809,18 +2809,18 @@ CallMethodHelper::ConvertDependentParam(uint8 i)
|
|||
src, array_count,
|
||||
datum_type, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type,
|
||||
JS_TRUE, ¶m_iid, &err)) {
|
||||
true, ¶m_iid, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Performs all necessary teardown on a parameter after method invocation.
|
||||
|
@ -2911,13 +2911,13 @@ CallMethodHelper::HandleDipperParam(nsXPTCVariant* dp,
|
|||
// Check for OOM, in either case.
|
||||
if (!dp->val.p) {
|
||||
JS_ReportOutOfMemory(mCallContext);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// We allocated, so we need to deallocate after the method call completes.
|
||||
dp->SetValNeedsCleanup();
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -3305,7 +3305,7 @@ static void ShowHeader(JSBool* printedHeader,
|
|||
{
|
||||
if (!*printedHeader) {
|
||||
DEBUG_PrintShadowObjectInfo(header, set, wrapper, proto);
|
||||
*printedHeader = JS_TRUE;
|
||||
*printedHeader = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3361,7 +3361,7 @@ static JSBool MembersAreTheSame(XPCNativeInterface* iface1,
|
|||
|
||||
if (member1->IsConstant()) {
|
||||
if (!member2->IsConstant())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
const nsXPTConstant* constant1;
|
||||
const nsXPTConstant* constant2;
|
||||
|
@ -3378,7 +3378,7 @@ static JSBool MembersAreTheSame(XPCNativeInterface* iface1,
|
|||
if (member1->IsMethod() != member2->IsMethod() ||
|
||||
member1->IsWritableAttribute() != member2->IsWritableAttribute() ||
|
||||
member1->IsReadOnlyAttribute() != member2->IsReadOnlyAttribute()) {
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
const nsXPTMethodInfo* mi1;
|
||||
|
@ -3434,22 +3434,22 @@ void DEBUG_ReportShadowedMembers(XPCNativeSet* set,
|
|||
nsnull
|
||||
};
|
||||
|
||||
static bool warned = JS_FALSE;
|
||||
static bool warned = false;
|
||||
if (!warned) {
|
||||
printf("!!! XPConnect won't warn about Shadowed Members of...\n ");
|
||||
for (const char** name = skipClasses; *name; name++)
|
||||
printf("%s %s", name == skipClasses ? "" : ",", *name);
|
||||
printf("\n");
|
||||
warned = JS_TRUE;
|
||||
warned = true;
|
||||
}
|
||||
|
||||
bool quit = JS_FALSE;
|
||||
bool quit = false;
|
||||
char* className = nsnull;
|
||||
si->GetCallback()->GetClassName(&className);
|
||||
if (className) {
|
||||
for (const char** name = skipClasses; *name; name++) {
|
||||
if (!strcmp(*name, className)) {
|
||||
quit = JS_TRUE;
|
||||
quit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3462,7 +3462,7 @@ void DEBUG_ReportShadowedMembers(XPCNativeSet* set,
|
|||
const char header[] =
|
||||
"!!!Object wrapped by XPConnect has members whose names shadow each other!!!";
|
||||
|
||||
JSBool printedHeader = JS_FALSE;
|
||||
JSBool printedHeader = false;
|
||||
|
||||
jsval QIName = rt->GetStringJSVal(XPCJSRuntime::IDX_QUERY_INTERFACE);
|
||||
|
||||
|
@ -3559,7 +3559,7 @@ void DEBUG_ReportWrapperThreadSafetyError(XPCCallContext& ccx,
|
|||
printf(" %s\n wrapper @ 0x%p\n", msg, (void *)wrapper);
|
||||
|
||||
printf(" JS call stack...\n");
|
||||
xpc_DumpJSStack(ccx, JS_TRUE, JS_TRUE, JS_TRUE);
|
||||
xpc_DumpJSStack(ccx, true, true, true);
|
||||
printf("---------------------------------------------------------------\n");
|
||||
|
||||
tls->ClearWrappedNativeThreadsafetyReportDepth();
|
||||
|
@ -3683,7 +3683,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
SLIM_LOG_NOT_CREATED(ccx, identityObj,
|
||||
"scriptable helper has no PreCreate hook");
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject* plannedParent = parent;
|
||||
|
@ -3691,20 +3691,20 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
if (rv != NS_SUCCESS_ALLOW_SLIM_WRAPPERS) {
|
||||
SLIM_LOG_NOT_CREATED(ccx, identityObj, "PreCreate hook refused");
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ccx.GetJSContext()->compartment != js::GetObjectCompartment(parent)) {
|
||||
SLIM_LOG_NOT_CREATED(ccx, identityObj, "wrong compartment");
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(ccx, parent)) {
|
||||
SLIM_LOG_NOT_CREATED(ccx, identityObj, "unable to enter compartment");
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parent != plannedParent) {
|
||||
|
@ -3713,7 +3713,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
if (newXpcScope != xpcScope) {
|
||||
SLIM_LOG_NOT_CREATED(ccx, identityObj, "crossing origins");
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3724,7 +3724,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
if (wrapper) {
|
||||
*rval = OBJECT_TO_JSVAL(wrapper);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
PRUint32 interfacesBitmap = classInfoHelper->GetInterfacesBitmap();
|
||||
|
@ -3732,19 +3732,19 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
sciProto(aHelper.forgetXPCClassInfo(), flags, interfacesBitmap);
|
||||
|
||||
AutoMarkingWrappedNativeProtoPtr xpcproto(ccx);
|
||||
JSBool isGlobal = JS_FALSE;
|
||||
JSBool isGlobal = false;
|
||||
xpcproto = XPCWrappedNativeProto::GetNewOrUsed(ccx, xpcScope,
|
||||
classInfoHelper, &sciProto,
|
||||
JS_FALSE, isGlobal);
|
||||
false, isGlobal);
|
||||
if (!xpcproto)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
xpcproto->CacheOffsets(identityObj);
|
||||
|
||||
XPCNativeScriptableInfo* si = xpcproto->GetScriptableInfo();
|
||||
JSClass* jsclazz = si->GetSlimJSClass();
|
||||
if (!jsclazz)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
wrapper = xpc_NewSystemInheritingJSObject(ccx, jsclazz,
|
||||
xpcproto->GetJSProtoObject(),
|
||||
|
@ -3752,7 +3752,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
if (!wrapper ||
|
||||
!JS_SetPrivate(ccx, wrapper, identityObj) ||
|
||||
!JS_SetReservedSlot(ccx, wrapper, 0, PRIVATE_TO_JSVAL(xpcproto.get())))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// Transfer ownership to the wrapper's private.
|
||||
aHelper.forgetCanonical();
|
||||
|
@ -3764,5 +3764,5 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||
|
||||
*rval = OBJECT_TO_JSVAL(wrapper);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ XPCNativeMember::GetCallInfo(XPCCallContext& ccx,
|
|||
*pInterface = (XPCNativeInterface*) JSVAL_TO_PRIVATE(ifaceVal);
|
||||
*pMember = (XPCNativeMember*) JSVAL_TO_PRIVATE(memberVal);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -82,7 +82,7 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
if (IsConstant()) {
|
||||
const nsXPTConstant* constant;
|
||||
if (NS_FAILED(iface->GetInterfaceInfo()->GetConstant(mIndex, &constant)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
const nsXPTCMiniVariant& mv = *constant->GetValue();
|
||||
|
||||
|
@ -96,11 +96,11 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
|
||||
if (!XPCConvert::NativeData2JS(ccx, &resultVal, &v.val, v.type,
|
||||
nsnull, nsnull))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*vp = resultVal;
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
// else...
|
||||
|
||||
|
@ -112,7 +112,7 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
if (IsMethod()) {
|
||||
const nsXPTMethodInfo* info;
|
||||
if (NS_FAILED(iface->GetInterfaceInfo()->GetMethodInfo(mIndex, &info)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// Note: ASSUMES that retval is last arg.
|
||||
argc = (intN) info->GetParamCount();
|
||||
|
@ -127,19 +127,19 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
|
||||
JSFunction *fun = JS_NewFunctionById(ccx, callback, argc, 0, parent, GetName());
|
||||
if (!fun)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSObject* funobj = JS_GetFunctionObject(fun);
|
||||
if (!funobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (!JS_SetReservedSlot(ccx, funobj, 0, PRIVATE_TO_JSVAL(iface))||
|
||||
!JS_SetReservedSlot(ccx, funobj, 1, PRIVATE_TO_JSVAL(this)))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(funobj);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -261,7 +261,7 @@ XPCNativeInterface::NewInstance(XPCCallContext& ccx,
|
|||
XPCNativeMember* members = nsnull;
|
||||
|
||||
int i;
|
||||
JSBool failed = JS_FALSE;
|
||||
JSBool failed = false;
|
||||
PRUint16 constCount;
|
||||
PRUint16 methodCount;
|
||||
PRUint16 totalCount;
|
||||
|
@ -310,7 +310,7 @@ XPCNativeInterface::NewInstance(XPCCallContext& ccx,
|
|||
for (i = 0; i < methodCount; i++) {
|
||||
const nsXPTMethodInfo* info;
|
||||
if (NS_FAILED(aInfo->GetMethodInfo(i, &info))) {
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ XPCNativeInterface::NewInstance(XPCCallContext& ccx,
|
|||
str = JS_InternString(ccx, info->GetName());
|
||||
if (!str) {
|
||||
NS_ERROR("bad method name");
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
name = INTERNED_STRING_TO_JSID(ccx, str);
|
||||
|
@ -354,14 +354,14 @@ XPCNativeInterface::NewInstance(XPCCallContext& ccx,
|
|||
for (i = 0; i < constCount; i++) {
|
||||
const nsXPTConstant* constant;
|
||||
if (NS_FAILED(aInfo->GetConstant(i, &constant))) {
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
str = JS_InternString(ccx, constant->GetName());
|
||||
if (!str) {
|
||||
NS_ERROR("bad constant name");
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
name = INTERNED_STRING_TO_JSID(ccx, str);
|
||||
|
@ -379,7 +379,7 @@ XPCNativeInterface::NewInstance(XPCCallContext& ccx,
|
|||
const char* bytes;
|
||||
if (NS_FAILED(aInfo->GetNameShared(&bytes)) || !bytes ||
|
||||
nsnull == (str = JS_InternString(ccx, bytes))) {
|
||||
failed = JS_TRUE;
|
||||
failed = true;
|
||||
}
|
||||
interfaceName = INTERNED_STRING_TO_JSID(ccx, str);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
static JSBool Throw(uintN errNum, JSContext* cx)
|
||||
{
|
||||
XPCThrower::Throw(errNum, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handy macro used in many callback stub below.
|
||||
|
@ -88,16 +88,16 @@ ToStringGuts(XPCCallContext& ccx)
|
|||
|
||||
if (!sz) {
|
||||
JS_ReportOutOfMemory(ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString* str = JS_NewStringCopyZ(ccx, sz);
|
||||
JS_smprintf_free(sz);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
ccx.SetRetVal(STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -107,7 +107,7 @@ XPC_WN_Shared_ToString(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (IS_SLIM_WRAPPER(obj)) {
|
||||
XPCNativeScriptableInfo *si =
|
||||
|
@ -123,16 +123,16 @@ XPC_WN_Shared_ToString(JSContext *cx, uintN argc, jsval *vp)
|
|||
#endif
|
||||
char *sz = JS_smprintf("[object %s" FMT_ADDR FMT_STR(" (native") FMT_ADDR FMT_STR(")") "]", si->GetJSClass()->name PARAM_ADDR(obj) PARAM_ADDR(xpc_GetJSPrivate(obj)));
|
||||
if (!sz)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSString* str = JS_NewStringCopyZ(cx, sz);
|
||||
JS_smprintf_free(sz);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*vp = STRING_TO_JSVAL(str);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj);
|
||||
|
@ -147,10 +147,10 @@ XPC_WN_Shared_ToSource(JSContext *cx, uintN argc, jsval *vp)
|
|||
static const char empty[] = "({})";
|
||||
JSString *str = JS_NewStringCopyN(cx, empty, sizeof(empty)-1);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*vp = STRING_TO_JSVAL(str);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -199,7 +199,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
MORPH_SLIM_WRAPPER(cx, obj);
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj);
|
||||
|
@ -214,7 +214,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
// responded to this get property call and now gives no object.
|
||||
// XXX Should this throw something at the caller?
|
||||
*vp = JSVAL_NULL;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// It is a double wrapped object. Figure out if the caller
|
||||
|
@ -233,7 +233,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
jsid id = ccx.GetRuntime()->
|
||||
GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
|
||||
|
||||
ccx.SetCallInfo(iface, iface->GetMemberAt(1), JS_FALSE);
|
||||
ccx.SetCallInfo(iface, iface->GetMemberAt(1), false);
|
||||
if (NS_FAILED(sm->
|
||||
CanAccess(nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
|
||||
&ccx, ccx,
|
||||
|
@ -242,7 +242,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
wrapper->GetClassInfo(), id,
|
||||
wrapper->GetSecurityInfoAddr()))) {
|
||||
// The SecurityManager should have set an exception.
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
|
||||
if (set) {
|
||||
if (iface)
|
||||
found = JS_TRUE;
|
||||
found = true;
|
||||
else
|
||||
found = set->FindMember(id, &member, &iface);
|
||||
} else
|
||||
|
@ -307,12 +307,12 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
JSFunction* fun = JS_NewFunction(ccx, call, 0, 0, obj, name);
|
||||
if (!fun) {
|
||||
JS_ReportOutOfMemory(ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return JS_DefinePropertyById(ccx, obj, id,
|
||||
OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)),
|
||||
nsnull, nsnull,
|
||||
|
@ -335,13 +335,13 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
name.encode(ccx, JSID_TO_STRING(id)) &&
|
||||
(iface2 = XPCNativeInterface::GetNewOrUsed(ccx, name.ptr()), iface2) &&
|
||||
nsnull != (to = wrapperToReflectInterfaceNames->
|
||||
FindTearOff(ccx, iface2, JS_TRUE, &rv)) &&
|
||||
FindTearOff(ccx, iface2, true, &rv)) &&
|
||||
nsnull != (jso = to->GetJSObject()))
|
||||
|
||||
{
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
|
||||
nsnull, nsnull,
|
||||
propFlags & ~JSPROP_ENUMERATE);
|
||||
|
@ -366,18 +366,18 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
0, 0, obj, name);
|
||||
|
||||
if (!fun)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JSObject* funobj = JS_GetFunctionObject(fun);
|
||||
if (!funobj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
propFlags |= JSPROP_GETTER;
|
||||
propFlags &= ~JSPROP_ENUMERATE;
|
||||
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp,
|
||||
funobj),
|
||||
|
@ -385,38 +385,38 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
}
|
||||
|
||||
if (resolved)
|
||||
*resolved = JS_FALSE;
|
||||
return JS_TRUE;
|
||||
*resolved = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!member) {
|
||||
if (wrapperToReflectInterfaceNames) {
|
||||
XPCWrappedNativeTearOff* to =
|
||||
wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, JS_TRUE);
|
||||
wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, true);
|
||||
|
||||
if (!to)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
JSObject* jso = to->GetJSObject();
|
||||
if (!jso)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
|
||||
nsnull, nsnull,
|
||||
propFlags & ~JSPROP_ENUMERATE);
|
||||
}
|
||||
if (resolved)
|
||||
*resolved = JS_FALSE;
|
||||
return JS_TRUE;
|
||||
*resolved = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (member->IsConstant()) {
|
||||
jsval val;
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return member->GetConstantValue(ccx, iface, &val) &&
|
||||
JS_DefinePropertyById(ccx, obj, id, val, nsnull, nsnull,
|
||||
propFlags);
|
||||
|
@ -431,7 +431,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
|
||||
jsval funval;
|
||||
if (!member->NewFunctionObject(ccx, iface, obj, &funval))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
// protect funobj until it is actually attached
|
||||
AUTO_MARK_JSVAL(ccx, funval);
|
||||
|
@ -447,7 +447,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
if (member->IsMethod()) {
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
return JS_DefinePropertyById(ccx, obj, id, funval, nsnull, nsnull,
|
||||
propFlags);
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
|||
|
||||
AutoResolveName arn(ccx, id);
|
||||
if (resolved)
|
||||
*resolved = JS_TRUE;
|
||||
*resolved = true;
|
||||
|
||||
return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter,
|
||||
propFlags);
|
||||
|
@ -488,7 +488,7 @@ XPC_WN_OnlyIWrite_AddPropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *
|
|||
|
||||
// Allow only XPConnect to add/set the property
|
||||
if (ccx.GetResolveName() == id)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ XPC_WN_Shared_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
{
|
||||
if (type == JSTYPE_OBJECT) {
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
MORPH_SLIM_WRAPPER(cx, obj);
|
||||
|
@ -533,17 +533,17 @@ XPC_WN_Shared_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
if (si && (si->GetFlags().WantCall() ||
|
||||
si->GetFlags().WantConstruct())) {
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Throw(NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN, cx);
|
||||
case JSTYPE_NUMBER:
|
||||
*vp = JS_GetNaNValue(cx);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
case JSTYPE_BOOLEAN:
|
||||
*vp = JSVAL_TRUE;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
case JSTYPE_VOID:
|
||||
case JSTYPE_STRING:
|
||||
{
|
||||
|
@ -553,10 +553,10 @@ XPC_WN_Shared_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
XPCNativeMember* member = ccx.GetMember();
|
||||
if (member && member->IsMethod()) {
|
||||
if (!XPCWrappedNative::CallMethod(ccx))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(*vp))
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// else...
|
||||
|
@ -564,10 +564,10 @@ XPC_WN_Shared_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
}
|
||||
default:
|
||||
NS_ERROR("bad type in conversion");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
NS_NOTREACHED("huh?");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -581,7 +581,7 @@ XPC_WN_Shared_Enumerate(JSContext *cx, JSObject *obj)
|
|||
// Since we aren't going to enumerate tearoff names and the prototype
|
||||
// handles non-mutated members, we can do this potential short-circuit.
|
||||
if (!wrapper->HasMutatedSet())
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
XPCNativeSet* set = wrapper->GetSet();
|
||||
XPCNativeSet* protoSet = wrapper->HasProto() ?
|
||||
|
@ -602,10 +602,10 @@ XPC_WN_Shared_Enumerate(JSContext *cx, JSObject *obj)
|
|||
protoSet->FindMember(name, nsnull, &index) && index == i)
|
||||
continue;
|
||||
if (!xpc_ForcePropertyResolve(cx, obj, name))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -725,15 +725,15 @@ XPC_WN_NoHelper_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
|
||||
XPCNativeSet* set = ccx.GetSet();
|
||||
if (!set)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
// Don't resolve properties that are on our prototype.
|
||||
if (ccx.GetInterface() && !ccx.GetStaticMemberIsLocal())
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
return DefinePropertyIfFound(ccx, obj, id,
|
||||
set, nsnull, nsnull, wrapper->GetScope(),
|
||||
JS_TRUE, wrapper, wrapper, nsnull,
|
||||
true, wrapper, wrapper, nsnull,
|
||||
JSPROP_ENUMERATE |
|
||||
JSPROP_READONLY |
|
||||
JSPROP_PERMANENT, nsnull);
|
||||
|
@ -752,7 +752,7 @@ JSBool
|
|||
XPC_WN_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
|
||||
{
|
||||
jsval v = *valp;
|
||||
*bp = JS_FALSE;
|
||||
*bp = false;
|
||||
|
||||
JSObject *obj2;
|
||||
XPCWrappedNative *wrapper =
|
||||
|
@ -760,7 +760,7 @@ XPC_WN_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
|
|||
if (obj2) {
|
||||
*bp = !JSVAL_IS_PRIMITIVE(v) && (JSVAL_TO_OBJECT(v) == obj2);
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
|
||||
|
@ -780,7 +780,7 @@ XPC_WN_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
|
|||
XPC_GetIdentityObject(cx, other));
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
|
@ -904,7 +904,7 @@ XPC_WN_MaybeResolvingPropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *
|
|||
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
|
||||
|
||||
if (ccx.GetResolvingWrapper() == wrapper)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ XPC_WN_MaybeResolvingStrictPropertyStub(JSContext *cx, JSObject *obj, jsid id, J
|
|||
XPCWrappedNative* wrapper = \
|
||||
XPCWrappedNative::GetAndMorphWrappedNativeOfJSObject(cx, obj); \
|
||||
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); \
|
||||
bool retval = JS_TRUE; \
|
||||
bool retval = true; \
|
||||
nsresult rv = wrapper->GetScriptableCallback()->
|
||||
|
||||
#define PRE_HELPER_STUB \
|
||||
|
@ -936,7 +936,7 @@ XPC_WN_MaybeResolvingStrictPropertyStub(JSContext *cx, JSObject *obj, jsid id, J
|
|||
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); \
|
||||
si = wrapper->GetScriptableCallback(); \
|
||||
} \
|
||||
bool retval = JS_TRUE; \
|
||||
bool retval = true; \
|
||||
nsresult rv = si->
|
||||
|
||||
#define POST_HELPER_STUB \
|
||||
|
@ -1003,7 +1003,7 @@ XPC_WN_Helper_Call(JSContext *cx, uintN argc, jsval *vp)
|
|||
XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, JSID_VOID,
|
||||
argc, JS_ARGV(cx, vp), vp);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_ASSERT(obj == ccx.GetFlattenedJSObject());
|
||||
|
||||
|
@ -1018,12 +1018,12 @@ XPC_WN_Helper_Construct(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
JSObject *obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, JSID_VOID,
|
||||
argc, JS_ARGV(cx, vp), vp);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
JS_ASSERT(obj == ccx.GetFlattenedJSObject());
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
JSObject **objp)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
bool retval = JS_TRUE;
|
||||
bool retval = true;
|
||||
JSObject* obj2FromScriptable = nsnull;
|
||||
if (IS_SLIM_WRAPPER(obj)) {
|
||||
XPCNativeScriptableInfo *si =
|
||||
|
@ -1160,7 +1160,7 @@ XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
retval = DefinePropertyIfFound(ccx, obj, id,
|
||||
set, iface, member,
|
||||
wrapper->GetScope(),
|
||||
JS_FALSE,
|
||||
false,
|
||||
wrapperForInterfaceNames,
|
||||
nsnull, si,
|
||||
enumFlag, &resolved);
|
||||
|
@ -1233,7 +1233,7 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
if (!si)
|
||||
return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
|
||||
|
||||
bool retval = JS_TRUE;
|
||||
bool retval = true;
|
||||
nsresult rv;
|
||||
|
||||
if (si->GetFlags().WantNewEnumerate()) {
|
||||
|
@ -1243,7 +1243,7 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
wrapper->HasMutatedSet() &&
|
||||
!XPC_WN_Shared_Enumerate(cx, obj)) {
|
||||
*statep = JSVAL_NULL;
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// XXX Might we really need to wrap this call and *also* call
|
||||
|
@ -1269,7 +1269,7 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
wrapper->HasMutatedSet() &&
|
||||
!XPC_WN_Shared_Enumerate(cx, obj)) {
|
||||
*statep = JSVAL_NULL;
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
rv = si->GetCallback()->
|
||||
Enumerate(wrapper, cx, obj, &retval);
|
||||
|
@ -1280,7 +1280,7 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
if (NS_FAILED(rv))
|
||||
return Throw(rv, cx);
|
||||
if (!retval)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
// Then fall through and call the default implementation...
|
||||
}
|
||||
}
|
||||
|
@ -1511,7 +1511,7 @@ XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
|
|||
mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
|
||||
|
||||
if (!(mFlags & nsIXPCScriptable::WANT_OUTER_OBJECT))
|
||||
mCanBeSlim = JS_TRUE;
|
||||
mCanBeSlim = true;
|
||||
|
||||
mJSClass.base.ext.isWrappedNative = true;
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ XPC_WN_CallMethod(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
#ifdef DEBUG_slimwrappers
|
||||
{
|
||||
|
@ -1550,7 +1550,7 @@ XPC_WN_CallMethod(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
if (!XPCNativeMember::GetCallInfo(ccx, funobj, &iface, &member))
|
||||
return Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, cx);
|
||||
ccx.SetCallInfo(iface, member, JS_FALSE);
|
||||
ccx.SetCallInfo(iface, member, false);
|
||||
return XPCWrappedNative::CallMethod(ccx);
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1562,7 @@ XPC_WN_GetterSetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
#ifdef DEBUG_slimwrappers
|
||||
{
|
||||
|
@ -1590,7 +1590,7 @@ XPC_WN_GetterSetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
ccx.SetArgsAndResultPtr(argc, JS_ARGV(cx, vp), vp);
|
||||
if (argc && member->IsWritableAttribute()) {
|
||||
ccx.SetCallInfo(iface, member, JS_TRUE);
|
||||
ccx.SetCallInfo(iface, member, true);
|
||||
JSBool retval = XPCWrappedNative::SetAttribute(ccx);
|
||||
if (retval)
|
||||
*vp = JS_ARGV(cx, vp)[0];
|
||||
|
@ -1598,7 +1598,7 @@ XPC_WN_GetterSetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
// else...
|
||||
|
||||
ccx.SetCallInfo(iface, member, JS_FALSE);
|
||||
ccx.SetCallInfo(iface, member, false);
|
||||
return XPCWrappedNative::GetAttribute(ccx);
|
||||
}
|
||||
|
||||
|
@ -1615,19 +1615,19 @@ XPC_WN_Shared_Proto_Enumerate(JSContext *cx, JSObject *obj)
|
|||
XPCWrappedNativeProto* self =
|
||||
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
|
||||
if (!self)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
if (self->GetScriptableInfo() &&
|
||||
self->GetScriptableInfo()->GetFlags().DontEnumStaticProps())
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
XPCNativeSet* set = self->GetSet();
|
||||
if (!set)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
ccx.SetScopeForNewJSObjects(obj);
|
||||
|
||||
PRUint16 interface_count = set->GetInterfaceCount();
|
||||
|
@ -1638,11 +1638,11 @@ XPC_WN_Shared_Proto_Enumerate(JSContext *cx, JSObject *obj)
|
|||
|
||||
for (PRUint16 k = 0; k < member_count; k++) {
|
||||
if (!xpc_ForcePropertyResolve(cx, obj, iface->GetMemberAt(k)->GetName()))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1676,11 +1676,11 @@ XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
XPCWrappedNativeProto* self =
|
||||
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
|
||||
if (!self)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
ccx.SetScopeForNewJSObjects(obj);
|
||||
|
||||
XPCNativeScriptableInfo* si = self->GetScriptableInfo();
|
||||
|
@ -1690,7 +1690,7 @@ XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
return DefinePropertyIfFound(ccx, obj, id,
|
||||
self->GetSet(), nsnull, nsnull,
|
||||
self->GetScope(),
|
||||
JS_TRUE, nsnull, nsnull, si,
|
||||
true, nsnull, nsnull, si,
|
||||
enumFlag, nsnull);
|
||||
}
|
||||
|
||||
|
@ -1760,16 +1760,16 @@ XPC_WN_OnlyIWrite_Proto_AddPropertyStub(JSContext *cx, JSObject *obj, jsid id, j
|
|||
XPCWrappedNativeProto* self =
|
||||
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
|
||||
if (!self)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
ccx.SetScopeForNewJSObjects(obj);
|
||||
|
||||
// Allow XPConnect to add the property only
|
||||
if (ccx.GetResolveName() == id)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
|
||||
}
|
||||
|
@ -1791,11 +1791,11 @@ XPC_WN_NoMods_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
XPCWrappedNativeProto* self =
|
||||
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
|
||||
if (!self)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx);
|
||||
if (!ccx.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
ccx.SetScopeForNewJSObjects(obj);
|
||||
|
||||
XPCNativeScriptableInfo* si = self->GetScriptableInfo();
|
||||
|
@ -1805,7 +1805,7 @@ XPC_WN_NoMods_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
return DefinePropertyIfFound(ccx, obj, id,
|
||||
self->GetSet(), nsnull, nsnull,
|
||||
self->GetScope(),
|
||||
JS_TRUE, nsnull, nsnull, si,
|
||||
true, nsnull, nsnull, si,
|
||||
JSPROP_READONLY |
|
||||
JSPROP_PERMANENT |
|
||||
enumFlag, nsnull);
|
||||
|
@ -1884,10 +1884,10 @@ XPC_WN_TearOff_Enumerate(JSContext *cx, JSObject *obj)
|
|||
PRUint16 member_count = iface->GetMemberCount();
|
||||
for (PRUint16 k = 0; k < member_count; k++) {
|
||||
if (!xpc_ForcePropertyResolve(cx, obj, iface->GetMemberAt(k)->GetName()))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -1906,7 +1906,7 @@ XPC_WN_TearOff_Resolve(JSContext *cx, JSObject *obj, jsid id)
|
|||
|
||||
return DefinePropertyIfFound(ccx, obj, id, nsnull, iface, nsnull,
|
||||
wrapper->GetScope(),
|
||||
JS_TRUE, nsnull, nsnull, nsnull,
|
||||
true, nsnull, nsnull, nsnull,
|
||||
JSPROP_READONLY |
|
||||
JSPROP_PERMANENT |
|
||||
JSPROP_ENUMERATE, nsnull);
|
||||
|
|
|
@ -99,7 +99,7 @@ XPCWrappedNativeProto::Init(XPCCallContext& ccx,
|
|||
mScriptableInfo =
|
||||
XPCNativeScriptableInfo::Construct(ccx, isGlobal, scriptableCreateInfo);
|
||||
if (!mScriptableInfo)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
js::Class* jsclazz;
|
||||
|
@ -136,7 +136,7 @@ XPCWrappedNativeProto::Init(XPCCallContext& ccx,
|
|||
JS_SetPrivate(ccx, mJSProtoObject, nsnull);
|
||||
mJSProtoObject = nsnull;
|
||||
XPCThrower::Throw(rv, ccx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,9 +219,9 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,
|
|||
(ScriptableCreateInfo &&
|
||||
ScriptableCreateInfo->GetFlags().DontSharePrototype())) {
|
||||
ciFlags |= XPC_PROTO_DONT_SHARE;
|
||||
shared = JS_FALSE;
|
||||
shared = false;
|
||||
} else {
|
||||
shared = JS_TRUE;
|
||||
shared = true;
|
||||
}
|
||||
|
||||
if (shared) {
|
||||
|
|
|
@ -115,7 +115,7 @@ XPCWrappedNativeScope*
|
|||
XPCWrappedNativeScope::GetNewOrUsed(XPCCallContext& ccx, JSObject* aGlobal)
|
||||
{
|
||||
|
||||
XPCWrappedNativeScope* scope = FindInJSObjectScope(ccx, aGlobal, JS_TRUE);
|
||||
XPCWrappedNativeScope* scope = FindInJSObjectScope(ccx, aGlobal, true);
|
||||
if (!scope)
|
||||
scope = new XPCWrappedNativeScope(ccx, aGlobal);
|
||||
else {
|
||||
|
@ -179,9 +179,9 @@ XPCWrappedNativeScope::IsDyingScope(XPCWrappedNativeScope *scope)
|
|||
{
|
||||
for (XPCWrappedNativeScope *cur = gDyingScopes; cur; cur = cur->mNext) {
|
||||
if (scope == cur)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -730,7 +730,7 @@ void DEBUG_CheckForComponentsInScope(JSContext* cx, JSObject* obj,
|
|||
// callback code.
|
||||
NS_ERROR("XPConnect is being called on a scope without a 'Components' property! (stack and details follow)");
|
||||
printf("The current JS stack is:\n");
|
||||
xpc_DumpJSStack(cx, JS_TRUE, JS_TRUE, JS_TRUE);
|
||||
xpc_DumpJSStack(cx, true, true, true);
|
||||
|
||||
printf("And the object whose scope lacks a 'Components' property is:\n");
|
||||
js_DumpObject(startingObj);
|
||||
|
|
|
@ -52,7 +52,7 @@ ThrowException(nsresult ex, JSContext *cx)
|
|||
{
|
||||
XPCThrower::Throw(ex, cx);
|
||||
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -70,7 +70,7 @@ UnwrapNW(JSContext *cx, uintN argc, jsval *vp)
|
|||
JSObject *obj = JSVAL_TO_OBJECT(v);
|
||||
if (!js::IsWrapper(obj)) {
|
||||
JS_SET_RVAL(cx, vp, v);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (xpc::WrapperFactory::IsXrayWrapper(obj) &&
|
||||
|
@ -79,7 +79,7 @@ UnwrapNW(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, v);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -96,7 +96,7 @@ XrayWrapperConstructor(JSContext *cx, uintN argc, jsval *vp)
|
|||
JSObject *obj = JSVAL_TO_OBJECT(vp[2]);
|
||||
if (!js::IsWrapper(obj)) {
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
obj = js::UnwrapObject(obj);
|
||||
|
|
|
@ -93,7 +93,7 @@ JSBool
|
|||
Throw(JSContext *cx, nsresult rv)
|
||||
{
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,32 +359,32 @@ interface_hasInstance(JSContext *cx, JSObject *obj, const js::Value *vp, JSBool
|
|||
JSVAL_IS_PRIMITIVE(prototype)) {
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||
JSMSG_THROW_TYPE_ERROR);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject *other = &vp->toObject();
|
||||
if (instanceIsProxy(other)) {
|
||||
ProxyHandler *handler = static_cast<ProxyHandler*>(js::GetProxyHandler(other));
|
||||
if (handler->isInstanceOf(JSVAL_TO_OBJECT(prototype))) {
|
||||
*bp = JS_TRUE;
|
||||
*bp = true;
|
||||
} else {
|
||||
JSObject *protoObj = JSVAL_TO_OBJECT(prototype);
|
||||
JSObject *proto = other;
|
||||
while ((proto = JS_GetPrototype(cx, proto))) {
|
||||
if (proto == protoObj) {
|
||||
*bp = JS_TRUE;
|
||||
return JS_TRUE;
|
||||
*bp = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*bp = JS_FALSE;
|
||||
*bp = false;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
*bp = JS_FALSE;
|
||||
return JS_TRUE;
|
||||
*bp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class LC>
|
||||
|
@ -794,7 +794,7 @@ ListBase<LC>::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
|||
|
||||
JSObject *expando = getExpandoObject(proxy);
|
||||
if (expando) {
|
||||
JSBool b = JS_TRUE;
|
||||
JSBool b = true;
|
||||
JSBool ok = JS_HasPropertyById(cx, expando, id, &b);
|
||||
*bp = !!b;
|
||||
if (!ok || *bp)
|
||||
|
|
|
@ -59,7 +59,7 @@ xpc_qsUnwrapThis<_interface>(JSContext *cx, \
|
|||
if (failureFatal && !native) \
|
||||
return xpc_qsThrow(cx, rv); \
|
||||
*ppThis = static_cast<_interface*>(static_cast<_base*>(native)); \
|
||||
return JS_TRUE; \
|
||||
return true; \
|
||||
} \
|
||||
\
|
||||
NS_SPECIALIZE_TEMPLATE \
|
||||
|
@ -98,10 +98,10 @@ castToElement(nsIContent *content, jsval val, nsGenericElement **ppInterface,
|
|||
jsval *pVal)
|
||||
{
|
||||
if (!content->IsElement())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
*ppInterface = static_cast<nsGenericElement*>(content->AsElement());
|
||||
*pVal = val;
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_SPECIALIZE_TEMPLATE
|
||||
|
@ -128,7 +128,7 @@ xpc_qsUnwrapThis<nsGenericElement>(JSContext *cx,
|
|||
}
|
||||
|
||||
if (!failureFatal && (!ok || !content)) {
|
||||
ok = JS_TRUE;
|
||||
ok = true;
|
||||
*ppThis = nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,10 @@ NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect,
|
|||
nsIJSEngineTelemetryStats)
|
||||
|
||||
nsXPConnect* nsXPConnect::gSelf = nsnull;
|
||||
JSBool nsXPConnect::gOnceAliveNowDead = JS_FALSE;
|
||||
JSBool nsXPConnect::gOnceAliveNowDead = false;
|
||||
PRUint32 nsXPConnect::gReportAllJSExceptions = 0;
|
||||
JSBool nsXPConnect::gDebugMode = JS_FALSE;
|
||||
JSBool nsXPConnect::gDesiredDebugMode = JS_FALSE;
|
||||
JSBool nsXPConnect::gDebugMode = false;
|
||||
JSBool nsXPConnect::gDesiredDebugMode = false;
|
||||
|
||||
// Global cache of the default script security manager (QI'd to
|
||||
// nsIScriptSecurityManager)
|
||||
|
@ -103,8 +103,8 @@ nsXPConnect::nsXPConnect()
|
|||
mInterfaceInfoManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)),
|
||||
mDefaultSecurityManager(nsnull),
|
||||
mDefaultSecurityManagerFlags(0),
|
||||
mShuttingDown(JS_FALSE),
|
||||
mNeedGCBeforeCC(JS_TRUE),
|
||||
mShuttingDown(false),
|
||||
mNeedGCBeforeCC(true),
|
||||
mCycleCollectionContext(nsnull)
|
||||
{
|
||||
mRuntime = XPCJSRuntime::newXPCJSRuntime(this);
|
||||
|
@ -134,7 +134,7 @@ nsXPConnect::~nsXPConnect()
|
|||
}
|
||||
|
||||
XPCPerThreadData::CleanupAllThreads();
|
||||
mShuttingDown = JS_TRUE;
|
||||
mShuttingDown = true;
|
||||
if (cx) {
|
||||
JS_BeginRequest(cx);
|
||||
|
||||
|
@ -157,7 +157,7 @@ nsXPConnect::~nsXPConnect()
|
|||
delete mRuntime;
|
||||
|
||||
gSelf = nsnull;
|
||||
gOnceAliveNowDead = JS_TRUE;
|
||||
gOnceAliveNowDead = true;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -388,7 +388,7 @@ nsXPConnect::Collect()
|
|||
// To improve debugging, if DEBUG_CC is defined all JS objects are
|
||||
// traversed.
|
||||
|
||||
mNeedGCBeforeCC = JS_FALSE;
|
||||
mNeedGCBeforeCC = false;
|
||||
|
||||
XPCCallContext ccx(NATIVE_CALLER);
|
||||
if (!ccx.IsValid())
|
||||
|
@ -929,7 +929,7 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb)
|
|||
TraversalTracer trc(cb);
|
||||
|
||||
JS_TRACER_INIT(&trc, cx, NoteJSChild);
|
||||
trc.eagerlyTraceWeakMaps = JS_FALSE;
|
||||
trc.eagerlyTraceWeakMaps = false;
|
||||
JS_TraceChildren(&trc, p, traceKind);
|
||||
|
||||
if (traceKind != JSTRACE_OBJECT || dontTraverse)
|
||||
|
@ -1139,7 +1139,7 @@ TraceXPCGlobal(JSTracer *trc, JSObject *obj)
|
|||
if (trc->callback == VerifyTraceXPCGlobalCalled) {
|
||||
// We don't do anything here, we only want to verify that TraceXPCGlobal
|
||||
// was called.
|
||||
reinterpret_cast<VerifyTraceXPCGlobalCalledTracer*>(trc)->ok = JS_TRUE;
|
||||
reinterpret_cast<VerifyTraceXPCGlobalCalledTracer*>(trc)->ok = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1185,7 +1185,7 @@ xpc_CreateGlobalObject(JSContext *cx, JSClass *clasp,
|
|||
if (clasp->flags & JSCLASS_XPCONNECT_GLOBAL) {
|
||||
VerifyTraceXPCGlobalCalledTracer trc;
|
||||
JS_TRACER_INIT(&trc.base, cx, VerifyTraceXPCGlobalCalled);
|
||||
trc.ok = JS_FALSE;
|
||||
trc.ok = false;
|
||||
JS_TraceChildren(&trc.base, *global, JSTRACE_OBJECT);
|
||||
NS_ABORT_IF_FALSE(trc.ok, "Trace hook needs to call TraceXPCGlobal if JSCLASS_XPCONNECT_GLOBAL is set.");
|
||||
}
|
||||
|
@ -2217,7 +2217,7 @@ nsXPConnect::GetWrappedNativePrototype(JSContext * aJSContext,
|
|||
|
||||
AutoMarkingWrappedNativeProtoPtr proto(ccx);
|
||||
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, scope, aClassInfo,
|
||||
&sciProto, JS_FALSE,
|
||||
&sciProto, false,
|
||||
OBJ_IS_NOT_GLOBAL);
|
||||
if (!proto)
|
||||
return UnexpectedFailure(NS_ERROR_FAILURE);
|
||||
|
@ -2254,7 +2254,7 @@ nsXPConnect::ReleaseJSContext(JSContext * aJSContext, bool noGC)
|
|||
printf("!xpc - deferring destruction of JSContext @ %p\n",
|
||||
(void *)aJSContext);
|
||||
#endif
|
||||
ccx->SetDestroyJSContextInDestructor(JS_TRUE);
|
||||
ccx->SetDestroyJSContextInDestructor(true);
|
||||
return NS_OK;
|
||||
}
|
||||
// else continue on and synchronously destroy the JSContext ...
|
||||
|
@ -2649,8 +2649,8 @@ fail:
|
|||
* debugger callbacks from having any effect.
|
||||
*/
|
||||
if (gDesiredDebugMode)
|
||||
JS_SetRuntimeDebugMode(rt, JS_FALSE);
|
||||
gDesiredDebugMode = gDebugMode = JS_FALSE;
|
||||
JS_SetRuntimeDebugMode(rt, false);
|
||||
gDesiredDebugMode = gDebugMode = false;
|
||||
}
|
||||
|
||||
NS_EXPORT_(void)
|
||||
|
@ -2850,20 +2850,20 @@ nsXPConnect::Base64Encode(JSContext *cx, jsval val, jsval *out)
|
|||
xpc_qsACString encodedString(cx, root, &root, xpc_qsACString::eNull,
|
||||
xpc_qsACString::eStringify);
|
||||
if (!encodedString.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCAutoString result;
|
||||
if (NS_FAILED(nsXPConnect::Base64Encode(encodedString, result))) {
|
||||
JS_ReportError(cx, "Failed to encode base64 data!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString *str = JS_NewStringCopyN(cx, result.get(), result.Length());
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*out = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -2928,20 +2928,20 @@ nsXPConnect::Base64Decode(JSContext *cx, jsval val, jsval *out)
|
|||
xpc_qsACString encodedString(cx, root, &root, xpc_qsACString::eNull,
|
||||
xpc_qsACString::eNull);
|
||||
if (!encodedString.IsValid())
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCAutoString result;
|
||||
if (NS_FAILED(nsXPConnect::Base64Decode(encodedString, result))) {
|
||||
JS_ReportError(cx, "Failed to decode base64 string!");
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString *str = JS_NewStringCopyN(cx, result.get(), result.Length());
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
*out = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -517,7 +517,7 @@ public:
|
|||
static nsXPConnect* GetSingleton();
|
||||
|
||||
// Called by module code in dll startup
|
||||
static void InitStatics() { gSelf = nsnull; gOnceAliveNowDead = JS_FALSE; }
|
||||
static void InitStatics() { gSelf = nsnull; gOnceAliveNowDead = false; }
|
||||
// Called by module code on dll shutdown.
|
||||
static void ReleaseXPConnectSingleton();
|
||||
|
||||
|
@ -525,7 +525,7 @@ public:
|
|||
|
||||
JSBool IsShuttingDown() const {return mShuttingDown;}
|
||||
|
||||
void EnsureGCBeforeCC() { mNeedGCBeforeCC = JS_TRUE; }
|
||||
void EnsureGCBeforeCC() { mNeedGCBeforeCC = true; }
|
||||
|
||||
nsresult GetInfoForIID(const nsIID * aIID, nsIInterfaceInfo** info);
|
||||
nsresult GetInfoForName(const char * name, nsIInterfaceInfo** info);
|
||||
|
@ -536,7 +536,7 @@ public:
|
|||
static nsresult Base64Encode(const nsAString &aString,
|
||||
nsAString &aBinaryData);
|
||||
|
||||
// If this returns JS_FALSE then an exception will be set on cx.
|
||||
// If this returns false then an exception will be set on cx.
|
||||
static JSBool Base64Encode(JSContext *cx, jsval val, jsval *out);
|
||||
|
||||
static nsresult Base64Decode(const nsACString &aBinaryData,
|
||||
|
@ -545,7 +545,7 @@ public:
|
|||
static nsresult Base64Decode(const nsAString &aBinaryData,
|
||||
nsAString &aString);
|
||||
|
||||
// If this returns JS_FALSE then an exception will be set on cx.
|
||||
// If this returns false then an exception will be set on cx.
|
||||
static JSBool Base64Decode(JSContext *cx, jsval val, jsval *out);
|
||||
|
||||
// nsCycleCollectionParticipant
|
||||
|
@ -1002,11 +1002,11 @@ public:
|
|||
size_t length;
|
||||
const jschar* chars = JS_GetStringCharsZAndLength(aContext, str, &length);
|
||||
if (!chars)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
NS_ASSERTION(IsEmpty(), "init() on initialized string");
|
||||
new(static_cast<nsDependentString *>(this)) nsDependentString(chars, length);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1560,12 +1560,12 @@ public:
|
|||
|
||||
static XPCWrappedNativeScope*
|
||||
FindInJSObjectScope(JSContext* cx, JSObject* obj,
|
||||
JSBool OKIfNotInitialized = JS_FALSE,
|
||||
JSBool OKIfNotInitialized = false,
|
||||
XPCJSRuntime* runtime = nsnull);
|
||||
|
||||
static XPCWrappedNativeScope*
|
||||
FindInJSObjectScope(XPCCallContext& ccx, JSObject* obj,
|
||||
JSBool OKIfNotInitialized = JS_FALSE)
|
||||
JSBool OKIfNotInitialized = false)
|
||||
{
|
||||
return FindInJSObjectScope(ccx, obj, OKIfNotInitialized,
|
||||
ccx.GetRuntime());
|
||||
|
@ -2074,7 +2074,7 @@ public:
|
|||
XPCNativeScriptableShared(JSUint32 aFlags, char* aName,
|
||||
PRUint32 interfacesBitmap)
|
||||
: mFlags(aFlags),
|
||||
mCanBeSlim(JS_FALSE)
|
||||
mCanBeSlim(false)
|
||||
{memset(&mJSClass, 0, sizeof(mJSClass));
|
||||
mJSClass.base.name = aName; // take ownership
|
||||
mJSClass.interfacesBitmap = interfacesBitmap;
|
||||
|
@ -2678,7 +2678,7 @@ public:
|
|||
XPCNativeInterface* aInterface);
|
||||
XPCWrappedNativeTearOff* FindTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface,
|
||||
JSBool needJSObject = JS_FALSE,
|
||||
JSBool needJSObject = false,
|
||||
nsresult* pError = nsnull);
|
||||
void Mark() const
|
||||
{
|
||||
|
@ -3464,7 +3464,7 @@ public:
|
|||
nsXPCException();
|
||||
virtual ~nsXPCException();
|
||||
|
||||
static void InitStatics() { sEverMadeOneFromFactory = JS_FALSE; }
|
||||
static void InitStatics() { sEverMadeOneFromFactory = false; }
|
||||
|
||||
protected:
|
||||
void Reset();
|
||||
|
@ -3698,20 +3698,20 @@ public:
|
|||
JSBool EnsureExceptionManager()
|
||||
{
|
||||
if (mExceptionManager)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
if (mExceptionManagerNotAvailable)
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIExceptionService> xs =
|
||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||
if (xs)
|
||||
xs->GetCurrentExceptionManager(&mExceptionManager);
|
||||
if (mExceptionManager)
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
|
||||
mExceptionManagerNotAvailable = JS_TRUE;
|
||||
return JS_FALSE;
|
||||
mExceptionManagerNotAvailable = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
XPCJSContextStack* GetJSContextStack() {return mJSContextStack;}
|
||||
|
|
|
@ -89,7 +89,7 @@ DebugCheckWrapperClass(JSObject* obj)
|
|||
{
|
||||
NS_ASSERTION(IS_WRAPPER_CLASS(js::GetObjectClass(obj)),
|
||||
"Forgot to check if this is a wrapper?");
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If IS_WRAPPER_CLASS for the JSClass of an object is true, the object can be
|
||||
|
|
|
@ -488,7 +488,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
|||
|
||||
jsid exposedPropsId = GetRTIdByIndex(cx, XPCJSRuntime::IDX_EXPOSEDPROPS);
|
||||
|
||||
JSBool found = JS_FALSE;
|
||||
JSBool found = false;
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, wrappedObject) ||
|
||||
!JS_HasPropertyById(cx, wrappedObject, exposedPropsId, &found))
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
#include "mozilla/FunctionTimer.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsdate.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
@ -696,32 +695,10 @@ CalculateProcessCreationTimestamp()
|
|||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::GetStartupInfo()
|
||||
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::Value* aRetval)
|
||||
{
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpConnect = do_GetService(nsIXPConnect::GetCID(), &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = xpConnect->GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
jsval *retvalPtr;
|
||||
ncc->GetRetValPtr(&retvalPtr);
|
||||
|
||||
*retvalPtr = JSVAL_NULL;
|
||||
ncc->SetReturnValueWasSet(true);
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
rv = ncc->GetJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
*retvalPtr = OBJECT_TO_JSVAL(obj);
|
||||
ncc->SetReturnValueWasSet(true);
|
||||
JSObject *obj = JS_NewObject(aCx, NULL, NULL, NULL);
|
||||
*aRetval = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
PRTime ProcessCreationTimestamp = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
|
||||
|
||||
|
@ -749,8 +726,8 @@ nsAppStartup::GetStartupInfo()
|
|||
Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, i);
|
||||
StartupTimeline::Record(ev, -1);
|
||||
} else {
|
||||
JSObject *date = js_NewDateObjectMsec(cx, StartupTimeline::Get(ev)/PR_USEC_PER_MSEC);
|
||||
JS_DefineProperty(cx, obj, StartupTimeline::Describe(ev), OBJECT_TO_JSVAL(date), NULL, NULL, JSPROP_ENUMERATE);
|
||||
JSObject *date = JS_NewDateObjectMsec(aCx, StartupTimeline::Get(ev) / PR_USEC_PER_MSEC);
|
||||
JS_DefineProperty(aCx, obj, StartupTimeline::Describe(ev), OBJECT_TO_JSVAL(date), NULL, NULL, JSPROP_ENUMERATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
interface nsICmdLineService;
|
||||
|
||||
[scriptable, uuid(35fcdb69-3bb6-4484-b99a-32f49a84fabd)]
|
||||
[scriptable, uuid(dd3e7b3c-0974-4a38-b4d3-ce2213452432)]
|
||||
interface nsIAppStartup : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ interface nsIAppStartup : nsISupports
|
|||
* Returns an object with main, process, firstPaint, sessionRestored properties.
|
||||
* Properties may not be available depending on platform or application
|
||||
*/
|
||||
void getStartupInfo();
|
||||
[implicit_jscontext] jsval getStartupInfo();
|
||||
|
||||
/**
|
||||
* True if startup was interrupted by an interactive prompt.
|
||||
|
|
Загрузка…
Ссылка в новой задаче