Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

[BUG-225356] Changed media event is not firing when the URL is amended by a '#' on post-Alex Ivy viewers. #4180

Open
sl-service-account opened this issue Aug 28, 2018 · 4 comments

Comments

@sl-service-account
Copy link

sl-service-account commented Aug 28, 2018

Please refer to this discussion on the forums: https://community.secondlife.com/forums/topic/426794-scripts-not-communicating-for-a-specific-user/

Short summary of the problem from the HUD creator

The system begins with a single prim with media (website) on a single face. When buttons on the webpage are pressed, the event is reflected in the webpage's URL through the addition of a '#' followed by some text - just like the use of internal links. A script in the hosting prim uses the 'changed' event to detect 'changed media'. When this event detects the addition of a '#', the text following it is parsed to interpret the command the script is to execute.

**With the recent update, the changed media event is not firing when the URL is amended by a '#'**.


I'm afraid my scripting isn't good enough to recreate a simple repro object, so the steps below show how to recreate the bug with the HUD created by @Vindictii.

Steps To Reproduce

Attachments

Original Jira Fields
Field Value
Issue BUG-225356
Summary Changed media event is not firing when the URL is amended by a '#' on post-Alex Ivy viewers.
Type Bug
Priority Unset
Status Accepted
Resolution Accepted
Reporter Whirly Fizzle (whirly.fizzle)
Created at 2018-08-28T17:08:35Z
Updated at 2018-09-07T14:33:32Z
{
  'Build Id': 'unset',
  'Business Unit': ['Platform'],
  'Date of First Response': '2018-08-28T13:39:42.070-0500',
  "Is there anything you'd like to add?": 'Bloody bloody media bugs',
  'ReOpened Count': 0.0,
  'Severity': 'Unset',
  'System': 'SL Viewer',
  'Target Viewer Version': 'viewer-development',
  'What just happened?': 'Media....',
  'What were you doing when it happened?': 'Bloody media...',
  'What were you expecting to happen instead?': 'Seriously, bloody media....',
  'Where': 'Any region',
}
@sl-service-account
Copy link
Author

Chaser Zaks commented at 2018-08-28T18:39:42Z, updated at 2018-08-28T18:41:18Z

I put a thingy west bound of http://maps.secondlife.com/secondlife/Testylvania%20Sandbox/108/161/21 which appears to reproduce this from the description. Object and scripts are full perm and shared with the Testylvanian group if need be to poke at the thing.

From a web development standpoint, updating(not replacing) the URL in CEF would make sense as it follows anchor links and triggers the "hashchange" window event in javascript.
Example implementation on how this would be fixed(in pseudo code):

//Example URL: https://secondlife.com/example/document.htm?key=value#anything
//Splitting it into a "path" would cause:
//origin: <protocol>://<host>[:port] (https://secondlife.com)
//pathname: [slash separated string] (/example/document.htm)
//querystring: [?[key=value[&...]]
//hashstring: [#[anything]]


