Closed Bug 1337917 Opened 3 years ago Closed 3 years ago

CSSRule constants aren't exposed to JS correctly


(Core :: DOM: CSS Object Model, defect)

51 Branch
Not set





(Reporter: rbyers, Unassigned)


User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2984.0 Safari/537.36

Steps to reproduce:

Evaluate, for example:
1. Object.getOwnPropertyDescriptor(CSSRule.prototype,'CHARSET_RULE')
2. Object.getOwnPropertyDescriptor(CSSMediaRule.prototype,'CHARSET_RULE')

Actual results:

Get (respectively):
1. undefined
2. { value: 2, writable: true, enumerable: true, configurable: true }

Expected results:

Get (respectively) - as in Chrome (and others):
1. {value: 2, writable: false, enumerable: true, configurable: false}
2. undefined

In particular, CHARSET_RULE is defined as constants on CSSRule by

According to that means they should show up as writable:false properties of CSSRule.prototype (and CSSRule - which they do).  Gecko seems to be the only engine where they instead show up on each sub-interface instead of CSSRule, and as writable:true properties.

We (chromium platform predictability project) are building tools to measure interoperability, and this Gecko bug results in our tools counting quite a large number of "Gecko-specific APIs".  We could possibly hack around this in our tool but the appropriate heuristic isn't obvious, and this could indeed lead to interop problems (eg. sites doing CSSRule.prototype.
Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core
This sounds like something that would be fixed by bug 851892 (which was our last major piece of WebIDL conversion), which is currently in Nightly and Developer Edition, i.e., in Firefox 53 and later.
Yep, the behavior described in comment 0 was due to rules still being on XPConnect bindings.  On nightly I see the expected behavior.

Rick, I assume you were testing with a release build of Firefox?
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 851892
Great! Yes, I just tested on 51 - sorry for the noise!
You need to log in before you can comment on or make changes to this bug.