Bug - Fixed updateSafetyText() badly implemented in charpane

Bale

Minion
CharPaneDecorator.java contains the line:
Code:
StringUtilities.singleStringReplace( buffer, "<body", "<body onload=\"updateSafetyText();\"" );

Unfortunately a reference to the "basic.js" file in the relay folder is lacking. This is causing Chrome to report "Uncaught ReferenceError: updateSafetyText is not defined" in the console and is probably preventing any good things intended to result from updateSafetyText().
 
:) While I have no idea what this does, I took a stab at fixing it because I was already messing with CharPaneDecorator.java. Attached patch is against r10887 and builds/runs/fixes the javascript error.
 

Attachments

  • fix_basicjs_ref.patch
    879 bytes · Views: 33

roippi

Developer
Poked around at this a bit. Using the scratchpad in web developer tools in firefox, it did know how to run updateSafetyText().. looked around, and I see

Code:
<script language="Javascript" src="/basics.js">

way up in the head of game.php. I'm not sure why chrome doesn't know how to find it? That seems like potentially a far more serious problem than just missing whatever this function does.
 

Bale

Minion
I didn't think to look for it in game.php. Sounds like a chrome bug. I'm changing the tag to "Not a bug"
 

Catch-22

Active member
This is a bug. The basics.js is only being included in "main.php" and the chat frame. It's not being included in the charpane. IronTetsubo's patch is not the correct way to include it, either.

Edit: RequestEditorKit.getFeatureRichHTML() hands the buffer over to CharPaneDecorator.decorate() and returns before this has a chance to happen.
PHP:
// Now do anything which doesn't work in Java's internal HTML renderer
if ( addComplexFeatures )
{
	StringUtilities.insertBefore(
		buffer, "</head>", "<script language=\"Javascript\" src=\"/basics.js\"></script>" );

	StringUtilities.insertBefore(
		buffer, "</head>", "<link rel=\"stylesheet\" href=\"/basics.css\" />" );
	//Bunch of other stuff...
}

Based on this information, a dev should be able to provide the correct solution (either handle it all in CharPaneDecorator, or hand the buffer back to RequestEditorKit to finish things off and add the rest of the complex features).
 
Last edited:
Top