author | Nicholas Nethercote <nnethercote@mozilla.com> |
Thu, 08 Aug 2013 15:53:04 -0700 | |
changeset 141957 | 7db702296585f916dd83febbe1e313f087ee55ae |
parent 141956 | f63d9777060cdb53188f0f07c46209ab3e36bfad |
child 141958 | 18236f0722def5c80fa83890b9ee8f4a4be1e432 |
push id | 25076 |
push user | ryanvm@gmail.com |
push date | Fri, 09 Aug 2013 23:09:21 +0000 |
treeherder | mozilla-central@cead6eb63964 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 898914 |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/caps/include/nsJSPrincipals.h +++ b/caps/include/nsJSPrincipals.h @@ -8,17 +8,17 @@ #define nsJSPrincipals_h__ #include "jsapi.h" #include "nsIPrincipal.h" class nsCString; struct nsJSPrincipals : nsIPrincipal, JSPrincipals { - static JSBool Subsume(JSPrincipals *jsprin, JSPrincipals *other); + static bool Subsume(JSPrincipals *jsprin, JSPrincipals *other); static void Destroy(JSPrincipals *jsprin); /* * Get a weak reference to nsIPrincipal associated with the given JS * principal. */ static nsJSPrincipals* get(JSPrincipals *principals) { nsJSPrincipals *self = static_cast<nsJSPrincipals *>(principals);
--- a/caps/include/nsScriptSecurityManager.h +++ b/caps/include/nsScriptSecurityManager.h @@ -366,23 +366,23 @@ public: private: // GetScriptSecurityManager is the only call that can make one nsScriptSecurityManager(); virtual ~nsScriptSecurityManager(); bool SubjectIsPrivileged(); - static JSBool + static bool CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSAccessMode mode, JS::MutableHandle<JS::Value> vp); // Decides, based on CSP, whether or not eval() and stuff can be executed. - static JSBool + static bool ContentSecurityPolicyPermitsJSAction(JSContext *cx); // Returns null if a principal cannot be found; generally callers // should error out at that point. static nsIPrincipal* doGetObjectPrincipal(JS::Handle<JSObject*> obj); #ifdef DEBUG static nsIPrincipal* old_doGetObjectPrincipal(JS::Handle<JSObject*> obj,
--- a/caps/src/nsJSPrincipals.cpp +++ b/caps/src/nsJSPrincipals.cpp @@ -15,17 +15,17 @@ #include "nsIJSRuntimeService.h" #include "nsIServiceManager.h" #include "nsMemory.h" #include "nsStringBuffer.h" // for mozilla::dom::workers::kJSPrincipalsDebugToken #include "mozilla/dom/workers/Workers.h" -/* static */ JSBool +/* static */ bool nsJSPrincipals::Subsume(JSPrincipals *jsprin, JSPrincipals *other) { bool result; nsresult rv = nsJSPrincipals::get(jsprin)->Subsumes(nsJSPrincipals::get(other), &result); return NS_SUCCEEDED(rv) && result; } /* static */ void
--- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -418,17 +418,17 @@ NS_IMPL_ISUPPORTS4(nsScriptSecurityManag nsIObserver) /////////////////////////////////////////////////// // Methods implementing nsIScriptSecurityManager // /////////////////////////////////////////////////// ///////////////// Security Checks ///////////////// -JSBool +bool nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx) { // Get the security manager nsScriptSecurityManager *ssm = nsScriptSecurityManager::GetScriptSecurityManager(); NS_ASSERTION(ssm, "Failed to get security manager service"); if (!ssm) @@ -478,17 +478,17 @@ nsScriptSecurityManager::ContentSecurity scriptSample, lineNum); } return evalOK; } -JSBool +bool nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSAccessMode mode, JS::MutableHandle<JS::Value> vp) { // Get the security manager nsScriptSecurityManager *ssm = nsScriptSecurityManager::GetScriptSecurityManager();
--- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -311,17 +311,17 @@ nsFrameMessageManager::LoadFrameScript(c NS_IMETHODIMP nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL) { mPendingScripts.RemoveElement(aURL); return NS_OK; } -static JSBool +static bool JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData) { nsAString* result = static_cast<nsAString*>(aData); result->Append(static_cast<const PRUnichar*>(aBuf), static_cast<uint32_t>(aLen)); return true; }
--- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -75,17 +75,17 @@ XBLFinalize(JSFreeOp *fop, JSObject *obj nsXBLDocumentInfo* docInfo = static_cast<nsXBLDocumentInfo*>(::JS_GetPrivate(obj)); nsContentUtils::DeferredFinalize(static_cast<nsIScriptGlobalObjectOwner*>(docInfo)); nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GetClass(obj)); c->Drop(); } -static JSBool +static bool XBLEnumerate(JSContext *cx, JS::Handle<JSObject*> obj) { nsXBLPrototypeBinding* protoBinding = static_cast<nsXBLPrototypeBinding*>(::JS_GetReservedSlot(obj, 0).toPrivate()); MOZ_ASSERT(protoBinding); return protoBinding->ResolveAllFields(cx, obj); }
--- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -63,18 +63,18 @@ public: virtual nsIScriptContext *GetContext(); virtual void OnFinalize(JSObject* aObject); virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts); // nsIScriptObjectPrincipal methods virtual nsIPrincipal* GetPrincipal(); - static JSBool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj, - JS::Handle<jsid> id, uint32_t accessType); + static bool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj, + JS::Handle<jsid> id, uint32_t accessType); NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXBLDocGlobalObject, nsIScriptGlobalObject) void ClearGlobalObjectOwner(); void UnmarkScriptContext(); @@ -85,17 +85,17 @@ protected: nsCOMPtr<nsIScriptContext> mScriptContext; JSObject *mJSObject; nsXBLDocumentInfo* mGlobalObjectOwner; // weak reference static JSClass gSharedGlobalClass; }; -JSBool +bool nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, uint32_t accessType) { nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager(); if (!ssm) { ::JS_ReportError(cx, "Unable to verify access to a global object property."); return false; } @@ -113,33 +113,33 @@ nsXBLDocGlobalObject::doCheckAccess(JSCo } } nsresult rv = ssm->CheckPropertyAccess(cx, base, JS_GetClass(base)->name, id, accessType); return NS_SUCCEEDED(rv); } -static JSBool +static bool nsXBLDocGlobalObject_getProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { return nsXBLDocGlobalObject:: doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY); } -static JSBool +static bool nsXBLDocGlobalObject_setProperty(JSContext *cx, JS::Handle<JSObject*> obj, - JS::Handle<jsid> id, JSBool strict, JS::MutableHandle<JS::Value> vp) + JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp) { return nsXBLDocGlobalObject:: doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY); } -static JSBool +static bool nsXBLDocGlobalObject_checkAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSAccessMode mode, JS::MutableHandle<JS::Value> vp) { uint32_t translated; if (mode & JSACC_WRITE) { translated = nsIXPCSecurityManager::ACCESS_SET_PROPERTY; } else { translated = nsIXPCSecurityManager::ACCESS_GET_PROPERTY; @@ -158,20 +158,20 @@ nsXBLDocGlobalObject_finalize(JSFreeOp * if (sgo) sgo->OnFinalize(obj); // The addref was part of JSObject construction NS_RELEASE(nativeThis); } -static JSBool +static bool nsXBLDocGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id) { - JSBool did_resolve = false; + bool did_resolve = false; return JS_ResolveStandardClass(cx, obj, id, &did_resolve); } JSClass nsXBLDocGlobalObject::gSharedGlobalClass = { "nsXBLPrototypeScript compilation scope", JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),
--- a/content/xbl/src/nsXBLProtoImpl.cpp +++ b/content/xbl/src/nsXBLProtoImpl.cpp @@ -295,17 +295,17 @@ nsXBLProtoImpl::ResolveAllFields(JSConte void nsXBLProtoImpl::UndefineFields(JSContext *cx, JS::Handle<JSObject*> obj) const { JSAutoRequest ar(cx); for (nsXBLProtoImplField* f = mFields; f; f = f->GetNext()) { nsDependentString name(f->GetName()); const jschar* s = reinterpret_cast<const jschar*>(name.get()); - JSBool hasProp; + bool hasProp; if (::JS_AlreadyHasOwnUCProperty(cx, obj, s, name.Length(), &hasProp) && hasProp) { bool dummy; ::JS_DeleteUCProperty2(cx, obj, s, name.Length(), &dummy); } } }
--- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -120,17 +120,17 @@ ValueHasISupportsPrivate(const JS::Value JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS; return (clasp->flags & HAS_PRIVATE_NSISUPPORTS) == HAS_PRIVATE_NSISUPPORTS; } // Define a shadowing property on |this| for the XBL field defined by the // contents of the callee's reserved slots. If the property was defined, // *installed will be true, and idp will be set to the property name that was // defined. -static JSBool +static bool InstallXBLField(JSContext* cx, JS::Handle<JSObject*> callee, JS::Handle<JSObject*> thisObj, JS::MutableHandle<jsid> idp, bool* installed) { *installed = false; // First ensure |this| is a reasonable XBL bound node. // @@ -318,17 +318,17 @@ nsXBLProtoImplField::InstallAccessors(JS JS::Rooted<jsid> id(aCx); JS::TwoByteChars chars(mName, NS_strlen(mName)); if (!JS_CharsToId(aCx, chars, id.address())) return NS_ERROR_OUT_OF_MEMORY; // Properties/Methods have historically taken precendence over fields. We // install members first, so just bounce here if the property is already // defined. - JSBool found = false; + bool found = false; if (!JS_AlreadyHasOwnPropertyById(aCx, aTargetClassObject, id, &found)) return NS_ERROR_FAILURE; if (found) return NS_OK; // FieldGetter and FieldSetter need to run in the XBL scope so that they can // see through any SOWs on their targets.
--- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -337,17 +337,17 @@ nsXBLProtoImplAnonymousMethod::Execute(n return NS_ERROR_OUT_OF_MEMORY; // Now call the method // Check whether it's OK to call the method. rv = nsContentUtils::GetSecurityManager()->CheckFunctionAccess(cx, method, thisObject); - JSBool ok = true; + bool ok = true; if (NS_SUCCEEDED(rv)) { JS::Rooted<JS::Value> retval(cx); ok = ::JS_CallFunctionValue(cx, thisObject, OBJECT_TO_JSVAL(method), 0 /* argc */, nullptr /* argv */, retval.address()); } if (!ok) { // If a constructor or destructor threw an exception, it doesn't stop
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -93,20 +93,20 @@ nsXULPDGlobalObject_finalize(JSFreeOp *f nsXULPDGlobalObject* nativeThis = static_cast<nsXULPDGlobalObject*>(JS_GetPrivate(obj)); nativeThis->OnFinalize(obj); // The addref was part of JSObject construction nsContentUtils::DeferredFinalize(nativeThis); } -JSBool +bool nsXULPDGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id) { - JSBool did_resolve = false; + bool did_resolve = false; return JS_ResolveStandardClass(cx, obj, id, &did_resolve); } JSClass nsXULPDGlobalObject::gSharedGlobalClass = { "nsXULPrototypeScript compilation scope", JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2177,17 +2177,17 @@ nsDOMClassInfo::PostCreatePrototype(JSCo if (!win || !(global = win->GetGlobalJSObject()) || win->IsClosedOrClosing()) { return NS_OK; } } // Don't overwrite a property set by content. - JSBool found; + bool found; if (!::JS_AlreadyHasOwnUCProperty(cx, global, reinterpret_cast<const jschar*>(mData->mNameUTF16), NS_strlen(mData->mNameUTF16), &found)) { return NS_ERROR_FAILURE; } nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_OK); @@ -2341,17 +2341,17 @@ static JSClass sGlobalScopePolluterClass JS_EnumerateStub, (JSResolveOp)nsWindowSH::GlobalScopePolluterNewResolve, JS_ConvertStub, nullptr }; // static -JSBool +bool nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { // Someone is accessing a element by referencing its name/id in the // global scope, do a security check to make sure that's ok. nsresult rv = sSecMan->CheckPropertyAccess(cx, ::JS_GetGlobalForObject(cx, obj), @@ -2364,17 +2364,17 @@ nsWindowSH::GlobalScopePolluterGetProper return false; } return true; } // Gets a subframe. -static JSBool +static bool ChildWindowGetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { MOZ_ASSERT(JSID_IS_STRING(id)); // Grab the native DOM window. vp.setUndefined(); nsCOMPtr<nsISupports> winSupports = do_QueryInterface(nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj)); @@ -2401,17 +2401,17 @@ static nsHTMLDocument* GetDocument(JSObject *obj) { MOZ_ASSERT(js::GetObjectJSClass(obj) == &sHTMLDocumentAllClass); return static_cast<nsHTMLDocument*>( static_cast<nsINode*>(JS_GetPrivate(obj))); } // static -JSBool +bool nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, JS::MutableHandle<JSObject*> objp) { if (!JSID_IS_STRING(id)) { // Nothing to do if we're resolving a non-string property. return true; } @@ -2447,17 +2447,17 @@ nsWindowSH::GlobalScopePolluterNewResolv return true; } } JS::Rooted<JSObject*> proto(cx); if (!::JS_GetPrototype(cx, obj, &proto)) { return false; } - JSBool hasProp; + bool hasProp; if (!proto || !::JS_HasPropertyById(cx, proto, id, &hasProp) || hasProp) { // No prototype, or the property exists on the prototype. Do // nothing. return true; } @@ -2498,17 +2498,17 @@ nsWindowSH::GlobalScopePolluterNewResolv objp.set(obj); } return true; } // static -JSBool +bool nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JS::Handle<JSObject*> aObj) { JS::Rooted<JSObject*> proto(cx); JS::Rooted<JSObject*> obj(cx, aObj); for (;;) { if (!::JS_GetPrototype(cx, obj, &proto)) { @@ -2856,17 +2856,17 @@ public: JS::Handle<JSObject*> obj, const jsval &val, bool *bp, bool *_retval); nsresult Install(JSContext *cx, JS::Handle<JSObject*> target, JS::Handle<JS::Value> aThisAsVal) { JS::Rooted<JS::Value> thisAsVal(cx, aThisAsVal); // The 'attrs' argument used to be JSPROP_PERMANENT. See bug 628612. - JSBool ok = JS_WrapValue(cx, thisAsVal.address()) && + bool ok = JS_WrapValue(cx, thisAsVal.address()) && ::JS_DefineUCProperty(cx, target, reinterpret_cast<const jschar *>(mClassName), NS_strlen(mClassName), thisAsVal, JS_PropertyStub, JS_StrictPropertyStub, 0); return ok ? NS_OK : NS_ERROR_UNEXPECTED; } @@ -3758,19 +3758,19 @@ nsWindowSH::GlobalResolve(nsGlobalWindow } NS_ENSURE_SUCCESS(rv, rv); if (!JS_WrapValue(cx, prop_val.address())) { return NS_ERROR_UNEXPECTED; } - JSBool ok = ::JS_DefinePropertyById(cx, obj, id, prop_val, - JS_PropertyStub, JS_StrictPropertyStub, - JSPROP_ENUMERATE); + bool ok = ::JS_DefinePropertyById(cx, obj, id, prop_val, + JS_PropertyStub, JS_StrictPropertyStub, + JSPROP_ENUMERATE); *did_resolve = true; return ok ? NS_OK : NS_ERROR_FAILURE; } if (name_struct->mType == nsGlobalNameStruct::eTypeDynamicNameSet) { nsCOMPtr<nsIScriptExternalNameSet> nameset = @@ -3845,32 +3845,32 @@ LocationSetterGuts(JSContext *cx, JSObje nsDependentJSString depStr; NS_ENSURE_TRUE(depStr.init(cx, val), NS_ERROR_UNEXPECTED); return location->SetHref(depStr); } template<class Interface> -static JSBool -LocationSetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict, +static bool +LocationSetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp) { nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address()); if (NS_FAILED(rv)) { xpc::Throw(cx, rv); return false; } return true; } -static JSBool +static bool LocationSetterUnwrapper(JSContext *cx, JS::Handle<JSObject*> obj_, JS::Handle<jsid> id, - JSBool strict, JS::MutableHandle<JS::Value> vp) + bool strict, JS::MutableHandle<JS::Value> vp) { JS::RootedObject obj(cx, obj_); JSObject *wrapped = XPCWrapper::UnsafeUnwrapSecurityWrapper(obj); if (wrapped) { obj = wrapped; } @@ -3985,18 +3985,18 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper); MOZ_ASSERT(win->IsInnerWindow()); nsIScriptContext *my_context = win->GetContextInternal(); // Don't resolve standard classes on XrayWrappers, only resolve them if we're // resolving on the real global object. if (!xpc::WrapperFactory::IsXrayWrapper(obj)) { - JSBool did_resolve = false; - JSBool ok = true; + bool did_resolve = false; + bool ok = true; JS::Rooted<JS::Value> exn(cx, JSVAL_VOID); { // Resolve standard classes on my_context's JSContext (or on cx, // if we don't have a my_context yet), in case the two contexts // have different origins. We want lazy standard class // initialization to behave as if it were done eagerly, on each // window's own context (not on some other window-caller's @@ -4063,17 +4063,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp JS::Rooted<JSObject*> scope(cx, wrapper->GetJSObject()); nsCOMPtr<nsIXPConnectJSObjectHolder> holder; JS::Rooted<JS::Value> v(cx); rv = WrapNative(cx, scope, location, &NS_GET_IID(nsIDOMLocation), true, v.address(), getter_AddRefs(holder)); NS_ENSURE_SUCCESS(rv, rv); - JSBool ok = JS_WrapValue(cx, v.address()) && + bool ok = JS_WrapValue(cx, v.address()) && JS_DefinePropertyById(cx, obj, id, v, JS_PropertyStub, LocationSetterUnwrapper, JSPROP_PERMANENT | JSPROP_ENUMERATE); if (!ok) { return NS_ERROR_FAILURE; } @@ -4512,17 +4512,17 @@ nsGenericArraySH::Enumerate(nsIXPConnect if (sCurrentlyEnumerating) { // Don't recurse to death. return NS_OK; } sCurrentlyEnumerating = true; JS::Rooted<JS::Value> len_val(cx); - JSBool ok = ::JS_GetProperty(cx, obj, "length", &len_val); + bool ok = ::JS_GetProperty(cx, obj, "length", &len_val); if (ok && JSVAL_IS_INT(len_val)) { int32_t length = JSVAL_TO_INT(len_val); for (int32_t i = 0; ok && i < length; ++i) { ok = ::JS_DefineElement(cx, obj, i, JSVAL_VOID, nullptr, nullptr, JSPROP_ENUMERATE | JSPROP_SHARED); } @@ -4608,17 +4608,17 @@ JSClass sHTMLDocumentAllClass = { JS_ConvertStub, nsHTMLDocumentSH::ReleaseDocument, nullptr, /* checkAccess */ nsHTMLDocumentSH::CallToGetPropMapper }; // static -JSBool +bool nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JS::Handle<JSObject*> obj, nsDocument *domdoc, nsContentList **nodeList) { // The document.all object is a mix of the node list returned by // document.getElementsByTagName("*") and a map of elements in the // document exposed by their id and/or name. To make access to the @@ -4674,17 +4674,17 @@ nsHTMLDocumentSH::GetDocumentAllNodeList xpc::Throw(cx, NS_ERROR_FAILURE); return false; } return *nodeList != nullptr; } -JSBool +bool nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj_, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { JS::Rooted<JSObject*> obj(cx, obj_); // document.all.item and .namedItem get their value in the // newResolve hook, so nothing to do for those properties here. And // we need to return early to prevent <div id="item"> from shadowing @@ -4771,17 +4771,17 @@ nsHTMLDocumentSH::DocumentAllGetProperty } } else { vp.setUndefined(); } return true; } -JSBool +bool nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, JS::MutableHandle<JSObject*> objp) { JS::RootedValue v(cx); if (nsDOMClassInfo::sItem_id == id || nsDOMClassInfo::sNamedItem_id == id) { // Define the item() or namedItem() method. @@ -4801,17 +4801,17 @@ nsHTMLDocumentSH::DocumentAllNewResolve( v = JSVAL_ONE; } else { if (!DocumentAllGetProperty(cx, obj, id, &v)) { return false; } } - JSBool ok = true; + bool ok = true; if (v.get() != JSVAL_VOID) { ok = ::JS_DefinePropertyById(cx, obj, id, v, nullptr, nullptr, 0); objp.set(obj); } return ok; } @@ -5047,17 +5047,17 @@ nsStorage2SH::NewResolve(nsIXPConnectWra if (!jsstr) { return NS_OK; } JS::Rooted<JSObject*> proto(cx); if (!::JS_GetPrototype(cx, realObj, &proto)) { return NS_ERROR_FAILURE; } - JSBool hasProp; + bool hasProp; if (proto && (::JS_HasPropertyById(cx, proto, id, &hasProp) && hasProp)) { // We found the property we're resolving on the prototype, // nothing left to do here then. return NS_OK; @@ -5293,17 +5293,17 @@ nsDOMConstructorSH::NewResolve(nsIXPConn static_cast<nsDOMConstructor *>(wrapper->Native()); nsresult rv = wrapped->ResolveInterfaceConstants(cx, nativePropsObj); NS_ENSURE_SUCCESS(rv, rv); // Now re-lookup the ID to see if we should report back that we resolved the // looked-for constant. Note that we don't have to worry about infinitely // recurring back here because the Xray wrapper's holder object doesn't call // NewResolve hooks. - JSBool found; + bool found; if (!JS_HasPropertyById(cx, nativePropsObj, id, &found)) { *_retval = false; return NS_OK; } if (found) { *objp = obj; }
--- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -328,23 +328,23 @@ public: NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsid id, uint32_t flags, JSObject **objp, bool *_retval) MOZ_OVERRIDE; NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSFreeOp *fop, JSObject *obj) MOZ_OVERRIDE; NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval) MOZ_OVERRIDE; - static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, - JS::Handle<jsid> id, unsigned flags, - JS::MutableHandle<JSObject*> objp); - static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, - JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp); - static JSBool InvalidateGlobalScopePolluter(JSContext *cx, - JS::Handle<JSObject*> obj); + static bool GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, + JS::Handle<jsid> id, unsigned flags, + JS::MutableHandle<JSObject*> objp); + static bool GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, + JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp); + static bool InvalidateGlobalScopePolluter(JSContext *cx, + JS::Handle<JSObject*> obj); static nsresult InstallGlobalScopePolluter(JSContext *cx, JS::Handle<JSObject*> obj); static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) { return new nsWindowSH(aData); } }; @@ -438,24 +438,24 @@ private: // HTMLAllCollection extern JSClass sHTMLDocumentAllClass; class nsHTMLDocumentSH { protected: - static JSBool GetDocumentAllNodeList(JSContext *cx, JS::Handle<JSObject*> obj, - nsDocument *doc, - nsContentList **nodeList); + static bool GetDocumentAllNodeList(JSContext *cx, JS::Handle<JSObject*> obj, + nsDocument *doc, + nsContentList **nodeList); public: - static JSBool DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - JS::MutableHandle<JS::Value> vp); - static JSBool DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - unsigned flags, JS::MutableHandle<JSObject*> objp); + static bool DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + JS::MutableHandle<JS::Value> vp); + static bool DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + unsigned flags, JS::MutableHandle<JSObject*> objp); static void ReleaseDocument(JSFreeOp *fop, JSObject *obj); static bool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp); }; // String array helper class nsStringArraySH : public nsGenericArraySH
--- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6731,17 +6731,17 @@ PostMessageReadStructuredClone(JSContext if (runtimeCallbacks) { return runtimeCallbacks->read(cx, reader, tag, data, nullptr); } return nullptr; } -static JSBool +static bool PostMessageWriteStructuredClone(JSContext* cx, JSStructuredCloneWriter* writer, JS::Handle<JSObject*> obj, void *closure) { StructuredCloneInfo* scInfo = static_cast<StructuredCloneInfo*>(closure); NS_ASSERTION(scInfo, "Must have scInfo!");
--- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -689,17 +689,17 @@ GetPromptFromContext(nsJSContext* ctx) nsIDocShell *docShell = win->GetDocShell(); NS_ENSURE_TRUE(docShell, nullptr); // Get the nsIPrompt interface from the docshell nsCOMPtr<nsIPrompt> prompt = do_GetInterface(docShell); return prompt.forget(); } -JSBool +bool nsJSContext::DOMOperationCallback(JSContext *cx) { nsresult rv; // Get the native context nsJSContext *ctx = static_cast<nsJSContext *>(::JS_GetContextPrivate(cx)); if (!ctx) { @@ -758,17 +758,17 @@ nsJSContext::DOMOperationCallback(JSCont // we'll tell the user about this and we'll give the user the option // of stopping the execution of the script. nsCOMPtr<nsIPrompt> prompt = GetPromptFromContext(ctx); NS_ENSURE_TRUE(prompt, false); // Check if we should offer the option to debug JS::RootedScript script(cx); unsigned lineno; - JSBool hasFrame = ::JS_DescribeScriptedCaller(cx, script.address(), &lineno); + bool hasFrame = ::JS_DescribeScriptedCaller(cx, script.address(), &lineno); bool debugPossible = hasFrame && js::CanCallContextDebugHandler(cx); #ifdef MOZ_JSDEBUGGER // Get the debugger service if necessary. if (debugPossible) { bool jsds_IsOn = false; const char jsdServiceCtrID[] = "@mozilla.org/js/jsd/debugger-service;1"; nsCOMPtr<jsdIExecutionHook> jsdHook; @@ -3310,17 +3310,17 @@ NS_DOMReadStructuredClone(JSContext* cx, return imageData->WrapObject(cx, global); } // Don't know what this is. Bail. xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR); return nullptr; } -JSBool +bool NS_DOMWriteStructuredClone(JSContext* cx, JSStructuredCloneWriter* writer, JS::Handle<JSObject*> obj, void *closure) { ImageData* imageData; nsresult rv = UnwrapObject<ImageData>(cx, obj, imageData); if (NS_FAILED(rv)) {
--- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -201,17 +201,17 @@ private: nsJSContext **mPrev; // mGlobalObjectRef ensures that the outer window stays alive as long as the // context does. It is eventually collected by the cycle collector. nsCOMPtr<nsIScriptGlobalObject> mGlobalObjectRef; static int JSOptionChangedCallback(const char *pref, void *data); - static JSBool DOMOperationCallback(JSContext *cx); + static bool DOMOperationCallback(JSContext *cx); }; class nsIJSRuntimeService; class nsJSRuntime MOZ_FINAL : public nsIScriptRuntime { public: // let people who can see us use our runtime for convenience. @@ -258,15 +258,15 @@ nsresult NS_CreateJSRuntime(nsIScriptRun /* prototypes */ void NS_ScriptErrorReporter(JSContext *cx, const char *message, JSErrorReport *report); JSObject* NS_DOMReadStructuredClone(JSContext* cx, JSStructuredCloneReader* reader, uint32_t tag, uint32_t data, void* closure); -JSBool NS_DOMWriteStructuredClone(JSContext* cx, - JSStructuredCloneWriter* writer, - JS::Handle<JSObject*> obj, void *closure); +bool NS_DOMWriteStructuredClone(JSContext* cx, + JSStructuredCloneWriter* writer, + JS::Handle<JSObject*> obj, void *closure); void NS_DOMStructuredCloneError(JSContext* cx, uint32_t errorid); #endif /* nsJSEnvironment_h */
--- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -25,17 +25,17 @@ #include "nsDOMJSUtils.h" // for GetScriptContextFromJSContext #include "nsContentUtils.h" #include "nsJSPrincipals.h" #include "mozilla/dom/BindingUtils.h" -JSBool +bool nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename, uint32_t* aLineno) { JSScript* script = nullptr; unsigned lineno = 0; if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) { return false;
--- a/dom/base/nsJSUtils.h +++ b/dom/base/nsJSUtils.h @@ -22,18 +22,18 @@ class nsIDOMEventListener; class nsIScriptContext; class nsIScriptGlobalObject; class nsIPrincipal; class nsJSUtils { public: - static JSBool GetCallingLocation(JSContext* aContext, const char* *aFilename, - uint32_t* aLineno); + static bool GetCallingLocation(JSContext* aContext, const char* *aFilename, + uint32_t* aLineno); static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj); static nsIScriptContext *GetStaticScriptContext(JSObject* aObj); static nsIScriptGlobalObject *GetDynamicScriptGlobal(JSContext *aContext); static nsIScriptContext *GetDynamicScriptContext(JSContext *aContext); @@ -94,30 +94,30 @@ public: * constructed, which leaves it empty (this->IsEmpty()), and initialized with * one of the init() methods below. */ nsDependentJSString() { } - JSBool init(JSContext* aContext, JSString* str) + bool init(JSContext* aContext, JSString* str) { size_t length; const jschar* chars = JS_GetStringCharsZAndLength(aContext, str, &length); if (!chars) return false; NS_ASSERTION(IsEmpty(), "init() on initialized string"); nsDependentString* base = this; new(base) nsDependentString(chars, length); return true; } - JSBool init(JSContext* aContext, const JS::Value &v) + bool init(JSContext* aContext, const JS::Value &v) { return init(aContext, JSVAL_TO_STRING(v)); } void init(JSFlatString* fstr) { MOZ_ASSERT(IsEmpty(), "init() on initialized string"); new(this) nsDependentJSString(fstr);
--- a/dom/base/nsStructuredCloneContainer.cpp +++ b/dom/base/nsStructuredCloneContainer.cpp @@ -107,17 +107,17 @@ nsStructuredCloneContainer::DeserializeT nsIVariant **aData) { NS_ENSURE_STATE(mData); NS_ENSURE_ARG_POINTER(aData); *aData = nullptr; // Deserialize to a JS::Value. JS::Rooted<JS::Value> jsStateObj(aCx); - JSBool hasTransferable = false; + bool hasTransferable = false; bool success = JS_ReadStructuredClone(aCx, mData, mSize, mVersion, jsStateObj.address(), nullptr, nullptr) && JS_StructuredCloneHasTransferables(mData, mSize, &hasTransferable); // We want to be sure that mData doesn't contain transferable objects MOZ_ASSERT(!hasTransferable); NS_ENSURE_STATE(success && !hasTransferable);
--- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -212,17 +212,17 @@ ErrorResult::ReportNotEnoughArgsError(JS namespace dom { bool DefineConstants(JSContext* cx, JS::Handle<JSObject*> obj, const ConstantSpec* cs) { for (; cs->name; ++cs) { - JSBool ok = + bool ok = JS_DefineProperty(cx, obj, cs->name, cs->value, NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT); if (!ok) { return false; } } return true; } @@ -346,17 +346,17 @@ CreateConstructor(JSContext* cx, JS::Han js::PrivateValue(const_cast<JSNativeHolder*>(nativeHolder))); return constructor; } static bool DefineConstructor(JSContext* cx, JS::Handle<JSObject*> global, const char* name, JS::Handle<JSObject*> constructor) { - JSBool alreadyDefined; + bool alreadyDefined; if (!JS_AlreadyHasOwnProperty(cx, global, name, &alreadyDefined)) { return false; } // This is Enumerable: False per spec. return alreadyDefined || JS_DefineProperty(cx, global, name, OBJECT_TO_JSVAL(constructor), nullptr, nullptr, 0); @@ -667,17 +667,17 @@ TryPreserveWrapper(JSObject* obj) // so it does not need to be preserved. If it is cycle collected, then // we can't tell if it is wrappercached or not, so we just return false. const DOMClass* domClass = GetDOMClass(obj); return domClass && !domClass->mParticipant; } // Can only be called with the immediate prototype of the instance object. Can // only be called on the prototype of an object known to be a DOM instance. -JSBool +bool InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID, uint32_t depth) { const DOMClass* domClass = static_cast<DOMClass*>( js::GetReservedSlot(protoObject, DOM_PROTO_INSTANCE_CLASS_SLOT).toPrivate()); return (uint32_t)domClass->mInterfaceChain[depth] == protoID; } @@ -1311,17 +1311,17 @@ GetPropertyOnPrototype(JSContext* cx, JS if (!js::GetObjectProto(cx, proxy, &proto)) { return false; } if (!proto) { *found = false; return true; } - JSBool hasProp; + bool hasProp; if (!JS_HasPropertyById(cx, proto, id, &hasProp)) { return false; } *found = hasProp; if (!hasProp || !vp) { return true; } @@ -1725,20 +1725,20 @@ GlobalObject::GlobalObject(JSContext* aC WorkerGlobalObject::WorkerGlobalObject(JSContext* aCx, JSObject* aObject) : mGlobalJSObject(aCx), mCx(aCx) { Maybe<JSAutoCompartment> ac; mGlobalJSObject = GetGlobalObject<false>(aCx, aObject, ac); } -JSBool +bool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*> instance, - JSBool* bp) + bool* bp) { const DOMIfaceAndProtoJSClass* clasp = DOMIfaceAndProtoJSClass::FromJSClass(js::GetObjectClass(obj)); const DOMClass* domClass = GetDOMClass(js::UncheckedUnwrap(instance)); MOZ_ASSERT(!domClass || clasp->mPrototypeID != prototypes::id::_ID_Count, "Why do we have a hasInstance hook if we don't have a prototype " @@ -1784,33 +1784,33 @@ InterfaceHasInstance(JSContext* cx, JS:: return false; } } *bp = false; return true; } -JSBool +bool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp, - JSBool* bp) + bool* bp) { if (!vp.isObject()) { *bp = false; return true; } JS::Rooted<JSObject*> instanceObject(cx, &vp.toObject()); return InterfaceHasInstance(cx, obj, instanceObject, bp); } -JSBool +bool InterfaceHasInstance(JSContext* cx, int prototypeID, int depth, JS::Handle<JSObject*> instance, - JSBool* bp) + bool* bp) { const DOMClass* domClass = GetDOMClass(js::UncheckedUnwrap(instance)); MOZ_ASSERT(!domClass || prototypeID != prototypes::id::_ID_Count, "Why do we have a hasInstance hook if we don't have a prototype " "ID?"); *bp = (domClass && domClass->mInterfaceChain[depth] == prototypeID);
--- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -979,17 +979,17 @@ ClearWrapper(T* p, void*) // // This operation will return false only for non-nsISupports cycle-collected // objects, because we cannot determine if they are wrappercached or not. bool TryPreserveWrapper(JSObject* obj); // Can only be called with the immediate prototype of the instance object. Can // only be called on the prototype of an object known to be a DOM instance. -JSBool +bool InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID, uint32_t depth); // Only set allowNativeWrapper to false if you really know you need it, if in // doubt use true. Setting it to false disables security wrappers. bool XPCOMObjectToJsval(JSContext* cx, JS::Handle<JSObject*> scope, xpcObjectHelper& helper, const nsIID* iid, @@ -2088,27 +2088,27 @@ const T& NonNullHelper(const OwningNonNu nsresult ReparentWrapper(JSContext* aCx, JS::HandleObject aObj); /** * Used to implement the hasInstance hook of an interface object. * * instance should not be a security wrapper. */ -JSBool +bool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*> instance, - JSBool* bp); -JSBool + bool* bp); +bool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp, - JSBool* bp); -JSBool + bool* bp); +bool InterfaceHasInstance(JSContext* cx, int prototypeID, int depth, JS::Handle<JSObject*> instance, - JSBool* bp); + bool* bp); // Helper for lenient getters/setters to report to console. If this // returns false, we couldn't even get a global. bool ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj); inline JSObject* GetUnforgeableHolder(JSObject* aGlobal, prototypes::ID aId)
--- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -957,17 +957,17 @@ class CGAbstractClassHook(CGAbstractStat class CGAddPropertyHook(CGAbstractClassHook): """ A hook for addProperty, used to preserve our wrapper from GC. """ def __init__(self, descriptor): args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'), Argument('JS::Handle<jsid>', 'id'), Argument('JS::MutableHandle<JS::Value>', 'vp')] CGAbstractClassHook.__init__(self, descriptor, ADDPROPERTY_HOOK_NAME, - 'JSBool', args) + 'bool', args) def generate_code(self): assert not self.descriptor.workers and self.descriptor.wrapperCache return (" // We don't want to preserve if we don't have a wrapper.\n" " if (self->GetWrapperPreserveColor()) {\n" " PreserveWrapper(self);\n" " }\n" " return true;") @@ -1147,19 +1147,19 @@ class CGNamedConstructors(CGThing): namedConstructors = CGWrapper(CGIndenter(namedConstructors), pre="static const NamedConstructor namedConstructors[] = {\n", post="\n};\n") return nativePropertyHooks + namedConstructors.define() class CGClassHasInstanceHook(CGAbstractStaticMethod): def __init__(self, descriptor): args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'), - Argument('JS::MutableHandle<JS::Value>', 'vp'), Argument('JSBool*', 'bp')] + Argument('JS::MutableHandle<JS::Value>', 'vp'), Argument('bool*', 'bp')] CGAbstractStaticMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME, - 'JSBool', args) + 'bool', args) def define(self): if not NeedsGeneratedHasInstance(self.descriptor): return "" return CGAbstractStaticMethod.define(self) def definition_body(self): return self.generate_code() @@ -5200,19 +5200,18 @@ class CGAbstractBindingMethod(CGAbstract Common class to generate the JSNatives for all our methods, getters, and setters. This will generate the function declaration and unwrap the |this| object. Subclasses are expected to override the generate_code function to do the rest of the work. This function should return a CGThing which is already properly indented. """ def __init__(self, descriptor, name, args, unwrapFailureCode=None, getThisObj="args.computeThis(cx).toObjectOrNull()", - callArgs="JS::CallArgs args = JS::CallArgsFromVp(argc, vp);", - returnType="bool"): - CGAbstractStaticMethod.__init__(self, descriptor, name, returnType, args) + callArgs="JS::CallArgs args = JS::CallArgsFromVp(argc, vp);"): + CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args) if unwrapFailureCode is None: self.unwrapFailureCode = 'return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "%s");' % descriptor.interface.identifier.name else: self.unwrapFailureCode = unwrapFailureCode self.getThisObj = getThisObj self.callArgs = callArgs @@ -5369,17 +5368,17 @@ class CGNewResolveHook(CGAbstractBinding def __init__(self, descriptor): assert descriptor.interface.getExtendedAttribute("NeedNewResolve") args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'), Argument('JS::Handle<jsid>', 'id'), Argument('unsigned', 'flags'), Argument('JS::MutableHandle<JSObject*>', 'objp')] # Our "self" is actually the "obj" argument in this case, not the thisval. CGAbstractBindingMethod.__init__( self, descriptor, NEWRESOLVE_HOOK_NAME, - args, getThisObj="", callArgs="", returnType="JSBool") + args, getThisObj="", callArgs="") def generate_code(self): return CGIndenter(CGGeneric( "JS::Rooted<JS::Value> value(cx);\n" "if (!self->DoNewResolve(cx, obj, id, &value)) {\n" " return false;\n" "}\n" "if (value.isUndefined()) {\n" @@ -5397,17 +5396,17 @@ class CGEnumerateHook(CGAbstractBindingM """ def __init__(self, descriptor): assert descriptor.interface.getExtendedAttribute("NeedNewResolve") args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj')] # Our "self" is actually the "obj" argument in this case, not the thisval. CGAbstractBindingMethod.__init__( self, descriptor, ENUMERATE_HOOK_NAME, - args, getThisObj="", callArgs="", returnType="JSBool") + args, getThisObj="", callArgs="") def generate_code(self): return CGIndenter(CGGeneric( "nsAutoTArray<nsString, 8> names;\n" "ErrorResult rv;\n" "self->GetOwnPropertyNames(cx, names, rv);\n" "rv.WouldReportJSException();\n" "if (rv.Failed()) {\n" @@ -7418,23 +7417,23 @@ class CGDOMJSProxyHandler_defineProperty # XXXbz Once this is fixed to only throw in strict mode, update the # code that decides whether to do a # CGDOMJSProxyHandler_defineProperty at all. set += ("if (IsArrayIndex(GetArrayIndexFromId(cx, id))) {\n" + " return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" + "}\n") % self.descriptor.name if UseHolderForUnforgeable(self.descriptor): - defineOnUnforgeable = ("JSBool hasUnforgeable;\n" + defineOnUnforgeable = ("bool hasUnforgeable;\n" "if (!JS_HasPropertyById(cx, ${holder}, id, &hasUnforgeable)) {\n" " return false;\n" "}\n" "if (hasUnforgeable) {\n" " *defined = true;" + - " JSBool unused;\n" + " bool unused;\n" " return js_DefineOwnProperty(cx, ${holder}, id, *desc, &unused);\n" "}\n") set += CallOnUnforgeableHolder(self.descriptor, defineOnUnforgeable, "xpc::WrapperFactory::IsXrayWrapper(proxy)") namedSetter = self.descriptor.operations['NamedSetter'] if namedSetter: @@ -7509,17 +7508,17 @@ class CGDOMJSProxyHandler_delete(ClassMe delete += ("int32_t index = GetArrayIndexFromId(cx, id);\n" + "if (IsArrayIndex(index)) {\n" + CGIndenter(CGGeneric(indexedBody)).define() + "\n" " // We always return here, even if the property was not found\n" " return true;\n" + "}\n") % self.descriptor.nativeType if UseHolderForUnforgeable(self.descriptor): - unforgeable = ("JSBool hasUnforgeable;\n" + unforgeable = ("bool hasUnforgeable;\n" "if (!JS_HasPropertyById(cx, ${holder}, id, &hasUnforgeable)) {\n" " return false;\n" "}\n" "if (hasUnforgeable) {\n" " *bp = false;\n" " return true;\n" "}") delete += CallOnUnforgeableHolder(self.descriptor, unforgeable) @@ -7615,18 +7614,18 @@ class CGDOMJSProxyHandler_hasOwn(ClassMe CGIndenter(CGProxyIndexedPresenceChecker(self.descriptor)).define() + "\n" + " *bp = found;\n" + " return true;\n" + "}\n\n") % (self.descriptor.nativeType) else: indexed = "" if UseHolderForUnforgeable(self.descriptor): - unforgeable = ("JSBool b = true;\n" - "JSBool ok = JS_AlreadyHasOwnPropertyById(cx, ${holder}, id, &b);\n" + unforgeable = ("bool b = true;\n" + "bool ok = JS_AlreadyHasOwnPropertyById(cx, ${holder}, id, &b);\n" "*bp = !!b;\n" "if (!ok || *bp) {\n" " return ok;\n" "}") unforgeable = CallOnUnforgeableHolder(self.descriptor, unforgeable) else: unforgeable = "" @@ -7644,18 +7643,18 @@ class CGDOMJSProxyHandler_hasOwn(ClassMe named = "*bp = false;" return """MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy), "Should not have a XrayWrapper here"); """ + indexed + unforgeable + """ JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy)); if (expando) { - JSBool b = true; - JSBool ok = JS_HasPropertyById(cx, expando, id, &b); + bool b = true; + bool ok = JS_HasPropertyById(cx, expando, id, &b); *bp = !!b; if (!ok || *bp) { return ok; } } """ + named + """ return true;""" @@ -7667,30 +7666,30 @@ class CGDOMJSProxyHandler_get(ClassMetho Argument('JS::Handle<JSObject*>', 'receiver'), Argument('JS::Handle<jsid>', 'id'), Argument('JS::MutableHandle<JS::Value>', 'vp')] ClassMethod.__init__(self, "get", "bool", args) self.descriptor = descriptor def getBody(self): if UseHolderForUnforgeable(self.descriptor): hasUnforgeable = ( - "JSBool hasUnforgeable;\n" + "bool hasUnforgeable;\n" "if (!JS_AlreadyHasOwnPropertyById(cx, ${holder}, id, &hasUnforgeable)) {\n" " return false;\n" "}\n" "if (hasUnforgeable) {\n" " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp);\n" "}") getUnforgeableOrExpando = CallOnUnforgeableHolder(self.descriptor, hasUnforgeable) else: getUnforgeableOrExpando = "" getUnforgeableOrExpando += """JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy)); if (expando) { - JSBool hasProp; + bool hasProp; if (!JS_HasPropertyById(cx, expando, id, &hasProp)) { return false; } if (hasProp) { return JS_GetPropertyById(cx, expando, id, vp); } }""" @@ -7790,17 +7789,17 @@ class CGDOMJSProxyHandler_getElementIfPr else: if self.descriptor.supportsNamedProperties(): get = CGProxyNamedGetter(self.descriptor, templateValues, "UINT_TO_JSVAL(index)").define() get += """ JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy)); if (expando) { - JSBool isPresent; + bool isPresent; if (!JS_GetElementIfPresent(cx, expando, index, expando, vp, &isPresent)) { return false; } if (isPresent) { *present = true; return true; } } @@ -7810,17 +7809,17 @@ if (expando) { "Should not have a XrayWrapper here"); """ + get + """ JS::Rooted<JSObject*> proto(cx); if (!js::GetObjectProto(cx, proxy, &proto)) { return false; } if (proto) { - JSBool isPresent; + bool isPresent; if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp, &isPresent)) { return false; } *present = isPresent; return true; } *present = false;
--- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -35,17 +35,17 @@ DefineStaticJSVals(JSContext* cx) int HandlerFamily; js::DOMProxyShadowsResult DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id) { JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO); if (v.isObject()) { - JSBool hasOwn; + bool hasOwn; if (!JS_AlreadyHasOwnPropertyById(cx, &v.toObject(), id, &hasOwn)) return js::ShadowCheckFailed; return hasOwn ? js::Shadows : js::DoesntShadow; } if (v.isUndefined()) { return js::DoesntShadow; @@ -198,17 +198,17 @@ DOMProxyHandler::defineProperty(JSContex return true; } JSObject* expando = EnsureExpandoObject(cx, proxy); if (!expando) { return false; } - JSBool dummy; + bool dummy; return js_DefineOwnProperty(cx, expando, id, *desc, &dummy); } bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) { JS::Rooted<JSObject*> expando(cx); @@ -247,17 +247,17 @@ DOMProxyHandler::has(JSContext* cx, JS:: // OK, now we have to look at the proto JS::Rooted<JSObject*> proto(cx); if (!js::GetObjectProto(cx, proxy, &proto)) { return false; } if (!proto) { return true; } - JSBool protoHasProp; + bool protoHasProp; bool ok = JS_HasPropertyById(cx, proto, id, &protoHasProp); if (ok) { *bp = protoHasProp; } return ok; } /* static */
--- a/dom/bindings/PrimitiveConversions.h +++ b/dom/bindings/PrimitiveConversions.h @@ -300,17 +300,17 @@ struct PrimitiveConversionTraits<T, eCla }; template<ConversionBehavior B> struct PrimitiveConversionTraits<bool, B> : public DisallowedConversion<bool> {}; template<> struct PrimitiveConversionTraits<bool, eDefault> { - typedef JSBool jstype; + typedef bool jstype; typedef bool intermediateType; static inline bool converter(JSContext* /* unused */, JS::Handle<JS::Value> v, jstype* retval) { *retval = JS::ToBoolean(v); return true; } };
--- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -542,17 +542,17 @@ BluetoothHfpManager::HandleVolumeChanged NS_ENSURE_TRUE_VOID(val.isObject()); JS::Rooted<JSObject*> obj(cx, &val.toObject()); JS::Rooted<JS::Value> key(cx); if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return; } - JSBool match; + bool match; if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) || !match) { return; } JS::Rooted<JS::Value> value(cx); if (!JS_GetProperty(cx, obj, "value", &value)|| !value.isNumber()) {
--- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -578,17 +578,17 @@ BluetoothService::HandleSettingsChanged( return NS_ERROR_OUT_OF_MEMORY; } if (!key.isString()) { return NS_OK; } // First, check if the string equals to BLUETOOTH_DEBUGGING_SETTING - JSBool match; + bool match; if (!JS_StringEqualsAscii(cx, key.toString(), BLUETOOTH_DEBUGGING_SETTING, &match)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; } if (match) { JS::Rooted<JS::Value> value(cx); if (!JS_GetProperty(cx, &obj, "value", &value)) {
--- a/dom/indexedDB/IDBKeyRange.cpp +++ b/dom/indexedDB/IDBKeyRange.cpp @@ -130,17 +130,17 @@ MakeOnlyKeyRange(JSContext* aCx, bool MakeLowerBoundKeyRange(JSContext* aCx, unsigned aArgc, jsval* aVp) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); JS::Rooted<JS::Value> val(aCx); - JSBool open = false; + bool open = false; if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", val.address(), &open)) { return false; } nsRefPtr<IDBKeyRange> keyRange = new IDBKeyRange(open, true, false); if (!GetKeyFromJSValOrThrow(aCx, val, keyRange->Lower())) { @@ -153,17 +153,17 @@ MakeLowerBoundKeyRange(JSContext* aCx, bool MakeUpperBoundKeyRange(JSContext* aCx, unsigned aArgc, jsval* aVp) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); JS::Rooted<JS::Value> val(aCx); - JSBool open = false; + bool open = false; if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", val.address(), &open)) { return false; } nsRefPtr<IDBKeyRange> keyRange = new IDBKeyRange(true, open, false); if (!GetKeyFromJSValOrThrow(aCx, val, keyRange->Upper())) { @@ -176,17 +176,17 @@ MakeUpperBoundKeyRange(JSContext* aCx, bool MakeBoundKeyRange(JSContext* aCx, unsigned aArgc, jsval* aVp) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); JS::Rooted<JS::Value> lowerVal(aCx), upperVal(aCx); - JSBool lowerOpen = false, upperOpen = false; + bool lowerOpen = false, upperOpen = false; if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "vv/bb", lowerVal.address(), upperVal.address(), &lowerOpen, &upperOpen)) { return false; } nsRefPtr<IDBKeyRange> keyRange = new IDBKeyRange(lowerOpen, upperOpen, false); @@ -214,17 +214,17 @@ const JSFunctionSpec gKeyRangeConstructo JS_FS_END }; #undef KEYRANGE_FUNCTION_FLAGS } // anonymous namespace // static -JSBool +bool IDBKeyRange::DefineConstructors(JSContext* aCx, JSObject* aObject) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(aCx, "Null pointer!"); NS_ASSERTION(aObject, "Null pointer!"); // Add the constructor methods for key ranges.
--- a/dom/indexedDB/IDBKeyRange.h +++ b/dom/indexedDB/IDBKeyRange.h @@ -24,18 +24,18 @@ class KeyRange; class IDBKeyRange MOZ_FINAL : public nsIIDBKeyRange { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIIDBKEYRANGE NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBKeyRange) - static JSBool DefineConstructors(JSContext* aCx, - JSObject* aObject); + static bool DefineConstructors(JSContext* aCx, + JSObject* aObject); static nsresult FromJSVal(JSContext* aCx, const jsval& aVal, IDBKeyRange** aKeyRange); template <class T> static already_AddRefed<IDBKeyRange> FromSerializedKeyRange(const T& aKeyRange);
--- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -1466,17 +1466,17 @@ IDBObjectStore::StructuredCloneReadCallb if (runtimeCallbacks) { return runtimeCallbacks->read(aCx, aReader, aTag, aData, nullptr); } return nullptr; } // static -JSBool +bool IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { StructuredCloneWriteInfo* cloneWriteInfo = reinterpret_cast<StructuredCloneWriteInfo*>(aClosure);
--- a/dom/indexedDB/IDBObjectStore.h +++ b/dom/indexedDB/IDBObjectStore.h @@ -103,17 +103,17 @@ public: template <class DeserializationTraits> static JSObject* StructuredCloneReadCallback(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, uint32_t aData, void* aClosure); - static JSBool + static bool StructuredCloneWriteCallback(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure); static nsresult ConvertFileIdsToArray(const nsAString& aFileIds, nsTArray<int64_t>& aResult);
--- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -521,17 +521,17 @@ NS_IMPL_QUERY_INTERFACE2(IndexedDatabase NS_IMETHODIMP IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx) { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE); NS_ENSURE_ARG(!JSVAL_IS_PRIMITIVE(aObj)); JS::Rooted<JSObject*> obj(aCx, JSVAL_TO_OBJECT(aObj)); - JSBool hasIndexedDB; + bool hasIndexedDB; if (!JS_HasProperty(aCx, obj, "indexedDB", &hasIndexedDB)) { return NS_ERROR_FAILURE; } if (hasIndexedDB) { NS_WARNING("Passed object already has an 'indexedDB' property!"); return NS_ERROR_FAILURE; }
--- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -44,17 +44,17 @@ IsValidKeyPathString(JSContext* aCx, con jsval stringVal; if (!xpc::StringToJsval(aCx, token, &stringVal)) { return false; } NS_ASSERTION(JSVAL_IS_STRING(stringVal), "This should never happen"); JSString* str = JSVAL_TO_STRING(stringVal); - JSBool isIdentifier = false; + bool isIdentifier = false; if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) { return false; } } // If the very last character was a '.', the tokenizer won't give us an empty // token, but the keyPath is still invalid. if (!aKeyPath.IsEmpty() && @@ -100,31 +100,31 @@ GetJSValFromKeyPathString(JSContext* aCx while (tokenizer.hasMoreTokens()) { const nsDependentSubstring& token = tokenizer.nextToken(); NS_ASSERTION(!token.IsEmpty(), "Should be a valid keypath"); const jschar* keyPathChars = token.BeginReading(); const size_t keyPathLen = token.Length(); - JSBool hasProp; + bool hasProp; if (!targetObject) { // We're still walking the chain of existing objects if (!obj) { return NS_ERROR_DOM_INDEXEDDB_DATA_ERR; } - JSBool ok = JS_HasUCProperty(aCx, obj, keyPathChars, keyPathLen, - &hasProp); + bool ok = JS_HasUCProperty(aCx, obj, keyPathChars, keyPathLen, + &hasProp); NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); if (hasProp) { // Get if the property exists... JS::Rooted<JS::Value> intermediate(aCx); - JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate); + bool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate); NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); // Treat explicitly undefined as an error. if (intermediate == JSVAL_VOID) { return NS_ERROR_DOM_INDEXEDDB_DATA_ERR; } if (tokenizer.hasMoreTokens()) { // ...and walk to it if there are more steps...
--- a/dom/ipc/StructuredCloneUtils.cpp +++ b/dom/ipc/StructuredCloneUtils.cpp @@ -93,17 +93,17 @@ Read(JSContext* aCx, JSStructuredCloneRe } return &wrappedBlob.toObject(); } return NS_DOMReadStructuredClone(aCx, aReader, aTag, aData, nullptr); } -JSBool +bool Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aClosure); StructuredCloneClosure* closure = static_cast<StructuredCloneClosure*>(aClosure);
--- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -210,17 +210,17 @@ public: virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor); virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent( const URIParams& aManifestURI, const URIParams& aDocumentURI, const bool& stickDocument) MOZ_OVERRIDE; virtual bool DeallocPOfflineCacheUpdateParent(POfflineCacheUpdateParent* actor); - JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp); + bool GetGlobalJSObject(JSContext* cx, JSObject** globalp); NS_DECL_ISUPPORTS NS_DECL_NSIAUTHPROMPTPROVIDER NS_DECL_NSISECUREBROWSERUI void HandleDelayedDialogs(); static TabParent *GetIMETabParent() { return mIMETabParent; }
--- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -103,50 +103,50 @@ NPClass nsJSObjWrapper::sJSObjWrapperNPC nsJSObjWrapper::NP_HasProperty, nsJSObjWrapper::NP_GetProperty, nsJSObjWrapper::NP_SetProperty, nsJSObjWrapper::NP_RemoveProperty, nsJSObjWrapper::NP_Enumerate, nsJSObjWrapper::NP_Construct }; -static JSBool +static bool NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp); -static JSBool -NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool *succeeded); - -static JSBool -NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict, +static bool +NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool *succeeded); + +static bool +NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp); -static JSBool +static bool NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp); -static JSBool +static bool NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op, JS::Value *statep, jsid *idp); -static JSBool +static bool NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, JS::MutableHandle<JSObject*> objp); -static JSBool +static bool NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp); static void NPObjWrapper_Finalize(JSFreeOp *fop, JSObject *obj); static bool NPObjWrapper_Call(JSContext *cx, unsigned argc, JS::Value *vp); static bool NPObjWrapper_Construct(JSContext *cx, unsigned argc, JS::Value *vp); -static JSBool +static bool CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject *npobj, JS::Handle<jsid> id, NPVariant* getPropertyResult, JS::Value *vp); JSClass sNPObjectJSWrapperClass = { NPRUNTIME_JSCLASS_NAME, JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE, NPObjWrapper_AddProperty, @@ -165,17 +165,17 @@ JSClass sNPObjectJSWrapperClass = typedef struct NPObjectMemberPrivate { JS::Heap<JSObject *> npobjWrapper; JS::Heap<JS::Value> fieldValue; JS::Heap<jsid> methodName; NPP npp; } NPObjectMemberPrivate; -static JSBool +static bool NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp); static void NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj); static bool NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp); @@ -462,17 +462,17 @@ ThrowJSException(JSContext *cx, const ch } PopException(); } else { ::JS_ReportError(cx, message); } } -static JSBool +static bool ReportExceptionIfPending(JSContext *cx) { const char *ex = PeekException(); if (!ex) { return true; } @@ -534,17 +534,17 @@ nsJSObjWrapper::NP_Invalidate(NPObject * PL_DHashTableOperate(&sJSObjWrappers, &key, PL_DHASH_REMOVE); } // Forget our reference to the JSObject. jsnpobj->mJSObj = nullptr; } } -static JSBool +static bool GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle<JS::Value> rval) { NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); return ::JS_GetPropertyById(cx, obj, NPIdentifierToJSId(id), rval); } // static @@ -569,17 +569,17 @@ nsJSObjWrapper::NP_HasMethod(NPObject *n nsCxPusher pusher; pusher.Push(cx); JSAutoCompartment ac(cx, npjsobj->mJSObj); AutoJSExceptionReporter reporter(cx); JS::Rooted<JS::Value> v(cx); - JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, &v); + bool ok = GetProperty(cx, npjsobj->mJSObj, id, &v); return ok && !JSVAL_IS_PRIMITIVE(v) && ::JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(v)); } static bool doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, uint32_t argCount, bool ctorCall, NPVariant *result) @@ -705,17 +705,17 @@ nsJSObjWrapper::NP_HasProperty(NPObject if (!npobj) { ThrowJSException(cx, "Null npobj in nsJSObjWrapper::NP_HasProperty!"); return false; } nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - JSBool found, ok = false; + bool found, ok = false; nsCxPusher pusher; pusher.Push(cx); AutoJSExceptionReporter reporter(cx); JSAutoCompartment ac(cx, npjsobj->mJSObj); NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); @@ -804,32 +804,32 @@ nsJSObjWrapper::NP_RemoveProperty(NPObje if (!npobj) { ThrowJSException(cx, "Null npobj in nsJSObjWrapper::NP_RemoveProperty!"); return false; } nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - JSBool ok = false; + bool ok = false; nsCxPusher pusher; pusher.Push(cx); AutoJSExceptionReporter reporter(cx); bool deleted = false; JSAutoCompartment ac(cx, npjsobj->mJSObj); NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); ok = ::JS_DeletePropertyById2(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), &deleted); if (ok && deleted) { // FIXME: See bug 425823, we shouldn't need to do this, and once // that bug is fixed we can remove this code. - JSBool hasProp; + bool hasProp; ok = ::JS_HasPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), &hasProp); if (ok && hasProp) { // The property might have been deleted, but it got // re-resolved, so no, it's not really deleted. deleted = false; } @@ -1095,17 +1095,17 @@ GetNPObject(JSContext *cx, JSObject *obj } return (NPObject *)::JS_GetPrivate(obj); } // Does not actually add a property because this is always followed by a // SetProperty call. -static JSBool +static bool NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class || !npobj->_class->hasProperty || !npobj->_class->hasMethod) { ThrowJSException(cx, "Bad NPObject as private data!"); @@ -1114,73 +1114,73 @@ NPObjWrapper_AddProperty(JSContext *cx, if (NPObjectIsOutOfProcessProxy(npobj)) { return true; } PluginDestructionGuard pdg(LookupNPP(npobj)); NPIdentifier identifier = JSIdToNPIdentifier(id); - JSBool hasProperty = npobj->_class->hasProperty(npobj, identifier); + bool hasProperty = npobj->_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) return false; if (hasProperty) return true; // We must permit methods here since JS_DefineUCFunction() will add // the function as a property - JSBool hasMethod = npobj->_class->hasMethod(npobj, identifier); + bool hasMethod = npobj->_class->hasMethod(npobj, identifier); if (!ReportExceptionIfPending(cx)) return false; if (!hasMethod) { ThrowJSException(cx, "Trying to add unsupported property on NPObject!"); return false; } return true; } -static JSBool -NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool *succeeded) +static bool +NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool *succeeded) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class || !npobj->_class->hasProperty || !npobj->_class->removeProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); return false; } PluginDestructionGuard pdg(LookupNPP(npobj)); NPIdentifier identifier = JSIdToNPIdentifier(id); if (!NPObjectIsOutOfProcessProxy(npobj)) { - JSBool hasProperty = npobj->_class->hasProperty(npobj, identifier); + bool hasProperty = npobj->_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) return false; if (!hasProperty) { *succeeded = true; return true; } } if (!npobj->_class->removeProperty(npobj, identifier)) *succeeded = false; return ReportExceptionIfPending(cx); } -static JSBool -NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict, +static bool +NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class || !npobj->_class->hasProperty || !npobj->_class->setProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); @@ -1197,17 +1197,17 @@ NPObjWrapper_SetProperty(JSContext *cx, return false; } PluginDestructionGuard pdg(npp); NPIdentifier identifier = JSIdToNPIdentifier(id); if (!NPObjectIsOutOfProcessProxy(npobj)) { - JSBool hasProperty = npobj->_class->hasProperty(npobj, identifier); + bool hasProperty = npobj->_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) return false; if (!hasProperty) { ThrowJSException(cx, "Trying to set unsupported property on NPObject!"); return false; } @@ -1215,31 +1215,31 @@ NPObjWrapper_SetProperty(JSContext *cx, NPVariant npv; if (!JSValToNPVariant(npp, cx, vp, &npv)) { ThrowJSException(cx, "Error converting jsval to NPVariant!"); return false; } - JSBool ok = npobj->_class->setProperty(npobj, identifier, &npv); + bool ok = npobj->_class->setProperty(npobj, identifier, &npv); _releasevariantvalue(&npv); // Release the variant if (!ReportExceptionIfPending(cx)) return false; if (!ok) { ThrowJSException(cx, "Error setting property on NPObject!"); return false; } return true; } -static JSBool +static bool NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class || !npobj->_class->hasProperty || !npobj->_class->hasMethod || !npobj->_class->getProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); @@ -1267,18 +1267,18 @@ NPObjWrapper_GetProperty(JSContext *cx, if (NPObjectIsOutOfProcessProxy(npobj)) { PluginScriptableObjectParent* actor = static_cast<ParentNPObject*>(npobj)->parent; // actor may be null if the plugin crashed. if (!actor) return false; - JSBool success = actor->GetPropertyHelper(identifier, &hasProperty, - &hasMethod, &npv); + bool success = actor->GetPropertyHelper(identifier, &hasProperty, + &hasMethod, &npv); if (!ReportExceptionIfPending(cx)) { if (success) _releasevariantvalue(&npv); return false; } if (success) { // We return NPObject Member class here to support ambiguous members. @@ -1316,17 +1316,17 @@ NPObjWrapper_GetProperty(JSContext *cx, if (!ReportExceptionIfPending(cx)) return false; } return true; } -static JSBool +static bool CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc, JS::Value *argv, JS::Value *rval, bool ctorCall) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class) { ThrowJSException(cx, "Bad NPObject as private data!"); @@ -1373,17 +1373,17 @@ CallNPMethodInternal(JSContext *cx, JS:: return false; } } NPVariant v; VOID_TO_NPVARIANT(v); JSObject *funobj = JSVAL_TO_OBJECT(argv[-2]); - JSBool ok; + bool ok; const char *msg = "Error calling method on NPObject!"; if (ctorCall) { // construct a new NPObject based on the NPClass in npobj. Fail if // no construct method is available. if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npobj->_class) && npobj->_class->construct) { @@ -1459,17 +1459,17 @@ CallNPMethod(JSContext *cx, unsigned arg } struct NPObjectEnumerateState { uint32_t index; uint32_t length; NPIdentifier *value; }; -static JSBool +static bool NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op, JS::Value *statep, jsid *idp) { NPObject *npobj = GetNPObject(cx, obj); NPIdentifier *enum_value; uint32_t length; NPObjectEnumerateState *state; @@ -1539,17 +1539,17 @@ NPObjWrapper_newEnumerate(JSContext *cx, *statep = JSVAL_NULL; break; } return true; } -static JSBool +static bool NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, JS::MutableHandle<JSObject*> objp) { NPObject *npobj = GetNPObject(cx, obj); if (!npobj || !npobj->_class || !npobj->_class->hasProperty || !npobj->_class->hasMethod) { ThrowJSException(cx, "Bad NPObject as private data!"); @@ -1593,17 +1593,17 @@ NPObjWrapper_NewResolve(JSContext *cx, J return fnc != nullptr; } // no property or method return true; } -static JSBool +static bool NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandle<JS::Value> vp) { JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); // Plugins do not simply use JS_ConvertStub, and the default [[DefaultValue]] // behavior, because that behavior involves calling toString or valueOf on // objects which weren't designed to accommodate this. Usually this wouldn't // be a problem, because the absence of either property, or the presence of @@ -1935,17 +1935,17 @@ LookupNPP(NPObject *npobj) return nullptr; } NS_ASSERTION(entry->mNpp, "Live NPObject entry w/o an NPP!"); return entry->mNpp; } -JSBool +bool CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, JS::Handle<jsid> id, NPVariant* getPropertyResult, JS::Value *vp) { NS_ENSURE_TRUE(vp, false); if (!npobj || !npobj->_class || !npobj->_class->getProperty || !npobj->_class->invoke) { ThrowJSException(cx, "Bad NPObject"); @@ -2011,17 +2011,17 @@ CreateNPObjectMember(NPP npp, JSContext memberPrivate->methodName = id; memberPrivate->npp = npp; ::JS_RemoveValueRoot(cx, vp); return true; } -static JSBool +static bool NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp) { NPObjectMemberPrivate *memberPrivate = (NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj, &sNPObjectMemberClass, nullptr); if (!memberPrivate) { NS_ERROR("no Ambiguous Member Private data!"); @@ -2109,17 +2109,17 @@ NPObjectMember_Call(JSContext *cx, unsig } return false; } } NPVariant npv; - JSBool ok; + bool ok; ok = npobj->_class->invoke(npobj, JSIdToNPIdentifier(memberPrivate->methodName), npargs, argc, &npv); // Release arguments. for (i = 0; i < argc; ++i) { _releasevariantvalue(npargs + i); }
--- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp @@ -1207,17 +1207,17 @@ PluginScriptableObjectParent::AnswerNPN_ return true; } *aSuccess = true; *aResult = convertedResult; return true; } -JSBool +bool PluginScriptableObjectParent::GetPropertyHelper(NPIdentifier aName, bool* aHasProperty, bool* aHasMethod, NPVariant* aResult) { NS_ASSERTION(Type() == Proxy, "Bad type!"); ParentNPObject* object = static_cast<ParentNPObject*>(mObject);
--- a/dom/plugins/ipc/PluginScriptableObjectParent.h +++ b/dom/plugins/ipc/PluginScriptableObjectParent.h @@ -132,20 +132,20 @@ public: // ResurrectProxyObject). void DropNPObject(); ScriptableObjectType Type() const { return mType; } - JSBool GetPropertyHelper(NPIdentifier aName, - bool* aHasProperty, - bool* aHasMethod, - NPVariant* aResult); + bool GetPropertyHelper(NPIdentifier aName, + bool* aHasProperty, + bool* aHasMethod, + NPVariant* aResult); private: static NPObject* ScriptableAllocate(NPP aInstance, NPClass* aClass); static void ScriptableInvalidate(NPObject* aObject);
--- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -718,17 +718,17 @@ nsGeolocationService::HandleMozsettingCh } JS::Rooted<JSObject*> obj(cx, &val.toObject()); JS::Rooted<JS::Value> key(cx); if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return; } - JSBool match; + bool match; if (!JS_StringEqualsAscii(cx, key.toString(), GEO_SETINGS_ENABLED, &match) || !match) { return; } JS::Rooted<JS::Value> value(cx); if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) { return; }
--- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -154,17 +154,17 @@ nsJSON::EncodeToStream(nsIOutputStream * rv = EncodeInternal(cx, val, &writer); NS_ENSURE_SUCCESS(rv, rv); rv = bufferedStream->Flush(); return rv; } -static JSBool +static bool WriteCallback(const jschar *buf, uint32_t len, void *data) { nsJSONWriter *writer = static_cast<nsJSONWriter*>(data); nsresult rv = writer->Write((const PRUnichar*)buf, (uint32_t)len); if (NS_FAILED(rv)) return false; return true; @@ -522,17 +522,17 @@ nsJSONListener::OnStopRequest(nsIRequest rv = ProcessBytes(nullptr, 0); NS_ENSURE_SUCCESS(rv, rv); } JS::RootedValue reviver(mCx, JS::NullValue()), value(mCx); JS::StableCharPtr chars(reinterpret_cast<const jschar*>(mBufferedChars.Elements()), mBufferedChars.Length()); - JSBool ok = JS_ParseJSONWithReviver(mCx, chars.get(), + bool ok = JS_ParseJSONWithReviver(mCx, chars.get(), uint32_t(mBufferedChars.Length()), reviver, value.address()); *mRootVal = value; mBufferedChars.TruncateLength(0); return ok ? NS_OK : NS_ERROR_FAILURE; }
--- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -180,17 +180,17 @@ TimeZoneSettingObserver::Observe(nsISupp // Get the key, which should be the JS string "time.timezone". JSObject &obj(val.toObject()); JS::Rooted<JS::Value> key(cx); if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; } - JSBool match; + bool match; if (!JS_StringEqualsAscii(cx, key.toString(), TIME_TIMEZONE, &match) || !match) { return NS_OK; } // Get the value, which should be a JS string like "America/Chicago". JS::Rooted<JS::Value> value(cx); if (!JS_GetProperty(cx, &obj, "value", &value) ||
--- a/dom/workers/EventListenerManager.cpp +++ b/dom/workers/EventListenerManager.cpp @@ -309,17 +309,17 @@ EventListenerManager::DispatchEvent(JSCo return false; } if (mCollections.isEmpty()) { return false; } JS::Rooted<JSString*> eventType(aCx); - JSBool eventIsTrusted; + bool eventIsTrusted; if (!JS_GetProperty(aCx, aEvent, "type", &val) || !(eventType = JS_ValueToString(aCx, val)) || !(eventType = JS_InternJSString(aCx, eventType))) { aRv.Throw(NS_ERROR_FAILURE); return false; } @@ -393,17 +393,17 @@ EventListenerManager::DispatchEvent(JSCo } continue; } static const char sHandleEventChars[] = "handleEvent"; JS::Rooted<JSObject*> thisObj(aCx, aTarget.GetJSObject()); - JSBool hasHandleEvent; + bool hasHandleEvent; if (!JS_HasProperty(aCx, listenerObj, sHandleEventChars, &hasHandleEvent)) { if (!JS_ReportPendingException(aCx)) { aRv.Throw(NS_ERROR_FAILURE); return false; } continue; }
--- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -179,17 +179,17 @@ protected: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, JS_GetClass(aObj)->name); return NULL; } static void InitEventCommon(JSObject* aObj, Event* aEvent, JSString* aType, - JSBool aBubbles, JSBool aCancelable, bool aIsTrusted) + bool aBubbles, bool aCancelable, bool aIsTrusted) { aEvent->mStopPropagationCalled = false; aEvent->mStopImmediatePropagationCalled = false; JS_SetReservedSlot(aObj, SLOT_type, STRING_TO_JSVAL(aType)); JS_SetReservedSlot(aObj, SLOT_target, JSVAL_NULL); JS_SetReservedSlot(aObj, SLOT_currentTarget, JSVAL_NULL); JS_SetReservedSlot(aObj, SLOT_eventPhase, INT_TO_JSVAL(CAPTURING_PHASE)); @@ -214,34 +214,34 @@ private: static void Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish<Event>(aObj); } - static JSBool + static bool GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32_t slot = JSID_TO_INT(aIdval); const char* name = sProperties[slot - SLOT_FIRST].name; if (!GetInstancePrivate(aCx, aObj, name)) { return false; } aVp.set(JS_GetReservedSlot(aObj, slot)); return true; } - static JSBool + static bool GetConstant(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> idval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(idval)); JS_ASSERT(JSID_TO_INT(idval) >= CAPTURING_PHASE && JSID_TO_INT(idval) <= BUBBLING_PHASE); aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval))); @@ -313,17 +313,17 @@ private: } Event* event = GetInstancePrivate(aCx, obj, sFunctions[2].name); if (!event) { return false; } JS::Rooted<JSString*> type(aCx); - JSBool bubbles, cancelable; + bool bubbles, cancelable; if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "Sbb", type.address(), &bubbles, &cancelable)) { return false; } InitEventCommon(obj, event, type, bubbles, cancelable, false); return true; } @@ -470,17 +470,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; } static void InitMessageEventCommon(JSContext* aCx, JSObject* aObj, Event* aEvent, - JSString* aType, JSBool aBubbles, JSBool aCancelable, + JSString* aType, bool aBubbles, bool aCancelable, JSString* aData, JSString* aOrigin, JSObject* aSource, bool aIsTrusted) { jsval emptyString = JS_GetEmptyStringValue(aCx); Event::InitEventCommon(aObj, aEvent, aType, aBubbles, aCancelable, aIsTrusted); JS_SetReservedSlot(aObj, SLOT_data, @@ -501,17 +501,17 @@ private: static void Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(IsThisClass(JS_GetClass(aObj))); MessageEvent* priv = GetJSPrivateSafeish<MessageEvent>(aObj); delete priv; } - static JSBool + static bool GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32_t slot = JSID_TO_INT(aIdval); JS_ASSERT(slot >= SLOT_data && slot < SLOT_COUNT); @@ -556,17 +556,17 @@ private: } MessageEvent* event = GetInstancePrivate(aCx, obj, sFunctions[0].name); if (!event) { return false; } JS::Rooted<JSString*> type(aCx), data(aCx), origin(aCx); - JSBool bubbles, cancelable; + bool bubbles, cancelable; JS::Rooted<JSObject*> source(aCx); if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "SbbSSo", type.address(), &bubbles, &cancelable, data.address(), origin.address(), source.address())) { return false; } InitMessageEventCommon(aCx, obj, event, type, bubbles, cancelable, @@ -683,17 +683,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; } static void InitErrorEventCommon(JSObject* aObj, Event* aEvent, JSString* aType, - JSBool aBubbles, JSBool aCancelable, + bool aBubbles, bool aCancelable, JSString* aMessage, JSString* aFilename, uint32_t aLineNumber, bool aIsTrusted) { Event::InitEventCommon(aObj, aEvent, aType, aBubbles, aCancelable, aIsTrusted); JS_SetReservedSlot(aObj, SLOT_message, STRING_TO_JSVAL(aMessage)); JS_SetReservedSlot(aObj, SLOT_filename, STRING_TO_JSVAL(aFilename)); JS_SetReservedSlot(aObj, SLOT_lineno, INT_TO_JSVAL(aLineNumber)); @@ -709,17 +709,17 @@ private: static void Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish<ErrorEvent>(aObj); } - static JSBool + static bool GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32_t slot = JSID_TO_INT(aIdval); JS_ASSERT(slot >= SLOT_message && slot < SLOT_COUNT); @@ -743,17 +743,17 @@ private: } ErrorEvent* event = GetInstancePrivate(aCx, obj, sFunctions[0].name); if (!event) { return false; } JS::Rooted<JSString*> type(aCx), message(aCx), filename(aCx); - JSBool bubbles, cancelable; + bool bubbles, cancelable; uint32_t lineNumber; if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "SbbSSu", type.address(), &bubbles, &cancelable, message.address(), filename.address(), &lineNumber)) { return false; } InitErrorEventCommon(obj, event, type, bubbles, cancelable, message, @@ -862,18 +862,18 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; } static void InitProgressEventCommon(JSObject* aObj, Event* aEvent, JSString* aType, - JSBool aBubbles, JSBool aCancelable, - JSBool aLengthComputable, double aLoaded, + bool aBubbles, bool aCancelable, + bool aLengthComputable, double aLoaded, double aTotal, bool aIsTrusted) { Event::InitEventCommon(aObj, aEvent, aType, aBubbles, aCancelable, aIsTrusted); JS_SetReservedSlot(aObj, SLOT_lengthComputable, aLengthComputable ? JSVAL_TRUE : JSVAL_FALSE); JS_SetReservedSlot(aObj, SLOT_loaded, DOUBLE_TO_JSVAL(aLoaded)); JS_SetReservedSlot(aObj, SLOT_total, DOUBLE_TO_JSVAL(aTotal)); @@ -889,17 +889,17 @@ private: static void Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish<ProgressEvent>(aObj); } - static JSBool + static bool GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32_t slot = JSID_TO_INT(aIdval); JS_ASSERT(slot >= SLOT_lengthComputable && slot < SLOT_COUNT); @@ -1026,22 +1026,22 @@ EventImmediatePropagationStopped(JSObjec return Event::ImmediatePropagationStopped(aEvent); } bool DispatchEventToTarget(JSContext* aCx, JS::Handle<JSObject*> aTarget, JS::Handle<JSObject*> aEvent, bool* aPreventDefaultCalled) { static const char kFunctionName[] = "dispatchEvent"; - JSBool hasProperty; + bool hasProperty; if (!JS_HasProperty(aCx, aTarget, kFunctionName, &hasProperty)) { return false; } - JSBool preventDefaultCalled = false; + bool preventDefaultCalled = false; if (hasProperty) { jsval argv[] = { OBJECT_TO_JSVAL(aEvent) }; JS::Rooted<JS::Value> rval(aCx, JS::UndefinedValue()); if (!JS_CallFunctionName(aCx, aTarget, kFunctionName, ArrayLength(argv), argv, rval.address()) || !JS_ValueToBoolean(aCx, rval, &preventDefaultCalled)) { return false; }
--- a/dom/workers/Exceptions.cpp +++ b/dom/workers/Exceptions.cpp @@ -120,17 +120,17 @@ private: if (!out) { return false; } JS_SET_RVAL(aCx, aVp, STRING_TO_JSVAL(out)); return true; } - static JSBool + static bool GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32_t slot = JSID_TO_INT(aIdval); JSClass* classPtr = JS_GetClass(aObj); @@ -141,17 +141,17 @@ private: sProperties[slot].name, classPtr->name); return false; } aVp.set(JS_GetReservedSlot(aObj, slot)); return true; } - static JSBool + static bool GetConstant(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> idval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(idval)); aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval))); return true; } };
--- a/dom/workers/File.cpp +++ b/dom/workers/File.cpp @@ -107,17 +107,17 @@ private: Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(JS_GetClass(aObj) == &sClass); nsIDOMBlob* blob = GetPrivate(aObj); NS_IF_RELEASE(blob); } - static JSBool + static bool GetSize(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "size"); if (!blob) { return false; } @@ -127,17 +127,17 @@ private: return false; } aVp.set(JS_NumberValue(double(size))); return true; } - static JSBool + static bool GetType(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "type"); if (!blob) { return false; } @@ -298,17 +298,17 @@ private: Finalize(JSFreeOp* aFop, JSObject* aObj) { JS_ASSERT(JS_GetClass(aObj) == &sClass); nsIDOMFile* file = GetPrivate(aObj); NS_IF_RELEASE(file); } - static JSBool + static bool GetMozFullPath(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "mozFullPath"); if (!file) { return false; } @@ -325,17 +325,17 @@ private: if (!jsFullPath) { return false; } aVp.set(STRING_TO_JSVAL(jsFullPath)); return true; } - static JSBool + static bool GetName(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "name"); if (!file) { return false; } @@ -348,17 +348,17 @@ private: if (!jsName) { return false; } aVp.set(STRING_TO_JSVAL(jsName)); return true; } - static JSBool + static bool GetLastModifiedDate(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "lastModifiedDate"); if (!file) { return false; }
--- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -582,17 +582,17 @@ LoadJITHardeningOption(const char* /* aP void ErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aReport) { WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx); return worker->ReportError(aCx, aMessage, aReport); } -JSBool +bool OperationCallback(JSContext* aCx) { WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx); // Now is a good time to turn on profiling if it's pending. profiler_js_operation_callback(); return worker->OperationCallback(aCx); @@ -685,17 +685,17 @@ public: if (!response->Dispatch(nullptr)) { NS_WARNING("Failed to dispatch response!"); } return NS_OK; } }; -JSBool +bool ContentSecurityPolicyAllows(JSContext* aCx) { WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx); worker->AssertIsOnWorkerThread(); if (worker->GetReportCSPViolations()) { nsString fileName; uint32_t lineNum = 0; @@ -935,17 +935,17 @@ public: } }; } /* anonymous namespace */ BEGIN_WORKERS_NAMESPACE // Entry point for the DOM. -JSBool +bool ResolveWorkerClasses(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId, unsigned aFlags, JS::MutableHandle<JSObject*> aObjp) { AssertIsOnMainThread(); // Make sure our strings are interned. if (JSID_IS_VOID(gStringIDs[0])) { for (uint32_t i = 0; i < ID_COUNT; i++) {
--- a/dom/workers/Worker.cpp +++ b/dom/workers/Worker.cpp @@ -170,17 +170,17 @@ protected: private: // No instance of this class should ever be created so these are explicitly // left without an implementation to prevent linking in case someone tries to // make one. Worker(); ~Worker(); - static JSBool + static bool GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; WorkerPrivate* worker = GetInstancePrivate(aCx, aObj, name); @@ -195,19 +195,19 @@ private: if (rv.Failed()) { JS_ReportError(aCx, "Failed to get listener!"); } aVp.set(listener ? OBJECT_TO_JSVAL(listener) : JSVAL_NULL); return true; } - static JSBool + static bool SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, - JSBool aStrict, JS::MutableHandle<JS::Value> aVp) + bool aStrict, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; WorkerPrivate* worker = GetInstancePrivate(aCx, aObj, name); if (!worker) { return !JS_IsExceptionPending(aCx);
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -215,17 +215,17 @@ struct WorkerStructuredCloneCallbacks } return imageData->WrapObject(aCx, global); } Error(aCx, 0); return nullptr; } - static JSBool + static bool Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { NS_ASSERTION(aClosure, "Null pointer!"); // We'll stash any nsISupports pointers that need to be AddRef'd here. nsTArray<nsCOMPtr<nsISupports> >* clonedObjects = static_cast<nsTArray<nsCOMPtr<nsISupports> >*>(aClosure); @@ -366,17 +366,17 @@ struct MainThreadWorkerStructuredCloneCa return &wrappedBlob.toObject(); } } JS_ClearPendingException(aCx); return NS_DOMReadStructuredClone(aCx, aReader, aTag, aData, nullptr); } - static JSBool + static bool Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { AssertIsOnMainThread(); NS_ASSERTION(aClosure, "Null pointer!"); // We'll stash any nsISupports pointers that need to be AddRef'd here. @@ -454,17 +454,17 @@ struct ChromeWorkerStructuredCloneCallba static JSObject* Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, uint32_t aData, void* aClosure) { return WorkerStructuredCloneCallbacks::Read(aCx, aReader, aTag, aData, aClosure); } - static JSBool + static bool Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { return WorkerStructuredCloneCallbacks::Write(aCx, aWriter, aObj, aClosure); } static void Error(JSContext* aCx, uint32_t aErrorId) @@ -500,17 +500,17 @@ struct MainThreadChromeWorkerStructuredC if (clone) { return clone; } JS_ClearPendingException(aCx); return NS_DOMReadStructuredClone(aCx, aReader, aTag, aData, nullptr); } - static JSBool + static bool Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle<JSObject*> aObj, void* aClosure) { AssertIsOnMainThread(); if (MainThreadWorkerStructuredCloneCallbacks::Write(aCx, aWriter, aObj, aClosure) || ChromeWorkerStructuredCloneCallbacks::Write(aCx, aWriter, aObj,
--- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -139,17 +139,17 @@ protected: virtual void _finalize(JSFreeOp* aFop) MOZ_OVERRIDE { EventTarget::_finalize(aFop); } private: - static JSBool + static bool GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); @@ -166,19 +166,19 @@ private: JS_ReportError(aCx, "Failed to get event listener!"); return false; } aVp.set(listener ? OBJECT_TO_JSVAL(listener) : JSVAL_NULL); return true; } - static JSBool + static bool SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, - JSBool aStrict, JS::MutableHandle<JS::Value> aVp) + bool aStrict, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); if (!scope) { return false; @@ -207,29 +207,29 @@ private: static bool Construct(JSContext* aCx, unsigned aArgc, jsval* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } - static JSBool + static bool GetSelf(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { if (!GetInstancePrivate(aCx, aObj, "self")) { return false; } aVp.set(OBJECT_TO_JSVAL(aObj)); return true; } - static JSBool + static bool GetLocation(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, sProperties[SLOT_location].name); if (!scope) { return false; } @@ -284,17 +284,17 @@ private: if (JSVAL_IS_BOOLEAN(rval) && JSVAL_TO_BOOLEAN(rval) && !JS_CallFunctionName(aCx, event, "preventDefault", 0, NULL, rval.address())) { return false; } return true; } - static JSBool + static bool GetOnErrorListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { const char* name = sEventStrings[STRING_onerror]; WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); if (!scope) { return false; } @@ -316,19 +316,19 @@ private: aVp.set(js::GetFunctionNativeReserved(adaptor, SLOT_wrappedFunction)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(aVp)); return true; } - static JSBool + static bool SetOnErrorListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, - JSBool aStrict, JS::MutableHandle<JS::Value> aVp) + bool aStrict, JS::MutableHandle<JS::Value> aVp) { const char* name = sEventStrings[STRING_onerror]; WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); if (!scope) { return false; } if (JSVAL_IS_PRIMITIVE(aVp)) { @@ -359,17 +359,17 @@ private: if (rv.Failed()) { JS_ReportError(aCx, "Failed to set event listener!"); return false; } return true; } - static JSBool + static bool GetNavigator(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, sProperties[SLOT_navigator].name); if (!scope) { return false; } @@ -481,17 +481,17 @@ private: JS::Rooted<JS::Value> dummy(aCx); if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v", dummy.address())) { return false; } return scope->mWorker->SetTimeout(aCx, aArgc, aVp, true); } - static JSBool + static bool ClearInterval(JSContext* aCx, unsigned aArgc, jsval* aVp) { JSObject* obj = JS_THIS_OBJECT(aCx, aVp); if (!obj) { return false; } WorkerGlobalScope* scope = GetInstancePrivate(aCx, obj, sFunctions[5].name); @@ -674,17 +674,17 @@ public: sProperties, sFunctions, NULL, NULL); if (proto) { js::SetReservedSlot(proto, DOM_PROTO_INSTANCE_CLASS_SLOT, JS::PrivateValue(DOMClassStruct())); } return proto; } - static JSBool + static bool InitPrivate(JSContext* aCx, JSObject* aObj, WorkerPrivate* aWorkerPrivate) { JS_ASSERT(JS_GetClass(aObj) == Class()); dom::AllocateProtoAndIfaceCache(aObj); nsRefPtr<DedicatedWorkerGlobalScope> scope = new DedicatedWorkerGlobalScope(aCx, aWorkerPrivate); @@ -709,17 +709,17 @@ protected: { MOZ_COUNT_DTOR(mozilla::dom::workers::DedicatedWorkerGlobalScope); } private: using EventTarget::GetEventListener; using EventTarget::SetEventListener; - static JSBool + static bool GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; DedicatedWorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); @@ -736,19 +736,19 @@ private: JS_ReportError(aCx, "Failed to get event listener!"); return false; } aVp.set(listener ? OBJECT_TO_JSVAL(listener) : JSVAL_NULL); return true; } - static JSBool + static bool SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval, - JSBool aStrict, JS::MutableHandle<JS::Value> aVp) + bool aStrict, JS::MutableHandle<JS::Value> aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); const char* name = sEventStrings[JSID_TO_INT(aIdval)]; DedicatedWorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); if (!scope) { return false; @@ -790,21 +790,21 @@ private: static bool Construct(JSContext* aCx, unsigned aArgc, jsval* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, Class()->name); return false; } - static JSBool + static bool Resolve(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId, unsigned aFlags, JS::MutableHandle<JSObject*> aObjp) { - JSBool resolved; + bool resolved; if (!JS_ResolveStandardClass(aCx, aObj, aId, &resolved)) { return false; } aObjp.set(resolved ? aObj.get() : NULL); return true; }
--- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -159,17 +159,17 @@ struct JSSettings return true; } return false; } }; // All of these are implemented in RuntimeService.cpp -JSBool +bool ResolveWorkerClasses(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId, unsigned aFlags, JS::MutableHandle<JSObject*> aObjp); void CancelWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); void SuspendWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow);
--- a/gfx/skia/patches/archive/0010-Bug-689069-ARM-Opts.patch +++ b/gfx/skia/patches/archive/0010-Bug-689069-ARM-Opts.patch @@ -11,26 +11,26 @@ Subject: [PATCH 10/10] Bug 755869 - diff --git a/gfx/skia/src/xml/SkJS.cpp b/gfx/skia/src/xml/SkJS.cpp index f2e7a83..b2717d7 100644 --- a/gfx/skia/src/xml/SkJS.cpp +++ b/gfx/skia/src/xml/SkJS.cpp @@ -74,7 +74,7 @@ extern "C" { #endif - static JSBool + static bool -global_enumerate(JSContext *cx, JSObject *obj) +global_enumerate(JSContext *cx, JSHandleObject *obj) { #ifdef LAZY_STANDARD_CLASSES return JS_EnumerateStandardClasses(cx, obj); @@ -84,7 +84,7 @@ global_enumerate(JSContext *cx, JSObject *obj) } - static JSBool + static bool -global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp) +global_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSObject **objp) { #ifdef LAZY_STANDARD_CLASSES if ((flags & JSRESOLVE_ASSIGNING) == 0) { -- 1.7.5.4
--- a/gfx/skia/src/xml/SkJS.cpp +++ b/gfx/skia/src/xml/SkJS.cpp @@ -68,32 +68,32 @@ extern "C" { const struct tm *timeptr ) { SkASSERT(0); return 0; } } #endif -static JSBool +static bool global_enumerate(JSContext *cx, JSObject *obj) { #ifdef LAZY_STANDARD_CLASSES return JS_EnumerateStandardClasses(cx, obj); #else return true; #endif } -static JSBool +static bool global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp) { #ifdef LAZY_STANDARD_CLASSES if ((flags & JSRESOLVE_ASSIGNING) == 0) { - JSBool resolved; + bool resolved; if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) return false; if (resolved) { *objp = obj; return true; } } @@ -102,17 +102,17 @@ global_resolve(JSContext *cx, JSObject * #if defined(SHELL_HACK) && defined(DEBUG) && defined(XP_UNIX) if ((flags & (JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING)) == 0) { /* * Do this expensive hack only for unoptimized Unix builds, which are * not used for benchmarking. */ char *path, *comp, *full; const char *name; - JSBool ok, found; + bool ok, found; JSFunction *fun; if (!JSVAL_IS_STRING(id)) return true; path = getenv("PATH"); if (!path) return true; path = JS_strdup(cx, path);
--- a/gfx/skia/src/xml/SkJSDisplayable.cpp +++ b/gfx/skia/src/xml/SkJSDisplayable.cpp @@ -55,29 +55,29 @@ #include "SkTextToPath.h" class SkJSDisplayable { public: SkJSDisplayable() : fDisplayable(NULL) {} ~SkJSDisplayable() { delete fDisplayable; } static void Destructor(JSContext *cx, JSObject *obj); - static JSBool GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp); - static JSBool SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp); + static bool GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp); + static bool SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp); static SkCanvas* gCanvas; static SkPaint* gPaint; - static JSBool Draw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); + static bool Draw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); SkDisplayable* fDisplayable; }; SkCanvas* SkJSDisplayable::gCanvas; SkPaint* SkJSDisplayable::gPaint; -JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) +bool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc, + jsval *argv, jsval *rval) { SkJSDisplayable *p = (SkJSDisplayable*) JS_GetPrivate(cx, obj); SkASSERT(p->fDisplayable->isDrawable()); SkDrawable* drawable = (SkDrawable*) p->fDisplayable; SkAnimateMaker maker(NULL, gCanvas, gPaint); drawable->draw(maker); return true; } @@ -88,17 +88,17 @@ JSFunctionSpec SkJSDisplayable_methods[] { "draw", SkJSDisplayable::Draw, 1, 0, 0 }, { 0 } }; static JSPropertySpec* gDisplayableProperties[kNumberOfTypes]; static JSClass gDisplayableClasses[kNumberOfTypes]; #define JS_INIT(_prefix, _class) \ -static JSBool _class##Constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { \ +static bool _class##Constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { \ SkJSDisplayable* jsDisplayable = new SkJSDisplayable(); \ jsDisplayable->fDisplayable = new _prefix##_class(); \ JS_SetPrivate(cx, obj, (void*) jsDisplayable); \ return true; \ } \ \ static JSObject* _class##Init(JSContext *cx, JSObject *obj, JSObject *proto) { \ JSObject *newProtoObj = JS_InitClass(cx, obj, proto, &gDisplayableClasses[SkType_##_class], \ @@ -210,18 +210,18 @@ static void GenerateTables() { } } #endif void SkJSDisplayable::Destructor(JSContext *cx, JSObject *obj) { delete (SkJSDisplayable*) JS_GetPrivate(cx, obj); } -JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id, - jsval *vp) +bool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id, + jsval *vp) { if (JSVAL_IS_INT(id) == 0) return true; SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj); SkDisplayable* displayable = p->fDisplayable; SkDisplayTypes displayableType = displayable->getType(); int members; const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members); @@ -288,17 +288,17 @@ JSBool SkJSDisplayable::GetProperty(JSCo *vp = STRING_TO_JSVAL(str); break; default: SkASSERT(0); // !!! unimplemented } return true; } -JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { +bool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { if (JSVAL_IS_INT(id) == 0) return true; SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj); SkDisplayable* displayable = p->fDisplayable; SkDisplayTypes displayableType = displayable->getType(); int members; const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members); int idIndex = JSVAL_TO_INT(id);
--- a/ipc/testshell/TestShellParent.cpp +++ b/ipc/testshell/TestShellParent.cpp @@ -30,53 +30,53 @@ TestShellParent::DeallocPTestShellComman return true; } bool TestShellParent::CommandDone(TestShellCommandParent* command, const nsString& aResponse) { // XXX what should happen if the callback fails? - /*JSBool ok = */command->RunCallback(aResponse); + /*bool ok = */command->RunCallback(aResponse); command->ReleaseCallback(); return true; } -JSBool +bool TestShellCommandParent::SetCallback(JSContext* aCx, JS::Value aCallback) { if (!mCallback.Hold(aCx)) { return false; } mCallback = aCallback; mCx = aCx; return true; } -JSBool +bool TestShellCommandParent::RunCallback(const nsString& aResponse) { NS_ENSURE_TRUE(*mCallback.ToJSValPtr() != JSVAL_NULL && mCx, false); JSAutoRequest ar(mCx); NS_ENSURE_TRUE(mCallback.ToJSObject(), false); JSAutoCompartment ac(mCx, mCallback.ToJSObject()); JS::Rooted<JSObject*> global(mCx, JS::CurrentGlobalOrNull(mCx)); JSString* str = JS_NewUCStringCopyN(mCx, aResponse.get(), aResponse.Length()); NS_ENSURE_TRUE(str, false); JS::Rooted<JS::Value> strVal(mCx, JS::StringValue(str)); JS::Rooted<JS::Value> rval(mCx); - JSBool ok = JS_CallFunctionValue(mCx, global, mCallback, 1, strVal.address(), + bool ok = JS_CallFunctionValue(mCx, global, mCallback, 1, strVal.address(), rval.address()); NS_ENSURE_TRUE(ok, false); return true; } void TestShellCommandParent::ReleaseCallback()
--- a/ipc/testshell/TestShellParent.h +++ b/ipc/testshell/TestShellParent.h @@ -38,20 +38,19 @@ public: }; class TestShellCommandParent : public PTestShellCommandParent { public: TestShellCommandParent() : mCx(NULL) { } - JSBool SetCallback(JSContext* aCx, - JS::Value aCallback); + bool SetCallback(JSContext* aCx, JS::Value aCallback); - JSBool RunCallback(const nsString& aResponse); + bool RunCallback(const nsString& aResponse); void ReleaseCallback(); protected: bool ExecuteCallback(const nsString& aResponse); void ActorDestroy(ActorDestroyReason why);
--- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -107,17 +107,17 @@ Print(JSContext *cx, } n++; if (n) fputc('\n', stdout); JS_SET_RVAL(cx, vp, JSVAL_VOID); return true; } -static JSBool +static bool GetLine(char *bufp, FILE *file, const char *prompt) { char line[256]; fputs(prompt, stdout); fflush(stdout); if (!fgets(line, sizeof line, file)) @@ -284,17 +284,17 @@ DumpHeap(JSContext *cx, { JSAutoByteString fileName; void* startThing = NULL; JSGCTraceKind startTraceKind = JSTRACE_OBJECT; void *thingToFind = NULL; size_t maxDepth = (size_t)-1; void *thingToIgnore = NULL; FILE *dumpFile; - JSBool ok; + bool ok; JS::Value *argv = JS_ARGV(cx, vp); JS_SET_RVAL(cx, vp, JSVAL_VOID); vp = argv + 0; if (argc > 0 && *vp != JSVAL_NULL && *vp != JSVAL_VOID) { JSString *str; @@ -396,24 +396,24 @@ typedef enum JSShellErrNum } /* anonymous namespace */ void XPCShellEnvironment::ProcessFile(JSContext *cx, JS::Handle<JSObject*> obj, const char *filename, FILE *file, - JSBool forceTTY) + bool forceTTY) { XPCShellEnvironment* env = this; JSScript *script; JS::Rooted<JS::Value> result(cx); int lineno, startline; - JSBool ok, hitEOF; + bool ok, hitEOF; char *bufp, buffer[4096]; JSString *str; if (forceTTY) { file = stdin; } else #ifdef HAVE_ISATTY @@ -697,17 +697,17 @@ XPCShellEnvironment::EvaluateString(cons return false; } if (aResult) { aResult->Truncate(); } JS::Rooted<JS::Value> result(cx); - JSBool ok = JS_ExecuteScript(cx, global, script, result.address()); + bool ok = JS_ExecuteScript(cx, global, script, result.address()); if (ok && result != JSVAL_VOID) { JSErrorReporter old = JS_SetErrorReporter(cx, NULL); JSString* str = JS_ValueToString(cx, result); nsDependentJSString depStr; if (str) depStr.init(cx, str); JS_SetErrorReporter(cx, old);
--- a/ipc/testshell/XPCShellEnvironment.h +++ b/ipc/testshell/XPCShellEnvironment.h @@ -26,41 +26,41 @@ namespace ipc { class XPCShellEnvironment { public: static XPCShellEnvironment* CreateEnvironment(); ~XPCShellEnvironment(); void ProcessFile(JSContext *cx, JS::Handle<JSObject*> obj, - const char *filename, FILE *file, JSBool forceTTY); + const char *filename, FILE *file, bool forceTTY); bool EvaluateString(const nsString& aString, nsString* aResult = nullptr); JSPrincipals* GetPrincipal() { return nsJSPrincipals::get(nsContentUtils::GetSystemPrincipal()); } JSObject* GetGlobalObject() { return mGlobalHolder.ToJSObject(); } void SetIsQuitting() { mQuitting = true; } - JSBool IsQuitting() { + bool IsQuitting() { return mQuitting; } protected: XPCShellEnvironment(); bool Init(); private: nsAutoJSValHolder mGlobalHolder; - JSBool mQuitting; + bool mQuitting; }; } /* namespace ipc */ } /* namespace mozilla */ #endif /* _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_ */
--- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -308,17 +308,17 @@ JavaScriptChild::AnswerHas(const ObjectI return false; JSAutoCompartment comp(cx, obj); RootedId internedId(cx); if (!convertGeckoStringToId(cx, id, &internedId)) return fail(cx, rs); - JSBool found; + bool found; if (!JS_HasPropertyById(cx, obj, internedId, &found)) return fail(cx, rs); *bp = !!found; return ok(rs); } bool @@ -430,17 +430,17 @@ JavaScriptChild::AnswerIsExtensible(cons JSAutoRequest request(cx); *result = false; RootedObject obj(cx, findObject(objId)); if (!obj) return false; - JSBool extensible; + bool extensible; if (!JS_IsExtensible(cx, obj, &extensible)) return fail(cx, rs); *result = !!extensible; return ok(rs); } bool @@ -512,17 +512,17 @@ JavaScriptChild::AnswerCall(const Object // Go through each argument that was an outparam, retrieve the "value" // field, and add it to a temporary list. We need to do this separately // because the outparams vector is not rooted. vals.clear(); for (size_t i = 0; i < outobjects.length(); i++) { RootedObject obj(cx, &outobjects[i].toObject()); RootedValue v(cx); - JSBool found; + bool found; if (JS_HasProperty(cx, obj, "value", &found)) { if (!JS_GetProperty(cx, obj, "value", &v)) return fail(cx, rs); } else { v = UndefinedValue(); } if (!vals.append(v)) return fail(cx, rs); @@ -637,15 +637,15 @@ JavaScriptChild::AnswerDOMInstanceOf(con *instanceof = false; RootedObject obj(cx, findObject(objId)); if (!obj) return false; JSAutoCompartment comp(cx, obj); - JSBool tmp; + bool tmp; if (!mozilla::dom::InterfaceHasInstance(cx, prototypeID, depth, obj, &tmp)) return fail(cx, rs); *instanceof = tmp; return ok(rs); }
--- a/js/ipc/JavaScriptParent.cpp +++ b/js/ipc/JavaScriptParent.cpp @@ -389,17 +389,17 @@ JavaScriptParent::call(JSContext *cx, Ha RootedValue v(cx); for (size_t i = 0; i < args.length() + 2; i++) { v = args.base()[i]; if (v.isObject()) { JSObject *obj = &v.toObject(); if (xpc::IsOutObject(cx, obj)) { // Make sure it is not an in-out object. - JSBool found; + bool found; if (!JS_HasProperty(cx, obj, "value", &found)) return false; if (found) { JS_ReportError(cx, "in-out objects cannot be sent via CPOWs yet"); return false; } vals.AppendElement(JSParam(void_t()));
--- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -349,25 +349,25 @@ JavaScriptShared::fromDescriptor(JSConte out->setter() = GetterOnlyPropertyStub; else out->setter() = UnknownPropertyOp; } return true; } -JSBool +bool UnknownPropertyStub(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) { JS_ReportError(cx, "getter could not be wrapped via CPOWs"); return false; } -JSBool -UnknownStrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp) +bool +UnknownStrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHandleValue vp) { JS_ReportError(cx, "setter could not be wrapped via CPOWs"); return false; } bool JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in, JSPropertyDescriptor *out) {
--- a/js/jsd/jsd.h +++ b/js/jsd/jsd.h @@ -75,17 +75,17 @@ typedef struct JSDProfileData JSDP /* * XXX What I'm calling a JSDContext is really more of a JSDTaskState. */ struct JSDContext { JSCList links; /* we are part of a JSCList */ - JSBool inited; + bool inited; void* data; uint32_t flags; JSD_ScriptHookProc scriptHook; void* scriptHookData; JSD_ExecutionHookProc interruptHook; void* interruptHookData; JSRuntime* jsrt; JSD_ErrorReporter errorReporter; @@ -158,22 +158,22 @@ struct JSDProfileData double totalOwnExecutionTime; }; struct JSDSourceText { JSCList links; /* we are part of a JSCList */ char* url; char* text; - unsigned textLength; - unsigned textSpace; - JSBool dirty; + unsigned textLength; + unsigned textSpace; + bool dirty; JSDSourceStatus status; - unsigned alterCount; - JSBool doingEval; + unsigned alterCount; + bool doingEval; }; struct JSDExecHook { JSCList links; /* we are part of a JSCList */ JSDScript* jsdscript; uintptr_t pc; JSD_ExecutionHookProc hook; @@ -284,17 +284,17 @@ jsd_DebuggerOnForUser(JSRuntime* extern JSDContext* jsd_DebuggerOn(void); extern void jsd_DebuggerOff(JSDContext* jsdc); extern void -jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff); +jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff); extern void jsd_DebuggerUnpause(JSDContext* jsdc); extern void jsd_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user); extern JSDContext* @@ -304,30 +304,30 @@ extern void* jsd_SetContextPrivate(JSDContext* jsdc, void *data); extern void* jsd_GetContextPrivate(JSDContext* jsdc); extern void jsd_ClearAllProfileData(JSDContext* jsdc); -extern JSBool +extern bool jsd_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata); -extern JSBool +extern bool jsd_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata); /***************************************************************************/ /* Script functions */ -extern JSBool +extern bool jsd_InitScriptManager(JSDContext *jsdc); extern void jsd_DestroyScriptManager(JSDContext* jsdc); extern JSDScript* jsd_FindJSDScript(JSDContext* jsdc, JSScript *script); @@ -384,44 +384,44 @@ extern JSDScript* jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp); extern void * jsd_SetScriptPrivate (JSDScript *jsdscript, void *data); extern void * jsd_GetScriptPrivate (JSDScript *jsdscript); -extern JSBool +extern bool jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript); extern const char* jsd_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript); extern JSString* jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript); extern unsigned jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript); extern unsigned jsd_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript); -extern JSBool +extern bool jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata); extern uintptr_t jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line); extern unsigned jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); -extern JSBool +extern bool jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs); extern void jsd_NewScriptHookProc( JSContext *cx, const char *filename, /* URL this script loads from */ @@ -433,32 +433,32 @@ jsd_NewScriptHookProc( extern void jsd_DestroyScriptHookProc( JSFreeOp *fop, JSScript *script, void* callerdata); /* Script execution hook functions */ -extern JSBool +extern bool jsd_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); -extern JSBool +extern bool jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript); -extern JSBool +extern bool jsd_ClearAllExecutionHooks(JSDContext* jsdc); extern void jsd_ScriptCreated(JSDContext* jsdc, JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, @@ -476,31 +476,31 @@ extern JSDSourceText* jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp); extern JSDSourceText* jsd_FindSourceForURL(JSDContext* jsdc, const char* url); extern const char* jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc); -extern JSBool +extern bool jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen); extern void jsd_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSDSourceStatus jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc); -extern JSBool +extern bool jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc); extern void -jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty); +jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, bool dirty); extern unsigned jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); extern unsigned jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSDSourceText* @@ -516,17 +516,17 @@ jsd_AppendSourceText(JSDContext* jsdc, extern JSDSourceText* jsd_AppendUCSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const jschar* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status); /* convienence function for adding complete source of url in one call */ -extern JSBool +extern bool jsd_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url); extern void jsd_DestroyAllSources(JSDContext* jsdc); @@ -537,89 +537,89 @@ extern void jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url); extern void jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url); /***************************************************************************/ /* Interrupt Hook functions */ -extern JSBool +extern bool jsd_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearInterruptHook(JSDContext* jsdc); -extern JSBool +extern bool jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, - JSBool enable); + bool enable); -extern JSBool +extern bool jsd_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearDebugBreakHook(JSDContext* jsdc); -extern JSBool +extern bool jsd_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearDebuggerHook(JSDContext* jsdc); extern JSTrapStatus jsd_CallExecutionHook(JSDContext* jsdc, JSContext* cx, unsigned type, JSD_ExecutionHookProc hook, void* hookData, jsval* rval); -extern JSBool +extern bool jsd_CallCallHook (JSDContext* jsdc, JSContext* cx, unsigned type, JSD_CallHookProc hook, void* hookData); -extern JSBool +extern bool jsd_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearThrowHook(JSDContext* jsdc); extern JSTrapStatus jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); extern JSTrapStatus jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); -extern JSBool +extern bool jsd_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearFunctionHook(JSDContext* jsdc); -extern JSBool +extern bool jsd_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); -extern JSBool +extern bool jsd_ClearTopLevelHook(JSDContext* jsdc); /***************************************************************************/ /* Stack Frame functions */ extern unsigned jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate); @@ -649,22 +649,22 @@ jsd_GetCallObjectForStackFrame(JSDContex JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetScopeChainForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); -extern JSBool +extern bool jsd_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); -extern JSBool +extern bool jsd_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetThisForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); @@ -675,51 +675,51 @@ jsd_GetIdForStackFrame(JSDContext* jsdc, JSDStackFrameInfo* jsdframe); extern JSDThreadState* jsd_NewThreadState(JSDContext* jsdc, JSContext *cx); extern void jsd_DestroyThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate); -extern JSBool +extern bool jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, - JSBool eatExceptions, JS::MutableHandleValue rval); + bool eatExceptions, JS::MutableHandleValue rval); -extern JSBool +extern bool jsd_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, - JSBool eatExceptions, JS::MutableHandleValue rval); + bool eatExceptions, JS::MutableHandleValue rval); extern JSString* jsd_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val); -extern JSBool +extern bool jsd_IsValidThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate); -extern JSBool +extern bool jsd_IsValidFrameInThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate); -extern JSBool +extern bool jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval); /***************************************************************************/ /* Locking support */ /* protos are in js_lock.h for: * jsd_CreateLock @@ -862,52 +862,52 @@ jsd_DropValue(JSDContext* jsdc, JSDValue extern jsval jsd_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval); extern void jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ -extern JSBool +extern bool jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval); -extern JSBool +extern bool jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ -extern JSBool +extern bool jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval); extern int32_t jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval); extern double jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval); @@ -963,26 +963,26 @@ jsd_GetPropertyAlias(JSDContext* jsdc, J extern unsigned jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop); /**************************************************/ /* Stepping Functions */ extern void * jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - JSBool before, JSBool *ok, void *closure); + bool before, bool *ok, void *closure); extern void * jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - JSBool before, JSBool *ok, void *closure); + bool before, bool *ok, void *closure); /**************************************************/ /* Object Functions */ -extern JSBool +extern bool jsd_InitObjectManager(JSDContext* jsdc); extern void jsd_DestroyObjectManager(JSDContext* jsdc); extern void jsd_DestroyObjects(JSDContext* jsdc); @@ -1021,17 +1021,17 @@ jsd_GetObjectForValue(JSDContext* jsdc, * returns new refcounted JSDValue */ extern JSDValue* jsd_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj); /**************************************************/ /* Atom Functions */ -extern JSBool +extern bool jsd_CreateAtomTable(JSDContext* jsdc); extern void jsd_DestroyAtomTable(JSDContext* jsdc); extern JSDAtom* jsd_AddAtom(JSDContext* jsdc, const char* str);
--- a/js/jsd/jsd_atom.cpp +++ b/js/jsd/jsd_atom.cpp @@ -58,17 +58,17 @@ static int static int _compareAtoms(const void *v1, const void *v2) { return 0 == strcmp(((JSDAtom*)v1)->str, ((JSDAtom*)v2)->str); } -JSBool +bool jsd_CreateAtomTable(JSDContext* jsdc) { jsdc->atoms = JS_NewHashTable(256, JS_HashString, _compareAtomKeys, _compareAtoms, NULL, NULL); #ifdef TEST_ATOMS _testAtoms(jsdc); #endif
--- a/js/jsd/jsd_high.cpp +++ b/js/jsd/jsd_high.cpp @@ -55,17 +55,17 @@ CreateJSDGlobal(JSContext *cx, JSClass * static JSClass global_class = { "JSDGlobal", JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, global_finalize }; -static JSBool +static bool _validateUserCallbacks(JSD_UserCallbacks* callbacks) { return !callbacks || (callbacks->size && callbacks->size <= sizeof(JSD_UserCallbacks)); } static JSDContext* _newJSDContext(JSRuntime* jsrt, @@ -231,28 +231,28 @@ jsd_DebuggerOff(JSDContext* jsdc) _destroyJSDContext(jsdc); if( jsdc->userCallbacks.setContext ) jsdc->userCallbacks.setContext(NULL, jsdc->user); } void -jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff) +jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff) { JS_SetDebuggerHandler(jsdc->jsrt, NULL, NULL); if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) { JS_SetExecuteHook(jsdc->jsrt, NULL, NULL); JS_SetCallHook(jsdc->jsrt, NULL, NULL); } JS_SetThrowHook(jsdc->jsrt, NULL, NULL); JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL); } -static JSBool +static bool jsd_DebugErrorHook(JSContext *cx, const char *message, JSErrorReport *report, void *closure); void jsd_DebuggerUnpause(JSDContext* jsdc) { JS_SetDebuggerHandler(jsdc->jsrt, jsd_DebuggerHandler, jsdc); JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc); @@ -323,17 +323,17 @@ jsd_JSDContextForJSContext(JSContext* co jsdc = iter; break; } } JSD_UNLOCK(); return jsdc; } -static JSBool +static bool jsd_DebugErrorHook(JSContext *cx, const char *message, JSErrorReport *report, void *closure) { JSDContext* jsdc = (JSDContext*) closure; JSD_ErrorReporter errorReporter; void* errorReporterData; if( ! jsdc ) @@ -382,29 +382,29 @@ jsd_DebugErrorHook(JSContext *cx, const return false; default: JS_ASSERT(0); break; } return true; } -JSBool +bool jsd_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata) { JSD_LOCK(); jsdc->errorReporter = reporter; jsdc->errorReporterData = callerdata; JSD_UNLOCK(); return true; } -JSBool +bool jsd_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata) { JSD_LOCK(); if( reporter ) *reporter = jsdc->errorReporter; if( callerdata )
--- a/js/jsd/jsd_hook.cpp +++ b/js/jsd/jsd_hook.cpp @@ -160,167 +160,167 @@ jsd_CallExecutionHook(JSDContext* jsdc, return JSTRAP_THROW; default: JS_ASSERT(0); break; } return JSTRAP_CONTINUE; } -JSBool +bool jsd_CallCallHook (JSDContext* jsdc, JSContext *cx, unsigned type, JSD_CallHookProc hook, void* hookData) { - JSBool hookanswer; + bool hookanswer; JSDThreadState* jsdthreadstate; hookanswer = false; if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc, cx))) { hookanswer = hook(jsdc, jsdthreadstate, type, hookData); jsd_DestroyThreadState(jsdc, jsdthreadstate); } return hookanswer; } -JSBool +bool jsd_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->interruptHookData = callerdata; jsdc->interruptHook = hook; JS_SetInterrupt(jsdc->jsrt, jsd_InterruptHandler, (void*) jsdc); JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearInterruptHook(JSDContext* jsdc) { JSD_LOCK(); JS_ClearInterrupt(jsdc->jsrt, NULL, NULL ); jsdc->interruptHook = NULL; JSD_UNLOCK(); return true; } -JSBool +bool jsd_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->debugBreakHookData = callerdata; jsdc->debugBreakHook = hook; JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearDebugBreakHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->debugBreakHook = NULL; JSD_UNLOCK(); return true; } -JSBool +bool jsd_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->debuggerHookData = callerdata; jsdc->debuggerHook = hook; JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearDebuggerHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->debuggerHook = NULL; JSD_UNLOCK(); return true; } -JSBool +bool jsd_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->throwHookData = callerdata; jsdc->throwHook = hook; JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearThrowHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->throwHook = NULL; JSD_UNLOCK(); return true; } -JSBool +bool jsd_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->functionHookData = callerdata; jsdc->functionHook = hook; JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearFunctionHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->functionHook = NULL; JSD_UNLOCK(); return true; } -JSBool +bool jsd_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->toplevelHookData = callerdata; jsdc->toplevelHook = hook; JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearTopLevelHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->toplevelHook = NULL; JSD_UNLOCK(); return true; }
--- a/js/jsd/jsd_java.cpp +++ b/js/jsd/jsd_java.cpp @@ -104,19 +104,19 @@ static Hnetscape_jsdebug_Script* JHandle* tbl = (JHandle*) unhand(controller)->scriptTable; JHandle* key = _constructInteger(ee,(long)jsdscript); return (Hnetscape_jsdebug_Script*) _getHash( ee, tbl, key ); } /***************************************************************************/ void -_scriptHook( JSDContext* jsdc, +_scriptHook( JSDContext* jsdc, JSDScript* jsdscript, - JSBool creating, + bool creating, void* callerdata ) { Hnetscape_jsdebug_Script* script; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return; @@ -425,17 +425,17 @@ struct Hjava_lang_String *netscape_jsdeb { struct Hnetscape_jsdebug_JSThreadState* threadStateOb; JSDThreadState* jsdthreadstate; JSDStackFrameInfo* jsdframe; char* filenameC; char* srcC; JSString* jsstr; jsval rval; - JSBool success; + bool success; int srclen; threadStateOb = (struct Hnetscape_jsdebug_JSThreadState*)unhand(frame)->threadState; jsdthreadstate = (JSDThreadState*) unhand(threadStateOb)->nativeThreadState; jsdframe = (JSDStackFrameInfo*) unhand(frame)->_nativePtr; if( ! context || ! controller || ! jsdframe )
--- a/js/jsd/jsd_lock.cpp +++ b/js/jsd/jsd_lock.cpp @@ -137,17 +137,17 @@ jsd_Unlock(JSDStaticLock* lock) if(--lock->count == 0) { lock->owner = NULL; PR_Unlock(lock->lock); } } #ifdef DEBUG -JSBool +bool jsd_IsLocked(JSDStaticLock* lock) { void* me; ASSERT_VALID_LOCK(lock); _CURRENT_THREAD(me); if (lock->owner != me) return false; JS_ASSERT(lock->count > 0); @@ -189,17 +189,17 @@ jsd_Lock(void* lock) } void jsd_Unlock(void* lock) { } #ifdef DEBUG -JSBool +bool jsd_IsLocked(void* lock) { return true; } #endif /* DEBUG */ /* * This Windows only thread id code is here to allow the Java-based
--- a/js/jsd/jsd_lock.h +++ b/js/jsd/jsd_lock.h @@ -28,16 +28,16 @@ jsd_CreateLock(); extern void jsd_Lock(JSDStaticLock* lock); extern void jsd_Unlock(JSDStaticLock* lock); #ifdef DEBUG -extern JSBool +extern bool jsd_IsLocked(JSDStaticLock* lock); #endif /* DEBUG */ extern void* jsd_CurrentThread(); #endif /* jsd_lock_h___ */
--- a/js/jsd/jsd_obj.cpp +++ b/js/jsd/jsd_obj.cpp @@ -118,17 +118,17 @@ jsd_Constructing(JSDContext* jsdc, JSCon } static JSHashNumber _hash_root(const void *key) { return ((JSHashNumber)(ptrdiff_t) key) >> 2; /* help lame MSVC1.5 on Win16 */ } -JSBool +bool jsd_InitObjectManager(JSDContext* jsdc) { JS_INIT_CLIST(&jsdc->objectsList); jsdc->objectsTable = JS_NewHashTable(256, _hash_root, JS_CompareValues, JS_CompareValues, NULL, NULL); return !!jsdc->objectsTable; }
--- a/js/jsd/jsd_scpt.cpp +++ b/js/jsd/jsd_scpt.cpp @@ -190,17 +190,17 @@ static JSHashAllocOps script_alloc_ops = jsd_alloc_script_table, jsd_free_script_table, jsd_alloc_script_entry, jsd_free_script_entry }; #ifndef JSD_SCRIPT_HASH_SIZE #define JSD_SCRIPT_HASH_SIZE 1024 #endif -JSBool +bool jsd_InitScriptManager(JSDContext* jsdc) { JS_INIT_CLIST(&jsdc->scripts); jsdc->scriptsTable = JS_NewHashTable(JSD_SCRIPT_HASH_SIZE, jsd_hash_script, JS_CompareValues, JS_CompareValues, &script_alloc_ops, (void*) jsdc); return !!jsdc->scriptsTable; } @@ -388,17 +388,17 @@ jsd_SetScriptPrivate(JSDScript *jsdscrip } void * jsd_GetScriptPrivate(JSDScript *jsdscript) { return jsdscript->data; } -JSBool +bool jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript) { JSDScript *current; JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); for( current = (JSDScript *)jsdc->scripts.next; current != (JSDScript *)&jsdc->scripts; @@ -476,24 +476,24 @@ jsd_GetClosestLine(JSDContext* jsdc, JSD if( line < first ) return first; if( line > last ) return last; return line; } -JSBool +bool jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** retLines, uintptr_t** retPCs) { unsigned first = jsdscript->lineBase; unsigned last = first + jsd_GetScriptLineExtent(jsdc, jsdscript) - 1; - JSBool ok; + bool ok; jsbytecode **pcs; unsigned i; if (last < startLine) return true; AutoSafeJSContext cx; JSAutoCompartment ac(cx, jsdscript->script); @@ -510,42 +510,42 @@ jsd_GetLinePCs(JSDContext* jsdc, JSDScri } JS_free(cx, pcs); } return ok; } -JSBool +bool jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->scriptHook = hook; jsdc->scriptHookData = callerdata; JSD_UNLOCK(); return true; } -JSBool +bool jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata) { JSD_LOCK(); if( hook ) *hook = jsdc->scriptHook; if( callerdata ) *callerdata = jsdc->scriptHookData; JSD_UNLOCK(); return true; } -JSBool -jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable) +bool +jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, bool enable) { - JSBool rv; + bool rv; AutoSafeJSContext cx; JSAutoCompartment ac(cx, jsdscript->script); JSD_LOCK(); rv = JS_SetSingleStepMode(cx, jsdscript->script, enable); JSD_UNLOCK(); return rv; } @@ -662,17 +662,17 @@ static JSDExecHook* jsdhook = (JSDExecHook*)jsdhook->links.next ) { if (jsdhook->pc == pc) return jsdhook; } return NULL; } -static JSBool +static bool _isActiveHook(JSDContext* jsdc, JSScript *script, JSDExecHook* jsdhook) { JSDExecHook* current; JSCList* list; JSDScript* jsdscript; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindJSDScript(jsdc, script); @@ -736,25 +736,25 @@ jsd_TrapHandler(JSContext *cx, JSScript return JSTRAP_CONTINUE; return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_BREAKPOINT, hook, hookData, rval); } -JSBool +bool jsd_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata) { JSDExecHook* jsdhook; - JSBool rv; + bool rv; JSD_LOCK(); if( ! hook ) { jsd_ClearExecutionHook(jsdc, jsdscript, pc); JSD_UNLOCK(); return true; } @@ -794,17 +794,17 @@ jsd_SetExecutionHook(JSDContext* } JS_APPEND_LINK(&jsdhook->links, &jsdscript->hooks); JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSDExecHook* jsdhook; JSD_LOCK(); @@ -824,17 +824,17 @@ jsd_ClearExecutionHook(JSDContext* JS_REMOVE_LINK(&jsdhook->links); free(jsdhook); JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript) { JSDExecHook* jsdhook; JSCList* list = &jsdscript->hooks; JSD_LOCK(); while( (JSDExecHook*)list != (jsdhook = (JSDExecHook*)list->next) ) { @@ -843,17 +843,17 @@ jsd_ClearAllExecutionHooksForScript(JSDC } JS_ClearScriptTraps(jsdc->jsrt, jsdscript->script); JSD_UNLOCK(); return true; } -JSBool +bool jsd_ClearAllExecutionHooks(JSDContext* jsdc) { JSDScript* jsdscript; JSDScript* iterp = NULL; JSD_LOCK(); while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) ) jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript);
--- a/js/jsd/jsd_stak.cpp +++ b/js/jsd/jsd_stak.cpp @@ -309,17 +309,17 @@ jsd_GetThisForStackFrame(JSDContext* jsd JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSDValue* jsdval = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { - JSBool ok; + bool ok; JS::RootedValue thisval(jsdthreadstate->context); JS_BeginRequest(jsdthreadstate->context); ok = jsdframe->frame.getThisValue(jsdthreadstate->context, &thisval); JS_EndRequest(jsdthreadstate->context); if(ok) jsdval = JSD_NewValue(jsdc, thisval); } @@ -351,60 +351,60 @@ jsd_GetIdForStackFrame(JSDContext* jsdc, rv = JS_GetAnonymousString(jsdc->jsrt); } } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } -JSBool +bool jsd_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { - JSBool rv = true; + bool rv = true; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { rv = jsdframe->frame.isDebuggerFrame(); } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } -JSBool +bool jsd_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { - JSBool rv = true; + bool rv = true; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { rv = jsdframe->isConstructing; } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } -JSBool +bool jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, - JSBool eatExceptions, JS::MutableHandleValue rval) + bool eatExceptions, JS::MutableHandleValue rval) { - JSBool retval; - JSBool valid; + bool retval; + bool valid; JSExceptionState* exceptionState = NULL; JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread); JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); @@ -422,26 +422,26 @@ jsd_EvaluateUCScriptInStackFrame(JSDCont rval); jsd_FinishedEvalUsingFilename(jsdc, filename); if (eatExceptions) JS_RestoreExceptionState(cx, exceptionState); return retval; } -JSBool +bool jsd_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, - JSBool eatExceptions, JS::MutableHandleValue rval) + bool eatExceptions, JS::MutableHandleValue rval) { - JSBool retval; - JSBool valid; + bool retval; + bool valid; JSExceptionState* exceptionState = NULL; JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread); JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); @@ -465,17 +465,17 @@ jsd_EvaluateScriptInStackFrame(JSDContex } JSString* jsd_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val) { - JSBool valid; + bool valid; JSString* retval; JSExceptionState* exceptionState; JSContext* cx; JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); @@ -487,17 +487,17 @@ jsd_ValToStringInStackFrame(JSDContext* exceptionState = JS_SaveExceptionState(cx); retval = JS_ValueToString(cx, val); JS_RestoreExceptionState(cx, exceptionState); return retval; } -JSBool +bool jsd_IsValidThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSDThreadState *cur; JS_ASSERT( JSD_THREADSTATES_LOCKED(jsdc) ); for( cur = (JSDThreadState*)jsdc->threadsStates.next; @@ -505,17 +505,17 @@ jsd_IsValidThreadState(JSDContext* cur = (JSDThreadState*)cur->links.next ) { if( cur == jsdthreadstate ) return true; } return false; } -JSBool +bool jsd_IsValidFrameInThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JS_ASSERT(JSD_THREADSTATES_LOCKED(jsdc)); if( ! jsd_IsValidThreadState(jsdc, jsdthreadstate) ) return false; @@ -526,17 +526,17 @@ jsd_IsValidFrameInThreadState(JSDContext JSD_ASSERT_VALID_STACK_FRAME(jsdframe); return true; } static JSContext* _getContextForThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { - JSBool valid; + bool valid; JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidThreadState(jsdc, jsdthreadstate); JSD_UNLOCK_THREADSTATES(jsdc); if( valid ) return jsdthreadstate->context; return NULL; } @@ -549,17 +549,17 @@ jsd_GetException(JSDContext* jsdc, JSDTh if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate))) return NULL; if(JS_GetPendingException(cx, &val)) return jsd_NewValue(jsdc, val); return NULL; } -JSBool +bool jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval) { JSContext* cx; if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate))) return false;
--- a/js/jsd/jsd_step.cpp +++ b/js/jsd/jsd_step.cpp @@ -28,17 +28,17 @@ static char* memset(p, ' ', MAX_INDENT); } if(i > MAX_INDENT) return p; return p + MAX_INDENT-i; } static void _interpreterTrace(JSDContext* jsdc, JSContext *cx, JSAbstractFramePtr frame, - bool isConstructing, JSBool before) + bool isConstructing, bool before) { JSDScript* jsdscript = NULL; JSScript * script; static indent = 0; JSString* funName = NULL; script = frame.script(); if(script) @@ -71,23 +71,23 @@ static void else puts("<unavailable>"); } printf("\n"); JS_ASSERT(indent >= 0); } #endif -JSBool +bool _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - JSBool before, unsigned type, JSD_CallHookProc hook, void *hookData) + bool before, unsigned type, JSD_CallHookProc hook, void *hookData) { JSDScript* jsdscript; JSScript* jsscript; - JSBool hookresult = true; + bool hookresult = true; if (!jsdc || !jsdc->inited) return false; if (!hook && !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) { /* no hook to call, no profile data needs to be collected, * so there is nothing to do here. @@ -229,17 +229,17 @@ JSBool #else return hookresult; #endif } void * jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - JSBool before, JSBool *ok, void *closure) + bool before, bool *ok, void *closure) { JSDContext* jsdc; JSD_CallHookProc hook; void* hookData; jsdc = (JSDContext*) closure; /* local in case jsdc->functionHook gets cleared on another thread */ @@ -255,17 +255,17 @@ jsd_FunctionCallHook(JSContext *cx, JSAb return closure; } return NULL; } void * jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - JSBool before, JSBool *ok, void *closure) + bool before, bool *ok, void *closure) { JSDContext* jsdc; JSD_CallHookProc hook; void* hookData; jsdc = (JSDContext*) closure; /* local in case jsdc->toplevelHook gets cleared on another thread */
--- a/js/jsd/jsd_text.cpp +++ b/js/jsd/jsd_text.cpp @@ -31,17 +31,17 @@ static void jsdsrc->textLength = 0; jsdsrc->textSpace = 0; jsdsrc->status = JSD_SOURCE_CLEARED; jsdsrc->dirty = true; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->doingEval = false; } -static JSBool +static bool _appendText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, size_t length) { #define MEMBUF_GROW 1000 unsigned neededSize = jsdsrc->textLength + length; if( neededSize > jsdsrc->textSpace ) @@ -130,17 +130,17 @@ static void static void _removeSourceFromRemovedList( JSDContext* jsdc, JSDSourceText* jsdsrc ) { JS_REMOVE_LINK(&jsdsrc->links); _destroySource( jsdc, jsdsrc ); } -static JSBool +static bool _isSourceInSourceList(JSDContext* jsdc, JSDSourceText* jsdsrcToFind) { JSDSourceText *jsdsrc; for( jsdsrc = (JSDSourceText*)jsdc->sources.next; jsdsrc != (JSDSourceText*)&jsdc->sources; jsdsrc = (JSDSourceText*)jsdsrc->links.next ) { @@ -250,17 +250,17 @@ jsd_FindSourceForURL(JSDContext* jsdc, c } const char* jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->url; } -JSBool +bool jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen ) { *ppBuf = jsdsrc->text; *pLen = jsdsrc->textLength; return true; } @@ -275,24 +275,24 @@ jsd_ClearSourceText(JSDContext* jsdc, JS } JSDSourceStatus jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->status; } -JSBool +bool jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->dirty; } void -jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty) +jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, bool dirty) { jsdsrc->dirty = dirty; } unsigned jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->alterCount; @@ -313,19 +313,19 @@ void DEBUG_ITERATE_SOURCES( JSDContext* JSDSourceText* jsdsrc = NULL; int dummy; while( NULL != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) ) { const char* url; const char* text; int len; - JSBool dirty; + bool dirty; JSDStreamStatus status; - JSBool gotSrc; + bool gotSrc; url = JSD_GetSourceURL(jsdc, jsdsrc); dirty = JSD_IsSourceDirty(jsdc, jsdsrc); status = JSD_GetSourceStatus(jsdc, jsdsrc); gotSrc = JSD_GetSourceText(jsdc, jsdsrc, &text, &len ); dummy = 0; /* gives us a line to set breakpoint... */ } @@ -447,17 +447,17 @@ jsd_AppendUCSourceText(JSDContext* jsdc, if(jsdsrc && status != JSD_SOURCE_PARTIAL) jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status); JSD_UNLOCK_SOURCE_TEXT(jsdc); return jsdsrc; } /* convienence function for adding complete source of url in one call */ -JSBool +bool jsd_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url) { JSDSourceText* jsdsrc; JSD_LOCK_SOURCE_TEXT(jsdc);
--- a/js/jsd/jsd_val.cpp +++ b/js/jsd/jsd_val.cpp @@ -52,101 +52,101 @@ void JSD_ASSERT_VALID_PROPERTY(JSDProper JS_ASSERT(jsdprop->val); JS_ASSERT(jsdprop->val->nref > 0); if(jsdprop->alias) JS_ASSERT(jsdprop->alias->nref > 0); } #endif -JSBool +bool jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval) { return !JSVAL_IS_PRIMITIVE(jsdval->val) || JSVAL_IS_NULL(jsdval->val); } -JSBool +bool jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_NUMBER(jsdval->val); } -JSBool +bool jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_INT(jsdval->val); } -JSBool +bool jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_DOUBLE(jsdval->val); } -JSBool +bool jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_STRING(jsdval->val); } -JSBool +bool jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_BOOLEAN(jsdval->val); } -JSBool +bool jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_NULL(jsdval->val); } -JSBool +bool jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_VOID(jsdval->val); } -JSBool +bool jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_PRIMITIVE(jsdval->val); } -JSBool +bool jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval) { AutoSafeJSContext cx; // NB: Actually unused. return !JSVAL_IS_PRIMITIVE(jsdval->val) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(jsdval->val)); } -JSBool +bool jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval) { AutoSafeJSContext cx; JS::RootedFunction fun(cx); if(jsd_IsValueFunction(jsdc, jsdval)) { JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(jsdval->val)); AutoSaveExceptionState as(cx); - JSBool ok = false; + bool ok = false; fun = JSD_GetValueFunction(jsdc, jsdval); if(fun) ok = JS_GetFunctionScript(cx, fun) ? false : true; JS_ASSERT(fun); return ok; } return !JSVAL_IS_PRIMITIVE(jsdval->val); } /***************************************************************************/ -JSBool +bool jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { jsval val = jsdval->val; if(!JSVAL_IS_BOOLEAN(val)) return false; return JSVAL_TO_BOOLEAN(val); } @@ -243,17 +243,17 @@ jsd_NewValue(JSDContext* jsdc, jsval val JS::RootedValue val(cx, value); JSDValue* jsdval; if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue)))) return NULL; if(JSVAL_IS_GCTHING(val)) { - JSBool ok; + bool ok; JSAutoCompartment ac(cx, jsdc->glob); ok = JS_AddNamedValueRoot(cx, &jsdval->val, "JSDValue"); if(ok && JSVAL_IS_STRING(val)) { if(!JS_WrapValue(cx, val.address())) { ok = false; } } @@ -346,17 +346,17 @@ static void _freeProps(JSDContext* jsdc, { JS_REMOVE_AND_INIT_LINK(&jsdprop->links); jsd_DropProperty(jsdc, jsdprop); } JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props)); CLEAR_BIT_FLAG(jsdval->flags, GOT_PROPS); } -static JSBool _buildProps(JSDContext* jsdc, JSDValue* jsdval) +static bool _buildProps(JSDContext* jsdc, JSDValue* jsdval) { AutoSafeJSContext cx; JS::RootedObject obj(cx); JSPropertyDescArray pda; unsigned i; JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props)); JS_ASSERT(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS))); @@ -464,17 +464,17 @@ jsd_GetValueProperty(JSDContext* jsdc, J { AutoSafeJSContext cx; JSAutoCompartment acBase(cx, jsdc->glob); JSDProperty* jsdprop; JSDProperty* iter = NULL; JS::RootedObject obj(cx); JS::RootedString name(cx, nameStr); unsigned attrs = 0; - JSBool found; + bool found; JSPropertyDesc pd; const jschar * nameChars; size_t nameLen; JS::RootedValue val(cx), nameval(cx); JS::RootedId nameid(cx); if(!jsd_IsValueObject(jsdc, jsdval)) return NULL;
--- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -532,17 +532,17 @@ jsds_ErrorHookProc (JSDContext *jsdc, JS running = false; if (!rval) return JSD_ERROR_REPORTER_DEBUG; return JSD_ERROR_REPORTER_PASS_ALONG; } -static JSBool +static bool jsds_CallHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata) { nsCOMPtr<jsdICallHook> hook; switch (type) { case JSD_HOOK_TOPLEVEL_START: @@ -647,17 +647,17 @@ jsds_ExecutionHookProc (JSDContext* jsdc *rval = JSD_GetValueWrappedJSVal(jsdc, jsdv); } } return hook_rv; } static void -jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, JSBool creating, +jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, bool creating, void* callerdata) { #ifdef CAUTIOUS_SCRIPTHOOK JSRuntime *rt = JS_GetRuntime(nsContentUtils::GetSafeJSContext()); #endif if (creating) { nsCOMPtr<jsdIScriptHook> hook;
--- a/js/jsd/jsdebug.cpp +++ b/js/jsd/jsdebug.cpp @@ -257,17 +257,17 @@ JSD_SetScriptPrivate(JSDScript *jsdscrip JSD_PUBLIC_API(void *) JSD_GetScriptPrivate(JSDScript *jsdscript) { JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptPrivate (jsdscript); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsActiveScript(jsdc, jsdscript); } JSD_PUBLIC_API(const char*) JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript) @@ -296,24 +296,24 @@ JSD_GetScriptBaseLineNumber(JSDContext* JSD_PUBLIC_API(unsigned) JSD_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptLineExtent(jsdc, jsdscript); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetScriptHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(uintptr_t) JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line) @@ -326,17 +326,17 @@ JSD_GetClosestPC(JSDContext* jsdc, JSDSc JSD_PUBLIC_API(unsigned) JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetClosestLine(jsdc, jsdscript, pc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetLinePCs(jsdc, jsdscript, startLine, maxLines, count, lines, pcs); } @@ -397,17 +397,17 @@ JSD_FindSourceForURL(JSDContext* jsdc, c JSD_PUBLIC_API(const char*) JSD_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_GetSourceURL(jsdc,jsdsrc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); JS_ASSERT(ppBuf); JS_ASSERT(pLen); return jsd_GetSourceText(jsdc, jsdsrc, ppBuf, pLen); @@ -425,26 +425,26 @@ JSD_ClearSourceText(JSDContext* jsdc, JS JSD_PUBLIC_API(JSDSourceStatus) JSD_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_GetSourceStatus(jsdc, jsdsrc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_IsSourceDirty(jsdc, jsdsrc); } JSD_PUBLIC_API(void) -JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty) +JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, bool dirty) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); jsd_SetSourceDirty(jsdc, jsdsrc, dirty); } JSD_PUBLIC_API(unsigned) JSD_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) @@ -496,165 +496,165 @@ JSD_AppendUCSourceText(JSDContext* j size_t length, JSDSourceStatus status) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_AppendUCSourceText(jsdc, jsdsrc, text, length, status); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(url); return jsd_AddFullSourceText(jsdc, text, length, url); } /***************************************************************************/ /* Execution/Interrupt Hook functions */ -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_SetExecutionHook(jsdc, jsdscript, pc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_ClearExecutionHook(jsdc, jsdscript, pc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearAllExecutionHooks(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearAllExecutionHooks(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetInterruptHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) -JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable) +JSD_PUBLIC_API(bool) +JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, bool enable) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_EnableSingleStepInterrupts(jsdc, jsdscript, enable); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearInterruptHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearInterruptHook(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetDebugBreakHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearDebugBreakHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearDebugBreakHook(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetDebuggerHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearDebuggerHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearDebuggerHook(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetThrowHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearThrowHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearThrowHook(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetTopLevelHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearTopLevelHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearTopLevelHook(jsdc); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetFunctionHook(jsdc, hook, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_ClearFunctionHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearFunctionHook(jsdc); } /***************************************************************************/ /* Stack Frame functions */ @@ -738,52 +738,52 @@ JSD_PUBLIC_API(JSString *) JSD_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetIdForStackFrame(jsdc, jsdthreadstate, jsdframe); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsStackFrameDebugger(jsdc, jsdthreadstate, jsdframe); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsStackFrameConstructing(jsdc, jsdthreadstate, jsdframe); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, true, rval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); @@ -791,34 +791,34 @@ JSD_AttemptUCScriptInStackFrame(JSDConte JS_ASSERT(length); JS_ASSERT(filename); return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, false, rval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); return jsd_EvaluateScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, true, rval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_AttemptScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); @@ -842,47 +842,47 @@ JSD_ValToStringInStackFrame(JSDContext* JSD_PUBLIC_API(JSDValue*) JSD_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetException(jsdc, jsdthreadstate); } -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetException(jsdc, jsdthreadstate, jsdval); } /***************************************************************************/ -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetErrorReporter(jsdc, reporter, callerdata); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetErrorReporter(jsdc, reporter, callerdata); } /***************************************************************************/ -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsLockingAndThreadIdSupported() { #ifdef JSD_THREADSAFE return true; #else return false; #endif } @@ -908,27 +908,27 @@ JSD_Lock(JSDStaticLock* lock) JSD_PUBLIC_API(void) JSD_Unlock(JSDStaticLock* lock) { #ifdef JSD_THREADSAFE jsd_Unlock(lock); #endif } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsLocked(JSDStaticLock* lock) { #if defined(JSD_THREADSAFE) && defined(DEBUG) return jsd_IsLocked(lock); #else return true; #endif } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsUnlocked(JSDStaticLock* lock) { #if defined(JSD_THREADSAFE) && defined(DEBUG) return ! jsd_IsLocked(lock); #else return true; #endif } @@ -970,107 +970,107 @@ JSD_RefreshValue(JSDContext* jsdc, JSDVa { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); jsd_RefreshValue(jsdc, jsdval); } /**************************************************/ -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueObject(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueObject(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNumber(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueInt(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueInt(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueDouble(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueString(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueString(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueBoolean(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueNull(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNull(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueVoid(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValuePrimitive(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueFunction(jsdc, jsdval); } -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_IsValueNative(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNative(jsdc, jsdval); } /**************************************************/ -JSD_PUBLIC_API(JSBool) +JSD_PUBLIC_API(bool) JSD_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueBoolean(jsdc, jsdval); } JSD_PUBLIC_API(int32_t)
--- a/js/jsd/jsdebug.h +++ b/js/jsd/jsdebug.h @@ -380,17 +380,17 @@ JSD_SetScriptPrivate(JSDScript* jsdscrip * Get the private data for this script */ extern JSD_PUBLIC_API(void *) JSD_GetScriptPrivate(JSDScript* jsdscript); /* * Determine if this script is still loaded in the interpreter */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript); /* * Get the filename associated with this script */ extern JSD_PUBLIC_API(const char*) JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript); @@ -420,31 +420,31 @@ JSD_GetScriptLineExtent(JSDContext* jsdc * Declaration of callback for notification of script creation and destruction. * 'creating' is true if creating new script, false if destroying existing * script (callback called just before actual destruction). * 'callerdata' is what was passed to JSD_SetScriptHook to set the hook. */ typedef void (* JSD_ScriptHookProc)(JSDContext* jsdc, JSDScript* jsdscript, - JSBool creating, + bool creating, void* callerdata); /* * Set a hook to be called when scripts are created or destroyed (loaded or * unloaded). * 'callerdata' can be whatever you want it to be. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata); /* * Get the current script hook. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata); /* * Get a 'Program Counter' value for a given line. This represents the location * of the first bit of executable code for this line of source. This 'pc' should * be considered an opaque handle. * 0 is returned for invalid scripts, or lines that lie outside the script. * If no code is on the given line, then the returned pc represents the first @@ -463,17 +463,17 @@ extern JSD_PUBLIC_API(unsigned) JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); /* * Get a list of lines and the corresponding earliest PC for each (see * JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL * may be passed for either lines or pcs to avoid filling anything in for that * argument. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs); /* these are only used in cases where scripts are created outside of JS*/ /* * Direct call to notify JSD that a script has been created. @@ -570,17 +570,17 @@ JSD_GetSourceURL(JSDContext* jsdc, JSDSo /* * Get the actual source text. This gives access to the actual storage of * the source - it sHould *not* be written to. * The buffer is NOT zero terminated (nor is it guaranteed to have space to * hold a zero terminating char). * XXX this is 8-bit character data. Unicode source is not yet supported. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen); /* * Clear the text -- delete the text and set the status to JSD_SOURCE_CLEARED. * This is useful if source is done loading and the debugger wishes to store * the text data itself (e.g. in a Java String). This allows avoidance of * storing the same text in multiple places. @@ -595,24 +595,24 @@ extern JSD_PUBLIC_API(JSDSourceStatus) JSD_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Has the source been altered since the last call to JSD_SetSourceDirty? * Use of JSD_IsSourceDirty and JSD_SetSourceDirty is still supported, but * discouraged in favor of the JSD_GetSourceAlterCount system. This dirty * scheme ASSUMES that there is only one consumer of the data. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Clear the dirty flag */ extern JSD_PUBLIC_API(void) -JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty); +JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, bool dirty); /* * Each time a source text item is altered this value is incremented. Any * consumer can store this value when they retieve other data about the * source text item and then check later to see if the current value is * different from their stored value. Thus they can know if they have stale * data or not. NOTE: this value is not gauranteed to start at any given number. */ @@ -680,17 +680,17 @@ JSD_AppendUCSourceText(JSDContext* j * jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, * text, length, JSD_SOURCE_PARTIAL); * if(jsdsrc) * jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, * NULL, 0, JSD_SOURCE_COMPLETED); * JSD_UNLOCK_SOURCE_TEXT(jsdc); * return jsdsrc ? true : false; */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url); /***************************************************************************/ /* Execution/Interrupt Hook functions */ @@ -726,146 +726,146 @@ typedef unsigned #define JSD_HOOK_FUNCTION_RETURN 3 /* done calling function */ /* * Implement a callback of this form in order to hook function call/returns. * Return true from a TOPLEVEL_START or FUNCTION_CALL type call hook if you * want to hear about the TOPLEVEL_END or FUNCTION_RETURN too. Return value is * ignored to TOPLEVEL_END and FUNCTION_RETURN type hooks. */ -typedef JSBool +typedef bool (* JSD_CallHookProc)(JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata); /* * Set Hook to be called whenever the given pc is about to be executed -- * i.e. for 'trap' or 'breakpoint' */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the hook for this pc */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); /* * Clear all the pc specific hooks for this script */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript); /* * Clear all the pc specific hooks for the entire JSRuntime associated with * this JSDContext */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearAllExecutionHooks(JSDContext* jsdc); /* * Set a hook to be called before the next instruction is executed. Depending * on the threading situation and whether or not an JS code is currently * executing the hook might be called before this call returns, or at some * future time. The hook will continue to be called as each instruction * executes until cleared. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Call the interrupt hook at least once per source line */ -extern JSD_PUBLIC_API(JSBool) -JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript *jsdscript, JSBool enable); +extern JSD_PUBLIC_API(bool) +JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript *jsdscript, bool enable); /* * Clear the current interrupt hook. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearInterruptHook(JSDContext* jsdc); /* * Set the hook that should be called whenever a JSD_ErrorReporter hook * returns JSD_ERROR_REPORTER_DEBUG. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the debug break hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearDebugBreakHook(JSDContext* jsdc); /* * Set the hook that should be called when the 'debugger' keyword is * encountered by the JavaScript interpreter during execution. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the 'debugger' keyword hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearDebuggerHook(JSDContext* jsdc); /* * Set the hook that should be called when a JS exception is thrown. * NOTE: the 'do default' return value is: JSD_HOOK_RETURN_CONTINUE_THROW */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the throw hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearThrowHook(JSDContext* jsdc); /* * Set the hook that should be called when a toplevel script begins or completes. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); /* * Clear the toplevel call hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearTopLevelHook(JSDContext* jsdc); /* * Set the hook that should be called when a function call or return happens. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); /* * Clear the function call hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_ClearFunctionHook(JSDContext* jsdc); /***************************************************************************/ /* Stack Frame functions */ /* * Get the count of call stack frames for the given JSDThreadState */ @@ -945,65 +945,65 @@ extern JSD_PUBLIC_API(JSString *) JSD_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * True if stack frame represents a frame created as a result of a debugger * evaluation. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * True if stack frame is constructing a new object. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Evaluate the given unicode source code in the context of the given stack frame. * returns true and puts result in rval on success, false on failure. * NOTE: The ErrorReporter hook might be called if this fails. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval); /* * Same as above, but does not eat exceptions. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval); /* single byte character version of JSD_EvaluateUCScriptInStackFrame */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval); /* * Same as above, but does not eat exceptions. */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_AttemptScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JS::MutableHandleValue rval); /* * Convert the given jsval to a string @@ -1022,17 +1022,17 @@ JSD_ValToStringInStackFrame(JSDContext* */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate); /* * Set the JSDValue currently being thrown as an exception. * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval); /***************************************************************************/ /* Error Reporter functions */ /* * XXX The ErrorReporter Hook scheme is going to change soon to more @@ -1051,36 +1051,36 @@ JSD_SetException(JSDContext* jsdc, JSDTh typedef unsigned (* JSD_ErrorReporter)(JSDContext* jsdc, JSContext* cx, const char* message, JSErrorReport* report, void* callerdata); /* Set ErrorReporter hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata); /* Get Current ErrorReporter hook */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata); /***************************************************************************/ /* Generic locks that callers can use for their own purposes */ struct JSDStaticLock; /* * Is Locking and GetThread supported in this build? */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsLockingAndThreadIdSupported(); /* * Create a reentrant/nestable lock */ extern JSD_PUBLIC_API(JSDStaticLock*) JSD_CreateLock(); @@ -1097,23 +1097,23 @@ JSD_Lock(JSDStaticLock* lock); */ extern JSD_PUBLIC_API(void) JSD_Unlock(JSDStaticLock* lock); /* * For debugging only if not (JS_THREADSAFE AND DEBUG) then returns true * So JSD_IsLocked(lock) may not equal !JSD_IsUnlocked(lock) */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsLocked(JSDStaticLock* lock); /* * See above... */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsUnlocked(JSDStaticLock* lock); /* * return an ID uniquely identifying this thread. */ extern JSD_PUBLIC_API(void*) JSD_CurrentThread(); @@ -1161,96 +1161,96 @@ extern JSD_PUBLIC_API(void) JSD_RefreshValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* * Does the JSDValue wrap a JSObject? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueObject(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a number (int or double)? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap an int? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueInt(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a double? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSString? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueString(JSDContext* jsdc, JSDValue* jsdval); /* -* Does the JSDValue wrap a JSBool? +* Does the JSDValue wrap a bool? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSVAL_NULL? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueNull(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSVAL_VOID? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a primative (not a JSObject)? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a function? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a native function? * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_IsValueNative(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* -* Return JSBool value (does NOT do conversion). +* Return bool value (does NOT do conversion). * *** new for version 1.1 **** */ -extern JSD_PUBLIC_API(JSBool) +extern JSD_PUBLIC_API(bool) JSD_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval); /* * Return int32_t value (does NOT do conversion). * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(int32_t) JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
--- a/js/jsd/jshash.cpp +++ b/js/jsd/jshash.cpp @@ -161,17 +161,17 @@ JS_HashTableRawLookup(JSHashTable *ht, J hep = &he->next; #ifdef JS_HASHMETER ht->nsteps++; #endif } return hep; } -static JSBool +static bool Resize(JSHashTable *ht, uint32_t newshift) { size_t nb, nentries, i; JSHashEntry **oldbuckets, *he, *next, **hep; size_t nold = NBUCKETS(ht); JS_ASSERT(newshift < JS_HASH_BITS); @@ -284,17 +284,17 @@ JS_HashTableRawRemove(JSHashTable *ht, J if (--ht->nentries < UNDERLOADED(n)) { Resize(ht, ht->shift + 1); #ifdef JS_HASHMETER ht->nshrinks++; #endif } } -JSBool +bool JS_HashTableRemove(JSHashTable *ht, const void *key) { JSHashNumber keyHash; JSHashEntry *he, **hep; keyHash = ht->keyHash(key); hep = JS_HashTableRawLookup(ht, keyHash, key); if ((he = *hep) == NULL)
--- a/js/jsd/jshash.h +++ b/js/jsd/jshash.h @@ -88,17 +88,17 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHa extern void JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he); /* Higher level access methods */ extern JSHashEntry * JS_HashTableAdd(JSHashTable *ht, const void *key, void *value); -extern JSBool +extern bool JS_HashTableRemove(JSHashTable *ht, const void *key); extern int JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg); extern void * JS_HashTableLookup(JSHashTable *ht, const void *key);
--- a/js/public/CallArgs.h +++ b/js/public/CallArgs.h @@ -84,17 +84,17 @@ namespace JS { extern JS_PUBLIC_DATA(const HandleValue) UndefinedHandleValue; /* * JS::CallReceiver encapsulates access to the callee, |this|, and eventual * return value for a function call. The principal way to create a * CallReceiver is using JS::CallReceiverFromVp: * - * static JSBool + * static bool * FunctionReturningThis(JSContext *cx, unsigned argc, JS::Value *vp) * { * JS::CallReceiver rec = JS::CallReceiverFromVp(vp); * * // Access to the callee must occur before accessing/setting * // the return value. * JSObject &callee = rec.callee(); * rec.rval().set(JS::ObjectValue(callee)); @@ -277,17 +277,17 @@ CallReceiverFromVp(Value *vp) return CallReceiverFromArgv(vp + 2); } /* * JS::CallArgs encapsulates everything JS::CallReceiver does, plus access to * the function call's arguments. The principal way to create a CallArgs is * like so, using JS::CallArgsFromVp: * - * static JSBool + * static bool * FunctionReturningArgcTimesArg0(JSContext *cx, unsigned argc, JS::Value *vp) * { * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); * * // Guard against no arguments or a non-numeric arg0. * if (args.length() == 0 || !args[0].isNumber()) { * args.rval().setInt32(0); * return true;
--- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -511,17 +511,17 @@ class ObjectPrivateVisitor { public: // Within CollectRuntimeStats, this method is called for each JS object // that has an nsISupports pointer. virtual size_t sizeOfIncludingThis(nsISupports *aSupports) = 0; // A callback that gets a JSObject's nsISupports pointer, if it has one. // Note: this function does *not* addref |iface|. - typedef JSBool(*GetISupportsFun)(JSObject *obj, nsISupports **iface); + typedef bool(*GetISupportsFun)(JSObject *obj, nsISupports **iface); GetISupportsFun getISupports_; ObjectPrivateVisitor(GetISupportsFun getISupports) : getISupports_(getISupports) {} }; extern JS_PUBLIC_API(bool)
--- a/js/public/Value.h +++ b/js/public/Value.h @@ -243,17 +243,17 @@ typedef enum JSWhyMagic # if JS_BITS_PER_WORD == 32 typedef union jsval_layout { uint64_t asBits; struct { union { int32_t i32; uint32_t u32; - JSBool boo; + uint32_t boo; // Don't use |bool| -- it must be four bytes. JSString *str; JSObject *obj; void *ptr; JSWhyMagic why; size_t word; uintptr_t uintptr; } payload; JSValueTag tag; @@ -290,17 +290,17 @@ typedef union jsval_layout typedef union jsval_layout { uint64_t asBits; struct { JSValueTag tag; union { int32_t i32; uint32_t u32; - JSBool boo; + uint32_t boo; // Don't use |bool| -- it must be four bytes. JSString *str; JSObject *obj; void *ptr; JSWhyMagic why; size_t word; uintptr_t uintptr; } payload; } s; @@ -344,32 +344,32 @@ JS_STATIC_ASSERT(sizeof(jsval_layout) == static inline jsval_layout BUILD_JSVAL(JSValueTag tag, uint32_t payload) { jsval_layout l; l.asBits = (((uint64_t)(uint32_t)tag) << 32) | payload; return l; } -static inline JSBool +static inline bool JSVAL_IS_DOUBLE_IMPL(jsval_layout l) { return (uint32_t)l.s.tag <= (uint32_t)JSVAL_TAG_CLEAR; } static inline jsval_layout DOUBLE_TO_JSVAL_IMPL(double d) { jsval_layout l; l.asDouble = d; MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(l)); return l; } -static inline JSBool +static inline bool JSVAL_IS_INT32_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_INT32; } static inline int32_t JSVAL_TO_INT32_IMPL(jsval_layout l) { @@ -380,31 +380,31 @@ static inline jsval_layout INT32_TO_JSVAL_IMPL(int32_t i) { jsval_layout l; l.s.tag = JSVAL_TAG_INT32; l.s.payload.i32 = i; return l; } -static inline JSBool +static inline bool JSVAL_IS_NUMBER_IMPL(jsval_layout l) { JSValueTag tag = l.s.tag; MOZ_ASSERT(tag != JSVAL_TAG_CLEAR); return (uint32_t)tag <= (uint32_t)JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET; } -static inline JSBool +static inline bool JSVAL_IS_UNDEFINED_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_UNDEFINED; } -static inline JSBool +static inline bool JSVAL_IS_STRING_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_STRING; } static inline jsval_layout STRING_TO_JSVAL_IMPL(JSString *str) { @@ -416,57 +416,56 @@ STRING_TO_JSVAL_IMPL(JSString *str) } static inline JSString * JSVAL_TO_STRING_IMPL(jsval_layout l) { return l.s.payload.str; } -static inline JSBool +static inline bool JSVAL_IS_BOOLEAN_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_BOOLEAN; } -static inline JSBool +static inline bool JSVAL_TO_BOOLEAN_IMPL(jsval_layout l) { return l.s.payload.boo; } static inline jsval_layout -BOOLEAN_TO_JSVAL_IMPL(JSBool b) +BOOLEAN_TO_JSVAL_IMPL(bool b) { jsval_layout l; - MOZ_ASSERT(b == JS_TRUE_DEPRECATED || b == JS_FALSE_DEPRECATED); l.s.tag = JSVAL_TAG_BOOLEAN; l.s.payload.boo = b; return l; } -static inline JSBool +static inline bool JSVAL_IS_MAGIC_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_MAGIC; } -static inline JSBool +static inline bool JSVAL_IS_OBJECT_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_OBJECT; } -static inline JSBool +static inline bool JSVAL_IS_PRIMITIVE_IMPL(jsval_layout l) { return (uint32_t)l.s.tag < (uint32_t)JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET; } -static inline JSBool +static inline bool JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l) { MOZ_ASSERT((uint32_t)l.s.tag <= (uint32_t)JSVAL_TAG_OBJECT); return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET; } static inline JSObject * JSVAL_TO_OBJECT_IMPL(jsval_layout l) @@ -479,17 +478,17 @@ OBJECT_TO_JSVAL_IMPL(JSObject *obj) { jsval_layout l; MOZ_ASSERT(obj); l.s.tag = JSVAL_TAG_OBJECT; l.s.payload.obj = obj; return l; } -static inline JSBool +static inline bool JSVAL_IS_NULL_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_NULL; } static inline jsval_layout PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) { @@ -502,63 +501,63 @@ PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) } static inline void * JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l) { return l.s.payload.ptr; } -static inline JSBool +static inline bool JSVAL_IS_GCTHING_IMPL(jsval_layout l) { /* gcc sometimes generates signed < without explicit casts. */ return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET; } static inline void * JSVAL_TO_GCTHING_IMPL(jsval_layout l) { return l.s.payload.ptr; } -static inline JSBool +static inline bool JSVAL_IS_TRACEABLE_IMPL(jsval_layout l) { return l.s.tag == JSVAL_TAG_STRING || l.s.tag == JSVAL_TAG_OBJECT; } static inline uint32_t JSVAL_TRACE_KIND_IMPL(jsval_layout l) { - return (uint32_t)(JSBool)JSVAL_IS_STRING_IMPL(l); + return (uint32_t)(bool)JSVAL_IS_STRING_IMPL(l); } -static inline JSBool +static inline bool JSVAL_IS_SPECIFIC_INT32_IMPL(jsval_layout l, int32_t i32) { return l.s.tag == JSVAL_TAG_INT32 && l.s.payload.i32 == i32; } -static inline JSBool -JSVAL_IS_SPECIFIC_BOOLEAN(jsval_layout l, JSBool b) +static inline bool +JSVAL_IS_SPECIFIC_BOOLEAN(jsval_layout l, bool b) { - return (l.s.tag == JSVAL_TAG_BOOLEAN) && (l.s.payload.boo == b); + return (l.s.tag == JSVAL_TAG_BOOLEAN) && (l.s.payload.boo == uint32_t(b)); } static inline jsval_layout MAGIC_TO_JSVAL_IMPL(JSWhyMagic why) { jsval_layout l; l.s.tag = JSVAL_TAG_MAGIC; l.s.payload.why = why; return l; } -static inline JSBool +static inline bool JSVAL_SAME_TYPE_IMPL(jsval_layout lhs, jsval_layout rhs) { JSValueTag ltag = lhs.s.tag, rtag = rhs.s.tag; return ltag == rtag || (ltag < JSVAL_TAG_CLEAR && rtag < JSVAL_TAG_CLEAR); } static inline JSValueType JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l) @@ -573,32 +572,32 @@ JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval static inline jsval_layout BUILD_JSVAL(JSValueTag tag, uint64_t payload) { jsval_layout l; l.asBits = (((uint64_t)(uint32_t)tag) << JSVAL_TAG_SHIFT) | payload; return l; } -static inline JSBool +static inline bool JSVAL_IS_DOUBLE_IMPL(jsval_layout l) { return l.asBits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE; } static inline jsval_layout DOUBLE_TO_JSVAL_IMPL(double d) { jsval_layout l; l.asDouble = d; MOZ_ASSERT(l.asBits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE); return l; } -static inline JSBool +static inline bool JSVAL_IS_INT32_IMPL(jsval_layout l) { return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_INT32; } static inline int32_t JSVAL_TO_INT32_IMPL(jsval_layout l) { @@ -608,29 +607,29 @@ JSVAL_TO_INT32_IMPL(jsval_layout l) static inline jsval_layout INT32_TO_JSVAL_IMPL(int32_t i32) { jsval_layout l; l.asBits = ((uint64_t)(uint32_t)i32) | JSVAL_SHIFTED_TAG_INT32; return l; } -static inline JSBool +static inline bool JSVAL_IS_NUMBER_IMPL(jsval_layout l) { return l.asBits < JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET; } -static inline JSBool +static inline bool JSVAL_IS_UNDEFINED_IMPL(jsval_layout l) { return l.asBits == JSVAL_SHIFTED_TAG_UNDEFINED; } -static inline JSBool +static inline bool JSVAL_IS_STRING_IMPL(jsval_layout l) { return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_STRING; } static inline jsval_layout STRING_TO_JSVAL_IMPL(JSString *str) { @@ -643,57 +642,56 @@ STRING_TO_JSVAL_IMPL(JSString *str) } static inline JSString * JSVAL_TO_STRING_IMPL(jsval_layout l) { return (JSString *)(l.asBits & JSVAL_PAYLOAD_MASK); } -static inline JSBool +static inline bool JSVAL_IS_BOOLEAN_IMPL(jsval_layout l) { return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_BOOLEAN; } -static inline JSBool +static inline bool JSVAL_TO_BOOLEAN_IMPL(jsval_layout l) { - return (JSBool)l.asBits; + return (bool)(l.asBits & JSVAL_PAYLOAD_MASK); } static inline jsval_layout -BOOLEAN_TO_JSVAL_IMPL(JSBool b) +BOOLEAN_TO_JSVAL_IMPL(bool b) { jsval_layout l; - MOZ_ASSERT(b == JS_TRUE_DEPRECATED || b == JS_FALSE_DEPRECATED); l.asBits = ((uint64_t)(uint32_t)b) | JSVAL_SHIFTED_TAG_BOOLEAN; return l; } -static inline JSBool +static inline bool JSVAL_IS_MAGIC_IMPL(jsval_layout l) { return (l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_MAGIC; } -static inline JSBool +static inline bool JSVAL_IS_PRIMITIVE_IMPL(jsval_layout l) { return l.asBits < JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET; } -static inline JSBool +static inline bool JSVAL_IS_OBJECT_IMPL(jsval_layout l) { MOZ_ASSERT((l.asBits >> JSVAL_TAG_SHIFT) <= JSVAL_SHIFTED_TAG_OBJECT); return l.asBits >= JSVAL_SHIFTED_TAG_OBJECT; } -static inline JSBool +static inline bool JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l) { MOZ_ASSERT((l.asBits >> JSVAL_TAG_SHIFT) <= JSVAL_TAG_OBJECT); return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET; } static inline JSObject * JSVAL_TO_OBJECT_IMPL(jsval_layout l) @@ -709,46 +707,46 @@ OBJECT_TO_JSVAL_IMPL(JSObject *obj) jsval_layout l; uint64_t objBits = (uint64_t)obj; MOZ_ASSERT(obj); MOZ_ASSERT((objBits >> JSVAL_TAG_SHIFT) == 0); l.asBits = objBits | JSVAL_SHIFTED_TAG_OBJECT; return l; } -static inline JSBool +static inline bool JSVAL_IS_NULL_IMPL(jsval_layout l) { return l.asBits == JSVAL_SHIFTED_TAG_NULL; } -static inline JSBool +static inline bool JSVAL_IS_GCTHING_IMPL(jsval_layout l) { return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET; } static inline void * JSVAL_TO_GCTHING_IMPL(jsval_layout l) { uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK; MOZ_ASSERT((ptrBits & 0x7) == 0); return (void *)ptrBits; } -static inline JSBool +static inline bool JSVAL_IS_TRACEABLE_IMPL(jsval_layout l) { return JSVAL_IS_GCTHING_IMPL(l) && !JSVAL_IS_NULL_IMPL(l); } static inline uint32_t JSVAL_TRACE_KIND_IMPL(jsval_layout l) { - return (uint32_t)(JSBool)!(JSVAL_IS_OBJECT_IMPL(l)); + return (uint32_t)(bool)!(JSVAL_IS_OBJECT_IMPL(l)); } static inline jsval_layout PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) { jsval_layout l; uint64_t ptrBits = (uint64_t)ptr; MOZ_ASSERT((ptrBits & 1) == 0); @@ -759,37 +757,37 @@ PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) static inline void * JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l) { MOZ_ASSERT((l.asBits & 0x8000000000000000LL) == 0); return (void *)(l.asBits << 1); } -static inline JSBool +static inline bool JSVAL_IS_SPECIFIC_INT32_IMPL(jsval_layout l, int32_t i32) { return l.asBits == (((uint64_t)(uint32_t)i32) | JSVAL_SHIFTED_TAG_INT32); } -static inline JSBool -JSVAL_IS_SPECIFIC_BOOLEAN(jsval_layout l, JSBool b) +static inline bool +JSVAL_IS_SPECIFIC_BOOLEAN(jsval_layout l, bool b) { return l.asBits == (((uint64_t)(uint32_t)b) | JSVAL_SHIFTED_TAG_BOOLEAN); } static inline jsval_layout MAGIC_TO_JSVAL_IMPL(JSWhyMagic why) { jsval_layout l; l.asBits = ((uint64_t)(uint32_t)why) | JSVAL_SHIFTED_TAG_MAGIC; return l; } -static inline JSBool +static inline bool JSVAL_SAME_TYPE_IMPL(jsval_layout lhs, jsval_layout rhs) { uint64_t lbits = lhs.asBits, rbits = rhs.asBits; return (lbits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE && rbits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE) || (((lbits ^ rbits) & 0xFFFF800000000000LL) == 0); } static inline JSValueType @@ -1162,17 +1160,16 @@ class Value #endif jsval_layout data; private: void staticAssertions() { JS_STATIC_ASSERT(sizeof(JSValueType) == 1); JS_STATIC_ASSERT(sizeof(JSValueTag) == 4); - JS_STATIC_ASSERT(sizeof(JSBool) == 4); JS_STATIC_ASSERT(sizeof(JSWhyMagic) <= 4); JS_STATIC_ASSERT(sizeof(Value) == 8); } friend jsval_layout (::JSVAL_TO_IMPL)(Value); friend Value (::IMPL_TO_JSVAL)(jsval_layout l); }; @@ -1664,29 +1661,29 @@ static_assert(sizeof(LayoutAlignmentTest */ typedef JS::Value jsval; static_assert(sizeof(jsval_layout) == sizeof(JS::Value), "jsval_layout and JS::Value must have identical layouts"); /************************************************************************/ -static inline JSBool +static inline bool JSVAL_IS_NULL(jsval v) { return JSVAL_IS_NULL_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSBool +static inline bool JSVAL_IS_VOID(jsval v) { return JSVAL_IS_UNDEFINED_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSBool +static inline bool JSVAL_IS_INT(jsval v) { return JSVAL_IS_INT32_IMPL(JSVAL_TO_IMPL(v)); } static inline int32_t JSVAL_TO_INT(jsval v) { @@ -1695,17 +1692,17 @@ JSVAL_TO_INT(jsval v) } static inline jsval INT_TO_JSVAL(int32_t i) { return IMPL_TO_JSVAL(INT32_TO_JSVAL_IMPL(i)); } -static inline JSBool +static inline bool JSVAL_IS_DOUBLE(jsval v) { return JSVAL_IS_DOUBLE_IMPL(JSVAL_TO_IMPL(v)); } static inline double JSVAL_TO_DOUBLE(jsval v) { @@ -1735,23 +1732,23 @@ DOUBLE_TO_JSVAL(double d) static inline jsval UINT_TO_JSVAL(uint32_t i) { if (i <= JSVAL_INT_MAX) return INT_TO_JSVAL((int32_t)i); return DOUBLE_TO_JSVAL((double)i); } -static inline JSBool +static inline bool JSVAL_IS_NUMBER(jsval v) { return JSVAL_IS_NUMBER_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSBool +static inline bool JSVAL_IS_STRING(jsval v) { return JSVAL_IS_STRING_IMPL(JSVAL_TO_IMPL(v)); } static inline JSString * JSVAL_TO_STRING(jsval v) { @@ -1775,42 +1772,42 @@ JSVAL_TO_OBJECT(jsval v) static inline jsval OBJECT_TO_JSVAL(JSObject *obj) { if (obj) return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj)); return IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_NULL, 0)); } -static inline JSBool +static inline bool JSVAL_IS_BOOLEAN(jsval v) { return JSVAL_IS_BOOLEAN_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSBool +static inline bool JSVAL_TO_BOOLEAN(jsval v) { MOZ_ASSERT(JSVAL_IS_BOOLEAN(v)); return JSVAL_TO_BOOLEAN_IMPL(JSVAL_TO_IMPL(v)); } static inline jsval -BOOLEAN_TO_JSVAL(JSBool b) +BOOLEAN_TO_JSVAL(bool b) { return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b)); } -static inline JSBool +static inline bool JSVAL_IS_PRIMITIVE(jsval v) { return JSVAL_IS_PRIMITIVE_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSBool +static inline bool JSVAL_IS_GCTHING(jsval v) { return JSVAL_IS_GCTHING_IMPL(JSVAL_TO_IMPL(v)); } static inline void * JSVAL_TO_GCTHING(jsval v) {
--- a/js/src/builtin/BinaryData.cpp +++ b/js/src/builtin/BinaryData.cpp @@ -1119,17 +1119,17 @@ BinaryArray::fill(JSContext *cx, unsigne return false; } args.rval().setUndefined(); RootedValue val(cx, args[0]); return FillBinaryArrayWithValue(cx, thisObj, val); } -JSBool +bool BinaryArray::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandleShape propp) { JS_ASSERT(IsBinaryArray(obj)); RootedObject type(cx, GetType(obj)); uint32_t index; if (js_IdIsIndex(id, &index) && @@ -1150,28 +1150,28 @@ BinaryArray::obj_lookupGeneric(JSContext objp.set(NULL); propp.set(NULL); return true; } return JSObject::lookupGeneric(cx, proto, id, objp, propp); } -JSBool +bool BinaryArray::obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleObject objp, MutableHandleShape propp) { RootedId id(cx, NameToId(name)); return obj_lookupGeneric(cx, obj, id, objp, propp); } -JSBool +bool BinaryArray::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp, MutableHandleShape propp) { JS_ASSERT(IsBinaryArray(obj)); RootedObject type(cx, GetType(obj)); if (index < ArrayType::length(cx, type)) { MarkNonNativePropertyFound(propp); @@ -1183,53 +1183,53 @@ BinaryArray::obj_lookupElement(JSContext if (proto) return JSObject::lookupElement(cx, proto, index, objp, propp); objp.set(NULL); propp.set(NULL); return true; } -JSBool +bool BinaryArray::obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp, MutableHandleShape propp) { RootedId id(cx, SPECIALID_TO_JSID(sid)); return obj_lookupGeneric(cx, obj, id, objp, propp); } -JSBool +bool BinaryArray::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp) { uint32_t index; if (js_IdIsIndex(id, &index)) { return obj_getElement(cx, obj, receiver, index, vp); } RootedValue idValue(cx, IdToValue(id)); Rooted<PropertyName*> name(cx, ToAtom<CanGC>(cx, idValue)->asPropertyName()); return obj_getProperty(cx, obj, receiver, name, vp); } -JSBool +bool BinaryArray::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp) { RootedObject proto(cx, obj->getProto()); if (!proto) { vp.setUndefined(); return true; } return JSObject::getProperty(cx, proto, receiver, name, vp); } -JSBool +bool BinaryArray::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp) { RootedObject type(cx, GetType(obj)); if (index < ArrayType::length(cx, type)) { RootedObject elementType(cx, ArrayType::elementType(cx, type)); size_t offset = GetMemSize(cx, elementType) * index; @@ -1240,72 +1240,72 @@ BinaryArray::obj_getElement(JSContext *c if (!proto) { vp.setUndefined(); return true; } return JSObject::getElement(cx, proto, receiver, index, vp); } -JSBool +bool BinaryArray::obj_getElementIfPresent(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool *present) { RootedObject type(cx, GetType(obj)); if (index < ArrayType::length(cx, type)) { *present = true; return obj_getElement(cx, obj, receiver, index, vp); } *present = false; vp.setUndefined(); return true; } -JSBool +bool BinaryArray::obj_getSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp) { RootedId id(cx, SPECIALID_TO_JSID(sid)); return obj_getGeneric(cx, obj, receiver, id, vp); } -JSBool +bool BinaryArray::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, - MutableHandleValue vp, JSBool strict) + MutableHandleValue vp, bool strict) { uint32_t index; if (js_IdIsIndex(id, &index)) { return obj_setElement(cx, obj, index, vp, strict); } if (JSID_IS_ATOM(id, cx->names().length)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REDEFINE_ARRAY_LENGTH); return false; } return true; } -JSBool +bool BinaryArray::obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, - JSBool strict) + bool strict) { RootedId id(cx, NameToId(name)); return obj_setGeneric(cx, obj, id, vp, strict); } -JSBool +bool BinaryArray::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index, - MutableHandleValue vp, JSBool strict) + MutableHandleValue vp, bool strict) { RootedObject type(cx, GetType(obj)); if (index >= ArrayType::length(cx, type)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BINARYDATA_BINARYARRAY_BAD_INDEX); return false; } @@ -1323,26 +1323,26 @@ BinaryArray::obj_setElement(JSContext *c if (!result) { return false; } return true; } -JSBool +bool BinaryArray::obj_setSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, - JSBool strict) + bool strict) { RootedId id(cx, SPECIALID_TO_JSID(sid)); return obj_setGeneric(cx, obj, id, vp, strict); } -JSBool +bool BinaryArray::obj_getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp) { uint32_t index; RootedObject type(cx, GetType(obj)); if (js_IdIsIndex(id, &index) && index < ArrayType::length(cx, type)) { @@ -1353,42 +1353,42 @@ BinaryArray::obj_getGenericAttributes(JS if (JSID_IS_ATOM(id, cx->names().length)) { *attrsp = JSPROP_READONLY | JSPROP_PERMANENT; return true; } return false; } -JSBool +bool BinaryArray::obj_getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name, unsigned *attrsp) { RootedId id(cx, NameToId(name)); return obj_getGenericAttributes(cx, obj, id, attrsp); } -JSBool +bool BinaryArray::obj_getElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp) { RootedId id(cx, INT_TO_JSID(index)); return obj_getGenericAttributes(cx, obj, id, attrsp); } -JSBool +bool BinaryArray::obj_getSpecialAttributes(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp) { RootedId id(cx, SPECIALID_TO_JSID(sid)); return obj_getGenericAttributes(cx, obj, id, attrsp); } -JSBool +bool BinaryArray::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, MutableHandleValue statep, MutableHandleId idp) { JS_ASSERT(IsBinaryArray(obj)); RootedObject type(cx, GetType(obj)); uint32_t index; @@ -1861,17 +1861,17 @@ BinaryStruct::obj_trace(JSTracer *tracer HeapPtrObject owner(val.toObjectOrNull()); MarkObject(tracer, &owner, "binarystruct.blockRefOwner"); } HeapPtrObject type(obj->getFixedSlot(SLOT_DATATYPE).toObjectOrNull()); MarkObject(tracer, &type, "binarystruct.type"); } -JSBool +bool BinaryStruct::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, MutableHandleValue statep, MutableHandleId idp) { JS_ASSERT(IsBinaryStruct(obj)); RootedObject type(cx, GetType(obj)); FieldList *fieldList = GetStructTypeFieldList(type); @@ -1901,17 +1901,17 @@ BinaryStruct::obj_enumerate(JSContext *c case JSENUMERATE_DESTROY: statep.setNull(); break; } return true; } -JSBool +bool BinaryStruct::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp) { if (!IsBinaryStruct(obj)) { char *valueStr = JS_EncodeString(cx, JS_ValueToString(cx, ObjectValue(*obj))); JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BINARYDATA_NOT_BINARYSTRUCT, valueStr); @@ -1935,37 +1935,37 @@ BinaryStruct::obj_getGeneric(JSContext * return JSObject::getGeneric(cx, proto, receiver, id, vp); } RootedObject fieldType(cx, fieldInfo->type); return Reify(cx, fieldType, obj, fieldInfo->offset, vp); } -JSBool +bool BinaryStruct::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp) { RootedId id(cx, NON_INTEGER_ATOM_TO_JSID(&(*name))); return obj_getGeneric(cx, obj, receiver, id, vp); } -JSBool +bool BinaryStruct::obj_getSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp) { RootedId id(cx, SPECIALID_TO_JSID(sid)); return obj_getGeneric(cx, obj, receiver, id, vp); } -JSBool +bool BinaryStruct::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, - MutableHandleValue vp, JSBool strict) + MutableHandleValue vp, bool strict) { if (!IsBinaryStruct(obj)) { char *valueStr = JS_EncodeString(cx, JS_ValueToString(cx, ObjectValue(*obj))); JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BINARYDATA_NOT_BINARYSTRUCT, valueStr); JS_free(cx, (void *) valueStr); return false; } @@ -1987,20 +1987,20 @@ BinaryStruct::obj_setGeneric(JSContext * RootedObject fieldType(cx, fieldInfo->type); if (!ConvertAndCopyTo(cx, fieldType, vp, loc)) return false; return true; } -JSBool +bool BinaryStruct::obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, - JSBool strict) + bool strict) { RootedId id(cx, NON_INTEGER_ATOM_TO_JSID(&(*name))); return obj_setGeneric(cx, obj, id, vp, strict); } static bool Reify(JSContext *cx, HandleObject type, HandleObject owner, size_t offset, MutableHandleValue to)
--- a/js/src/builtin/BinaryData.h +++ b/js/src/builtin/BinaryData.h @@ -163,96 +163,96 @@ class BinaryArray static bool construct(JSContext *cx, unsigned int argc, jsval *vp); static void finalize(FreeOp *op, JSObject *obj); static void obj_trace(JSTracer *tracer, JSObject *obj); static bool subarray(JSContext *cx, unsigned int argc, jsval *vp); static bool fill(JSContext *cx, unsigned int argc, jsval *vp); - static JSBool obj_lookupGeneric(JSContext *cx, HandleObject obj, - HandleId id, MutableHandleObject objp, - MutableHandleShape propp); + static bool obj_lookupGeneric(JSContext *cx, HandleObject obj, + HandleId id, MutableHandleObject objp, + MutableHandleShape propp); - static JSBool obj_lookupProperty(JSContext *cx, HandleObject obj, - HandlePropertyName name, - MutableHandleObject objp, - MutableHandleShape propp); + static bool obj_lookupProperty(JSContext *cx, HandleObject obj, + HandlePropertyName name, + MutableHandleObject objp, + MutableHandleShape propp); - static JSBool obj_lookupElement(JSContext *cx, HandleObject obj, - uint32_t index, MutableHandleObject objp, - MutableHandleShape propp); + static bool obj_lookupElement(JSContext *cx, HandleObject obj, + uint32_t index, MutableHandleObject objp, + MutableHandleShape propp); - static JSBool obj_lookupSpecial(JSContext *cx, HandleObject obj, - HandleSpecialId sid, - MutableHandleObject objp, - MutableHandleShape propp); + static bool obj_lookupSpecial(JSContext *cx, HandleObject obj, + HandleSpecialId sid, + MutableHandleObject objp, + MutableHandleShape propp); - static JSBool obj_getGeneric(JSContext *cx, HandleObject obj, - HandleObject receiver, - HandleId id, - MutableHandleValue vp); + static bool obj_getGeneric(JSContext *cx, HandleObject obj, + HandleObject receiver, + HandleId id, + MutableHandleValue vp); - static JSBool obj_getProperty(JSContext *cx, HandleObject obj, - HandleObject receiver, - HandlePropertyName name, - MutableHandleValue vp); + static bool obj_getProperty(JSContext *cx, HandleObject obj, + HandleObject receiver, + HandlePropertyName name, + MutableHandleValue vp); - static JSBool obj_getElement(JSContext *cx, HandleObject obj, - HandleObject receiver, - uint32_t index, - MutableHandleValue vp); + static bool obj_getElement(JSContext *cx, HandleObject obj, + HandleObject receiver, + uint32_t index, + MutableHandleValue vp); - static JSBool obj_getElementIfPresent(JSContext *cx, HandleObject obj, - HandleObject receiver, - uint32_t index, - MutableHandleValue vp, - bool *present); + static bool obj_getElementIfPresent(JSContext *cx, HandleObject obj, + HandleObject receiver, + uint32_t index, + MutableHandleValue vp, + bool *present); - static JSBool obj_getSpecial(JSContext *cx, HandleObject obj, - HandleObject receiver, - HandleSpecialId sid, - MutableHandleValue vp); + static bool obj_getSpecial(JSContext *cx, HandleObject obj, + HandleObject receiver, + HandleSpecialId sid, + MutableHandleValue vp); - static JSBool obj_setGeneric(JSContext *cx, HandleObject obj, - HandleId id, MutableHandleValue vp, - JSBool strict); + static bool obj_setGeneric(JSContext *cx, HandleObject obj, + HandleId id, MutableHandleValue vp, + bool strict); - static JSBool obj_setProperty(JSContext *cx, HandleObject obj, - HandlePropertyName name, - MutableHandleValue vp, - JSBool strict); + static bool obj_setProperty(JSContext *cx, HandleObject obj, + HandlePropertyName name, + MutableHandleValue vp, + bool strict); - static JSBool obj_setElement(JSContext *cx, HandleObject obj, - uint32_t index, MutableHandleValue vp, - JSBool strict); + static bool obj_setElement(JSContext *cx, HandleObject obj, + uint32_t index, MutableHandleValue vp, + bool strict); - static JSBool obj_setSpecial(JSContext *cx, HandleObject obj, - HandleSpecialId sid, - MutableHandleValue vp, - JSBool strict); + static bool obj_setSpecial(JSContext *cx, HandleObject obj, + HandleSpecialId sid, + MutableHandleValue vp, + bool strict); - static JSBool obj_getGenericAttributes(JSContext *cx, HandleObject obj, - HandleId id, unsigned *attrsp); + static bool obj_getGenericAttributes(JSContext *cx, HandleObject obj, + HandleId id, unsigned *attrsp); - static JSBool obj_getPropertyAttributes(JSContext *cx, HandleObject obj, - HandlePropertyName name, - unsigned *attrsp); + static bool obj_getPropertyAttributes(JSContext *cx, HandleObject obj, + HandlePropertyName name, + unsigned *attrsp); - static JSBool obj_getElementAttributes(JSContext *cx, HandleObject obj, - uint32_t index, unsigned *attrsp); + static bool obj_getElementAttributes(JSContext *cx, HandleObject obj, + uint32_t index, unsigned *attrsp); - static JSBool obj_getSpecialAttributes(JSContext *cx, HandleObject obj, - HandleSpecialId sid, - unsigned *attrsp); + static bool obj_getSpecialAttributes(JSContext *cx, HandleObject obj, + HandleSpecialId sid, + unsigned *attrsp); - static JSBool obj_enumerate(JSContext *cx, HandleObject obj, - JSIterateOp enum_op, - MutableHandleValue statep, - MutableHandleId idp); + static bool obj_enumerate(JSContext *cx, HandleObject obj, + JSIterateOp enum_op, + MutableHandleValue statep, + MutableHandleId idp); static bool lengthGetter(JSContext *cx, unsigned int argc, jsval *vp); }; class StructType : public JSObject { private: static JSObject *create(JSContext *cx, HandleObject structTypeGlobal, @@ -291,39 +291,38 @@ class BinaryStruct : public JSObject static JSObject *create(JSContext *cx, HandleObject type, HandleObject owner, size_t offset); static bool construct(JSContext *cx, unsigned int argc, jsval *vp); static void finalize(js::FreeOp *op, JSObject *obj); static void obj_trace(JSTracer *tracer, JSObject *obj); - static JSBool obj_enumerate(JSContext *cx, HandleObject obj, - JSIterateOp enum_op, - MutableHandleValue statep, - MutableHandleId idp); + static bool obj_enumerate(JSContext *cx, HandleObject obj, + JSIterateOp enum_op, + MutableHandleValue statep, + MutableHandleId idp); - static JSBool obj_getGeneric(JSContext *cx, HandleObject obj, - HandleObject receiver, HandleId id, - MutableHandleValue vp); + static bool obj_getGeneric(JSContext *cx, HandleObject obj, + HandleObject receiver, HandleId id, + MutableHandleValue vp); - static JSBool obj_getProperty(JSContext *cx, HandleObject obj, - HandleObject receiver, - HandlePropertyName name, - MutableHandleValue vp); - - static JSBool obj_getSpecial(JSContext *cx, HandleObject obj, - HandleObject receiver, HandleSpecialId sid, - MutableHandleValue vp); + static bool obj_getProperty(JSContext *cx, HandleObject obj, + HandleObject receiver, + HandlePropertyName name, + MutableHandleValue vp); - static JSBool obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, - MutableHandleValue vp, JSBool strict); + static bool obj_getSpecial(JSContext *cx, HandleObject obj, + HandleObject receiver, HandleSpecialId sid, + MutableHandleValue vp); - static JSBool obj_setProperty(JSContext *cx, HandleObject obj, - HandlePropertyName name, - MutableHandleValue vp, - JSBool strict); + static bool obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, + MutableHandleValue vp, bool strict); + static bool obj_setProperty(JSContext *cx, HandleObject obj, + HandlePropertyName name, + MutableHandleValue vp, + bool strict); }; } // namespace js #endif /* builtin_BinaryData_h */
--- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -383,17 +383,17 @@ DefineAccessor(JSContext *cx, unsigned a /* enumerable: true */ PropertyName *acc = (Type == Getter) ? names.get : names.set; RootedValue accessorVal(cx, args[1]); if (!JSObject::defineProperty(cx, descObj, acc, accessorVal)) return false; RootedObject thisObj(cx, &args.thisv().toObject()); - JSBool dummy; + bool dummy; RootedValue descObjValue(cx, ObjectValue(*descObj)); if (!DefineOwnProperty(cx, thisObj, id, descObjValue, &dummy)) return false; args.rval().setUndefined(); return true; } @@ -519,17 +519,17 @@ obj_getPrototypeOf(JSContext *cx, unsign if (!Invoke(cx, args2)) return false; args.rval().set(args2.rval()); return true; } #if JS_HAS_OBJ_WATCHPOINT -static JSBool +static bool obj_watch_handler(JSContext *cx, JSObject *obj_, jsid id_, jsval old, jsval *nvp, void *closure) { RootedObject obj(cx, obj_); RootedId id(cx, id_); /* Avoid recursion on (obj, id) already being watched on cx. */ AutoResolving resolving(cx, obj, id, AutoResolving::WATCH); @@ -834,17 +834,17 @@ obj_defineProperty(JSContext *cx, unsign RootedObject obj(cx); if (!GetFirstArgumentAsObject(cx, args, "Object.defineProperty", &obj)) return false; RootedId id(cx); if (!ValueToId<CanGC>(cx, args.get(1), &id)) return false; - JSBool junk; + bool junk; if (!DefineOwnProperty(cx, obj, id, args.get(2), &junk)) return false; args.rval().setObject(*obj); return true; } /* ES5 15.2.3.7: Object.defineProperties(O, Properties) */
--- a/js/src/builtin/Profilers.cpp +++ b/js/src/builtin/Profilers.cpp @@ -69,34 +69,34 @@ StartOSXProfiling(const char *profileNam else UnsafeError("Failed to start %s", profiler); return false; } return true; } #endif -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_StartProfiling(const char *profileName) { - JSBool ok = true; + bool ok = true; #ifdef __APPLE__ ok = StartOSXProfiling(profileName); #endif #ifdef __linux__ if (!js_StartPerf()) ok = false; #endif return ok; } -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_StopProfiling(const char *profileName) { - JSBool ok = true; + bool ok = true; #ifdef __APPLE__ #ifdef MOZ_SHARK Shark::Stop(); #endif #ifdef MOZ_INSTRUMENTS Instruments::Stop(profileName); #endif #endif @@ -106,20 +106,20 @@ JS_StopProfiling(const char *profileName #endif return ok; } /* * Start or stop whatever platform- and configuration-specific profiling * backends are available. */ -static JSBool +static bool ControlProfilers(bool toState) { - JSBool ok = true; + bool ok = true; if (! Probes::ProfilingActive && toState) { #ifdef __APPLE__ #if defined(MOZ_SHARK) || defined(MOZ_INSTRUMENTS) const char* profiler; #ifdef MOZ_SHARK ok = Shark::Start(); profiler = "Shark"; @@ -164,32 +164,32 @@ ControlProfilers(bool toState) /* * Pause/resume whatever profiling mechanism is currently compiled * in, if applicable. This will not affect things like dtrace. * * Do not mix calls to these APIs with calls to the individual * profilers' pause/resume functions, because only overall state is * tracked, not the state of each profiler. */ -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_PauseProfilers(const char *profileName) { return ControlProfilers(false); } -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_ResumeProfilers(const char *profileName) { return ControlProfilers(true); } -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_DumpProfile(const char *outfile, const char *profileName) { - JSBool ok = true; + bool ok = true; #ifdef MOZ_CALLGRIND js_DumpCallgrind(outfile); #endif return ok; } #ifdef MOZ_PROFILING @@ -373,47 +373,47 @@ static const JSFunctionSpec profiling_fu JS_FN("stopCallgrind", StopCallgrind, 0,0), JS_FN("dumpCallgrind", DumpCallgrind, 1,0), #endif JS_FS_END }; #endif -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_DefineProfilingFunctions(JSContext *cx, JSObject *objArg) { RootedObject obj(cx, objArg); assertSameCompartment(cx, obj); #ifdef MOZ_PROFILING return JS_DefineFunctions(cx, obj, profiling_functions); #else return true; #endif } #ifdef MOZ_CALLGRIND -JS_FRIEND_API(JSBool) +JS_FRIEND_API(bool) js_StartCallgrind() { JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_START_INSTRUMENTATION); JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_ZERO_STATS); return true; } -JS_FRIEND_API(JSBool) +JS_FRIEND_API(bool) js_StopCallgrind() { JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_STOP_INSTRUMENTATION); return true; } -JS_FRIEND_API(JSBool) +JS_FRIEND_API(bool) js_DumpCallgrind(const char *outfile) { if (outfile) { JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS_AT(outfile)); } else { JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS); } @@ -447,17 +447,17 @@ js_DumpCallgrind(const char *outfile) #include <signal.h> #include <sys/wait.h> #include <unistd.h> static bool perfInitialized = false; static pid_t perfPid = 0; -JSBool js_StartPerf() +bool js_StartPerf() { const char *outfile = "mozperf.data"; if (perfPid != 0) { UnsafeError("js_StartPerf: called while perf was already running!\n"); return false; } @@ -523,17 +523,17 @@ JSBool js_StartPerf() return true; } else { UnsafeError("js_StartPerf: fork() failed\n"); return false; } } -JSBool js_StopPerf() +bool js_StopPerf() { if (perfPid == 0) { UnsafeError("js_StopPerf: perf is not running.\n"); return true; } if (kill(perfPid, SIGINT)) { UnsafeError("js_StopPerf: kill failed\n");
--- a/js/src/builtin/Profilers.h +++ b/js/src/builtin/Profilers.h @@ -19,71 +19,71 @@ * * The profileName is used by some profilers to describe the current profiling * run. It may be used for part of the filename of the output, but the * specifics depend on the profiler. Many profilers will ignore it. Passing in * NULL is legal; some profilers may use it to output to stdout or similar. * * Returns true if no profilers fail to start. */ -extern JS_PUBLIC_API(JSBool) +extern JS_PUBLIC_API(bool) JS_StartProfiling(const char *profileName); /** * Stop any profilers that were previously started with JS_StartProfiling. * Returns true if no profilers fail to stop. */ -extern JS_PUBLIC_API(JSBool) +extern JS_PUBLIC_API(bool) JS_StopProfiling(const char *profileName); /** * Write the current profile data to the given file, if applicable to whatever * profiler is being used. */ -extern JS_PUBLIC_API(JSBool) +extern JS_PUBLIC_API(bool) JS_DumpProfile(const char *outfile, const char *profileName); /** * Pause currently active profilers (only supported by some profilers). Returns * whether any profilers failed to pause. (Profilers that do not support * pause/resume do not count.) */ -extern JS_PUBLIC_API(JSBool) +extern JS_PUBLIC_API(bool) JS_PauseProfilers(const char *profileName); /** * Resume suspended profilers */ -extern JS_PUBLIC_API(JSBool) +extern JS_PUBLIC_API(bool) JS_ResumeProfilers(const char *profileName); /** * The profiling API calls are not able to report errors, so they use a * thread-unsafe global memory buffer to hold the last error encountered. This * should only be called after something returns false. */ JS_PUBLIC_API(const char *) JS_UnsafeGetLastProfilingError(); #ifdef MOZ_CALLGRIND -extern JS_FRIEND_API(JSBool) +extern JS_FRIEND_API(bool) js_StopCallgrind(); -extern JS_FRIEND_API(JSBool) +extern JS_FRIEND_API(bool) js_StartCallgrind(); -extern JS_FRIEND_API(JSBool) +extern JS_FRIEND_API(bool) js_DumpCallgrind(const char *outfile); #endif /* MOZ_CALLGRIND */ #ifdef __linux__ -extern JS_FRIEND_API(JSBool) +extern JS_FRIEND_API(bool) js_StartPerf(); -extern JS_FRIEND_API(JSBool) +extern JS_FRIEND_API(bool) js_StopPerf(); #endif /* __linux__ */ #endif /* builtin_Profilers_h */
--- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -389,17 +389,17 @@ static const JSFunctionSpec regexp_metho * RegExp.multiline $* * RegExp.lastMatch $& * RegExp.lastParen $+ * RegExp.leftContext $` * RegExp.rightContext $' */ #define DEFINE_STATIC_GETTER(name, code) \ - static JSBool \ + static bool \ name(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) \ { \ RegExpStatics *res = cx->regExpStatics(); \ code; \ } DEFINE_STATIC_GETTER(static_input_getter, return res->createPendingInput(cx, vp)) DEFINE_STATIC_GETTER(static_multiline_getter, vp.setBoolean(res->multiline()); @@ -415,18 +415,18 @@ DEFINE_STATIC_GETTER(static_paren3_gette DEFINE_STATIC_GETTER(static_paren4_getter, return res->createParen(cx, 4, vp)) DEFINE_STATIC_GETTER(static_paren5_getter, return res->createParen(cx, 5, vp)) DEFINE_STATIC_GETTER(static_paren6_getter, return res->createParen(cx, 6, vp)) DEFINE_STATIC_GETTER(static_paren7_getter, return res->createParen(cx, 7, vp)) DEFINE_STATIC_GETTER(static_paren8_getter, return res->createParen(cx, 8, vp)) DEFINE_STATIC_GETTER(static_paren9_getter, return res->createParen(cx, 9, vp)) #define DEFINE_STATIC_SETTER(name, code) \ - static JSBool \ - name(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp)\ + static bool \ + name(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHandleValue vp)\ { \ RegExpStatics *res = cx->regExpStatics(); \ code; \ return true; \ } DEFINE_STATIC_SETTER(static_input_setter, if (!JSVAL_IS_STRING(vp) && !JS_ConvertValue(cx, vp, JSTYPE_STRING, vp.address()))
--- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -194,17 +194,17 @@ static bool GC(JSContext *cx, unsigned argc, jsval *vp) { /* * If the first argument is 'compartment', we collect any compartments * previously scheduled for GC via schedulegc. If the first argument is an * object, we collect the object's compartment (and any other compartments * scheduled for GC). Otherwise, we collect all compartments. */ - JSBool compartment = false; + bool compartment = false; if (argc == 1) { Value arg = vp[2]; if (arg.isString()) { if (!JS_StringEqualsAscii(cx, arg.toString(), "compartment", &compartment)) return false; } else if (arg.isObject()) { PrepareZoneForGC(UncheckedUnwrap(&arg.toObject())->zone()); compartment = true;
--- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -154,33 +154,33 @@ bufferTooSmall: /******************************************************************************* ** JSAPI function prototypes *******************************************************************************/ static bool ConstructAbstract(JSContext* cx, unsigned argc, jsval* vp); namespace CType { static bool ConstructData(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ConstructBasic(JSContext* cx, HandleObject obj, const CallArgs& args); + static bool ConstructBasic(JSContext* cx, HandleObject obj, const CallArgs& args); static void Trace(JSTracer* trc, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj); static void FinalizeProtoClass(JSFreeOp *fop, JSObject* obj); - static JSBool PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool NameGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool NameGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool SizeGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool SizeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); + static bool PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); static bool CreateArray(JSContext* cx, unsigned argc, jsval* vp); static bool ToString(JSContext* cx, unsigned argc, jsval* vp); static bool ToSource(JSContext* cx, unsigned argc, jsval* vp); - static JSBool HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool* bp); + static bool HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, bool* bp); /* * Get the global "ctypes" object. * * |obj| must be a CType object. * * This function never returns NULL. @@ -191,103 +191,103 @@ namespace CType { namespace ABI { bool IsABI(JSObject* obj); static bool ToSource(JSContext* cx, unsigned argc, jsval* vp); } namespace PointerType { static bool Create(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); - - static JSBool TargetTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); + + static bool TargetTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool ContentsGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ContentsGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool ContentsSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, + static bool ContentsSetter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp); static bool IsNull(JSContext* cx, unsigned argc, jsval* vp); static bool Increment(JSContext* cx, unsigned argc, jsval* vp); static bool Decrement(JSContext* cx, unsigned argc, jsval* vp); // The following is not an instance function, since we don't want to expose arbitrary // pointer arithmetic at this moment. - static JSBool OffsetBy(JSContext* cx, const CallArgs& args, int offset); + static bool OffsetBy(JSContext* cx, const CallArgs& args, int offset); } namespace ArrayType { static bool Create(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); - - static JSBool ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); + + static bool ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool LengthGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool LengthGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp); + static bool Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); + static bool Setter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp); static bool AddressOfElement(JSContext* cx, unsigned argc, jsval* vp); } namespace StructType { static bool Create(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); - - static JSBool FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args); + + static bool FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, + static bool FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp); static bool AddressOfField(JSContext* cx, unsigned argc, jsval* vp); static bool Define(JSContext* cx, unsigned argc, jsval* vp); } namespace FunctionType { static bool Create(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ConstructData(JSContext* cx, HandleObject typeObj, + static bool ConstructData(JSContext* cx, HandleObject typeObj, HandleObject dataObj, HandleObject fnObj, HandleObject thisObj, jsval errVal); static bool Call(JSContext* cx, unsigned argc, jsval* vp); - static JSBool ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); - static JSBool IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval, + static bool ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); + static bool IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp); } namespace CClosure { static void Trace(JSTracer* trc, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj); // libffi callback static void ClosureStub(ffi_cif* cif, void* result, void** args, void* userData); } namespace CData { static void Finalize(JSFreeOp *fop, JSObject* obj); - static JSBool ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, - MutableHandleValue vp); - static JSBool ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, - JSBool strict, MutableHandleValue vp); + static bool ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, + MutableHandleValue vp); + static bool ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, + bool strict, MutableHandleValue vp); static bool Address(JSContext* cx, unsigned argc, jsval* vp); static bool ReadString(JSContext* cx, unsigned argc, jsval* vp); static bool ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp); static bool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSString *GetSourceString(JSContext *cx, HandleObject typeObj, void *data); - static JSBool ErrnoGetter(JSContext* cx, HandleObject obj, HandleId idval, - MutableHandleValue vp); + static bool ErrnoGetter(JSContext* cx, HandleObject obj, HandleId idval, + MutableHandleValue vp); #if defined(XP_WIN) - static JSBool LastErrorGetter(JSContext* cx, HandleObject obj, HandleId idval, - MutableHandleValue vp); + static bool LastErrorGetter(JSContext* cx, HandleObject obj, HandleId idval, + MutableHandleValue vp); #endif // defined(XP_WIN) } namespace CDataFinalizer { /* * Attach a C function as a finalizer to a JS object. * * This function is available from JS as |ctypes.withFinalizer|. @@ -797,17 +797,17 @@ static JSErrorFormatString ErrorFormatSt static const JSErrorFormatString* GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber) { if (0 < errorNumber && errorNumber < CTYPESERR_LIMIT) return &ErrorFormatString[errorNumber]; return NULL; } -static JSBool +static bool TypeError(JSContext* cx, const char* expected, jsval actual) { JSString* str = JS_ValueToSource(cx, actual); JSAutoByteString bytes; const char* src; if (str) { src = bytes.encodeLatin1(cx, str); @@ -913,34 +913,34 @@ InitCDataClass(JSContext* cx, HandleObje if (//!JS_FreezeObject(cx, prototype) || // XXX fixme - see bug 541212! !JS_FreezeObject(cx, ctor)) return NULL; return prototype; } -static JSBool +static bool DefineABIConstant(JSContext* cx, HandleObject parent, const char* name, ABICode code, HandleObject prototype) { RootedObject obj(cx, JS_DefineObject(cx, parent, name, &sCABIClass, prototype, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)); if (!obj) return false; JS_SetReservedSlot(obj, SLOT_ABICODE, INT_TO_JSVAL(code)); return JS_FreezeObject(cx, obj); } // Set up a single type constructor for // ctypes.{Pointer,Array,Struct,Function}Type. -static JSBool +static bool InitTypeConstructor(JSContext* cx, HandleObject parent, HandleObject CTypeProto, HandleObject CDataProto, const JSFunctionSpec spec, const JSFunctionSpec* fns, const JSPropertySpec* props, const JSFunctionSpec* instanceFns, @@ -1052,17 +1052,17 @@ AttachProtos(JSObject* proto, const Auto { // For a given 'proto' of [[Class]] "CTypeProto", attach each of the 'protos' // to the appropriate CTypeProtoSlot. (SLOT_CTYPES is the last slot // of [[Class]] "CTypeProto" that we fill in this automated manner.) for (uint32_t i = 0; i <= SLOT_CTYPES; ++i) JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i])); } -static JSBool +static bool InitTypeClasses(JSContext* cx, HandleObject parent) { // Initialize the ctypes.CType class. This acts as an abstract base class for // the various types, and provides the common API functions. It has: // * [[Class]] "Function" // * __proto__ === Function.prototype // * A constructor that throws a TypeError. (You can't construct an // abstract type!) @@ -1271,17 +1271,17 @@ static bool GetObjectProperty(JSContext } } /* namespace ctypes */ } /* namespace js */ using namespace js; using namespace js::ctypes; -JS_PUBLIC_API(JSBool) +JS_PUBLIC_API(bool) JS_InitCTypesClass(JSContext* cx, JSObject *globalArg) { RootedObject global(cx, globalArg); // attach ctypes property to global object RootedObject ctypes(cx, JS_NewObject(cx, &sCTypesGlobalClass, NULL, NULL)); if (!ctypes) return false; @@ -1341,17 +1341,17 @@ JS_FRIEND_API(size_t) SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj) { if (!CData::IsCData(obj)) return 0; size_t n = 0; jsval slot = JS_GetReservedSlot(obj, ctypes::SLOT_OWNS); if (!JSVAL_IS_VOID(slot)) { - JSBool owns = JSVAL_TO_BOOLEAN(slot); + bool owns = JSVAL_TO_BOOLEAN(slot); slot = JS_GetReservedSlot(obj, ctypes::SLOT_DATA); if (!JSVAL_IS_VOID(slot)) { char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot)); n += mallocSizeOf(buffer); if (owns) n += mallocSizeOf(*buffer); } } @@ -1526,17 +1526,17 @@ struct IsNegativeImpl<Type, true> { // Determine whether Type 'i' is negative. template<class Type> static JS_ALWAYS_INLINE bool IsNegative(Type i) { return IsNegativeImpl<Type, numeric_limits<Type>::is_signed>::Test(i); } -// Implicitly convert val to bool, allowing JSBool, int, and double +// Implicitly convert val to bool, allowing bool, int, and double // arguments numerically equal to 0 or 1. static bool jsvalToBool(JSContext* cx, jsval val, bool* result) { if (JSVAL_IS_BOOLEAN(val)) { *result = JSVAL_TO_BOOLEAN(val); return true; } @@ -1550,17 +1550,17 @@ jsvalToBool(JSContext* cx, jsval val, bo *result = d != 0; // Allow -0. return d == 1 || d == 0; } // Don't silently convert null to bool. It's probably a mistake. return false; } -// Implicitly convert val to IntegerType, allowing JSBool, int, double, +// Implicitly convert val to IntegerType, allowing bool, int, double, // Int64, UInt64, and CData integer types 't' where all values of 't' are // representable by IntegerType. template<class IntegerType> static bool jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact); @@ -1881,17 +1881,17 @@ jsidToSize(JSContext* cx, jsid val, bool return false; // Also check that the result fits in a double. return Convert<size_t>(double(*result)) == *result; } // Implicitly convert a size value to a jsval, ensuring that the size_t value // fits in a double. -static JSBool +static bool SizeTojsval(JSContext* cx, size_t size, jsval* result) { if (Convert<size_t>(double(size)) != size) { JS_ReportError(cx, "size overflow"); return false; } *result = JS_NumberValue(double(size)); @@ -2027,17 +2027,17 @@ strnlen(const CharType* begin, size_t ma // * If 'wantPrimitive' is true, the caller indicates that 'result' must be // a JS primitive, and ConvertToJS will fail if 'result' would be a CData // object. Otherwise: // * If a CData object 'parentObj' is supplied, the new CData object is // dependent on the given parent and its buffer refers to a slice of the // parent's buffer. // * If 'parentObj' is null, the new CData object may or may not own its // resulting buffer depending on the 'ownResult' argument. -static JSBool +static bool ConvertToJS(JSContext* cx, HandleObject typeObj, HandleObject parentObj, void* data, bool wantPrimitive, bool ownResult, jsval* result) { @@ -2182,17 +2182,17 @@ bool CanConvertTypedArrayItemTo(JSObject // coercion between types. There are two cases in which this function is used: // 1) The target buffer is internal to a CData object; we simply write data // into it. // 2) We are converting an argument for an ffi call, in which case 'isArgument' // will be true. This allows us to handle a special case: if necessary, // we can autoconvert a JS string primitive to a pointer-to-character type. // In this case, ownership of the allocated string is handed off to the // caller; 'freePointer' will be set to indicate this. -static JSBool +static bool ImplicitConvert(JSContext* cx, HandleValue val, JSObject* targetType_, void* buffer, bool isArgument, bool* freePointer) { RootedObject targetType(cx, targetType_); @@ -2573,17 +2573,17 @@ ImplicitConvert(JSContext* cx, } return true; } // Convert jsval 'val' to a C binary representation of CType 'targetType', // storing the result in 'buffer'. This function is more forceful than // ImplicitConvert. -static JSBool +static bool ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* buffer) { // If ImplicitConvert succeeds, use that result. if (ImplicitConvert(cx, val, targetType, buffer, false, NULL)) return true; // If ImplicitConvert failed, and there is no pending exception, then assume // hard failure (out of memory, or some other similarly serious condition). @@ -2596,17 +2596,17 @@ ExplicitConvert(JSContext* cx, HandleVal // can throw a different one as required. JS_ClearPendingException(cx); TypeCode type = CType::GetTypeCode(targetType); switch (type) { case TYPE_bool: { // Convert according to the ECMAScript ToBoolean() function. - JSBool result; + bool result; ASSERT_OK(JS_ValueToBoolean(cx, val, &result)); *static_cast<bool*>(buffer) = result != false; break; } #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Convert numeric values with a C-style cast, and */ \ /* allow conversion from a base-10 or base-16 string. */ \ @@ -2905,17 +2905,17 @@ BuildTypeSource(JSContext* cx, // the same CType and containing the same binary value. This assumes that any // StructType 't' is bound to an in-scope variable of name 't.name'. (This means // the type comparison function CType::TypesEqual will return true when // comparing the types, since struct equality is determined by strict JSObject // pointer equality.) Further, if 'isImplicit' is true, ensure that the // resulting string can ImplicitConvert successfully if passed to another data // constructor. (This is important when called recursively, since fields of // structs and arrays are converted with ImplicitConvert.) -static JSBool +static bool BuildDataSource(JSContext* cx, HandleObject typeObj, void* data, bool isImplicit, AutoString& result) { TypeCode type = CType::GetTypeCode(typeObj); switch (type) { @@ -3111,17 +3111,17 @@ CType::ConstructData(JSContext* cx, return ArrayType::ConstructData(cx, obj, args); case TYPE_struct: return StructType::ConstructData(cx, obj, args); default: return ConstructBasic(cx, obj, args); } } -JSBool +bool CType::ConstructBasic(JSContext* cx, HandleObject obj, const CallArgs& args) { if (args.length() > 1) { JS_ReportError(cx, "CType constructor takes zero or one argument"); return false; } @@ -3586,61 +3586,61 @@ CType::GetProtoFromType(JSContext* cx, J JS_ASSERT(CType::IsCTypeProto(proto)); // Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype. jsval result = JS_GetReservedSlot(proto, slot); JS_ASSERT(!JSVAL_IS_PRIMITIVE(result)); return JSVAL_TO_OBJECT(result); } -JSBool +bool CType::PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType or CTypeProto"); return false; } unsigned slot = CType::IsCTypeProto(obj) ? (unsigned) SLOT_OURDATAPROTO : (unsigned) SLOT_PROTO; vp.set(JS_GetReservedSlot(obj, slot)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) || JSVAL_IS_VOID(vp)); return true; } -JSBool +bool CType::NameGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return false; } JSString* name = CType::GetName(cx, obj); if (!name) return false; vp.setString(name); return true; } -JSBool +bool CType::SizeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return false; } vp.set(JS_GetReservedSlot(obj, SLOT_SIZE)); JS_ASSERT(JSVAL_IS_NUMBER(vp) || JSVAL_IS_VOID(vp)); return true; } -JSBool +bool CType::PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return false; } JSObject* pointerType = PointerType::CreateInternal(cx, obj); @@ -3740,18 +3740,18 @@ CType::ToSource(JSContext* cx, unsigned } if (!result) return false; args.rval().setString(result); return true; } -JSBool -CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool* bp) +bool +CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, bool* bp) { JS_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_PROTO); JS::Rooted<JSObject*> prototype(cx, &slot.toObject()); JS_ASSERT(prototype); JS_ASSERT(CData::IsCDataProto(prototype)); @@ -3902,17 +3902,17 @@ PointerType::CreateInternal(JSContext* c JS_SetReservedSlot(typeObj, SLOT_TARGET_T, OBJECT_TO_JSVAL(baseType)); // Finally, cache our newly-created PointerType on our pointed-to CType. JS_SetReservedSlot(baseType, SLOT_PTR, OBJECT_TO_JSVAL(typeObj)); return typeObj; } -JSBool +bool PointerType::ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return false; } @@ -3994,17 +3994,17 @@ PointerType::GetBaseType(JSObject* obj) { JS_ASSERT(CType::GetTypeCode(obj) == TYPE_pointer); jsval type = JS_GetReservedSlot(obj, SLOT_TARGET_T); JS_ASSERT(!type.isNull()); return &type.toObject(); } -JSBool +bool PointerType::TargetTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return false; @@ -4034,17 +4034,17 @@ PointerType::IsNull(JSContext* cx, unsig return false; } void* data = *static_cast<void**>(CData::GetData(obj)); args.rval().setBoolean(data == NULL); return true; } -JSBool +bool PointerType::OffsetBy(JSContext* cx, const CallArgs& args, int offset) { JSObject* obj = JS_THIS_OBJECT(cx, args.base()); if (!obj) return false; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; @@ -4084,17 +4084,17 @@ PointerType::Increment(JSContext* cx, un bool PointerType::Decrement(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); return OffsetBy(cx, args, -1); } -JSBool +bool PointerType::ContentsGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; @@ -4122,21 +4122,21 @@ PointerType::ContentsGetter(JSContext* c RootedValue result(cx); if (!ConvertToJS(cx, baseType, NullPtr(), data, false, false, result.address())) return false; vp.set(result); return true; } -JSBool +bool PointerType::ContentsSetter(JSContext* cx, HandleObject obj, HandleId idval, - JSBool strict, + bool strict, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } // Get pointer type and base type. @@ -4247,17 +4247,17 @@ ArrayType::CreateInternal(JSContext* cx, JS_SetReservedSlot(typeObj, SLOT_ELEMENT_T, OBJECT_TO_JSVAL(baseType)); // Set the length. JS_SetReservedSlot(typeObj, SLOT_LENGTH, lengthVal); return typeObj; } -JSBool +bool ArrayType::ConstructData(JSContext* cx, HandleObject obj_, const CallArgs& args) { RootedObject obj(cx, obj_); // Make a mutable version if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); @@ -4443,30 +4443,30 @@ ArrayType::BuildFFIType(JSContext* cx, J for (size_t i = 0; i < length; ++i) ffiType->elements[i] = ffiBaseType; ffiType->elements[length] = NULL; return ffiType.forget(); } -JSBool +bool ArrayType::ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return false; } vp.set(JS_GetReservedSlot(obj, SLOT_ELEMENT_T)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp)); return true; } -JSBool +bool ArrayType::LengthGetter(JSContext* cx, HandleObject obj_, HandleId idval, MutableHandleValue vp) { JSObject *obj = obj_; // This getter exists for both CTypes and CDatas of the ArrayType persuasion. // If we're dealing with a CData, get the CType from it. if (CData::IsCData(obj)) obj = CData::GetCType(obj); @@ -4476,17 +4476,17 @@ ArrayType::LengthGetter(JSContext* cx, H return false; } vp.set(JS_GetReservedSlot(obj, SLOT_LENGTH)); JS_ASSERT(vp.isNumber() || vp.isUndefined()); return true; } -JSBool +bool ArrayType::Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } @@ -4512,18 +4512,18 @@ ArrayType::Getter(JSContext* cx, HandleO } RootedObject baseType(cx, GetBaseType(typeObj)); size_t elementSize = CType::GetSize(baseType); char* data = static_cast<char*>(CData::GetData(obj)) + elementSize * index; return ConvertToJS(cx, baseType, obj, data, false, false, vp.address()); } -JSBool -ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp) +bool +ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp) { // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } // Bail early if we're not an ArrayType. (This setter is present for all @@ -4664,17 +4664,17 @@ ExtractStructField(JSContext* cx, jsval return NULL; } return JSID_TO_FLAT_STRING(nameid); } // For a struct field with 'name' and 'type', add an element of the form // { name : type }. -static JSBool +static bool AddFieldToArray(JSContext* cx, jsval* element, JSFlatString* name_, JSObject* typeObj_) { RootedObject typeObj(cx, typeObj_); Rooted<JSFlatString*> name(cx, name_); RootedObject fieldObj(cx, JS_NewObject(cx, NULL, NULL, NULL)); @@ -4741,17 +4741,17 @@ PostBarrierCallback(JSTracer *trc, void { JSString *prior = static_cast<JSString*>(k); FieldInfoHash *table = static_cast<FieldInfoHash*>(d); JSString *key = prior; JS_CallStringTracer(trc, &key, "CType fieldName"); table->rekey(JS_ASSERT_STRING_IS_FLAT(prior), JS_ASSERT_STRING_IS_FLAT(key)); } -JSBool +bool StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsObj_) { RootedObject typeObj(cx, typeObj_); RootedObject fieldsObj(cx, fieldsObj_); uint32_t len; ASSERT_OK(JS_GetArrayLength(cx, fieldsObj, &len)); @@ -4983,17 +4983,17 @@ StructType::Define(JSContext* cx, unsign if (!JS_IsArrayObject(cx, arr)) { JS_ReportError(cx, "argument must be an array"); return false; } return DefineInternal(cx, obj, arr); } -JSBool +bool StructType::ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return false; } @@ -5123,17 +5123,17 @@ StructType::BuildFieldsArray(JSContext* // Seal the fields array. if (!JS_FreezeObject(cx, fieldsProp)) return NULL; return fieldsProp; } -JSBool +bool StructType::FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return false; } vp.set(JS_GetReservedSlot(obj, SLOT_FIELDS)); @@ -5153,17 +5153,17 @@ StructType::FieldsArrayGetter(JSContext* vp.setObject(*fields); } JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(vp))); return true; } -JSBool +bool StructType::FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } JSObject* typeObj = CData::GetCType(obj); @@ -5176,18 +5176,18 @@ StructType::FieldGetter(JSContext* cx, H if (!field) return false; char* data = static_cast<char*>(CData::GetData(obj)) + field->mOffset; RootedObject fieldType(cx, field->mType); return ConvertToJS(cx, fieldType, obj, data, false, false, vp.address()); } -JSBool -StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp) +bool +StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { @@ -5372,17 +5372,17 @@ PrepareReturnType(JSContext* cx, jsval t } // libffi cannot pass types of zero size by value. JS_ASSERT(typeCode == TYPE_void_t || CType::GetSize(result) != 0); return result; } -static JS_ALWAYS_INLINE JSBool +static JS_ALWAYS_INLINE bool IsEllipsis(JSContext* cx, jsval v, bool* isEllipsis) { *isEllipsis = false; if (!JSVAL_IS_STRING(v)) return true; JSString* str = JSVAL_TO_STRING(v); if (str->length() != 3) return true; @@ -5391,17 +5391,17 @@ IsEllipsis(JSContext* cx, jsval v, bool* return false; jschar dot = '.'; *isEllipsis = (chars[0] == dot && chars[1] == dot && chars[2] == dot); return true; } -static JSBool +static bool PrepareCIF(JSContext* cx, FunctionInfo* fninfo) { ffi_abi abi; if (!GetABI(cx, OBJECT_TO_JSVAL(fninfo->mABI), &abi)) { JS_ReportError(cx, "Invalid ABI specification"); return false; } @@ -5637,17 +5637,17 @@ FunctionType::CreateInternal(JSContext* JS_SetReservedSlot(typeObj, SLOT_FNINFO, PRIVATE_TO_JSVAL(fninfo.forget())); return typeObj; } // Construct a function pointer to a JS function (see CClosure::Create()). // Regular function pointers are constructed directly in // PointerType::ConstructData(). -JSBool +bool FunctionType::ConstructData(JSContext* cx, HandleObject typeObj, HandleObject dataObj, HandleObject fnObj, HandleObject thisObj, jsval errVal) { JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function); @@ -5678,17 +5678,17 @@ FunctionType::ConstructData(JSContext* c // change the pointer value. // XXX This will need to change when bug 541212 is fixed -- CData::ValueSetter // could be called on a frozen object. return JS_FreezeObject(cx, dataObj); } typedef Array<AutoValue, 16> AutoValueAutoArray; -static JSBool +static bool ConvertArgument(JSContext* cx, HandleValue arg, JSObject* type, AutoValue* value, AutoValueAutoArray* strings) { if (!value->SizeToType(cx, type)) { JS_ReportAllocationOverflow(cx); @@ -5883,27 +5883,27 @@ FunctionType::GetFunctionInfo(JSObject* JS_ASSERT(CType::GetTypeCode(obj) == TYPE_function); jsval slot = JS_GetReservedSlot(obj, SLOT_FNINFO); JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot)); return static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot)); } -static JSBool +static bool CheckFunctionType(JSContext* cx, JSObject* obj) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_function) { JS_ReportError(cx, "not a FunctionType"); return false; } return true; } -JSBool +bool FunctionType::ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return false; // Check if we have a cached argTypes array. vp.set(JS_GetReservedSlot(obj, SLOT_ARGS_T)); if (!JSVAL_IS_VOID(vp)) @@ -5928,39 +5928,39 @@ FunctionType::ArgTypesGetter(JSContext* if (!JS_FreezeObject(cx, argTypes)) return false; JS_SetReservedSlot(obj, SLOT_ARGS_T, OBJECT_TO_JSVAL(argTypes)); vp.setObject(*argTypes); return true; } -JSBool +bool FunctionType::ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return false; // Get the returnType object from the FunctionInfo. vp.setObject(*GetFunctionInfo(obj)->mReturnType); return true; } -JSBool +bool FunctionType::ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return false; // Get the abi object from the FunctionInfo. vp.setObject(*GetFunctionInfo(obj)->mABI); return true; } -JSBool +bool FunctionType::IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return false; vp.setBoolean(GetFunctionInfo(obj)->mIsVariadic); return true; } @@ -6181,17 +6181,17 @@ CClosure::ClosureStub(ffi_cif* cif, void RootedObject argType(cx, fninfo->mArgTypes[i]); if (!ConvertToJS(cx, argType, NullPtr(), args[i], false, false, &argv[i])) return; } // Call the JS function. 'thisObj' may be NULL, in which case the JS engine // will find an appropriate object to use. RootedValue rval(cx); - JSBool success = JS_CallFunctionValue(cx, thisObj, OBJECT_TO_JSVAL(jsfnObj), + bool success = JS_CallFunctionValue(cx, thisObj, OBJECT_TO_JSVAL(jsfnObj), cif->nargs, argv.begin(), rval.address()); // Convert the result. Note that we pass 'isArgument = false', such that // ImplicitConvert will *not* autoconvert a JS string into a pointer-to-char // type, which would require an allocation that we can't track. The JS // function must perform this conversion itself and return a PointerType // CData; thusly, the burden of freeing the data is left to the user. if (success && cif->rtype != &ffi_type_void) @@ -6349,17 +6349,17 @@ CData::Create(JSContext* cx, void CData::Finalize(JSFreeOp *fop, JSObject* obj) { // Delete our buffer, and the data it contains if we own it. jsval slot = JS_GetReservedSlot(obj, SLOT_OWNS); if (JSVAL_IS_VOID(slot)) return; - JSBool owns = JSVAL_TO_BOOLEAN(slot); + bool owns = JSVAL_TO_BOOLEAN(slot); slot = JS_GetReservedSlot(obj, SLOT_DATA); if (JSVAL_IS_VOID(slot)) return; char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot)); if (owns) FreeOp::get(fop)->free_(*buffer); @@ -6397,34 +6397,34 @@ CData::IsCData(JSObject* obj) } bool CData::IsCDataProto(JSObject* obj) { return JS_GetClass(obj) == &sCDataProtoClass; } -JSBool +bool CData::ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } // Convert the value to a primitive; do not create a new CData object. RootedObject ctype(cx, GetCType(obj)); if (!ConvertToJS(cx, ctype, NullPtr(), GetData(obj), true, false, vp.address())) return false; return true; } -JSBool -CData::ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp) +bool +CData::ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, bool strict, MutableHandleValue vp) { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } return ImplicitConvert(cx, vp, GetCType(obj), GetData(obj), false, NULL); } @@ -6686,30 +6686,30 @@ CData::ToSource(JSContext* cx, unsigned if (!result) return false; args.rval().setString(result); return true; } -JSBool +bool CData::ErrnoGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp) { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "this is not not global object ctypes"); return false; } vp.set(JS_GetReservedSlot(obj, SLOT_ERRNO)); return true; } #if defined(XP_WIN) -JSBool +bool CData::LastErrorGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp) { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "not global object ctypes"); return false; } vp.set(JS_GetReservedSlot(obj, SLOT_LASTERROR));
--- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -164,17 +164,17 @@ DeflateStringToUTF8Buffer(JSContext *may char *dst, size_t *dstlenp); /******************************************************************************* ** Function and struct API definitions *******************************************************************************/ JS_ALWAYS_INLINE void -ASSERT_OK(JSBool ok) +ASSERT_OK(bool ok) { JS_ASSERT(ok); } // for JS error reporting enum ErrorNum { #define MSG_DEF(name, number, count, exception, format) \ name = number, @@ -226,17 +226,17 @@ struct FieldHashPolicy const jschar* s = l->chars(); size_t n = l->length(); uint32_t hash = 0; for (; n > 0; s++, n--) hash = hash * 33 + *s; return hash; } - static JSBool match(const Key &k, const Lookup &l) { + static bool match(const Key &k, const Lookup &l) { if (k == l) return true; if (k->length() != l->length()) return false; return memcmp(k->chars(), l->chars(), k->length() * sizeof(jschar)) == 0; } @@ -438,17 +438,17 @@ namespace ArrayType { JSObject* GetBaseType(JSObject* obj); size_t GetLength(JSObject* obj); bool GetSafeLength(JSObject* obj, size_t* result); ffi_type* BuildFFIType(JSContext* cx, JSObject* obj); } namespace StructType { - JSBool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj); + bool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj); const FieldInfoHash* GetFieldInfo(JSObject* obj); const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSFlatString *name); JSObject* BuildFieldsArray(JSContext* cx, JSObject* obj); ffi_type* BuildFFIType(JSContext* cx, JSObject* obj); } namespace FunctionType {
--- a/js/src/gdb/gdb-tests.cpp +++ b/js/src/gdb/gdb-tests.cpp @@ -23,17 +23,17 @@ inline T * checkPtr(T *ptr) { if (! ptr) abort(); return ptr; } void -checkBool(JSBool success) +checkBool(bool success) { if (! success) abort(); } /* The error reporter callback. */ void reportError(JSContext *cx, const char *message, JSErrorReport *report) {
--- a/js/src/ion/IonBuilder.cpp +++ b/js/src/ion/IonBuilder.cpp @@ -5295,17 +5295,17 @@ IonBuilder::jsop_eval(uint32_t argc) // name on the scope chain and the eval is performing a call on that // value. Use a dynamic scope chain lookup rather than a full eval. if (string->isConcat() && string->getOperand(1)->isConstant() && string->getOperand(1)->toConstant()->value().isString()) { JSString *str = string->getOperand(1)->toConstant()->value().toString(); - JSBool match; + bool match; if (!JS_StringEqualsAscii(cx, str, "()", &match)) return false; if (match) { MDefinition *name = string->getOperand(0); MInstruction *dynamicName = MGetDynamicName::New(scopeChain, name); current->add(dynamicName); MInstruction *thisv = MPassArg::New(thisValue);
--- a/js/src/ion/IonCaches.cpp +++ b/js/src/ion/IonCaches.cpp @@ -928,17 +928,17 @@ GenerateCallGetter(JSContext *cx, IonScr Address(StackPointer, IonOOLNativeGetterExitFrameLayout::offsetOfResult()), JSReturnOperand); } else { Register argObjReg = argUintNReg; Register argIdReg = regSet.takeGeneral(); PropertyOp target = shape->getterOp(); JS_ASSERT(target); - // JSPropertyOp: JSBool fn(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) + // JSPropertyOp: bool fn(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) // Push args on stack first so we can take pointers to make handles. masm.Push(UndefinedValue()); masm.movePtr(StackPointer, argVpReg); // push canonical jsid from shape instead of propertyname. RootedId propId(cx); if (!shape->getUserId(cx, &propId)) @@ -1853,18 +1853,18 @@ SetPropertyIC::attachSetterCall(JSContex // Ensure stack is aligned. DebugOnly<uint32_t> initialStack = masm.framePushed(); attacher.pushStubCodePointer(masm); StrictPropertyOp target = shape->setterOp(); JS_ASSERT(target); - // JSStrictPropertyOp: JSBool fn(JSContext *cx, HandleObject obj, - // HandleId id, JSBool strict, MutableHandleValue vp); + // JSStrictPropertyOp: bool fn(JSContext *cx, HandleObject obj, + // HandleId id, bool strict, MutableHandleValue vp); // Push args on stack first so we can take pointers to make handles. if (value().constant()) masm.Push(value().value()); else masm.Push(value().reg()); masm.movePtr(StackPointer, argVpReg);
--- a/js/src/ion/x64/Trampoline-x64.cpp +++ b/js/src/ion/x64/Trampoline-x64.cpp @@ -22,17 +22,17 @@ using namespace js::ion; // All registers to save and restore. This includes the stack pointer, since we // use the ability to reference register values on the stack by index. static const RegisterSet AllRegs = RegisterSet(GeneralRegisterSet(Registers::AllMask), FloatRegisterSet(FloatRegisters::AllMask)); /* This method generates a trampoline on x64 for a c++ function with * the following signature: - * JSBool blah(void *code, int argc, Value *argv, JSObject *scopeChain, + * bool blah(void *code, int argc, Value *argv, JSObject *scopeChain, * Value *vp) * ...using standard x64 fastcall calling convention */ IonCode * IonRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) { MacroAssembler masm(cx);
--- a/js/src/jsapi-tests/README +++ b/js/src/jsapi-tests/README @@ -44,17 +44,17 @@ Here is a sample test: return true; } END_TEST(testIntString_bug515273) The BEGIN_TEST and END_TEST macros bracket each test. By convention, the test name is <testFilename>_<detail>. (The above test is in testIntString.cpp.) The curly braces are required. This block is the body of a C++ member function -that returns JSBool. The test harness calls this member function +that returns bool. The test harness calls this member function automatically. If the function returns true, the test passes. False, it fails. JSAPI tests often need extra global C/C++ code: a JSClass, a getter or setter function, a resolve hook. Put these before the BEGIN_TEST macro. The body of the test can use these member variables and macros, defined in tests.h:
--- a/js/src/jsapi-tests/testAddPropertyPropcache.cpp +++ b/js/src/jsapi-tests/testAddPropertyPropcache.cpp @@ -7,17 +7,17 @@ #include "jsapi-tests/tests.h" /* Do the test a bunch of times, because sometimes we seem to randomly miss the propcache */ static const int expectedCount = 100; static int callCount = 0; -static JSBool +static bool addProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { callCount++; return true; } JSClass addPropertyClass = { "AddPropertyTester",
--- a/js/src/jsapi-tests/testChromeBuffer.cpp +++ b/js/src/jsapi-tests/testChromeBuffer.cpp @@ -116,17 +116,17 @@ BEGIN_TEST(testChromeBuffer) "} catch (e) { " " return trusted(untrusted); " "} "; CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); JS::RootedValue rval(cx); CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), rval.address())); - JSBool match; + bool match; CHECK(JS_StringEqualsAscii(cx, JSVAL_TO_STRING(rval), "From trusted: InternalError: too much recursion", &match)); CHECK(match); } /* * Check that JS_SaveFrameChain called on the way from content to chrome * (say, as done by XPCJSContextSTack::Push) works.