Last Comment Bug 716226 - CSSKeyframeRule created by CSSKeyframesRule.insertRule has invalid value for parentRule/parentStyleSheet and doesn't allow changes to its CSSStyleDeclaration attrib
: CSSKeyframeRule created by CSSKeyframesRule.insertRule has invalid value for ...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: Trunk
: All All
: P3 normal (vote)
: mozilla12
Assigned To: Boris Zbarsky [:bz]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-07 06:08 PST by petabyte
Modified: 2012-01-12 09:47 PST (History)
2 users (show)
bzbarsky: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
js_snippet_bugreport.js (1.29 KB, text/plain)
2012-01-07 06:08 PST, petabyte
no flags Details
When using insertRule on a keyframes rule, set up the child keyframe rule correctly. (3.46 KB, patch)
2012-01-11 08:44 PST, Boris Zbarsky [:bz]
dbaron: review+
Details | Diff | Review

Description petabyte 2012-01-07 06:08:48 PST
Created attachment 586664 [details]
js_snippet_bugreport.js

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0
Build ID: 20111216140209

Steps to reproduce:

I did the following steps with JS in a regular html document (no FF extension):
===

I programmatically created a StyleSheet node, inserted a new CSSKeyframesRule (with an initial rule) into which I also inserted a new CSSKeyframeRule. Then I accessed the CSSStyleDeclaration attributes of both CSSKeyframeRules and tried to change its `cssText` and/or one of its style properties.


===
The JS code I used to accomplish the outlined steps are available in the attached file and on Mozilla's pastebin: http://pastebin.mozilla.org/1438111


Actual results:

Changing `cssText`/style props of the 'initial' CSSKeyframeRule worked as expected. 

But the newly created CSSKeyframeRule neither has a valid value for `parentRule` nor one for `parentStyleSheet` -- both are null. When I try to change its `cssText` attribute or one of its style properties, exceptions are thrown. (Error: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMCSSStyleDeclaration.cssText])




Expected results:

`parentRule` and `parentStyleSheet` of the newly created CSSKeyframeRule should point to the according instances and changing `cssText` or a style property should be possible without throwing an exception.
Comment 1 Boris Zbarsky [:bz] 2012-01-10 21:42:56 PST
nsCSSKeyframesRule::InsertRule just appends the new rule to mRules for some reason.  That's broken.  It should call AppendStyleRule instead.
Comment 2 Boris Zbarsky [:bz] 2012-01-11 08:44:23 PST
Created attachment 587716 [details] [diff] [review]
When using insertRule on a keyframes rule, set up the child keyframe rule correctly.
Comment 3 Boris Zbarsky [:bz] 2012-01-11 09:27:53 PST
petabyte, thanks for the bug report and the testcase!
Comment 4 petabyte 2012-01-11 10:02:21 PST
I thank *you* for providing a fix so quickly. :) It's the first time I filed a bug in here, so I have no experience about how long it takes until a fix usually lands ... can you estimate how long it will take until your fix will be part of a nightly/beta build? (just roughly)
Comment 5 Boris Zbarsky [:bz] 2012-01-11 10:18:20 PST
That basically depends on how long it takes for David Baron to look over the patch and review it.  Could be anywhere from a few hours to a few months, depending on what else is on his plate.  If this is causing serious problems, I can ask him to see what he can do to expedite the review; the actual time needed to review this shouldn't be that high.

Once he reviews the patch, it'll probably take me less than a day to land it; it'll show up in a nightly at that point.
Comment 6 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2012-01-11 10:39:42 PST
Comment on attachment 587716 [details] [diff] [review]
When using insertRule on a keyframes rule, set up the child keyframe rule correctly.

r=dbaron
Comment 7 Boris Zbarsky [:bz] 2012-01-11 11:44:19 PST
Well, that answers that question.  ;)  This should be in tomorrow's (Jan 12, PST) nightlies.

https://hg.mozilla.org/integration/mozilla-inbound/rev/d28ab93ab623
Comment 8 petabyte 2012-01-11 12:49:14 PST
Yay! :-)
Comment 9 Matt Brubeck (:mbrubeck) 2012-01-12 08:40:27 PST
https://hg.mozilla.org/mozilla-central/rev/d28ab93ab623
Comment 10 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2012-01-12 09:47:12 PST
... which means actually the Jan 13 nightlies.

Note You need to log in before you can comment on or make changes to this bug.