Permalink
Browse files

Fixes a regression that will cause inline scripts to be removed when …

…using js responseType
  • Loading branch information...
jansepar committed Jul 29, 2013
1 parent 9e13713 commit 575abf0da0880dbea9f81db98bfee3612b40a08e
View
@@ -118,7 +118,7 @@ module.exports = function(grunt) {
'http://localhost:3000/tests/unblockify.html',
'http://localhost:3000/tests/cssOptimize.html'
],
concurrency: 4,
concurrency: 16,
tunneled: true,
detailedError: true,
browsers: [
@@ -1760,7 +1760,10 @@ define('jazzcat',["utils", "capture"], function(Utils, Capture) {
if (!jsonp && concat) {
for (var i=0, len=scripts.length; i<len; i++) {
var script = scripts[i];
script.parentNode.removeChild(script);
// Only remove scripts if they are external
if (script.getAttribute(options.attribute)) {
script.parentNode.removeChild(script);
}
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -23,7 +23,6 @@ <h1>Performance test for Jazzcat</h1>
<p class="loader hide">Running...</p>
<div id="chartContainer" style="height: 300px; width: 100%;"></div>
<p class="loader hide">loading...</p>
<script src="/mobifyjs/performance/resources/jquery.js"></script>
<script>

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -402,7 +402,10 @@ define(["utils", "capture"], function(Utils, Capture) {
if (!jsonp && concat) {
for (var i=0, len=scripts.length; i<len; i++) {
var script = scripts[i];
script.parentNode.removeChild(script);
// Only remove scripts if they are external
if (script.getAttribute(options.attribute)) {
script.parentNode.removeChild(script);
}
}
}
View
@@ -25,6 +25,7 @@
<script x-src="http://uncached/2/" class="combine"></script>
<script x-src="http://uncached/2/" class="combine"></script>
<script x-src="http://excluded/"></script>
<script class="combine"></script>
</textarea>
<!-- Fixtures for ensuring `optimizeScripts` executes scripts in the right order. -->
@@ -557,7 +558,7 @@
}
});
asyncTest('optimizeScripts', 16, function() {
asyncTest('optimizeScripts', 18, function() {
httpCache.reset({
'http://cached/': {
'headers': {'expires': UTC_TWO_WEEKS_FROM_NOW},
@@ -580,6 +581,7 @@
uncachedHead2: scripts[4],
uncachedBody2: scripts[5],
excluded: scripts[6],
inline: scripts[7]
}
};
@@ -724,6 +726,23 @@
ok((html === expected || html === expected_ie), "Separate, JS response type");
var scripts = generateScripts();
var html = getHTMLWithLoader([],
[scripts.inline],
{concat: true, responseType: 'js'});
expected = "<html><head><title></title></head><body><script class=\"combine\"><\/script></body></html>";
equal(html, expected, "Regression, ensure inline scripts don't get removed, JS response type");
var scripts = generateScripts();
var html = getHTMLWithLoader([],
[scripts.inline],
{concat: true, responseType: 'jsonp'});
expected = "<html><head><title></title></head><body><script>Jazzcat.httpCache.load();<\/script><script class=\"combine\"><\/script></body></html>";
equal(html, expected, "Regression, ensure inline scripts don't get removed, jsonp response type");
start();
});

0 comments on commit 575abf0

Please sign in to comment.