Page MenuHomePhabricator

Navigation error caused by "VariantAlly" gadget: "Page not found: /w/undefined"
Closed, ResolvedPublicBUG REPORT

Assigned To
None
Authored By
MilkyDefer
Dec 1 2023, 3:02 AM
Referenced Files
Unknown Object (File)
Dec 1 2023, 2:10 PM
F41550192: undefined.mp4
Dec 1 2023, 3:02 AM
Tokens
"Y So Serious" token, awarded by Cwek."Barnstar" token, awarded by Jdlrobson.

Description

Steps to replicate the issue (include links if applicable):

  • Open visual editor
  • Click any button on the toolbar
  • Page not found: /w/undefined

Event Timeline

MilkyDefer added a subscriber: Winston_Sung.

I tried using visual editor in Japanese and Korean Wikipedia and found no problems. I think it is safe to assume that this is another Chinese-exclusive problem.

As with previous experiences with Chinese language-exclusive problems, @Winston_Sung do you have any idea?

This comment was removed by HualinXMN.

The problem may not appear when safe mode is activated. That means this is most likely a local gadget issue. Sorry for casting doubt on the translation team.

This is caused by an on-wiki gadget: https://zh.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-VariantAlly.js&diff=79927662&oldid=79892477

@Jdlrobson's edit fixed it throwing exception but caused it to return undefined, causing more breakage.

As the maintainer of the gadget I suggest change line 140:

} catch (e) {
	return; // <-- here
}

into:

} catch (e) {
	return link;
}

and link 213:

var anchor_1 = target.closest('a');

into

var anchor_1 = target.closest('a[href]');
Diskdance renamed this task from Page not found: /w/undefined to Navigation error caused by on-wiki gadget: Page not found: /w/undefined.Dec 1 2023, 2:26 PM

Caused by VariantAlly function rewriteAnchors .

在T352501#9375007中,@Diskdance写道:

This is caused by an on-wiki gadget: https://zh.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-VariantAlly.js&diff=79927662&oldid=79892477

@Jdlrobson's edit fixed it throwing exception but caused it to return undefined, causing more breakage.

As the maintainer of the gadget I suggest change line 140:

} catch (e) {
	return; // <-- here
}

into:

} catch (e) {
	return link;
}

and link 213:

var anchor_1 = target.closest('a');

into

var anchor_1 = target.closest('a[href]');

fixed

This still sets an href, it just sets the href to the current page. Now click on OOUI tools reload the page. The fix to the library (https://github.com/wikimedia-gadgets/VariantAlly/pull/5) should cause it to skip over non-href <a> tags.

I've applied my own fix with @disksance 's blessing and things appear to be working now.

Func claimed this task.
Func removed Func as the assignee of this task.
Func subscribed.
Aklapper renamed this task from Navigation error caused by on-wiki gadget: Page not found: /w/undefined to Navigation error caused by "VariantAlly" gadget: "Page not found: /w/undefined".Dec 4 2023, 6:40 PM