New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline js files even if they contain "</script>" #106

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 8 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 6, 2015

What steps will reproduce the problem?

1. Turn on inline_javascript
2. Visit http://www.profileheaven.com/forum/forums.html
3. Page not correctly parsed by browser and shows JS to user.

What is the expected output? What do you see instead?

(See attached html saves)

","i"))){i++;if(i>=max_iteration){break;}else{text_blocks[text_blocks.length]=_m
atch[1];source_code=source_code.replace(_match[0],'');}}try{if(text_blocks.lengt
h){for(i=0;i 

Is shown inline in the page, functionality doesn't seem to be affected.  
Browser is IE9 Beta.

What version of the product are you using (please check X-Mod-Pagespeed
header)?

0.9.10.1-244

On what operating system?

CentOS release 5.4 (Final)

Which version of Apache?
Apache/2.2.3

Which MPM?
Standard

Please provide any additional information below, especially a URL or an
HTML file that exhibits the problem.

http://www.profileheaven.com/forum/forums.html




Original issue reported on code.google.com by mark.har...@gmail.com on 20 Nov 2010 at 3:14

Attachments:

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Thanks for the report; I have reproduced the issue.  I believe the problem is 
that there is a Javascript file that is being inlined and which contains the 
string "</script>"; this is fine in an external Javascript file, but when 
inlined it causes the browser to think that the <script> tag is being closed at 
that point, which is in the middle of the script.  I'll start working on a fix.

Original comment by mdste...@google.com on 24 Nov 2010 at 3:29

  • Changed state: Accepted
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Noticed similar on other pages. Why not wrapping the included javascript in a 
CDATA-tag? As long as the file does not contain the plain sequence "]]>" 
nothing should happen.
In the case it does, try a fallback on xml comment, if the file also has a 
"-->" in it, just don't inline it.

Original comment by Andreas....@gmail.com on 1 Dec 2010 at 10:36

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

With our new impending branch, we are avoiding this bug by skipping the inline 
if the javascript file contains the string "</script>".

I am changing this to an 'enhancement' so we can track the desire to escape 
that string and go ahead and inline it.

Summary was: Incorrect inline_javascript

Original comment by jmara...@google.com on 3 Dec 2010 at 10:13

  • Changed title: Inline js files even if they contain "</script>"
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by sligocki@google.com on 3 Dec 2010 at 10:24

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

It turns out that many scripts include </script> and can't be inlined, such as 
show_ads.js

We should find a better fix, such as encoding.

Original comment by jkar...@google.com on 24 Oct 2013 at 5:27

  • Added labels: Priority-Medium
  • Removed labels: Priority-Low
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by jefftk@google.com on 17 Dec 2013 at 4:22

  • Changed state: Started
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by jefftk@google.com on 30 Dec 2013 at 5:54

  • Changed state: Fixed
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by sligocki@google.com on 2 Jan 2014 at 2:52

  • Added labels: Milestone-v31, release-note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment