pad.html: fix regression introduced with 5879037ddc.

Revision 5879037ddc fixed a security bug, but introduced a regression, where
on page load the js console showed:

   ReferenceError: require is not defined

The reason was that the fix called require('../static/js/pad_utils') to load a
module at a time when require() was still not defined.
This change anticipates the loading of require-kernel, and manually loads
pad_utils.

The fix proposed in #3670 by aaron-costello, which seemed to do the right
thing, anticipating the configuration phase of require-kernel, did not work.
It had to be declined and replaced by this (less elegant) change.
pull/3676/head
muxator 2019-11-30 20:32:39 +01:00
parent ba38ed3bba
commit 695c2d2e84
1 changed files with 6 additions and 3 deletions

View File

@ -360,9 +360,13 @@
<% e.end_block(); %>
<% e.begin_block("scripts"); %>
<script type="text/javascript">
var padutils = require('../static/js/pad_utils').padutils;
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<!-- Include pad_utils manually -->
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/pad_utils.js?callback=require.define"></script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt
(function() {
// Display errors on page load to the user
@ -380,7 +384,6 @@
// @license-end
</script>
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script>
<!-- Include base packages manually (this help with debugging) -->