Closed Bug 7018 Opened 25 years ago Closed 25 years ago

brendan's home page gets crash

Categories

(Core Graveyard :: Java: Live Connect, defect, P3)

x86
Windows 95
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: chofmann, Assigned: beard)

References

()

Details

(Whiteboard: Y2k)

top100 site ;-) -> brendan's home page gets crash on M6 candidate...

if you ingnore the crash and proceed, the console shows...

FindBookmarkShortcut: in='http://people.netscape.com/brendan/'  out=''
JavaScript error: missing name after . operator
URL: http://people.netscape.com/brendan/ LineNo: 47
Line text: 'knob = mocha.this;', Error text: 'this;'
JavaScript error: missing name after . operator
URL: http://people.netscape.com/brendan/ LineNo: 50
Line text: 'window.', Error text: ''
Document: Done (11.15 secs)
Got a handle to forward menu item
Setting forward menu item disabled
Obtained MenuItem Back
Setting Back menuitem to enabled
Document http://people.netscape.com/brendan/ loaded successfully

talkback stack looks like...

 Call Stack:    (Signature = jsj_MapJSContextToJSJThread 340da52c)
jsj_MapJSContextToJSJThread
    [d:\builds\seamonkey\mozilla\js\src\liveconnect\jsj_utils.c, line 425]
JavaPackage_resolve
    [d:\builds\seamonkey\mozilla\js\src\liveconnect\jsj_JavaPackage.c, line 152]
js_LookupProperty
    [d:\builds\seamonkey\mozilla\js\src\jsobj.c, line 1505]
js_GetProperty
    [d:\builds\seamonkey\mozilla\js\src\jsobj.c, line 1666]
js_Interpret
    [d:\builds\seamonkey\mozilla\js\src\jsinterp.c, line 2173]
js_Execute
    [d:\builds\seamonkey\mozilla\js\src\jsinterp.c, line 817]
JS_EvaluateUCScriptForPrincipals
    [d:\builds\seamonkey\mozilla\js\src\jsapi.c, line 2392]
nsJSContext::EvaluateString
[d:\builds\seamonkey\mozilla\dom\src\base\nsJSEnvironment.cpp, line 127]
HTMLContentSink::EvaluateScript
   [d:\builds\seamonkey\mozilla\layout\html\document\src\nsHTMLContentSink.cpp,
line 2742]
HTMLContentSink::ProcessSCRIPTTag
    [d:\builds\seamonkey\mozilla\layout\html\document\src\nsHTMLContentSink.cpp,
line 2854]
HTMLContentSink::AddLeaf
   [d:\builds\seamonkey\mozilla\layout\html\document\src\nsHTMLContentSink.cpp,
line 1949]
CNavDTD::AddLeaf
   [d:\builds\seamonkey\mozilla\htmlparser\src\CNavDTD.cpp, line 2801]
CNavDTD::AddHeadLeaf
     [d:\builds\seamonkey\mozilla\htmlparser\src\CNavDTD.cpp, line 2834]
