Page MenuHomePhabricator

Template wizard (user script prototype) won't insert a template in IE11
Closed, DeclinedPublic

Description

I (re)tested out the template wizard by using the javascript code. It works well at Chrome and Firefox.

However, I was testing the wizard at IE11 on Windows 7. When I was trying to insert a template, the wizard won't load, i.e. it won't insert the template. I clicked the "Cancel" button, but it won't stop or do anything else.

I retried the wizard again and F12 console and debugger to detect exceptions, which I found as shown below:

I was also using the gadget to display javascript errors:

Details

Related Gerrit Patches:
mediawiki/extensions/TemplateWizard : masterAvoid endswith(), for ES5 compatibility

Event Timeline

gh87 created this task.Apr 2 2018, 8:15 AM
Restricted Application added a project: Community-Tech. · View Herald TranscriptApr 2 2018, 8:15 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@gh87: Please paste text (like error messages) as plain text data (and not only as image files). It allows others who run into the same problem to search for the text and find an already existing report. Thanks.

@Aklapper Copy-pasting results of Console mode contents as-is are indeed hard (if I'm George Ho, I kindly will also make a screenshot but make that more big), Ctrl+C kindly not working and by right clicking - Copy you need to select a better copy style which I doubt George has opinion on it. But as you requested:
1-

if ( format.endOfLine && !template.endsWith( '\n' ) ) {
Object doesn't support property or method 'endsWith'

2-

00.inheritClass( mediaWiki.TemplateWizard.TemplateForm, 00.ui.Widget );
Unable to get property 'Widget' of undefined or null reference

3-

SCRIPT5007: Unable to get property 'Widget' of undefined or null reference
File: index.php, Line: 39, Column: 2

4-

throw new Error('inheritClass: Origin is not a function (actually'+originFn+')')...
inheritClass: Origin is not a function (actually undefined)

5-

Javascript Error
inheritClass: Origin is not a function (actually undefined)

6-

Javascript Error
https://en.wikipedia.org/w/index.php?title=User:Samwilson/TemplateWizard.js&ac... (full url is?) at line 39: Unable to get property 'Widget' of undefined or null reference
Niharika added subscribers: MusikAnimal, Niharika.EditedApr 2 2018, 11:36 PM

@MusikAnimal Could you test this one on your tab? Will be great, if so!

It worked for me in IE 11 on Windows 10. @gh87 What template, specifically, were you trying to add? Does it matter if you try to insert the template on a blank page, or a page with different content? Also, what skin are you using?

gh87 added a comment.EditedApr 3 2018, 7:37 PM

@MusikAnimal I was using IE11 on Windows 7 with Vector skin. Actually, I was testing on inserting the "Infobox film" or "infobox person" template in a page.

gh87 updated the task description. (Show Details)Apr 4 2018, 8:15 PM

For the first error: the method endsWith() is not present on browsers that do not support ES6, like IE 11: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Browser_compatibility. We only require ES5 support. You must not use it, instead use template.match( /\n$/ ) or something similar. Looking at the code, this error only happens for templates with some particular formats specified in TemplateData, but I don't really know this code to debug further.

For the other errors: they indicate that OOjs UI is not being loaded. This might be somehow caused by the first error breaking everything, or it might be a missing dependency.

matmarex removed a subscriber: matmarex.Apr 4 2018, 8:30 PM
MusikAnimal added a subscriber: Samwilson.EditedApr 4 2018, 8:37 PM

For the first error: the method endsWith() is not present on browsers that do not support ES6

Good catch! That's definitely a problem. Your other findings explain why I wasn't able to reproduce.

I know @Samwilson is in the middle of breaking out the code into separate files for the extension, but in the meantime I've manually made this change with Special:Diff/834272150.

@gh87 Does it work for you now?

Change 424155 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/TemplateWizard@master] Avoid endswith(), for ES5 compatibility

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

Oops! I think I even knew that about endswith, but forgot. It feels like the sort of method that must have existed for ages. Wasn't there an endswith in Visual Basic? ;-)

I think the OOUI dependency will be fixed in the extension version of TemplateWizard; is it okay to not get that working for the gadget?

The patch for endswith() is https://gerrit.wikimedia.org/r/#/c/424155/

gh87 added a comment.Apr 4 2018, 11:17 PM

@MusikAnimal It now works for me... Well, whenever I go anywhere while using the template, there is still one exception at line 39:

OO.inheritClass( mediaWiki.TemplateWizard.TemplateForm, OO.ui.Widget );

The error message displays as this:

Unable to get property 'Widget' of undefined or null reference

Seen in the second screenshot, copied into this comment:

Nevertheless, I'll test this out for a while and may give some feedback later than.

Change 424155 merged by jenkins-bot:
[mediawiki/extensions/TemplateWizard@master] Avoid endswith(), for ES5 compatibility

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

gh87 added a comment.Apr 4 2018, 11:51 PM

However, sometimes at IE11, the puzzle piece icon doesn't appear well, so I have to reload over and over.

However, sometimes at IE11, the puzzle piece icon doesn't appear well, so I have to reload over and over.

I have seen that problem a couple of times in Safari where a couple of refreshes make the icon show up. Not a problem we should solve for the prototype script though.

Niharika closed this task as Declined.May 15 2018, 7:02 PM
Niharika moved this task from Product backlog to Archive on the Community-Tech board.

Marking as Declined as we are not working on the prototype script anymore.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMay 15 2018, 7:02 PM
gh87 renamed this task from Template wizard won't insert a template in IE11 to Template wizard (user script prototype) won't insert a template in IE11.May 15 2018, 7:31 PM