Closed Bug 1325352 Opened 7 years ago Closed 7 years ago

MDN preview of wiki page creation edit gives script error.

Categories

(developer.mozilla.org Graveyard :: Wiki pages, defect)

All
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Leif.AMO, Assigned: arai)

References

Details

(Whiteboard: [specification][type:bug])

What did you do?
================
1. Had user account page creation enabled.
2. Went to https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/developer (which did not exist), and edited the first draft of the page.  It is both similar and related to the "author" page, so I copy/pasted the source (by editing "author" page and clicking the "Source" button above the textarea) and edited.
3. Attempted to preview page, was sent to https://developer.mozilla.org/en-US/docs/preview-wiki-content with an error message.

What happened?
==============
I was sent to a different wiki page to view a preview, and given an error message, quoted below.  The partial preview was partially corrupted in that all lists and menus were listed as numbered lists without any style.

 There was a scripting error on this page. While it is being addressed by site editors, you can view partial content below.

Anyone with an MDN profile can edit a document to fix an error. Use the KumaScript troubleshooting guide as a starting point.

    Error type:
        TemplateExecutionError 
    In macro:
        WebExtCompat (Edit Template) 
    Parsing macro:
        WebExtCompat ([]) 
    Full text of error:

        Problem executing template WebExtCompat:
           30 | <p>{{WebExtCompat()}}</p>
           31 | 
           32 | <h2 id="Example">Example</h2>
        -------------^
           33 | 
           34 | <pre class="brush: json">

        TypeError: ejs:1
         >> 1| <%
            2| 
            3| var heading = $1 || "h3";
            4| 

        Cannot call method 'split' of undefined
            at eval (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:199:12), <anonymous>:41:27)
            at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15
            at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:74:30



What should have happened?
==========================
I should have been presented with the page displayed exactly as it would be if I had pressed "Submit".

Is there anything else we should know?
======================================
I switched the content editor from "Source" mode back to visual mode to approximate a "preview", but this doesn't render templates, etc.  So I just hit "Submit", and the page submitted and displayed fine.  But the whole point of a preview button is to have a working preview.  Either fix the preview or remove the button.
The issue is from bug 973678 that slug isn't defined in preview mode.
need similar fix as bug 1321963.
See Also: → 973678, 1321963
https://github.com/mozilla/kumascript/pull/75
Assignee: nobody → arai.unmht
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(In reply to Tooru Fujisawa [:arai] from comment #2)
> https://github.com/mozilla/kumascript/pull/75

The PR got merged by SphinxKnight.

To copy my post on the PR:
This fixes the error, though I think it would have been even better if there was a note about this like when using the {{cssinfo}} macro.

This would make it more obvious that the change here can be reverted once the environment variables are set within the preview (bug 973678).

Sebastian
okay, I'll file another bug to make it more helpful on preview mode.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
See Also: → 1326396
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.