Bug - Not A Bug r12630 produces relay browser display issues

Bale

Minion
In r12630 the relay browser began to display differently depending on the value of relayUsesCachedImages. A clear example is displayed by bordemstirs's Raidlog Override.


A picture is worth a thousand words, so here are two thousand words of explanation.
  • On the left is the display under r12629 (and any value for relayUsesCachedImages).
  • On the right is r12630 with relayUsesCachedImages == false.
  • Note that r12630 will display the image on the left if relayUsesCachedImages == true.


x2z.gif
 
Last edited:
Does this only affect this page, as I can see it here but not elsewhere?

There is a piece of code missing from the page where the links are coloured in default rather than black, which is :
Code:
<script language=Javascript>
<!--
if (parent.frames.length == -1) location.href="game.php";
//-->
</script>
<script language=Javascript src="/images/scripts/keybinds.min.2.js"></script>
<script language=Javascript src="/images/scripts/window.20111231.js"></script>
<script language="javascript">function chatFocus(){if(top.chatpane.document.chatform.graf) top.chatpane.document.chatform.graf.focus();}
if (typeof defaultBind != 'undefined') { defaultBind(47, 2, chatFocus); defaultBind(190, 2, chatFocus);defaultBind(191, 2, chatFocus); defaultBind(47, 8, chatFocus);defaultBind(190, 8, chatFocus); defaultBind(191, 8, chatFocus); }</script><script language=Javascript src="jquery-1.10.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="/images/styles.20130904.css">

It is present when the raidlogs are switched to KoL ones rather than modified ones, and when using cached images is disabled.

I think the issue is around this line : matcher m=create_matcher("/images/scripts/jquery.+?js",page.substring(12,i));

It matches /images/scripts/jquery-1.3.1.min.js but not images.kingdomofloathing.com/scripts/jquery-1.3.1.min.js.
 
I get you're saying that this is a script error. I'm not entirely satisfied though because of two questions.
  1. Why should the script behave differently before and after r12630?
  2. And why should relayUsesCachedImages affect the result after r12630?
 
I don't think I said it was a script error. I said the difference I could see is that a section got cut out when the script was in place. I've been away for the weekend and haven't caught up with the detail of what changed when I was away.

It works differently because it appears that in 12629 even with relayUsesCashedImages off, it would still cache scripts at /images/scripts. In 12630 it doesn't, as that code was removed.

I'm not going to change that back without understanding why it was removed.
 
The old standard seems to be that mafia would always used a cached images/scripts directory regardless of setting. All calls to images.kingdomofloathing.com/scripts would automatically be replaced with /images/scripts
The change in r12630 broke script behavior. That's why the raidlog is failing to work properly with image caching disabled. The raidlog only has access to /images/scripts when it should be checking for both. The following change in the script should at least lead to a solution:
Code:
matcher m=create_matcher("http://images\\.kingdomofloathing\\.com|images)/scripts/jquery.+?js",page.substring(12,i));
I put mention of it in the thread.

@Darzil: I think it was changed because if the cache is disabled, all images.kingdomofloathing.com calls should be going to KoL rather than using any cache. Using the cache would then be buggy behavior. VEracity is putting some work in to this (see here) so we may get a few changes.
 
Last edited:
And I'd like to understand why we cached scripts, previously, when we had the only "caching" setting turned off!

Since I had observed that browsers cached things on their own - except when we cached things, in which case they continually asked KoLmafia to serve them - I decided to cache nothing when the only caching setting was disabled. I am considering moving to caching that does not depend on munging the links in the page text, but simply caches images the first time the browser asks for them and serves the local image henceforth. I experimented with this yesterday, but have a ways to go before I submit it.

I believe that KoLmafia should work correctly, whether or not it caches things. (That is "should", as in a design principle, not "should", as in "it's working correctly now".)

Apparently this script depends on working with KoLmafia's link munging. So, yes - the change in behavior was prompted by a KoLmafia change, but the "bug" reported here will need to be fixed in the script that depended on the old behavior. I'd encourage it to not do that, since I don't think the old behavior is coming back.
 
And that's why my post went into the script's own topic. ;)

As I suspected, a simple script edit fixes everything - thanks, Fluxxdog!
 
Back
Top