path currentUrl;
media change message(path url)
    if(url.origin == currentUrl.origin && url.pathname == currentUrl.pathname && url.querystring == currentUrl.querystring)
        if(url.hashstring != currentUrl.hashstring)
            update url(Cause the "hashchange" window event, don't cause a navigation event(refresh/reload/etc))
        
        //else do nothing
    
    else
        replace url(Cause navigation event)
    
    currentUrl = url;

@sl-service-account
Copy link
Author

Whirly Fizzle commented at 2018-08-28T21:06:29Z

Confirmed Chaser's test page at https://felix.softhyena.com/BUG-225356.htm reproduces the bug on post-Alex Ivy viewers but not on pre-Alex Ivy viewers.

Clicking on the bottom ?test link followed by the top #test link.

  • On Alex Ivy viewers: Bottom link fires change event 2048 (CHANGED_MEDIA), top link does not.
  • On Pre-Alex Ivy viewers: Bottom link fires change event 2048 (CHANGED_MEDIA), top link fires change event 2048 (CHANGED_MEDIA).

@sl-service-account
Copy link
Author

Oz Linden commented at 2018-09-05T16:03:55Z, updated at 2018-09-05T22:20:58Z

Can you make a simple LSL script that illustrates the problem without picking up all of a HUD?

and it would appear from Chasers demo that appending/modifying a query parameter does still generate the Changed event.  Is there a reason why you can't use that?  There's nothing wrong with the server ignoring parameters it doesn't care about.

@sl-service-account
Copy link
Author

Whirly Fizzle commented at 2018-09-07T14:33:32Z

  • Rez a box & make it a suitable size for a media screen.

  • Add the following script to the box

    list sites = [
        "https://felix.softhyena.com/BUG-225356.htm?test=0.8990316884092033"
    ];
    
    string currentUrl;
    
    setupMedia(string url){
        llSetPrimMediaParams(2, [
            PRIM_MEDIA_ALT_IMAGE_ENABLE, FALSE,
            PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_STANDARD,
            PRIM_MEDIA_CURRENT_URL, url,
            PRIM_MEDIA_HOME_URL, url,
            PRIM_MEDIA_AUTO_LOOP, TRUE,
            PRIM_MEDIA_AUTO_PLAY, TRUE,
            PRIM_MEDIA_AUTO_SCALE, TRUE,
            PRIM_MEDIA_AUTO_ZOOM, FALSE,
            PRIM_MEDIA_FIRST_CLICK_INTERACT, TRUE,
            PRIM_MEDIA_WIDTH_PIXELS, 1024,
            PRIM_MEDIA_HEIGHT_PIXELS, 1024,
            PRIM_MEDIA_WHITELIST_ENABLE, FALSE,
            PRIM_MEDIA_WHITELIST, "",
            PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_ANYONE,
            PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_ANYONE
        ]);
    }
    
    setMediaUrl(string url){
        llSay(0, "Media set to "+url);
        llSetPrimMediaParams(2, [
            PRIM_MEDIA_CURRENT_URL, url
        ]);
    }
    
    list getChanges(integer change){
        list evt;
        if((CHANGED_INVENTORY&change) == CHANGED_INVENTORY)evt = evt + "CHANGED_INVENTORY";
        if((CHANGED_COLOR&change) == CHANGED_COLOR)evt = evt + "CHANGED_COLOR";
        if((CHANGED_SHAPE&change) == CHANGED_SHAPE)evt = evt + "CHANGED_SHAPE";
        if((CHANGED_SCALE&change) == CHANGED_SCALE)evt = evt + "CHANGED_SCALE";
        if((CHANGED_TEXTURE&change) == CHANGED_TEXTURE)evt = evt + "CHANGED_TEXTURE";
        if((CHANGED_LINK&change) == CHANGED_LINK)evt = evt + "CHANGED_LINK";
        if((CHANGED_ALLOWED_DROP&change) == CHANGED_ALLOWED_DROP)evt = evt + "CHANGED_ALLOWED_DROP";
        if((CHANGED_OWNER&change) == CHANGED_OWNER)evt = evt + "CHANGED_OWNER";
        if((CHANGED_REGION&change) == CHANGED_REGION)evt = evt + "CHANGED_REGION";
        if((CHANGED_TELEPORT&change) == CHANGED_TELEPORT)evt = evt + "CHANGED_TELEPORT";
        if((CHANGED_REGION_START&change) == CHANGED_REGION_START)evt = evt + "CHANGED_REGION_START";
        if((CHANGED_MEDIA&change) == CHANGED_MEDIA)evt = evt + "CHANGED_MEDIA";
        return evt;
    }
    
    default{
        state_entry(){
            llSetLinkPrimitiveParamsFast(1, [
                PRIM_TEXT, "BUG-225356 Repro", <1,1,1>, 1,
            PRIM_LINK_TARGET, 2,
                PRIM_TEXT, "Click to reset URL", <1,1,1>, 1,
            PRIM_LINK_TARGET, 3,
                PRIM_TEXT, "Click to append \"#test=<random>\" via LSL", <1,1,1>, 1
            ]);
            currentUrl = llList2String(sites, llFloor(llFrand(llGetListLength(sites))));
            setupMedia(currentUrl);
        }
    
        touch_start(integer total_number){
            integer i = llDetectedLinkNumber(0);
            if(i == 2){
                currentUrl = llList2String(sites, llFloor(llFrand(llGetListLength(sites))));
                setMediaUrl(currentUrl);
            }else if(i == 3){
                setMediaUrl(currentUrl+"#test="+(string)llFrand(1));
            }
        }
        
        changed(integer c){
            llSay(0, "I received change event "+(string)c+" ("+llDumpList2String(getChanges(c), "|")+")");   
        }
    }
  • On the media face, click the bottom ?test link & observe in local chat that a CHANGED_MEDIA event is fired.

  • Click the top #test link & observe that no CHANGED_MEDIA event is fired.

  • On Pre-Alex Ivy viewers, both the ?test and the #test links produce a CHANGED_MEDIA event.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant