Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError #9761

Open
IceBane opened this issue May 8, 2024 · 10 comments
Open

Uncaught TypeError #9761

IceBane opened this issue May 8, 2024 · 10 comments

Comments

@IceBane
Copy link

IceBane commented May 8, 2024

We are getting the below error in our implementation:

Uncaught TypeError: g.indexOf is not a function
at HTMLDocument. (wet-boew.js:9816:7)
at HTMLDocument.dispatch (jquery.min.js:2:42571)
at v.handle (jquery.min.js:2:40572)
(anonymous) @ wet-boew.js:9816
dispatch @jquery.min.js:2
v.handle @jquery.min.js:2

here is the code at lines 9815-9818

confirm = function( event ) {
var elm = event.target,
$elm = $( elm ),
settings = $elm.data();

Any idea what might be causing this?

@mercury64
Copy link

What version of WET and jquery?

I am going to assume this has to do with the session timeout, as that is what the js code shows for settings= $elem.data();

Post your settings array with the refreshCallBack: value

@IceBane
Copy link
Author

IceBane commented May 9, 2024 via email

@mercury64
Copy link

mercury64 commented May 9, 2024

I think I know the problem, the javascript error is because it is expecting a function where it receives a value.

Change your refreshCallback setting to be an actual function, then in the function call your checkSessionValidity.

Try this:

        var settings = {
            inactivity: 1620000, // 27 mins
            reactionTime: 180000, // 3 mins
            sessionalive: 1620000, // 27 mins
            refreshCallbackUrl: "./keepAlive",
            logouturl: "./login",
            method: "GET",
            refreshCallback: function( response ) {
                checkSessionValidity( response );
            }
        };

@IceBane
Copy link
Author

IceBane commented May 14, 2024

Hi mercury64,

That's not it. Still getting same wet-boew.js error on line 9816:7

var elm = event.target

Would you have any other idea why the wet-boew.js file is puking?

@mercury64
Copy link

Unfortunately I cannot reproduce your issue with wet 4.0.27 and jquery 3.4.1.
I'm using the demo session-en.html page for testing.

One thing, I'm not sure why it happens is my ./keepAlive page is returning "success", but includes a \n.
This is probably just my test environment.

This is the javascript at the end of the page that I am testing with:

<script>

    (function($, window, wb) {
        "use strict";
        $(document).on("wb-ready.wb", function(event) {
            var settings = {
                inactivity: 30000, // 27 mins
                reactionTime: 15000, // 3 mins
                sessionalive: 30000, // 27 mins
                refreshCallbackUrl: "./keepAlive",
                logouturl: "./login",
                method: "GET",
              refreshCallback: function( response ) {   /* callback function used to check the server response */
                    return checkSessionValidity( response );
                }
            }
            $(".wb-sessto").trigger("reset.wb-sessto", settings);
        });

        function checkSessionValidity(responseBody) {

            var str = responseBody.replace(/['"]+/g, "");
            str = str.toUpperCase();

            if (str == "SUCCESS\n") {
                return "true";
            } else {
                return "false";
            }
        }

    })(jQuery, window, wb);
</script>

Sorry, cannot reproduce your error.

@mercury64
Copy link

Hi mercury64,

That's not it. Still getting same wet-boew.js error on line 9816:7

var elm = event.target

Would you have any other idea why the wet-boew.js file is puking?

You will have to debug in console setting break point at line 9815, 9816 and see what event.target is. This should be the modal pop up button click, maybe the default has been overridden by something else?

Screenshot 2024-05-14 at 09 01 13

@IceBane
Copy link
Author

IceBane commented May 15, 2024 via email

@IceBane
Copy link
Author

IceBane commented May 15, 2024

What do I look for it I wanted to find this being overridden by something else like you mention?

@mercury64
Copy link

mercury64 commented May 16, 2024

What do I look for it I wanted to find this being overridden by something else like you mention?

Tough question. I would approach this using one or all of the following methods:

  1. simplify your problem page, remove elements(html, sections, divs, buttons, etc...) one by one and see if the issue resolves itself
  2. get the original demo of session-timeout.html working first, then add your custom javascript
  3. start with a working page(see # 2), then add your elements, see if/when the problem comes back
  • verify you don't have multiple versions of javascript
  • default WET 4.0.27 uses javascript 2.1.4, you are using 3.4.1
  • remove any other custom javascript that is not part of default WET

If you can, post a link to your page, or post the HTML here.

If you cut&paste html, use code formatting three backticks ``` and the key word html, and close with backticks ```

```html
<html>
  <head><title>Your Page</title></head>
  <body>
     ...
  </body>
</html>
```

@IceBane
Copy link
Author

IceBane commented May 16, 2024

Okay thanks. I will have to look at this again before our next release.

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

No branches or pull requests

2 participants