Bug 941437 part 2. Remove the unused cx argument from UNWRAP_OBJECT and UNWRAP_WORKER_OBJECT. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 21 Nov 2013 07:51:16 -0500
changeset 156691 9b97964281626eb52a102b9750e4655f6013e896
parent 156690 3e6033b201bef1d6caa7c85eb8249e6484764e23
child 156692 0ed3e74f6fd48988b0b33d8bcb9693e10b267031
push id36525
push userbzbarsky@mozilla.com
push dateThu, 21 Nov 2013 12:52:55 +0000
treeherdermozilla-inbound@9b9796428162 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs941437
milestone28.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
Bug 941437 part 2. Remove the unused cx argument from UNWRAP_OBJECT and UNWRAP_WORKER_OBJECT. r=smaug
content/events/src/nsDOMMessageEvent.cpp
content/media/WebVTTListener.cpp
dom/base/MessagePort.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/CallbackObject.cpp
dom/indexedDB/IDBKeyRange.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/ipc/IndexedDBParent.cpp
dom/promise/Promise.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerScope.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
--- a/content/events/src/nsDOMMessageEvent.cpp
+++ b/content/events/src/nsDOMMessageEvent.cpp
@@ -151,17 +151,17 @@ nsDOMMessageEvent::Constructor(const moz
                                  getter_AddRefs(wrappedNative));
 
     if (wrappedNative) {
       event->mWindowSource = do_QueryWrappedNative(wrappedNative);
     }
 
     if (!event->mWindowSource) {
       MessagePortBase* port = nullptr;
-      nsresult rv = UNWRAP_OBJECT(MessagePort, aCx, aParam.mSource, port);
+      nsresult rv = UNWRAP_OBJECT(MessagePort, aParam.mSource, port);
       if (NS_FAILED(rv)) {
         aRv.Throw(NS_ERROR_INVALID_ARG);
         return nullptr;
       }
 
       event->mPortSource = port;
     }
   }
