Closed Bug 115140 Opened 23 years ago Closed 23 years ago

EqualsIgnoreCase fails silently when it should succeed

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: akkzilla, Assigned: jag+mozilla)

References

(Blocks 1 open bug)

Details

nsHTMLURLRefObject has a macro that reads:
// String classes change too often and I can't keep up.
// Set this macro to this week's approved case-insensitive compare routine.
#define MATCHES(tagName, str) tagName.EqualsIgnoreCase(str)

tagName is an nsString, str is an ascii literal like "href".
This worked a few weeks ago, but now, though it still compiles without warnings,
it fails to match when it should (e.g. when NS_LossyConvertUCS2toASCII(tagName)
prints out as "href") at line 176 of that file.

I've tried inserting an NS_LITERAL_STRING around the literals (which would seem
to be more correct), but then it doesn't compile.  I've tried a couple of other
suggestions jag gave me on IRC, but I've had no luck.  Jag says it works on
Windows, so this is apparently a unix-only failure (probably due to single vs.
double byte issues).

This has regressed the link checker, so it's blocking bug 112985, bug 108296 and
bug 114926.  We need a clue as to what changed so that we can fix the problem
and get moving again on these other bugs
Blocks: 108296, 112985, 114926
I can't reproduce this on my linux box nor on my windows box.

With the following snippet of code, and the test-case you described: load any
html file with a <a href> in it, then select "Check Links" from the debug menu

    // href >> A, AREA, BASE, LINK
    printf("---jag--- curAttr: %s\n",
NS_LossyConvertUCS2toASCII(curAttr).get());
    if (MATCHES(curAttr, "href"))
    {
      printf("---jag--- it matched\n");

I get this output:

---jag--- curAttr: href
---jag--- it matched
---jag--- curAttr: href
---jag--- it matched
0: Trying to check test.html
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "Component returned failure code: 0x804b000a
[nsIURIChecker.asyncCheckURI]"  nsresult: "0x804b000a (<unknown>)"  location:
"JS frame :: chrome://editor/content/ComposerCommands.js :: anonymous :: line
1240"  data: no]
************************************************************
An error occurred executing the cmd_checkLinks command

Seems to me EqualsIgnoreCase works just fine.
You're right -- it's working now.  I don't know if something changed, or if I
was just on drugs when I was trying it a few days ago.  But I can't find a
problem with it now.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
akk: it must have been something in the build because you and i both saw the
same thing with completely separate builds.
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.