Closed Bug 127557 Opened 23 years ago Closed 23 years ago

getParentMenuButtonRecursive is not defined in linkToolbarItem.js

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: ajschult784, Assigned: brendan)

References

()

Details

(Keywords: js1.5)

Attachments

(1 file, 1 obsolete file)

i686 Linux from today's CVS:
I get a Javascript exception when following a link in a bugzilla bug list:
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "getParentMenuButtonRecursive is not defined"
{file: "chrome://navigator/content/linkToolbarItem.js" line: 87}]' when calling
method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021
(NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "<unknown>"  data: yes]
************************************************************

Steps to reproduce:
1) open a bugzilla bug list
2) click on a bug link

I do not see this with a clean profile, but get it everytime with my normal one.
I don't know what component this should be, but Gerv wrote linkToolbarItem.js,
so he gets it.
Attached patch patch (obsolete) — Splinter Review
move function getParentMenuBottonRecursive outside of function LinkToolbarItem
I'll look at this
To Christopher
Assignee: gerv → choess
Status: UNCONFIRMED → NEW
Ever confirmed: true
I see this with binary build 2002022406 but not 2002022208.  possibly a side
effect of bug 62124
I mean bug 62164.
If it really is a side-effect of bug 62164, Brendan should know about it, as
that patch wasn't supposed to cause any change in behavior ;) Is there any
direct evidence that this bug is caused by that change? Can we reduce this to a
simple JS testcase that fails, and/or verify for sure that bug 62164 was the
cause of this (ie, test on builds identical except for that patch)?

(Brendan, I'm cc'ing you just so that this issue is on your radar; feel free to
take it back off your radar if it seems unrelated to your change, or if you just
aren't interested in it :) )
I fear it's related, too.  Can someone (timeless?) produce a minimal JS-only
test case that shows us not picking up the function name properly?
I also get the error on build 2002022221 (right after checkin of bug 62164)
It certainly could be that bug 62164 regressed something we don't test for in
the js testsuite; cc'ing pschwartau.  We need a minimal testcase.

/be
What happens if you quit, remove the FastLoad file from your profile, and
restart?  The comment about it not happening with a clean profile suggests a
problem between FastLoad and the JS engine, although once the clean profile has
been used for one session, there should be a new FastLoad file there, and the
bug should bite again.  Does it?

/be
The default profile has the Site Navigation Bar disabled by default.  Enabling
it to "Show Only as Needed" or "Show Always" causes the behavior to appear in a
clean profile.
I debugged this, it's the second regression known to be caused by the big patch
for bug 62164.  Fix in a moment.

/be
Assignee: choess → brendan
Blocks: 122050
Keywords: js1.5, mozilla0.9.9
Target Milestone: --- → mozilla0.9.9
Severity: normal → critical
Status: NEW → ASSIGNED
Attached patch proposed fixSplinter Review
Amid the massive changes for bug 62164, I made a change to call_enumerate in
jsfun.c of the "one of these things is not like the other -- let's unify!"
sort, and that was not the right thing.  I was comparing how call_enumerate
finds the function object whose properties should be reflected into its call
object with how call_resolve finds the function object in which it will lookup
(including prototype search, as usual) a particular id.

But as the comment in this patch makes clear, call_enumerate is different.  It
must look in the scope of the compiler-created function object, not in a
possibly mutated scope belonging to a cloned function object that shares the
underlying JSFunction and JSScript with its prototype, but that exists to carry
the right scope chain (this arises with nested functions, and in XUL scripts
due to "brutal sharing").

When a XUL script sets .prototype on a function object, it is mutating a clone.
 If call_enumerate looks at that clone's scope, it will see only a property
named 'prototype'.  It will not see parameters and local variables/functions,
so it will miss getParentMenuButtonRecursive in the case at hand in this bug.

I tested this patch with the links toolbar on as needed, it works. 
Confirmation and code review for 0.9.9 sought -- this should go in today. 
Sorry for the trouble, thanks for the good testcase (Phil, we need to cover
this case somehow in the JS suite; I'll find you later today to talk about how
to do that without "brutal sharing").

/be
Attachment #71207 - Attachment is obsolete: true
QA Contact: doronr → pschwartau
Component: Browser-General → JavaScript Engine
Comment on attachment 72090 [details] [diff] [review]
proposed fix

When I added function cloning, I had no idea it would be this exciting!

sr=shaver, thanks for the nice long comment, too.
Attachment #72090 - Flags: superreview+
Blocks: 127777
Comment on attachment 72090 [details] [diff] [review]
proposed fix

r=jband. Looks right to me.
Attachment #72090 - Flags: review+
Comment on attachment 72090 [details] [diff] [review]
proposed fix

a=asa (on behalf of drivers) for checkin to 0.9.9
Attachment #72090 - Flags: approval+
Fixed in trunk and 0.9.9 branch.

/be
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 128800 has been marked as a duplicate of this bug. ***
Testcase added to JS testsuite:

        mozilla/js/tests/js1_5/Regress/regress-127557.js

This is a testcase that Brendan created, and it depends on the new
clone() function in js.c, the SpiderMonkey shell, just added today:

Usage:
clone     clone(fun[, scope])    Clone function object
The testcase now passes in the current JS debug/optimized shell on 
WinNT, Linux, and Mac9.1. However, if the fix for this bug is backed out,
the test fails as follows:

                ReferenceError: h_peer is not defined

Marking Verified FIXED -
Status: RESOLVED → VERIFIED
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: