wikimedia-gadgets / afc-helper

A tool for reviewing Articles for Creation submissions on the English Wikipedia
https://en.wikipedia.org/wiki/Wikipedia:AFCH
GNU General Public License v3.0
37 stars 80 forks source link

Uncaught DOMException: The quota has been exceeded. #237

Open NovemLinguae opened 2 years ago

NovemLinguae commented 2 years ago

When Star Mississippi uses AFCH, when declining drafts, he reports that he is often getting an Uncaught DOMException: The quota has been exceeded. error that prevents him from being able to decline the draft. Instead, AFCH hangs. The stack trace points to this line of code:

https://github.com/WPAFC/afch-rewrite/blob/826153d3f1aa83bea5a9839fddfc7f3117143a1a/src/modules/submissions.js#L2405

More info: https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Articles_for_creation#Script_hanging

Googling indicates this may have something to do with running out of memory.

My step debugging doesn't indicate the declineCounts variable is very big though.

image

Stack trace:


Uncaught DOMException: The quota has been exceeded. Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:1668
set https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:1668
handleDecline https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:2406
addFormSubmitHandler https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:1353
jQuery 3
getText https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:894
jQuery 3
_revisionApiRequest https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:878
jQuery 3
getPageText https://en.wikipedia.org/wiki/Draft:Silverlakes_Equestrian_and_Sports_Complex line 227 > injectedScript:1166
jQuery 8
siddharthvp commented 2 years ago

AFCH.userData.set sets into both the localStorage and API useroptions. As it's a DOMException, clearly it has to do with the former. The localStorage can be full due to its use by other running javascripts.

The solution would be replace the raw localStorage calls with mw.storage wrapper that swallows any exceptions. That being said, I don't see much need for localStorage being used at all, since the local AFCH.userData._optsCache and the API options should cover all bases.