Closed GoogleCodeExporter closed 9 years ago
There are two possible solutions.
1) Remove byte order markers in positions not at the start of the javascripts
in the JavaScript minifier as ecmascript says that these should be treated like
whitespace anyway.
2) Propagate the content-type charset header from the server into rewritten
resources.
Or we could do both. But the second option is a more general solution, so we
should at least do two and maybe one as well.
Original comment by jkar...@google.com
on 17 Apr 2013 at 6:46
[deleted comment]
On second thought solution 1 might change the behavior of the site, so we
should not do that.
Original comment by jkar...@google.com
on 17 Apr 2013 at 7:07
Out of curiosity, why would solution #1 change the behavior?
Original comment by jmara...@google.com
on 17 Apr 2013 at 7:32
If there are utf-8 BOMs in the javascript and utf-8 isn't set as the charset
then the page might break in a browser. If mod_pagespeed removes the BOMs then
the page would no longer break. We'd be 'fixing' people's pages, which is not
the intent.
Original comment by jkar...@google.com
on 18 Apr 2013 at 10:41
Note that the file that was giving problems, jquery.query.js, has recently had
its BOM removed for exactly this reason:
http://core.trac.wordpress.org/ticket/23315
Original comment by jkar...@google.com
on 18 Apr 2013 at 11:51
mod_pagespeed has been propagating charset since at least 0.10.22.4-r1633, but
I can confirm that it did not in 0.9.18.7 which is what
https://groups.google.com/forum/#!msg/mod-pagespeed-discuss/r6lcoseTJks/IrQD04sQ
0PcJ is using.
Original comment by jkar...@google.com
on 18 Apr 2013 at 1:30
So this is apparently not the problem for
http://wordpress.org/support/topic/35-rc3-new-media-uploader-doesnt-work-with-go
ogle-mod_pagespeed who is running 1.4.26.2-2759 on his site.
Original comment by jkar...@google.com
on 18 Apr 2013 at 1:40
That topic was raised before we released 1.4. My comment on that site is the
first made since we released 1.4.
Original comment by jmara...@google.com
on 18 Apr 2013 at 1:47
But he said in the first post that he was running stable, which should be >=
0.10-beta right?
Original comment by jkar...@google.com
on 18 Apr 2013 at 1:53
Good point, seems like branch 22 was the first one with the encoding change...
Original comment by morlov...@google.com
on 18 Apr 2013 at 2:03
I was able to force wordpress to break by doing the following:
0) run old mod_pagespeed (0.9.18.7) with default rewriting rules.
1) run wordpress-3.2.1 (it lets you change the default charset) and set the
wordpress default charset to koi8-r in admin -> settings -> reading. (it
defaults to utf-8 which ignores the BOMs)
2) add the line "wp_enqueue_script('jquery-query'); around line 24 of
wpadmin/media-upload.php so that it concatenates the offending file (this isn't
loaded by default, presumably some plugin which I cannot find would cause this
to happen as it shows up in the URLs of the reported problems).
3) Now browse to media->new media on the console and you'll see the syntax
error in the console, though it doesn't appear to break anything on the page.
So could this be the problem? Did people change their charset from UTF-8?
That's harder to do in more recent wordpress releases but maybe if you just
keep upgrading the setting sticks around.
Original comment by jkar...@google.com
on 18 Apr 2013 at 3:27
The charset responses for html from the sites in question are both UTF-8 and
not alternates, so that's unlikely to be the problem.
Original comment by jkar...@google.com
on 18 Apr 2013 at 3:45
The problem wound up being an issue with the javascript lexer in js_minify.
Specifically, when trying to determine if a '/' is a divide symbol or the start
of a regex, it could get confused, causing the rest of the javascript to be
incorrectly minified.
The specific problem for Wordpress was in file underscore.min.js and is used in
the AddMEdia button on the page to add a new post. The script contains the
line, 'typeof /./', where the first '/' was seen as a divide instead of the
start of a regex.
Original comment by jkar...@google.com
on 23 Apr 2013 at 5:25
Original comment by jkar...@google.com
on 25 Apr 2013 at 10:46
Original comment by jkar...@google.com
on 25 Apr 2013 at 12:07
Original comment by jmara...@google.com
on 25 Apr 2013 at 1:14
Original comment by sligocki@google.com
on 24 Jun 2013 at 2:11
Original issue reported on code.google.com by
jkar...@google.com
on 17 Apr 2013 at 5:48