Closed Bug 329848 Opened 18 years ago Closed 18 years ago

ASSERTION: transform-attribute parse error

Categories

(Core :: SVG, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: longsonr)

References

Details

(Keywords: assertion, testcase)

Attachments

(5 files, 2 obsolete files)

###!!! ASSERTION: transform-attribute parse error: 'Error', file /Users/admin/trunk/mozilla/content/svg/content/src/nsSVGTransformList.cpp, line 246

I think this is just a bogus assertion.
Attached image testcase
Yeah, this is yet another case where we should be sending a message to the js console instead of asserting.
Blocks: 344905
Attached patch patch (obsolete) — Splinter Review
I was planning to get tor to sr this, do I need to get anyone else to review it?
Assignee: general → longsonr
Status: NEW → ASSIGNED
Attachment #230612 - Flags: review?(bzbarsky)
Comment on attachment 230612 [details] [diff] [review]
patch

>Index: content/base/public/nsContentUtils.h
>Index: content/base/src/nsContentUtils.cpp
>+  "chrome://global/locale/svg/svg.properties",

That trailing comma will break builds.  Remove it.

Does this need to be in #ifdef MOZ_SVG?

>Index: content/svg/content/src/nsSVGElement.cpp

>+      nsAutoString attributeName, attributeValue(aValue);

Why is attributeValue an nsAutoString?  Please use PromiseFlatString() as needed if you need a flat string from an nsAString.

>+      nsSVGUtils::ReportToConsole(GetCurrentDoc(),

Why the current doc and not the owner doc?  That looks wrong.

>Index: dom/locales/jar.mn
>+  locale/@AB_CD@/global/svg/svg.properties                     (%chrome/svg/svg.properties)

Again, should this be ifdefed?
Attachment #230612 - Flags: review?(bzbarsky) → review-
Attachment #230614 - Flags: review?(bzbarsky) → review+
Attached patch address review comments (obsolete) — Splinter Review
> (From update of attachment 230612 [details] [diff] [review] [edit])
> >Index: content/base/public/nsContentUtils.h
> >Index: content/base/src/nsContentUtils.cpp
> >+  "chrome://global/locale/svg/svg.properties",

> That trailing comma will break builds.  Remove it.

> Does this need to be in #ifdef MOZ_SVG?

Added #ifdef MOZ_SVG and moved property up so that it always requires a comma.

> >Index: content/svg/content/src/nsSVGElement.cpp

> >+      nsAutoString attributeName, attributeValue(aValue);

> Why is attributeValue an nsAutoString?  Please use PromiseFlatString() as
> needed if you need a flat string from an nsAString.

Done.

> >+      nsSVGUtils::ReportToConsole(GetCurrentDoc(),

> Why the current doc and not the owner doc?  That looks wrong.

Changed. When would you use GetCurrentDoc over GetOwnerDoc?

> >Index: dom/locales/jar.mn
> >+  locale/@AB_CD@/global/svg/svg.properties                     (%chrome/svg/svg.properties)

> Again, should this be ifdefed?

Changed, didn't realise you could do that.
Attachment #230612 - Attachment is obsolete: true
Attachment #230721 - Flags: review?(bzbarsky)
Comment on attachment 230721 [details] [diff] [review]
address review comments

>Index: content/svg/content/src/nsSVGElement.cpp
>+      const PRUnichar *strings[] = { attributeName.get(), PromiseFlatString(aValue).get() };

After this line, that pointer is pointing at the innards of an object that's gone.  So if aValue is not already flat, you will generally crash.

You need to keep the object alive:

const nsAFlatString& flatValue = PromiseFlatString(aValue);

  then use flatValue.get().  Or something along those lines.

>Index: dom/locales/jar.mn
>+#ifdef MOZ_SVG  
>+  locale/@AB_CD@/global/svg/svg.properties                     (%chrome/svg/svg.properties)
>+#endif

And you did check that this works (that is, that this file is preprocessed), right?

In general, GetOwnerDoc() is the same as the DOM's ownerDocument.  GetCurrentDoc() is the document the node is being rendered in (e.g. null for nodes that are not inserted into a document).
Attachment #230721 - Flags: review?(bzbarsky) → review-
> (From update of attachment 230721 [details] [diff] [review] [edit])
> >Index: content/svg/content/src/nsSVGElement.cpp
> >+      const PRUnichar *strings[] = { attributeName.get(), PromiseFlatString(aValue).get() };

> After this line, that pointer is pointing at the innards of an object that's
> gone.  So if aValue is not already flat, you will generally crash.

> You need to keep the object alive:

> const nsAFlatString& flatValue = PromiseFlatString(aValue);

>   then use flatValue.get().  Or something along those lines.

Done.

> >Index: dom/locales/jar.mn
> >+#ifdef MOZ_SVG  
> >+  locale/@AB_CD@/global/svg/svg.properties                     (%chrome/svg/svg.properties)
> >+#endif

> And you did check that this works (that is, that this file is preprocessed),
right?

I checked that this was the correct syntax by looking at other jar.mn files. I then rebuilt the whole browser and checked that the testcase still caused my new warning message to be displayed in the Error Console. Is there any other testing you would recommend? 

After reading your response I also checked that the svg.properties file was in en-US.jar and that the date of en-US.jar was later than that of the jar.mn file that I changed.
Attachment #230721 - Attachment is obsolete: true
Attachment #230747 - Flags: review?(bzbarsky)
Comment on attachment 230747 [details] [diff] [review]
address additional review comments

r=bzbarsky
Attachment #230747 - Flags: review?(bzbarsky) → review+
Attachment #230747 - Flags: superreview?(tor)
Attachment #230614 - Flags: superreview?(tor)
Attachment #230614 - Flags: superreview?(tor) → superreview+
Attachment #230747 - Flags: superreview?(tor) → superreview+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
This checkin seems to have screwed things up on various port builds "nsSVGElement.cpp", line 226: Error: ReportToConsole is not a member of nsSVGUtils

I have commented out the offending call temporarily while I try to determine what is wrong.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Is it OK to try this again now?
Attachment #230898 - Flags: superreview?(tor)
Attachment #230898 - Flags: review?(tor)
Attachment #230898 - Flags: superreview?(tor)
Attachment #230898 - Flags: superreview+
Attachment #230898 - Flags: review?(tor)
Attachment #230898 - Flags: review+
additional spaces after MOZ_SVG causes a warning in the build log. Removing the bogus spaces fixes it.
Attachment #231089 - Flags: superreview?(tor)
Attachment #231089 - Flags: review?(tor)
Attachment #231089 - Flags: superreview?(tor)
Attachment #231089 - Flags: superreview+
Attachment #231089 - Flags: review?(tor)
Attachment #231089 - Flags: review+
Comment on attachment 231089 [details] [diff] [review]
fix build warning

Checked in fix for build warning.
checked in fix to restore functionality. Fortunately blackdeath was OK with it this time.
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
*** Bug 322528 has been marked as a duplicate of this bug. ***
Crashtest checked in.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: