Area::ParseCoords(aSpec);  PRBool saneRect = PR_TRUE; PRInt32 flag = nsIScriptError::warningFlag; if (mNumCoords >= 4) { if (mCoords[0] > mCoords[2]) {  nscoord x = mCoords[2]; mCoords[2] = mCoords[0]; mCoords[0] = x; saneRect = PR_FALSE; }  if (mCoords[1] > mCoords[3]) {  nscoord y = mCoords[3]; mCoords[3] = mCoords[1]; mCoords[1] = y; saneRect = PR_FALSE; }  if (mNumCoords > 4) {  saneRect = PR_FALSE; } } else { saneRect = PR_FALSE; flag = nsIScriptError::errorFlag; }  if (!saneRect) {  nsresult rv; nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return; nsCOMPtr<nsIScriptError> errorObject = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv); if (NS_FAILED(rv)) return; nsCOMPtr<nsIStringBundleService> stringBundleService = do_GetService(kCStringBundleServiceCID, &rv); if (NS_FAILED(rv)) return; nsCOMPtr<nsIStringBundle> bundle; rv = stringBundleService->CreateBundle( "chrome: getter_AddRefs(bundle)); if (NS_FAILED(rv)) return; nsXPIDLString errorText; rv = bundle->FormatStringFromName(NS_LITERAL_STRING("ImageMapRectBoundsError").get(), nsnull, 0, getter_Copies(errorText)); if (NS_FAILED(rv)) return;   nsINodeInfo *nodeInfo = mArea->GetNodeInfo(); NS_ASSERTION(nodeInfo, "Element with no nodeinfo");  nsIDocument* doc = nodeInfo->GetDocument(); nsCAutoString urlSpec; if (doc) { nsCOMPtr<nsIURI> uri; doc->GetDocumentURL(getter_AddRefs(uri)); if (uri) { uri->GetSpec(urlSpec); } } rv = errorObject->Init(errorText.get(), NS_ConvertUTF8toUCS2(urlSpec).get(), /* file name */ PromiseFlatString(aSpec).get(), /* source line */ 0, /* line number */ 0, /* column number */ flag, "ImageMap"); if (NS_FAILED(rv)) return;  consoleService->LogMessage(errorObject);
char* cp = ToNewCString(aSpec); if (cp) { mCoords = lo_parse_coord_list(cp, &mNumCoords); nsCRT::free(cp);
void RectArea::ParseCoords(const nsAString& aSpec){  Area::ParseCoords(aSpec);  PRBool saneRect = PR_TRUE;  PRInt32 flag = nsIScriptError::warningFlag;  if (mNumCoords >= 4) {    if (mCoords[0] > mCoords[2]) {      // x-coords in reversed order      nscoord x = mCoords[2];      mCoords[2] = mCoords[0];      mCoords[0] = x;      saneRect = PR_FALSE;    }      if (mCoords[1] > mCoords[3]) {      // y-coords in reversed order      nscoord y = mCoords[3];      mCoords[3] = mCoords[1];      mCoords[1] = y;      saneRect = PR_FALSE;    }    if (mNumCoords > 4) {      // Someone missed the concept of a rect here      saneRect = PR_FALSE;    }  } else {    saneRect = PR_FALSE;    flag = nsIScriptError::errorFlag;  }  if (!saneRect) {    // Report the error to the console.    nsresult rv;    nsCOMPtr<nsIConsoleService> consoleService =      do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);    if (NS_FAILED(rv))      return;    nsCOMPtr<nsIScriptError> errorObject =      do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);    if (NS_FAILED(rv))      return;    nsCOMPtr<nsIStringBundleService> stringBundleService =      do_GetService(kCStringBundleServiceCID, &rv);    if (NS_FAILED(rv))      return;    nsCOMPtr<nsIStringBundle> bundle;    rv = stringBundleService->CreateBundle(           "chrome://global/locale/layout_errors.properties",           getter_AddRefs(bundle));    if (NS_FAILED(rv))      return;    nsXPIDLString errorText;    rv =      bundle->FormatStringFromName(NS_LITERAL_STRING("ImageMapRectBoundsError").get(),                                   nsnull, 0,                                   getter_Copies(errorText));    if (NS_FAILED(rv))      return;    // XXX GetOwnerDocument    nsINodeInfo *nodeInfo = mArea->GetNodeInfo();    NS_ASSERTION(nodeInfo, "Element with no nodeinfo");    nsIDocument* doc = nodeInfo->GetDocument();    nsCAutoString urlSpec;    if (doc) {      nsCOMPtr<nsIURI> uri;      doc->GetDocumentURL(getter_AddRefs(uri));      if (uri) {        uri->GetSpec(urlSpec);      }    }    rv = errorObject->Init(errorText.get(),                           NS_ConvertUTF8toUCS2(urlSpec).get(), /* file name */                           PromiseFlatString(aSpec).get(), /* source line */                           0, /* line number */                           0, /* column number */                           flag,                           "ImageMap");    if (NS_FAILED(rv))      return;    consoleService->LogMessage(errorObject);  }}