CNavDTD::HandleStartToken
       [d:\builds\seamonkey\mozilla\htmlparser\src\CNavDTD.cpp, line

I think we have been crashing on this page with other problems
but they have been fixed and we are now exposing some new bugs..
hey how did brendan get to be in the hot 100?

fur, is this yours?
hey how did brendan get to be in the hot 100?

fur, is this yours?
From the crash location, my guess is that the OJI code isn't setting up the
correct set of callbacks when no JVM plugin is installed, i.e. the
map_js_context_to_jsj_thread() callback should fail and return an error message
that indicates that Java is not installed.

I'm not sure who gets OJI bugs these days.  Would it be Patrick Beard ?
he drives a boxter. he digs chelsea. thats hot!
and the mac stack is...

 Call Stack:    (Signature = 0xf400f500 8d518110)
  0xf400f500
  JavaPackage_resolve()
                                     [jsj_JavaPackage.c, line 151]
  js_LookupProperty()
                                     [jsobj.c, line 1503]
  js_GetProperty()
                                     [jsobj.c, line 1660]
  js_Interpret()
                                     [jsinterp.c, line 2155]
  js_Execute()
                                     [jsinterp.c, line 815]
  JS_EvaluateUCScriptForPrincipals()
                                     [jsapi.c, line 2390]
  DOM_DLL + 0x378c (0x16ddd0dc)
  layout.shlb + 0x36384 (0x1765c144)
  layout.shlb + 0x36858 (0x1765c618)
  layout.shlb + 0x33c20 (0x176599e0)
  CNavDTD::AddLeaf()
                                     [CNavDTD.cpp, line 2798]
Looks like a threading problem.

-Chris
Threading prob?  If so, chofmann please to be assigning this bug to
chouck@knobproductions.com.

While you're at it, file a bug with knobproductions.com's bugsystem about my
page, it still says my car is gray and orange, it should say silver and red.

/be
chouck sez he won't work on js threading problems.
he is focused only on nspr 1.0.
Assignee: beard → fur
The problem is in the LiveConnect function:

JSJavaThreadState *
jsj_MapJSContextToJSJThread(JSContext *cx, JNIEnv **envp);

JSJ_callbacks is NULL, but this function doesn't check that, so it crashes.
Adding a NULL check fixes the crash. Here's the patch if you want to check this
in:

Index: jsj_utils.c
===================================================================
RCS file: /cvsroot/mozilla/js/src/liveconnect/jsj_utils.c,v
retrieving revision 1.4
diff -r1.4 jsj_utils.c
423c423
<     if (jsj_env == NULL)
---
>     if (jsj_env == NULL && JSJ_callbacks != NULL)
Target Milestone: M7
chouck sez he depends on this in M7.
we need to deliver it by then.
chouck who?
I don't think this is the right fix.  JSJ_Callbacks should not be NULL if
LiveConnect is engaged, i.e. if there's a JVM plugin and Java/LiveConnect is
enabled.  What I could do instead is to add code which causes the
per-JSContext initialization of LiveConnect to fail if JSJ_Callbacks hasn't been
set up, but this would merely amount to a safeguard against erroneous usage of
the LiveConnect APIs.

I still regard this as a failure on the part of OJI, however, since no error
message is avilable to be displayed on the JS console when a script fails in its
attempt to use LiveConnect, e.g. "No JVM plugin installed" or "Java is disabled
in the control panel".  The LiveConnect callback API has provisions for error
messages for exactly this purpose, but OJI is apparently not defining these
callbacks.
Assignee: fur → beard
I never noticed that this was reassigned back to me.  Please look at my previous
comment as to why I believe this to be an OJI problem.
Status: NEW → ASSIGNED
Whiteboard: Y2k
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
I've fixed this by not doing the per-JSContext class initialization of
LiveConnect. That way, if Java isn't around, then "java.*" isn't defined at all.
Better?

Checked in a fix in mozilla/dom/src/base/nsJSEnvironment.cpp,1.32.
This sounds like a reasonable solution.  One possible problem, however, is that
the error messages that result when a script accesses LiveConnect when it's
unavailabel may be somewhat incomprehensible, e.g. "java has no properties",
instead of, "Failed attempt to access Java because it has been disabled in the
preferences panel".

Along similar lines, we need to make sure that no crash will result when
accessing LiveConnect from the Java side if JS has been disabled via prefs.
Status: RESOLVED → VERIFIED
works fine in today's viewer. however there are still some serious problems
with that page.  for example, the Geek Code block should have X+++:

"This is the BEST show on TV, and it's about time. I've seen everything David
Duchovny and Gillian Anderson have ever done that been recorded and I'm a loyal
Duchovny/ Gillian Anderson fan. I've Converted at least 10 people. I have every
episode at SP, debate the fine details on-line, and have a credit for at least
2 YAXAs."
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.