Page MenuHomePhabricator

Javascript preview when editing users skin file should be loaded the same as in module mode
Closed, ResolvedPublic

Description

There was a change (gerrit 152122 / 9272bc6c472122548199865c5175185bdaa469c3) which wraps a whole module in a function, but this is not done when using the preview while editing a javascript page. Makes the preview useless to see all the errors, which may generated when using Firefox (T71924).

Details

Reference
bz70526

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:56 AM
bzimport set Reference to bz70526.
bzimport added a subscriber: Unknown Object (MLST).
matmarex set Security to None.
matmarex removed a subscriber: Unknown Object (MLST).

T71924 has been fixed. Is this therefore fixed too?

The described behavior still exist. When you make a preview of your common.js with the content

alert();

the preview contains:

<script>
alert('x');

</script>

Because T71924 is fixed the necessary for a preview with a encapsulated function is not very high.

Krinkle claimed this task.

User modules are transported as a string that is invoked with globalEval. Previews are called the same way by OutputPage in case of previews.

This used to be consistent. 9272bc6c4721225 temporarily made it inconsistent by wrapping them normally (but forgot about preview). However various problems with this kind of conditional wrapping were discovered in 2015 which is why I reverted my commit and gave up on this idea.

Conditional wrapping was admittedly a bad idea because conditionally executing code that is potentially incompatible with the current browser is next to impossible. We since solved this problem by instead making the download itself conditional. This was done sometime in 2016.