Closed Bug 400366 Opened 16 years ago Closed 16 years ago

[FIX] typeof Prototype == object since 2007/05/10

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: Mardak, Assigned: jst)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

Loading the following url results in an XPC_NOT_ENOUGH_ARGS exception for calling nsIDOMWindowInternal.scroll.

http://wii.com/jp/articles/mario-galaxy/crv/vol3/index.html#id=cv_mg-3-01-orchestra

The offending line is..

$(window).scroll(TB_position)

.. where the script is probably trying to use jQuery's scroll function, but is getting window.scroll.

If I change the script to $("window").scroll(..), the exception isn't thrown.

This started happening with 20070510 nightly builds; the page works fine in Firefox 2.0.0.8 and still fails with the latest trunk 20071018.

http://bonsai.mozilla.org/cvsquery.cgi?date=explicit&mindate=2007-05-09+04&maxdate=2007-05-10+04

After doing some debugging of the jQuery $ function, it turns out it's going into the if condition on trunk because "typeof Prototype != "undefined"" and actually turns out to be object.
Oh, should have updated some steps now that I realize it's typeof Prototype causing the problem.

javascript:alert(typeof Prototype)

it should probably be "undefined" but is turning up as "object".
Regression from bug 370098. We should probably change Prototype to DOMPrototype at http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/dom/src/base/nsDOMClassInfo.cpp&rev=1.481&mark=577#570 and maybe Constructor to DOMConstructor?
Blocks: 370098
Flags: blocking1.9?
Assignee: nobody → jst
Flags: blocking1.9? → blocking1.9+
jresig: How much of an issue is this with 2-yr old versions (0.30) of jQuery's $ function checking "typeof Prototype"? Should it only affect $(window) and a particular set of jQuery functions, so only a small number of websites should be affected?
Well, with this copy of jQuery, I would say that it's "not a very big deal" - HOWEVER - I would consider the introduction of a Prototype or Constructor variable to be a VERY BIG DEAL (and a very bad thing). I'm sure if the Prototype guys found out they'd have a coronary.

But yeah, if these variables are DOM-specific, then they should probably have the DOM prefix.
Attached patch Fix.Splinter Review
Attachment #287476 - Flags: superreview?(peterv)
Attachment #287476 - Flags: review?(peterv)
Summary: typeof Prototype == object since 2007/05/10 → [FIX] typeof Prototype == object since 2007/05/10
should probably add a test for this before you check it in.
Flags: in-testsuite?
Comment on attachment 287476 [details] [diff] [review]
Fix.

Do we need to rename nsIDOMConstructor to nsIDOMDOMConstructor too?
Attachment #287476 - Flags: superreview?(peterv)
Attachment #287476 - Flags: superreview+
Attachment #287476 - Flags: review?(peterv)
Attachment #287476 - Flags: review+
Yeah, I just checked this in and did the rename (interface only, not the file). Marking FIXED.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.