Closed
Bug 612267
Opened 14 years ago
Closed 14 years ago
Methods added to Window.prototype don't show up on window
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla2.0b9
Tracking | Status | |
---|---|---|
blocking2.0 | --- | betaN+ |
People
(Reporter: t.brain, Assigned: mrbkap)
References
Details
(Keywords: regression, testcase)
Attachments
(2 files, 1 obsolete file)
193 bytes,
text/html
|
Details | |
7.12 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; .NET4.0C) Build Identifier: 4.0b7 After adding a method to Window.prototype, the method doesn't show up on the existing window object. Similarily, getters/setters or other fields don't show up either. This is a regression in 4.0b7, and is confirmed to work as expected in 4.0b6 and 3.5. Reproducible: Always Steps to Reproduce: Use the following code: Window.prototype.testMethod=function () { alert("foo") }; window.testMethod(); Actual Results: Throws a "window.testMethod is not a function" error. Under 4.0b6 and 3.5, alerts "foo". Expected Results: Should always alert "foo".
Comment 1•14 years ago
|
||
Working with 3.6 FWIW.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Vista → All
Hardware: x86 → All
Version: unspecified → Trunk
Comment 2•14 years ago
|
||
Testcase should show "foo". Showing an error message on trunk.
Updated•14 years ago
|
![]() |
||
Comment 4•14 years ago
|
||
Yeah, Window.prototype is no longer on the __proto__ chain for |window|. In particular, I see: window.__proto__.__proto__.__proto__.__proto__ === null window.__proto__.__proto__.__proto__ === Object.prototype window.__proto__.__proto__ === global scope polluter window.__proto__ == some XPConnect prototype (according to toString()), but not Window.prototype Blake?
blocking2.0: --- → ?
Component: DOM: Core & HTML → XPConnect
QA Contact: general → xpconnect
Comment 5•14 years ago
|
||
Whether this is by design (which I suspect it is) or something that needs to be fixed is one question that we at least need answered before we ship.
Assignee: nobody → mrbkap
blocking2.0: ? → betaN+
Assignee | ||
Comment 6•14 years ago
|
||
I *think* that the real fix here was to fix up the outer window's prototype, but I also think that the RefreshProtype had been misplaced to begin with.
Attachment #496671 -
Flags: review?(jst)
Assignee | ||
Comment 7•14 years ago
|
||
So, the real problem was that the outer window's (proxy's) prototype was not being updated when we refreshed the prototype of the inner window. Then, when we called ConnectToInner, we would overwrite the new prototype with the old one, leading to the inconsistent state found here. I also moved the RefreshPrototype call into SetOuterObject since that's called on every pageload instead of just the first (as it should have been from the beginning). The real bug fix is the addition of the JS_SetPrototype in SetOuterObject. The assertion that replaces the code in ConnectToInner would have caught the bug much more easily.
Attachment #490555 -
Attachment is obsolete: true
Attachment #496987 -
Flags: review?(jst)
Assignee | ||
Updated•14 years ago
|
Attachment #496671 -
Attachment is obsolete: true
Attachment #496671 -
Flags: review?(jst)
Assignee | ||
Updated•14 years ago
|
Attachment #490555 -
Attachment is obsolete: false
Comment 8•14 years ago
|
||
Comment on attachment 496987 [details] [diff] [review] Proposed fix v1.1 Looks good, but when reading through this I did notice that nsJSContext::InitOuterWindow() is unused now (afaict), so please file a followup bug to delete it (impl and interface definition).
Attachment #496987 -
Flags: review?(jst) → review+
Comment 9•14 years ago
|
||
Since this bug had the regressionwindow-wanted keyword set (probably redundant given the r+ patch, but didn't want to remove the keyword without actually giving a regression range in case it was intentional). Last good nightly: 2010-10-13 First bad nightly: 2010-10-14 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f6e81dd5a125&tochange=ad0a0be8be74
Keywords: regressionwindow-wanted
Assignee | ||
Comment 10•14 years ago
|
||
Thanks Ed. That shows that it was the compartments landing that broke this. That which makes sense, since compartments introduced the crazy RefreshProtoype dance that I had to fix here.
Assignee | ||
Comment 11•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/b445e3e2dff0
Whiteboard: fixed-in-tracemonkey
Updated•14 years ago
|
Summary: Methods added to Window.prototype don't show up on window → [ready to land] Methods added to Window.prototype don't show up on window
Comment 12•14 years ago
|
||
Pushed: https://hg.mozilla.org/mozilla-central/rev/307f6c854845
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: fixed-in-tracemonkey
Target Milestone: --- → mozilla2.0b9
Comment 13•14 years ago
|
||
It's actually: https://hg.mozilla.org/mozilla-central/rev/b7fbd54c9622
Summary: [ready to land] Methods added to Window.prototype don't show up on window → Methods added to Window.prototype don't show up on window
You need to log in
before you can comment on or make changes to this bug.
Description
•