[FIX]unknown namespace error reporting could be clearer

RESOLVED FIXED

Status

()

Core
CSS Parsing and Computation
RESOLVED FIXED
16 years ago
16 years ago

People

(Reporter: timeless, Assigned: bz)

Tracking

({modern})

Trunk
modern
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

16 years ago
CSS Error (chrome://messenger/skin/addressbook/addressbook.css :225.6): Unknown
namespace prefix '|'.  Selector expected Ruleset ignored due to bad selector.

<bz> the error reporting there is broken, though...
<bz> the bogus prefix is "html"
Created attachment 106765 [details] [diff] [review]
Report the actual namespace causing the error.
Attachment #106765 - Flags: review?(dbaron)
Keywords: modern
OS: Windows 2000 → All
Hardware: PC → All
Summary: addressbook triggers css style error → [FIX]unknown namespace error reporting could be clearer
Comment on attachment 106765 [details] [diff] [review]
Report the actual namespace causing the error.

> static void ReportUnexpectedToken(nsCSSScanner *sc,
>                                   nsCSSToken& tok,
>                                   const nsAString& err)
> {
>-  nsAutoString error(err + NS_LITERAL_STRING(" '"));
>+  // XXX Flatten the string so we don't append to a concatenation,
>+  // since that goes into an infinite loop.
>+  nsAutoString error(err);
>+  error += NS_LITERAL_STRING(" '");

No need for "XXX".  Cite bug 70083 instead.

>-        REPORT_UNEXPECTED_TOKEN(NS_LITERAL_STRING("Unknown namespace prefix"));
>+        REPORT_UNEXPECTED_TOKEN(
>+            NS_LITERAL_STRING("Unknown namespace prefix '") +
>+            buffer +
>+            NS_LITERAL_STRING("'; didn't expect")
>+          );

Should this be written REPORT_UNEXPECTED rather than REPORT_UNEXPECTED_TOKEN? 
What does buffer hold and what does mToken hold?

Same thing below.
Comment on attachment 106765 [details] [diff] [review]
Report the actual namespace causing the error.

Well, now that I read the bug I see what mToken holds.	So yeah, I think you
should just switch to REPORT_UNEXPECTED -- it's obvious enough if the error is
reported at the position of the |.
Created attachment 106767 [details] [diff] [review]
Fix those

ah, right.  That was the bug#.
Attachment #106765 - Attachment is obsolete: true
Attachment #106767 - Flags: review?(dbaron)
Attachment #106765 - Flags: review?(dbaron)
Attachment #106767 - Flags: review?(dbaron) → review+
fixed.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.