--- a/content/media/WebVTTListener.cpp
+++ b/content/media/WebVTTListener.cpp
@@ -157,17 +157,17 @@ WebVTTListener::OnDataAvailable(nsIReque
 NS_IMETHODIMP
 WebVTTListener::OnCue(const JS::Value &aCue, JSContext* aCx)
 {
   if (!aCue.isObject()) {
     return NS_ERROR_FAILURE;
   }
 
   TextTrackCue* cue;
-  nsresult rv = UNWRAP_OBJECT(VTTCue, aCx, &aCue.toObject(), cue);
+  nsresult rv = UNWRAP_OBJECT(VTTCue, &aCue.toObject(), cue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   cue->SetTrackElement(mElement);
   mElement->mTrack->AddCue(*cue);
 
   return NS_OK;
 }
 
@@ -175,18 +175,17 @@ WebVTTListener::OnCue(const JS::Value &a
 NS_IMETHODIMP
 WebVTTListener::OnRegion(const JS::Value &aRegion, JSContext* aCx)
 {
   if (!aRegion.isObject()) {
     return NS_ERROR_FAILURE;
   }
 
   TextTrackRegion* region;
-  nsresult rv = UNWRAP_OBJECT(VTTRegion, aCx, &aRegion.toObject(),
-                              region);
+  nsresult rv = UNWRAP_OBJECT(VTTRegion, &aRegion.toObject(), region);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mElement->mTrack->AddRegion(*region);
 
   return NS_OK;
 }
 
 } // namespace dom
--- a/dom/base/MessagePort.cpp
+++ b/dom/base/MessagePort.cpp
@@ -186,17 +186,17 @@ PostMessageWriteStructuredClone(JSContex
     if (scTag) {
       return JS_WriteUint32Pair(writer, scTag, 0) &&
              JS_WriteBytes(writer, &supports, sizeof(supports)) &&
              scInfo->mEvent->StoreISupports(supports);
     }
   }
 
   MessagePortBase* port = nullptr;
-  nsresult rv = UNWRAP_OBJECT(MessagePort, cx, obj, port);
+  nsresult rv = UNWRAP_OBJECT(MessagePort, obj, port);
   if (NS_SUCCEEDED(rv)) {
     nsRefPtr<MessagePortBase> newPort = port->Clone();
 
     if (!newPort) {
       return false;
     }
 
     return JS_WriteUint32Pair(writer, SCTAG_DOM_MESSAGEPORT, 0) &&
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -3998,17 +3998,17 @@ nsHTMLDocumentSH::GetDocumentAllNodeList
   nsresult rv = NS_OK;
 
   JS::Rooted<JS::Value> collection(cx, JS_GetReservedSlot(obj, 0));
 
   if (!JSVAL_IS_PRIMITIVE(collection)) {
     // We already have a node list in our reserved slot, use it.
     JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(collection));
     nsIHTMLCollection* htmlCollection;
-    rv = UNWRAP_OBJECT(HTMLCollection, cx, obj, htmlCollection);
+    rv = UNWRAP_OBJECT(HTMLCollection, obj, htmlCollection);
     if (NS_SUCCEEDED(rv)) {
       NS_ADDREF(*nodeList = static_cast<nsContentList*>(htmlCollection));
     }
     else {
       nsISupports *native = nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj);
       if (native) {
         NS_ADDREF(*nodeList = nsContentList::FromSupports(native));
         rv = NS_OK;
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7567,17 +7567,17 @@ PostMessageWriteStructuredClone(JSContex
     if (scTag)
       return JS_WriteUint32Pair(writer, scTag, 0) &&
              JS_WriteBytes(writer, &supports, sizeof(supports)) &&
              scInfo->event->StoreISupports(supports);
   }
 
   if (MessageChannel::PrefEnabled()) {
     MessagePortBase* port = nullptr;
-    nsresult rv = UNWRAP_OBJECT(MessagePort, cx, obj, port);
+    nsresult rv = UNWRAP_OBJECT(MessagePort, obj, port);
     if (NS_SUCCEEDED(rv) && scInfo->subsumes) {
       nsRefPtr<MessagePortBase> newPort = port->Clone();
 
       if (!newPort) {
         return false;
       }
 
       return JS_WriteUint32Pair(writer, SCTAG_DOM_MESSAGEPORT, 0) &&
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2800,17 +2800,17 @@ NS_DOMReadStructuredClone(JSContext* cx,
 
 bool
 NS_DOMWriteStructuredClone(JSContext* cx,
                            JSStructuredCloneWriter* writer,
                            JS::Handle<JSObject*> obj,
                            void *closure)
 {
   ImageData* imageData;
-  nsresult rv = UNWRAP_OBJECT(ImageData, cx, obj, imageData);
+  nsresult rv = UNWRAP_OBJECT(ImageData, obj, imageData);
   if (NS_FAILED(rv)) {
     // Don't know what this is. Bail.
     xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
     return false;
   }
 
   // Prepare the ImageData internals.
   uint32_t width = imageData->Width();
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -194,18 +194,17 @@ ErrorResult::ReportJSException(JSContext
 
 void
 ErrorResult::ReportJSExceptionFromJSImplementation(JSContext* aCx)
 {
   MOZ_ASSERT(!mMightHaveUnreportedJSException,
              "Why didn't you tell us you planned to handle JS exceptions?");
 
   dom::DOMError* domError;
-  nsresult rv = UNWRAP_OBJECT(DOMError, aCx, &mJSException.toObject(),
-                              domError);
+  nsresult rv = UNWRAP_OBJECT(DOMError, &mJSException.toObject(), domError);
   if (NS_FAILED(rv)) {
     // Unwrapping really shouldn't fail here, if mExceptionHandling is set to
     // eRethrowContentExceptions then the CallSetup destructor only stores an
     // exception if it unwraps to DOMError. If we reach this then either
     // mExceptionHandling wasn't set to eRethrowContentExceptions and we
     // shouldn't be calling ReportJSExceptionFromJSImplementation or something
     // went really wrong.
     NS_RUNTIMEABORT("We stored a non-DOMError exception!");
@@ -1785,17 +1784,17 @@ ReparentWrapper(JSContext* aCx, JS::Hand
     }
 
     if (!copyTo || !JS_CopyPropertiesFrom(aCx, copyTo, propertyHolder)) {
       MOZ_CRASH();
     }
   }
 
   nsObjectLoadingContent* htmlobject;
-  nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, aCx, aObj, htmlobject);
+  nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, aObj, htmlobject);
   if (NS_FAILED(rv)) {
     rv = UnwrapObject<prototypes::id::HTMLEmbedElement,
                       HTMLSharedObjectElement>(aObj, htmlobject);
     if (NS_FAILED(rv)) {
       rv = UnwrapObject<prototypes::id::HTMLAppletElement,
                         HTMLSharedObjectElement>(aObj, htmlobject);
       if (NS_FAILED(rv)) {
         htmlobject = nullptr;
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -188,17 +188,17 @@ UnwrapDOMObjectToISupports(JSObject* aOb
 
 inline bool
 IsDOMObject(JSObject* obj)
 {
   const js::Class* clasp = js::GetObjectClass(obj);
   return IsDOMClass(clasp) || IsDOMProxy(obj, clasp);
 }
 
-#define UNWRAP_OBJECT(Interface, cx, obj, value)                             \
+#define UNWRAP_OBJECT(Interface, obj, value)                                 \
   mozilla::dom::UnwrapObject<mozilla::dom::prototypes::id::Interface,        \
     mozilla::dom::Interface##Binding::NativeType>(obj, value)
 
 // Some callers don't want to set an exception when unwrapping fails
 // (for example, overload resolution uses unwrapping to tell what sort
 // of thing it's looking at).
 // U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
 template <prototypes::ID PrototypeID, class T, typename U>
--- a/dom/bindings/CallbackObject.cpp
+++ b/dom/bindings/CallbackObject.cpp
@@ -152,17 +152,17 @@ CallbackObject::CallSetup::ShouldRethrow
 
   JS::Rooted<JSObject*> obj(mCx, &aException.toObject());
   obj = js::UncheckedUnwrap(obj, /* stopAtOuter = */ false);
   if (js::GetObjectCompartment(obj) != mCompartment) {
     return false;
   }
 
   DOMError* domError;
-  return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, mCx, obj, domError));
+  return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, obj, domError));
 }
 
 CallbackObject::CallSetup::~CallSetup()
 {
   // First things first: if we have a JSContext, report any pending
   // errors on it, unless we were told to re-throw them.
   if (mCx) {
     bool dealtWithPendingException = false;
--- a/dom/indexedDB/IDBKeyRange.cpp
+++ b/dom/indexedDB/IDBKeyRange.cpp
@@ -72,17 +72,17 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
     nsresult rv = GetKeyFromJSVal(aCx, aVal, keyRange->Lower());
     if (NS_FAILED(rv)) {
       return rv;
     }
   }
   else {
     MOZ_ASSERT(aVal.isObject());
     // An object is not permitted unless it's another IDBKeyRange.
-    if (NS_FAILED(UNWRAP_OBJECT(IDBKeyRange, aCx, obj, keyRange))) {
+    if (NS_FAILED(UNWRAP_OBJECT(IDBKeyRange, obj, keyRange))) {
       return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
     }
   }
 
   keyRange.forget(aKeyRange);
   return NS_OK;
 }
 
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1587,17 +1587,17 @@ IDBObjectStore::StructuredCloneWriteCall
     uint64_t value = 0;
     return JS_WriteBytes(aWriter, &value, sizeof(value));
   }
 
   IDBTransaction* transaction = cloneWriteInfo->mTransaction;
   FileManager* fileManager = transaction->Database()->Manager();
 
   file::FileHandle* fileHandle = nullptr;
-  if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aCx, aObj, fileHandle))) {
+  if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aObj, fileHandle))) {
     nsRefPtr<FileInfo> fileInfo = fileHandle->GetFileInfo();
 
     // Throw when trying to store non IDB file handles or IDB file handles
     // across databases.
     if (!fileInfo || fileInfo->Manager() != fileManager) {
       return false;
     }
 
--- a/dom/indexedDB/ipc/IndexedDBParent.cpp
+++ b/dom/indexedDB/ipc/IndexedDBParent.cpp
@@ -410,17 +410,17 @@ IndexedDBDatabaseParent::HandleRequestEv
 
   ErrorResult error;
   JS::Rooted<JS::Value> result(cx, mOpenRequest->GetResult(cx, error));
   ENSURE_SUCCESS(error, error.ErrorCode());
 
   MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
 
   IDBDatabase *database;
-  rv = UNWRAP_OBJECT(IDBDatabase, cx, &result.toObject(), database);
+  rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
   if (NS_FAILED(rv)) {
     NS_WARNING("Didn't get the object we expected!");
     return rv;
   }
 
   DatabaseInfo* dbInfo = database->Info();
   MOZ_ASSERT(dbInfo);
 
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -228,17 +228,17 @@ Promise::JSCallback(JSContext *aCx, unsi
   JS::CallArgs args = CallArgsFromVp(aArgc, aVp);
 
   JS::Rooted<JS::Value> v(aCx,
                           js::GetFunctionNativeReserved(&args.callee(),
                                                         SLOT_PROMISE));
   MOZ_ASSERT(v.isObject());
 
   Promise* promise;
-  if (NS_FAILED(UNWRAP_OBJECT(Promise, aCx, &v.toObject(), promise))) {
+  if (NS_FAILED(UNWRAP_OBJECT(Promise, &v.toObject(), promise))) {
     return Throw(aCx, NS_ERROR_UNEXPECTED);
   }
 
   v = js::GetFunctionNativeReserved(&args.callee(), SLOT_TASK);
   PromiseCallback::Task task = static_cast<PromiseCallback::Task>(v.toInt32());
 
   if (task == PromiseCallback::Resolve) {
     promise->MaybeResolveInternal(aCx, args.get(0));
@@ -496,17 +496,17 @@ Promise::ResolveInternal(JSContext* aCx,
                          PromiseTaskSync aAsynchronous)
 {
   mResolvePending = true;
 
   // TODO: Bug 879245 - Then-able objects
   if (aValue.isObject()) {
     JS::Rooted<JSObject*> valueObj(aCx, &aValue.toObject());
     Promise* nextPromise;
-    nsresult rv = UNWRAP_OBJECT(Promise, aCx, valueObj, nextPromise);
+    nsresult rv = UNWRAP_OBJECT(Promise, valueObj, nextPromise);
 
     if (NS_SUCCEEDED(rv)) {
       nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this);
       nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(this);
       nextPromise->AppendCallbacks(resolveCb, rejectCb);
       return;
     }
   }
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -341,17 +341,17 @@ struct WorkerStructuredCloneCallbacks
           return true;
         }
       }
     }
 
     // See if this is an ImageData object.
     {
       ImageData* imageData = nullptr;
-      if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageData, aCx, aObj, imageData))) {
+      if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageData, aObj, imageData))) {
         // Prepare the ImageData internals.
         uint32_t width = imageData->Width();
         uint32_t height = imageData->Height();
         JS::Rooted<JSObject*> dataArray(aCx, imageData->GetDataObject());
 
         // Write the internals to the stream.
         JSAutoCompartment ac(aCx, dataArray);
         return JS_WriteUint32Pair(aWriter, SCTAG_DOM_IMAGEDATA, 0) &&
@@ -5402,17 +5402,17 @@ BEGIN_WORKERS_NAMESPACE
 WorkerCrossThreadDispatcher*
 GetWorkerCrossThreadDispatcher(JSContext* aCx, JS::Value aWorker)
 {
   if (!aWorker.isObject()) {
     return nullptr;
   }
 
   WorkerPrivate* w = nullptr;
-  UNWRAP_OBJECT(Worker, aCx, &aWorker.toObject(), w);
+  UNWRAP_OBJECT(Worker, &aWorker.toObject(), w);
   MOZ_ASSERT(w);
   return w->GetCrossThreadDispatcher();
 }
 
 // Can't use NS_IMPL_CYCLE_COLLECTION_CLASS(WorkerPrivateParent) because of the
 // templates.
 template <>
 WorkerPrivateParent<WorkerPrivate>::cycleCollection WorkerPrivateParent<WorkerPrivate>::_cycleCollectorGlobal = WorkerPrivateParent<WorkerPrivate>::cycleCollection();
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -17,17 +17,17 @@
 #include "mozilla/dom/SharedWorkerGlobalScopeBinding.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #include "RuntimeService.h" // For WorkersDumpEnabled().
 
-#define UNWRAP_WORKER_OBJECT(Interface, cx, obj, value)                       \
+#define UNWRAP_WORKER_OBJECT(Interface, obj, value)                           \
   UnwrapObject<prototypes::id::Interface##_workers,                           \
     mozilla::dom::Interface##Binding_workers::NativeType>(obj, value)
 
 using namespace mozilla::dom;
 USING_WORKERS_NAMESPACE
 
 BEGIN_WORKERS_NAMESPACE
 
@@ -254,17 +254,17 @@ DedicatedWorkerGlobalScope::DedicatedWor
 : WorkerGlobalScope(aWorkerPrivate)
 {
 }
 
 /* static */ bool
 DedicatedWorkerGlobalScope::Visible(JSContext* aCx, JSObject* aObj)
 {
   DedicatedWorkerGlobalScope* self = nullptr;
-  nsresult rv = UNWRAP_WORKER_OBJECT(DedicatedWorkerGlobalScope, aCx, aObj, self);
+  nsresult rv = UNWRAP_WORKER_OBJECT(DedicatedWorkerGlobalScope, aObj, self);
   return NS_SUCCEEDED(rv) && self;
 }
 
 JSObject*
 DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
                                              JS::CompartmentOptions& aOptions,
                                              JSPrincipals* aPrincipal)
 {
@@ -294,17 +294,17 @@ SharedWorkerGlobalScope::SharedWorkerGlo
 : WorkerGlobalScope(aWorkerPrivate), mName(aName)
 {
 }
 
 /* static */ bool
 SharedWorkerGlobalScope::Visible(JSContext* aCx, JSObject* aObj)
 {
   SharedWorkerGlobalScope* self = nullptr;
-  nsresult rv = UNWRAP_WORKER_OBJECT(SharedWorkerGlobalScope, aCx, aObj, self);
+  nsresult rv = UNWRAP_WORKER_OBJECT(SharedWorkerGlobalScope, aObj, self);
   return NS_SUCCEEDED(rv) && self;
 }
 
 JSObject*
 SharedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
                                           JS::CompartmentOptions& aOptions,
                                           JSPrincipals* aPrincipal)
 {
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -1965,17 +1965,17 @@ nsXPCComponents_Exception::HasInstance(n
                                        const jsval &val, bool *bp,
                                        bool *_retval)
 {
     using namespace mozilla::dom;
 
     RootedValue v(cx, val);
     if (bp) {
         Exception* e;
-        *bp = NS_SUCCEEDED(UNWRAP_OBJECT(Exception, cx, v.toObjectOrNull(), e)) ||
+        *bp = NS_SUCCEEDED(UNWRAP_OBJECT(Exception, v.toObjectOrNull(), e)) ||
               JSValIsInterfaceOfType(cx, v, NS_GET_IID(nsIException));
     }
     return NS_OK;
 }
 
 /***************************************************************************/
 // This class is for the thing returned by "new Component.Constructor".
 
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -587,17 +587,17 @@ WindowGlobalOrNull(JSObject *aObj)
     MOZ_ASSERT(aObj);
     JSObject *glob = js::GetGlobalForObjectCrossCompartment(aObj);
     MOZ_ASSERT(glob);
 
     // This will always return null until we have Window on WebIDL bindings,
     // at which point it will do the right thing.
     if (!IS_WN_CLASS(js::GetObjectClass(glob))) {
         nsGlobalWindow* win = nullptr;
-        UNWRAP_OBJECT(Window, nullptr, glob, win);
+        UNWRAP_OBJECT(Window, glob, win);
         return win;
     }
 
     nsISupports* supports = XPCWrappedNative::Get(glob)->GetIdentityObject();
     nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(supports);
     if (!piWin)
         return nullptr;
     return static_cast<nsGlobalWindow*>(piWin.get());
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -256,17 +256,17 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
 
             if (JS_GetPendingException(cx, &jsexception)) {
                 nsresult rv;
                 if (jsexception.isObject()) {
                     // XPConnect may have constructed an object to represent a
                     // C++ QI failure. See if that is the case.
                     using namespace mozilla::dom;
                     Exception *e = nullptr;
-                    UNWRAP_OBJECT(Exception, cx, &jsexception.toObject(), e);
+                    UNWRAP_OBJECT(Exception, &jsexception.toObject(), e);
 
                     if (e &&
                         NS_SUCCEEDED(e->GetResult(&rv)) &&
                         rv == NS_NOINTERFACE) {
                         JS_ClearPendingException(cx);
                     }
                 } else if (JSVAL_IS_NUMBER(jsexception)) {
                     // JS often throws an nsresult.