Nice! I could not dig so deeply without you
2015-09-23 2:18 GMT+03:00 Pau Garcia i Quiles <[email protected]>:
> I have tracked down the problem to jquery.min.js from libjs-jquery,
> version 1.11.3+dfsg-3
>
> That package contains this:
>
> $ ls -lah /usr/share/javascript/jquery
> total 580K
> drwxr-xr-x 2 root root 4.0K Sep 23 00:51 .
> drwxr-xr-x 4 root root 4.0K Sep 23 00:51 ..
> -rw-r--r-- 1 root root 278K Aug 29 03:46 jquery.js
> lrwxrwxrwx 1 root root 13 Aug 29 03:46 jquery.lite.js -> jquery.min.js
> -rw-r--r-- 1 root root 144K Aug 29 03:46 jquery.min.js
> -rw-r--r-- 1 root root 148K Aug 29 03:46 jquery.min.map
> lrwxrwxrwx 1 root root 13 Aug 29 03:46 jquery.pack.js -> jquery.min.js
>
> Where jquery.min.js is obtained by uglifying jquery.js. Extract from
> jquery-1.11.3+dfsg/debian/rules:
>
> dist/jquery.min.js dist/jquery.min.map: dist/jquery.js
> uglifyjs \
> --source-map dist/jquery.min.map \
> --source-map-url jquery.min.map \
> --output dist/jquery.min.js \
> $^
>
> There are at least two problems there:
>
> - jquery.min.map should not be distributed in the first place
>
> - jquery.min.js contains this at the very end:
>
> [...]
> "jquery",[],function(){return jQuery})}var
>
> _jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return
> jQuery};if(typeof noGlobal===st
> rundefined){window.jQuery=window.$=jQuery}return jQuery});
> //# sourceMappingURL=jquery.min.map
>
>
> See that comment? Remember it
>
> When Wt builds, jquery.min.js, Wt.min.js and Boot.min.js are converted to
> C by the filetostring.cmake macro called in src/CMakeLists.txt. This
> generates JQuery_js.C, Boot_js.C and Wt_js.C.
>
> The extraneous comment in /usr/share/javascript/jquery/jquery.min.js
> results in this in JQuery_js.C:
>
> "jquery\",[],function(){return jQuery})}var
> _jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_
> $}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return
> jQuery};if(typeof
> noGlobal===strundefined){window.jQuery=window.$=jQuery}return
> jQuery});\r\n"
> "//# sourceMappingURL=jquery.min.map";
> std::vector<const char *> JQuery_js()
> {
> std::vector<const char *> retval;
>
> retval.push_back(JQuery_js1);
>
> retval.push_back(JQuery_js2);
>
> retval.push_back(JQuery_js3);
>
> return retval;
> }
> }
>
> When Wt generates JavaScript and that comment gets in the middle, it
> causes errors.
>
> Therefore, I think the problem boils down to bad minification of jquery.js
> in the libjs-jquery package.
>
> I will report the bug
>
>
> --
> Pau Garcia i Quiles
> http://www.elpauer.org
> (Due to my workload, I may need 10 days to answer)
>