Discussions » Development

How to identify the script which make an error popup?

§
Posted: 31 Januari 2021

I have a script (in my many userscripts installed...) which produce an error popup:
Error JavaScript application:
"exception: TypeError: document.getElementById(...) is null"

I can't found it simply:
- Disable one by one is not efficient or survey the browser console because,
It open this popup one time by day (like it search an update...)
- I have open some scripts code, to see if i can find some related to alert(),
but without result...

I use WWaterfox Classic and Gersemonkey 3.17 / Tampermonkey

§
Posted: 31 Januari 2021

Here the popup

§
Posted: 31 Januari 2021
Edited: 31 Januari 2021

Disabling one by one is the most efficient way in this case, though you will take like 1 month to figure out which script is showing this alert...

You can also try to paste and search in every single script codes this "document.getElementById(", then paste that with the element id on the page this alert is shown and if you get the null message on the console it means that that document.getElementById("ElementName") is causing the error

Usually userscripts doesn't shown an alert box with errors, this is usually only displayed in the console, then it's easy to figure out which script is causing the error, but since this is an alert box showing an error I don't think that this method will work.

You can also try to check all of your scripts to see which one of them have codes to display an personalized alert box with that 2 symbols. I don't think that this box is just an alert(), but I'm not sure how the default alert() box looks like on firefox anyways...

§
Posted: 31 Januari 2021

Thanks!
As i said, i do a search with "alert".
I do a search with "TypeError" in some scripts active:
Same no result

I think make a search about "document.getElementById" sould not efficient too:
It's very common in script and i am not coder to understand if there is an error in the execution.

In an other hand, maybe it's an addon alert...
:-)

§
Posted: 31 Januari 2021

If I were you I would do this:

  1. Find all scripts that contains "alert" and "document.getElementById"
  2. Code analysis or disabling one by one

Also, I have noticed a caption "exception" (screenshot below) that added either by the script, either by a browser. If it is added by the script, that could simplify your search a lot. Send to your browser console alert(new TypeError(123)). If the alert would not has caption "exception", it means you could search through the scripts that you get from the step 1 with phrase "exception" too.

§
Posted: 01 Februari 2021

Hmmm... thanks for your suggestions.

Since a long time i try to caught this popup.
The console option should be great but as i said this alter goes 3 time by day.
And as i remember, when i trying to open the console when i see this damn popup,
i can't open it before closing the popup.

But i am not coder...
;-)

PS:
I find a script with:

function reportMessage(msg) {
console.log(msg);
}

function reportWarning(msg) {
console.warn(msg);
}

function reportError(msg) {
console.error(msg);
}

3 time, like exactly the number of time it open the popup...
I disble these line by /* */ :
I cross my finger.
Result in 1 or 2 adys.

§
Posted: 01 Februari 2021

That is not you are looking for.

And you don't get my advice, I think. Can you just share your scripts? You are using greasemonkey, right? Here is described how to do this, up to step 3.

§
Posted: 01 Februari 2021

Konk:
Ho yes, i take your advise in consideration:
You helped me to fix the Citrus script!

I make your test "alert(new TypeError(123))" in the console:
no "exception" in the popup

I know already that the error mention is always:
"exception: TypeError: document.getElementById(...) is null"

So that "exception" signify it's a script problem?

§
Posted: 01 Februari 2021

I try to send you my scripts...
But greasemonkey don't like ZIP files...
I make a test by modifing the zip extention gif.
noway.
Any other solution?

§
Posted: 01 Februari 2021

Exception means that the script is showing the text and contains this text in the codes,search in the codes for the exception text....

Gif and zip files has nothing to do with each other....

Then send us prints and or the name of all of the scripts you use...

§
Posted: 01 Februari 2021

Btw anything that starts with console. means that it's and invisible message,not and alert)

§
Posted: 01 Februari 2021

*unless it's like console alert()

§
Posted: 01 Februari 2021
Edited: 01 Februari 2021

So that "exception" signify it's a script problem?

