Closed Bug 795751 Opened 9 years ago Closed 9 years ago

Build error when trying to make a css property preffable


(Core :: CSS Parsing and Computation, defect)

Not set





(Reporter: dholbert, Assigned: bzbarsky)




(2 files)

 1. Add a pref name (including some period characters) for a pref in nsCSSPropList.h

   e.g. the attached patch attempts to add the pref "svg.markerOffset.enabled" for the "marker-offset" property

 2. Try to build

ACTUAL RESULTS: This build error:
Traceback (most recent call last):
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/config/", line 56, in <module>
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/config/", line 48, in main
    execfile(script, frozenglobals)
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/dom/bindings/", line 80, in <module>
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/dom/bindings/", line 58, in main
    parser.parse(''.join(lines), fullPath)
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/dom/bindings/parser/", line 3818, in parse
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/other-licenses/ply/ply/", line 263, in parse
    return self.parseopt(input,lexer,debug,tracking,tokenfunc)
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/other-licenses/ply/ply/", line 792, in parseopt
    tok = self.errorfunc(errtoken)
  File "/scratch/work/builds/mozilla-central/mozilla-central.12-03-19.10-25/mozilla/dom/bindings/parser/", line 3768, in p_error
    raise WebIDLError("invalid syntax", [Location(self.lexer, p.lineno, p.lexpos, self._filename)])
WebIDL.WebIDLError: error: invalid syntax, CSS2Properties.webidl line 129:44
  [Throws, TreatNullAs=EmptyString, Pref=svg.markerOffset.enabled] attribute DOMString markerOffset;
make[6]: *** [ParserResults.pkl] Error 1

I suspect the code-generation needs some quotes somewhere to address this, or something.  Or maybe I'm doing something wrong?

If I use a pref-name that doesn't have any periods in it, it succeeds, and the pref works. (though that's not ideal, because we don't want to accumulate tons of prefs without any periods)

If I add escaped quotes around the pref-name, it successfully builds, but I'm not sure that the pref successfully works.  (I tried and couldn't get it to work at first)
Here's the line of the generated $OBJ/dom/bindings/CSS2Properties.webidl file, when the build fails with the attached patch.  (This is also printed in the build warning in comment 0, but here it is straight from the webidl file, for convenience):
>  [Throws, TreatNullAs=EmptyString, Pref=svg.markerOffset.enabled] attribute DOMString markerOffset;
I think I just misunderstood the parser change khuey made to support this.  I thought he allowed values with '.' in them for extended attributes, but he allowed quoted strings.  This fixes things to work fine with pref names with whatever non-quote chars you want in them.
Attachment #666393 - Flags: review?(dholbert)
Comment on attachment 666393 [details] [diff] [review]
Make CSS2Properties stuff work even with property names that are not identifiers.

Er, assume the checkin comment is fixed to talk about "pref names", not "property names".  ;)
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Comment on attachment 666393 [details] [diff] [review]
Make CSS2Properties stuff work even with property names that are not identifiers.

Looks great! Makes sense, and confirmed to fix this on my end.
Attachment #666393 - Flags: review?(dholbert) → review+
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla18
Blocks: 796212
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.