Page MenuHomePhabricator

mw.util.addPortletLink causes TypeError if the provided jQuery object is empty
Closed, ResolvedPublic

Description

After Change-Id: Ibc86c2dc33a8a3ba378138525c2523ba69bca8f1, I get
"TypeError: Cannot read property 'parentNode' of undefined"
for the command
mw.util.addPortletLink(
'p-lang', '#', 'TEST', 't-test', 'TEST', 'T', $( '.wbc-editpage' ).first()
);
when I use it on
https://en.wikipedia.org/wiki/Main_Page

If the user passes a jQuery object, but it is empty, the function should still default to $ul.append( $item ).


Version: 1.22.0
Severity: normal

Details

Reference
bz56770

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz56770.
He7d3r created this task.Nov 8 2013, 12:01 PM

Change 94601 had a related patch set uploaded by Umherirrender:
mw.util.addPortletLink: Check length before access array index

https://gerrit.wikimedia.org/r/94601

Should we backport this to 1.22, since this is a regression?

Change 94601 merged by jenkins-bot:
mw.util.addPortletLink: Check length before access array index

https://gerrit.wikimedia.org/r/94601

Change 95190 had a related patch set uploaded by Bartosz Dziewoński:
mw.util.addPortletLink: Check length before access array index

https://gerrit.wikimedia.org/r/95190

Change 95190 merged by jenkins-bot:
mw.util.addPortletLink: Check length before access array index

https://gerrit.wikimedia.org/r/95190

Fixed, merged, backported to release.