Closed
Bug 404748
Opened 17 years ago
Closed 17 years ago
__defineSetter__ regression in FF3: no longer works with event properties when used on prototype
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla1.9beta2
People
(Reporter: fick_el, Assigned: jst)
References
Details
Attachments
(2 files, 2 obsolete files)
510 bytes,
text/html
|
Details | |
1.93 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
mtschrep
:
approval1.9+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9b1) Gecko/2007110904 Firefox/3.0b1
Build Identifier:
The following code works well in FF2 and earlier:
HTMLDivElement.prototype.__defineSetter__("onclick",function () { alert("setter called"); });
divRef.onclick=function () {};
In FF3b the setter is never called. It is called fine for non-event properties, but all event properties stopped working.
This regression is critical for us and will require going through many changes in order to workaround. Can this be fixed for FF3?
Reproducible: Always
Comment 1•17 years ago
|
||
Could you attach a minimal testcase using "Add an attachment"?
And finding the regression range would be great http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/
Comment 3•17 years ago
|
||
Regression somewhere between 2006-09-01 - 2006-11-15
Comment 4•17 years ago
|
||
2006-10-06-04-trunk works, 2006-10-07-04-trunk doesn't.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 5•17 years ago
|
||
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-10-06+01%3A00%3A00&maxdate=2006-10-07+07%3A00%3A00&cvsroot=%2Fcvsroot
I'd guess bug 349465.
Blocks: 349465
Comment 7•17 years ago
|
||
Ah, didn't notice bug 159849.
Comment 8•17 years ago
|
||
Indeed, regression from bug 159849. Tested backing out locally.
Blocks: 159849
Comment 9•17 years ago
|
||
I don't see a way to make both |with| (which requires that the property resolve somewhere on the prototype chain of the object) and the defineSetter thing here work short of always making sure to define the property on an ancestor of the prototype defineSetter was called on. Of course people can call it at arbitrary places in the prototype chain (Object.prototype, anyone)? And we don't really want to be putting on* properties on Object.prototype.
Put another way, we could perhaps with a lot of pain put the properties on HTMLDivElement.prototype, but then someone calling HTMLElement.prototype.defineSetter will run into this exact same bug.
Unless I'm seriusly missing something about how the JS engine works, I think our only reasonable options are that we ship either this bug or bug 159849.
Flags: blocking1.9?
Reporter | ||
Comment 10•17 years ago
|
||
Boris, I understand the point you make about the impossibility of supporting people trying to call it at arbitrary places in the chain. However, I believe that the main issue here is to keep supporting code that was already working, and not necessarily try to accommodate any conceivable new situation.
HTMLSomeElement.prototype.__defineSetter__ on event properties worked up to and including FF2. The patch to bug 159849, which broke it, was never included in any official release, as far as I'm aware. So basically the choice is between keeping backward compatibility, and introducing new functionality.
I may not be entirely objective, but I'd argue that the new functionality offered by the 159849 patch is coming to support a feature that is both generally discouraged for performance and ambiguity reasons (FF 1.5 even had a strict warning about usage of 'with') and is not helping support more websites, as the syntax choice is very rare.
I'd definitely go with keeping backward compatibility here.
Comment 11•17 years ago
|
||
> the main issue here is to keep supporting code that was already working
Yes, but the question is what this set of code should be.
> So basically the choice is between keeping backward compatibility, and
> introducing new functionality.
It's a choice between keeping compatibility and making some sites that used to not work work...
> as the syntax choice is very rare.
Sadly, it's not. There's a lot of "with" usage out there, esp. in some of the JS libraries floating around (Dreamweaver stuff comes to mind).
I do agree that it's not clear which way the tradeoff should go here; we need data... Plus I'd like to hear what Brendan has to say, if anything.
Assignee | ||
Comment 12•17 years ago
|
||
Assignee | ||
Comment 13•17 years ago
|
||
This reverts us to work as we used to in the case described here. bz, what do you think about this approach?
Attachment #289715 -
Flags: superreview?(bzbarsky)
Attachment #289715 -
Flags: review?(bzbarsky)
Comment 14•17 years ago
|
||
I guess that works. It makes the behavior ordering-dependent (so if you assign on an object once before the defineSetter call, the setter will never get called for future sets of that property on that object), but if we assume the defineSetter happens early enough it would work.
I'm a little confused by two parts of the patch:
1) When doing an assignment, why are we now doing a RegisterCompileHandler if
there is a setter up the proto chain?
2) How can we hit the !ok case in the innermost |if| there? The previous
condition was "!proto || (ok && hasProp)", right?
Assignee | ||
Comment 15•17 years ago
|
||
(In reply to comment #14)
> I guess that works. It makes the behavior ordering-dependent (so if you assign
> on an object once before the defineSetter call, the setter will never get
> called for future sets of that property on that object), but if we assume the
> defineSetter happens early enough it would work.
Yeah, not sure we can do much about that...
> I'm a little confused by two parts of the patch:
>
> 1) When doing an assignment, why are we now doing a RegisterCompileHandler if
> there is a setter up the proto chain?
> 2) How can we hit the !ok case in the innermost |if| there? The previous
> condition was "!proto || (ok && hasProp)", right?
Both of those are screwups when I refactored some of that code from an earlier version... New patch coming up.
Assignee | ||
Comment 16•17 years ago
|
||
Attachment #289714 -
Attachment is obsolete: true
Attachment #289715 -
Attachment is obsolete: true
Attachment #289735 -
Flags: superreview?(bzbarsky)
Attachment #289735 -
Flags: review?(bzbarsky)
Attachment #289715 -
Flags: superreview?(bzbarsky)
Attachment #289715 -
Flags: review?(bzbarsky)
Comment 17•17 years ago
|
||
Comment on attachment 289735 [details] [diff] [review]
Updated fix.
This, I buy.
Please check in some tests to go with the fix?
Attachment #289735 -
Flags: superreview?(bzbarsky)
Attachment #289735 -
Flags: superreview+
Attachment #289735 -
Flags: review?(bzbarsky)
Attachment #289735 -
Flags: review+
Updated•17 years ago
|
Assignee: nobody → jst
Assignee | ||
Comment 18•17 years ago
|
||
I'd love to see someone step up and help write testcases for this, and to get this landed. This isn't a high priority blocker, if a blocker at all, so I'd love to not spend more time on this now unless I have to.
Assignee | ||
Updated•17 years ago
|
Attachment #289735 -
Flags: approval1.9?
Comment 19•17 years ago
|
||
Comment on attachment 289735 [details] [diff] [review]
Updated fix.
would be great to get some tests with this...
Attachment #289735 -
Flags: approval1.9? → approval1.9+
Updated•17 years ago
|
Keywords: checkin-needed
Comment 20•17 years ago
|
||
Checking in dom/src/base/nsDOMClassInfo.cpp;
/cvsroot/mozilla/dom/src/base/nsDOMClassInfo.cpp,v <-- nsDOMClassInfo.cpp
new revision: 1.492; previous revision: 1.491
done
Status: NEW → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M10
Comment 22•17 years ago
|
||
(In reply to comment #14)
> I guess that works. It makes the behavior ordering-dependent (so if you assign
> on an object once before the defineSetter call, the setter will never get
> called for future sets of that property on that object), but if we assume the
> defineSetter happens early enough it would work.
That's life on the prototype chain, though. Sorry I didn't reply to my summons earlier -- was traveling last week -- glad to see you guys sorted it out.
/be
Comment 23•10 years ago
|
||
Issue is Resolved - removing QA-Wanted Keywords - QA-Wanted query clean-up task
Keywords: qawanted
You need to log in
before you can comment on or make changes to this bug.
Description
•