It is not a problem. It is a custom text that added by the script author that makes easier to find the script.

I try to send you my scripts... But greasemonkey don't like ZIP files...

You can use any file share service. https://dropmefiles.com/

§
Posted: 01 Februari 2021

Konf:
i testd your service:
https://dropmefiles.com/uPxNI

It is working ?

§
Posted: 01 Februari 2021

No, the only user script on that zip file is Flickr_-_AUTO_ShowAllGroups_(Photo_Page)_v2.user.js this doesn't help

§
Posted: 01 Februari 2021
§
Posted: 01 Februari 2021

It seems that you could erase this line
catch (e) {
alert("exception: " + e);
}

and you should probably erase this line too
catch (e) {
callback({ threadId: threadId, success: false, message: 'Exception: ' + e });
}

These seems to be the buggy scripts
Flickr Commented On (HTTPS) - v.2.29 - Tweak 2020
Flickr - Number of Favs on Photostream - OK

§
Posted: 01 Februari 2021

*I've converted all the .js files to .txt files and joined then into 1 single .txt file to make it easier to ctrl+f
https://dropmefiles.com/VsYfg

§
Posted: 01 Februari 2021

I test that !
Good job....

§
Posted: 01 Februari 2021

About "Flickr - Number of Favs on Photostream - OK "

If i comment this code to disable it: the script stop working:
//PB POP ERROR TEST by Hacker09

/*
catch (e) {
callback({ threadId: threadId, success: false, message: 'Exception: ' + e });
}
}
*/

§
Posted: 01 Februari 2021

Same if i do:

//PB POP ERROR TEST by Hacker09

/*
catch (e) {
callback({ threadId: threadId, success: false, message: 'Exception: ' + e });
}
*/

§
Posted: 01 Februari 2021

About the GM:
Flickr Commented On (HTTPS) - v.2.29 - Tweak 2020

It stop working too if i do:

// PB POP ERROR TEST by Hacker09
/*
} catch (e) {
alert("exception: " + e);
}
*/
})();

§
Posted: 01 Februari 2021

They are both the same thing. Try erasing this
catch (e) {
alert("exception: " + e);
}

If nothing I said works, then I don't know what else could be done...

§
Posted: 01 Februari 2021

when i erase these lines, the script stop working...
Maybe it possible to keep them and change the "alert("exception: " + e);" which open a popup,
for only an alert into the console console?

So , i tested, and the script work :
// PB POP ERROR TEST by Hacker09

} catch (e) {
// alert("exception: " + e);
alert();
}


But i don't know if it is good for the popup problem...

§
Posted: 01 Februari 2021

I do the same thing for GM ""Flickr - Number of Favs on Photostream - OK ""
//PB POP ERROR TEST by Hacker09
catch (e) {
// callback({ threadId: threadId, success: false, message: 'Exception: ' + e });
callback({ threadId: threadId, success: false, message: 'Test: ' + e });
}


Script work, but like for my other bad trick, i don't know id it solve the popup...

§
Posted: 01 Februari 2021

That should be good for the popup problem... Now just wait...

§
Posted: 02 Februari 2021

hacker09, "try" construction will never work without "catch" part

§
Posted: 02 Februari 2021
Edited: 02 Februari 2021

decembre, all you need to do is to remove a one single string from the screenshot. That is the topic problem fix. Still, the popup means that script is broken to some extent.

§
Posted: 02 Februari 2021

hacker09, "try" construction will never work without "catch" part



Yeah I was thinking that this is the case. Thanks

§
Posted: 02 Februari 2021

konf and hacker09, Thanks to you!

These scripts work with your suggestions (that's very old scripts unmaintained, but useful for me).
Now wait and see for the popup thing;

§
Posted: 02 Februari 2021

You are welcome.

Unfortunately we are the "only 3" active users on greasyfork anyways...

§
Posted: 02 Februari 2021

i hope not!
:-)

§
Posted: 03 Februari 2021

Good new:
No popup error since your last corrections.

Re thanks you dear, "active' users!

Post reply

Sign in to post a reply.