static void NSResultToNameAndMessage(nsresult aNSResult, nsCString& aName, nsCString& aMessage, uint16_t* aCode) { aName.Truncate(); aMessage.Truncate(); *aCode = 0; for (uint32_t idx = 0; idx < ArrayLength(sDOMErrorMsgMap); idx++) { if (aNSResult == sDOMErrorMsgMap[idx].mNSResult) { aName.Rebind(sDOMErrorMsgMap[idx].mName, strlen(sDOMErrorMsgMap[idx].mName)); aMessage.Rebind(sDOMErrorMsgMap[idx].mMessage, strlen(sDOMErrorMsgMap[idx].mMessage)); *aCode = sDOMErrorMsgMap[idx].mCode; return; } } NS_WARNING("Huh, someone is throwing non-DOM errors using the DOM module!"); return; }