Last modified: 2014-08-04 13:47:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70235, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68235 - VisualEditor: "Unknown error" on saving on officewiki
VisualEditor: "Unknown error" on saving on officewiki
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
MediaWiki integration (Other open bugs)
unspecified
All All
: High major
: VE-deploy-2014-08-14
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-18 20:40 UTC by Alex Monk
Modified: 2014-08-04 13:47 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Alex Monk 2014-07-18 20:40:38 UTC
We get "Unknown error" (not internationalised) when saving on officewiki.

This is because the response object given to ve.init.mw.Target.onSave is actually a jqXhr(?) object here for some reason, which has an error function. The data we actually want is in the responseJSON property of this, and we can also get it via .done( ... ).

This stuff comes through tryWithPreparedCacheKey and the way it fits together with everything else wasn't very clear here (lots of chaining deferreds etc.)
Comment 1 Alex Monk 2014-07-18 21:06:19 UTC
Does not affect other private wikis (checked otrswiki, collabwiki), not major/high priority.
Comment 2 Alex Monk 2014-07-23 18:13:37 UTC
officewiki is important, actually
Comment 3 Gerrit Notification Bot 2014-07-23 20:22:10 UTC
Change 148757 had a related patch set uploaded by Catrope:
Followup b141a7d23: don't display:none; the popup in the DesktopContext

https://gerrit.wikimedia.org/r/148757
Comment 4 James Forrester 2014-07-23 20:29:26 UTC
Mis-fire.
Comment 5 Roan Kattouw 2014-08-03 02:51:23 UTC
This was caused by local JS overwriting Function.prototype.bind with a broken polyfill that ignores additional parameters rather than passing them to the bound function.

We were using something like onSave.bind( this, doc, saveData ) which should have resulted in a call like onSave( doc, saveData, responseData, statusText, jqXHR ) but the broken polyfill dropped doc and saveData, causing the remaining arguments to be shifted two places to the left. Then when we check if responseData.error is defined, we're really looking at jqXHR.error, which is in fact a method on the jqXHR object, so it's always defined and we always believe there is an error, even if there isn't one. But of course we can't find an error code or error text because we're looking in the wrong place, so we say "Unknown error". In fact, we would say that even if there was an error, because the error data got shifted over into the doc parameter, which we don't look at.

https://office.wikimedia.org/w/index.php?title=MediaWiki:LAPI.js&diff=115901&oldid=24064 fixes the unconditional overwrite so Function.prototype.bind isn't overwritten if it's already present. This check was already being done for everything else that the script polyfills.

https://office.wikimedia.org/w/index.php?title=MediaWiki%3ALAPI.js&diff=115904&oldid=115902 fixes the polyfill to correctly pass additional parameters along.
Comment 6 James Forrester 2014-08-03 09:52:51 UTC
https://dpaste.de/JS7k/raw courtesy of legoktm is an mwgrep of all of the redefinitions of bind on the cluster. Yay.
Comment 7 Alex Monk 2014-08-04 13:47:52 UTC
So that last srwikibooks entry appears to be in an unused file... Roan, can you release and upstream the LAPI.js changes to the other wikis? I don't think I can do it (I'd have to do it as staff, but my global editinterface is personal, so...).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links