Prevent a crash on Safari on String.prototype.stripScripts and extractScripts with large <script> tags.
This commit is contained in:
parent
c0509c7f5f
commit
4c90be6a30
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Prevent a crash on Safari on String.prototyype.stripScripts and extractScripts with large <script> tags. [Thomas Fuchs]
|
||||
|
||||
* Prevent linefeed normalisation in String.prototype.escapeHTML and unescapeHTML on IE for consistency with other browsers. Speed optimizations for Safari and IE. [Thomas Fuchs]
|
||||
|
||||
* Make Hash.toQueryString serialize undefined values. Ensure consistency with String.prototype.toQueryParams. Closes #7806. [Mislav Marohnić]
|
||||
|
2
src/prototype.js
vendored
2
src/prototype.js
vendored
@ -17,7 +17,7 @@ var Prototype = {
|
||||
document.createElement('form').__proto__)
|
||||
},
|
||||
|
||||
ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
|
||||
ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
|
||||
emptyFunction: function() {},
|
||||
K: function(x) { return x }
|
||||
}
|
||||
|
@ -270,7 +270,7 @@
|
||||
<script type="text/javascript" language="javascript" charset="utf-8">
|
||||
// <![CDATA[
|
||||
|
||||
var testVar = 'to be updated';
|
||||
var testVar = 'to be updated', testVar2 = '';
|
||||
|
||||
Element.addMethods("LI", {
|
||||
pancakes: function(element) { return "pancakes"; }
|
||||
@ -364,7 +364,7 @@
|
||||
}},
|
||||
|
||||
testElementUpdateWithScript: function() {with(this) {
|
||||
$('testdiv').update('hello from div!<script>testVar="hello!"</'+'script>');
|
||||
$('testdiv').update('hello from div!<script>\ntestVar="hello!";\n</'+'script>');
|
||||
assertEqual('hello from div!',$('testdiv').innerHTML);
|
||||
wait(100,function(){
|
||||
assertEqual('hello!',testVar);
|
||||
@ -375,6 +375,18 @@
|
||||
assertMatch(/^another hello from div!\s+here it goes$/,$('testdiv').innerHTML);
|
||||
wait(100,function(){
|
||||
assertEqual('another hello!',testVar);
|
||||
|
||||
Element.update('testdiv','a\n<script>testVar="a"\ntestVar="b"</'+'script>');
|
||||
wait(100,function(){
|
||||
assertEqual('b', testVar);
|
||||
|
||||
Element.update('testdiv',
|
||||
'x<script>testVar2="a"</'+'script>\nblah\n'+
|
||||
'x<script>testVar2="b"</'+'script>');
|
||||
wait(100,function(){
|
||||
assertEqual('b', testVar2);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}},
|
||||
@ -934,7 +946,20 @@
|
||||
assertRespondsTo('orangeJuice', elem2);
|
||||
assertEqual("orange juice", elem.orangeJuice());
|
||||
assertEqual("orange juice", elem2.orangeJuice());
|
||||
}}
|
||||
}},
|
||||
|
||||
testScriptFragment: function() {with(this) {
|
||||
var element = document.createElement('div');
|
||||
// tests an issue with Safari 2.0 crashing when the ScriptFragment
|
||||
// regular expression is using a pipe-based approach for
|
||||
// matching any character
|
||||
['\r','\n',' '].each(function(character){
|
||||
$(element).update("<script>"+character.times(10000)+"</scr"+"ipt>");
|
||||
assertEqual('', element.innerHTML);
|
||||
});
|
||||
$(element).update("<script>var blah='"+'\\'.times(10000)+"'</scr"+"ipt>");
|
||||
assertEqual('', element.innerHTML);
|
||||
}}
|
||||
}, 'testlog');
|
||||
|
||||
// ]]>
|
||||
|
Loading…
Reference in New Issue
Block a user