Skip to content
Permalink
Browse files

Merge branch 't/12215'

  • Loading branch information...
mlewand committed Aug 13, 2014
2 parents 47dff75 + 46ae250 commit ed68866e87029bc240e71f9e8d4ba6995841bd8d
@@ -20,6 +20,7 @@ Fixed Issues:
* [#12281](http://dev.ckeditor.com/ticket/12281): Fixed: Minor syntax issue in CSS files.
* [#12178](http://dev.ckeditor.com/ticket/12178): [Blink/Webkit] Fixed: Iterator does not return block if selection is located at the end of it.
* [#12185](http://dev.ckeditor.com/ticket/12185): [IE9QM] Fixed: Error thrown when moving mouse over focused editor's scrollbar.
* [#12215](http://dev.ckeditor.com/ticket/12215): Fixed: Basepath resolution doesn't recognize semicolon as a query separator.

Other Changes:

@@ -5,7 +5,10 @@

// Compressed version of core/ckeditor_base.js. See original for instructions.
/*jsl:ignore*/
window.CKEDITOR||(window.CKEDITOR=function(){var b={timestamp:"",version:"%VERSION%",revision:"%REV%",rnd:Math.floor(900*Math.random())+100,_:{pending:[]},status:"unloaded",basePath:function(){var a=window.CKEDITOR_BASEPATH||"";if(!a)for(var b=document.getElementsByTagName("script"),c=0;c<b.length;c++){var d=b[c].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(d){a=d[1];break}}-1==a.indexOf(":/")&&"//"!=a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return a}(),getUrl:function(a){-1==a.indexOf(":/")&&0!==a.indexOf("/")&&(a=this.basePath+a);this.timestamp&&"/"!=a.charAt(a.length-1)&&!/[&?]t=/.test(a)&&(a+=(0<=a.indexOf("?")?"&":"?")+"t="+this.timestamp);return a},domReady:function(){function a(){try{document.addEventListener?(document.removeEventListener("DOMContentLoaded",a,!1),b()):document.attachEvent&&"complete"===document.readyState&&(document.detachEvent("onreadystatechange",a),b())}catch(d){}}function b(){for(var a;a=c.shift();)a()}var c=[];return function(b){c.push(b);"complete"===document.readyState&&setTimeout(a,1);if(1==c.length)if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,!1),window.addEventListener("load",a,!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",a);window.attachEvent("onload",a);b=!1;try{b=!window.frameElement}catch(e){}if(document.documentElement.doScroll&&b){var f=function(){try{document.documentElement.doScroll("left")}catch(b){setTimeout(f,1);return}a()};f()}}}}()},e=window.CKEDITOR_GETURL;if(e){var g=b.getUrl;b.getUrl=function(a){return e.call(b,a)||g.call(b,a)}}return b}());
window.CKEDITOR||(window.CKEDITOR=function(){var e=/(^|.*[\\\/])ckeditor\.js(?:\?.*|;.*)?$/i,b={timestamp:"",version:"%VERSION%",revision:"%REV%",rnd:Math.floor(900*Math.random())+100,_:{pending:[],basePathSrcPattern:e},status:"unloaded",basePath:function(){var a=window.CKEDITOR_BASEPATH||"";if(!a)for(var b=document.getElementsByTagName("script"),c=0;c<b.length;c++){var f=b[c].src.match(e);if(f){a=f[1];break}}-1==a.indexOf(":/")&&"//"!=a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+
a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return a}(),getUrl:function(a){-1==a.indexOf(":/")&&0!==a.indexOf("/")&&(a=this.basePath+a);this.timestamp&&"/"!=a.charAt(a.length-1)&&!/[&?]t=/.test(a)&&(a+=(0<=a.indexOf("?")?"&":"?")+"t="+this.timestamp);return a},domReady:function(){function a(){try{document.addEventListener?(document.removeEventListener("DOMContentLoaded",
a,!1),b()):document.attachEvent&&"complete"===document.readyState&&(document.detachEvent("onreadystatechange",a),b())}catch(f){}}function b(){for(var a;a=c.shift();)a()}var c=[];return function(b){c.push(b);"complete"===document.readyState&&setTimeout(a,1);if(1==c.length)if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,!1),window.addEventListener("load",a,!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",a);window.attachEvent("onload",a);b=!1;try{b=
!window.frameElement}catch(e){}if(document.documentElement.doScroll&&b){var d=function(){try{document.documentElement.doScroll("left")}catch(b){setTimeout(d,1);return}a()};d()}}}}()},d=window.CKEDITOR_GETURL;if(d){var g=b.getUrl;b.getUrl=function(a){return d.call(b,a)||g.call(b,a)}}return b}());
/*jsl:end*/

if ( CKEDITOR.loader )
@@ -9,9 +9,7 @@
*/

// #### Compressed Code
// Must be updated on changes in the script as well as updated in the ckeditor.js file.

// window.CKEDITOR||(window.CKEDITOR=function(){var b={timestamp:"",version:"%VERSION%",revision:"%REV%",rnd:Math.floor(900*Math.random())+100,_:{pending:[]},status:"unloaded",basePath:function(){var a=window.CKEDITOR_BASEPATH||"";if(!a)for(var b=document.getElementsByTagName("script"),c=0;c<b.length;c++){var d=b[c].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(d){a=d[1];break}}-1==a.indexOf(":/")&&"//"!=a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return a}(),getUrl:function(a){-1==a.indexOf(":/")&&0!==a.indexOf("/")&&(a=this.basePath+a);this.timestamp&&"/"!=a.charAt(a.length-1)&&!/[&?]t=/.test(a)&&(a+=(0<=a.indexOf("?")?"&":"?")+"t="+this.timestamp);return a},domReady:function(){function a(){try{document.addEventListener?(document.removeEventListener("DOMContentLoaded",a,!1),b()):document.attachEvent&&"complete"===document.readyState&&(document.detachEvent("onreadystatechange",a),b())}catch(d){}}function b(){for(var a;a=c.shift();)a()}var c=[];return function(b){c.push(b);"complete"===document.readyState&&setTimeout(a,1);if(1==c.length)if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,!1),window.addEventListener("load",a,!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",a);window.attachEvent("onload",a);b=!1;try{b=!window.frameElement}catch(e){}if(document.documentElement.doScroll&&b){var f=function(){try{document.documentElement.doScroll("left")}catch(b){setTimeout(f,1);return}a()};f()}}}}()},e=window.CKEDITOR_GETURL;if(e){var g=b.getUrl;b.getUrl=function(a){return e.call(b,a)||g.call(b,a)}}return b}());
// Compressed code in ckeditor.js must be be updated on changes in the script.
// The Closure Compiler online service should be used when updating this manually:
// http://closure-compiler.appspot.com/

@@ -25,6 +23,8 @@ if ( !window.CKEDITOR ) {
* @singleton
*/
window.CKEDITOR = ( function() {
var basePathSrcPattern = /(^|.*[\\\/])ckeditor\.js(?:\?.*|;.*)?$/i;

var CKEDITOR = {

/**
@@ -76,7 +76,8 @@ if ( !window.CKEDITOR ) {
* @private
*/
_: {
pending: []
pending: [],
basePathSrcPattern: basePathSrcPattern
},

/**
@@ -111,17 +112,14 @@ if ( !window.CKEDITOR ) {
* @property {String}
*/
basePath: ( function() {
// ATTENTION: fixes to this code must be ported to
// var basePath in "core/loader.js".

// Find out the editor directory path, based on its <script> tag.
var path = window.CKEDITOR_BASEPATH || '';

if ( !path ) {
var scripts = document.getElementsByTagName( 'script' );

for ( var i = 0; i < scripts.length; i++ ) {
var match = scripts[ i ].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
var match = scripts[ i ].src.match( basePathSrcPattern );

if ( match ) {
path = match[ 1 ];
@@ -312,4 +310,4 @@ if ( !window.CKEDITOR ) {
* for details.
*/

// PACKAGER_RENAME( CKEDITOR )
// PACKAGER_RENAME( CKEDITOR )
@@ -76,39 +76,6 @@ if ( !CKEDITOR.loader ) {
'creators/inline': []
};

var basePath = ( function() {
// This is a copy of CKEDITOR.basePath, but requires the script having
// "_source/loader.js".
if ( CKEDITOR && CKEDITOR.basePath )
return CKEDITOR.basePath;

// Find out the editor directory path, based on its <script> tag.
var path = '';
var scripts = document.getElementsByTagName( 'script' );

for ( var i = 0; i < scripts.length; i++ ) {
var match = scripts[ i ].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );

if ( match ) {
path = match[ 1 ];
break;
}
}

// In IE (only) the script.src string is the raw valued entered in the
// HTML. Other browsers return the full resolved URL instead.
if ( path.indexOf( '://' ) == -1 ) {
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[ 0 ] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\// )[ 0 ] + path;
}

return path;
} )();

var timestamp = ( CKEDITOR && CKEDITOR.timestamp ) || ( new Date() ).valueOf(); // %REMOVE_LINE%
/* // %REMOVE_LINE%
* The production implementation contains a fixed timestamp // %REMOVE_LINE%
@@ -120,7 +87,7 @@ if ( !CKEDITOR.loader ) {
if ( CKEDITOR && CKEDITOR.getUrl )
return CKEDITOR.getUrl( resource );

return basePath + resource + ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + timestamp;
return CKEDITOR.basePath + resource + ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + timestamp;
};

var pendingLoad = [];
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,2 @@
<iframe id="iframe-default-params"></iframe>
<iframe id="iframe-semicolon-params"></iframe>
@@ -0,0 +1,65 @@
/* bender-tags: editor,unit */

( function() {
'use strict';

bender.test( {
'test CKEDITOR.basePath when used src="ckeditor.js?foo&bar"': function() {
var iframe = CKEDITOR.document.getById( 'iframe-default-params' ),
doc = iframe.getFrameDocument();

iframe.on( 'load', function() {
resume( function() {
var iCKEDITOR = iframe.$.contentWindow.CKEDITOR;

assert.areSame( CKEDITOR.basePath, iCKEDITOR.basePath );
} );
} );

doc.$.open();
doc.$.write( '<script src="' + CKEDITOR.getUrl( 'ckeditor.js' ) + '?foo=1&bar=2"></scr' + 'ipt>' );
doc.$.close();

wait();
},

'test CKEDITOR.basePath ckeditor.js src pattern': function() {
var pattern = CKEDITOR._.basePathSrcPattern;

a( 'ckeditor.js' );
a( '/ckeditor.js' );
a( '\\ckeditor.js' );
a( '/ckeditor.js?foo=1#bar' );
a( 'CKEDITOR.JS' );
// #12215
a( '/ckeditor.js;id=foo-bar' );

function a( src ) {
assert.isMatching( pattern, src, src );
}
},

/*
#12215
Test impossible to perform with present Bender's capabilities.
'test CKEDITOR.basePath when used src="ckeditor.js;foo&bar"': function() {
var iframe = CKEDITOR.document.getById( 'iframe-semicolon-params' ),
doc = iframe.getFrameDocument();
iframe.on( 'load', function() {
resume( function() {
var iCKEDITOR = iframe.$.contentWindow.CKEDITOR;
assert.areSame( CKEDITOR.basePath, iCKEDITOR.basePath );
} );
} );
doc.$.open();
doc.$.write( '<script src="' + CKEDITOR.getUrl( 'ckeditor.js' ) + ';foo=1&bar=2"></scr' + 'ipt>' );
doc.$.close();
wait();
}
*/
} );
} )();

0 comments on commit ed68866

Please sign in to comment.
You can’t perform that action at this time.