Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @ignore
* solve io between sub domains using proxy page
* @author yiminghe@gmail.com
*/
var util = require('util');
var DomEvent = require('event-dom'),
url = require('url'),
Dom = require('dom'),
XhrTransportBase = require('./xhr-transport-base');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var PROXY_PAGE = '/sub_domain_proxy.html',
doc = document,
// hostname:{iframe: , ready:}
iframeMap = {};
function SubDomainTransport(io) {
var self = this,
c = io.config;
self.io = io;
c.crossDomain = false;
logger.info('use SubDomainTransport for: ' + c.url);
}
util.augment(SubDomainTransport, XhrTransportBase.proto, {
// get nativeXhr from iframe document
// not from current document directly like XhrTransport
/**
* @ignore
* use flash to accomplish cross domain request, usage scenario ? why not jsonp ?
* @author yiminghe@gmail.com
*/
var util = require('util');
var IO = require('./base'),
Dom = require('dom');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var // current running request instances
maps = {},
ID = 'io_swf',
// flash transporter
flash,
doc = document,
// whether create the flash transporter
init = false;
// create the flash transporter
function _swf(uri, _, uid) {
if (init) {
return;
}
init = true;
/**
* @ignore
* solve io between sub domains using proxy page
* @author yiminghe@gmail.com
*/
var util = require('util');
var Event = require('event/dom'),
url = require('url'),
Dom = require('dom'),
XhrTransportBase = require('./xhr-transport-base');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var PROXY_PAGE = '/sub_domain_proxy.html',
doc = document,
// hostname:{iframe: , ready:}
iframeMap = {};
function SubDomainTransport(io) {
var self = this,
c = io.config;
self.io = io;
c.crossDomain = false;
logger.info('use SubDomainTransport for: ' + c.url);
}
util.augment(SubDomainTransport, XhrTransportBase.proto, {
// get nativeXhr from iframe document
// not from current document directly like XhrTransport
/**
* @ignore
* non-refresh upload file with form by iframe
* @author yiminghe@gmail.com
*/
var util = require('util'),
querystring = require('querystring'),
Dom = require('dom'),
IO = require('./base'),
Event = require('event/dom');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var UA = require('ua');
var doc = document,
OK_CODE = 200,
ERROR_CODE = 500,
BREATH_INTERVAL = 30,
iframeConverter = util.clone(IO.getConfig().converters.text);
// https://github.com/kissyteam/kissy/issues/304
// returned data must be escaped by server for json dataType
// as data
// eg:
//
// {
// "<a>xx</a>"
// }
//
/**
* @ignore
* base for xhr and subdomain
* @author yiminghe@gmail.com
*/
var util = require('util');
var url = require('url');
var querystring = require('querystring');
var IO = require('./base');
var UA = require('ua');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var OK_CODE = 200,
supportCORS,
win = window,
// http://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx
XDomainRequest_ = UA.ieMode > 7 && win.XDomainRequest,
NO_CONTENT_CODE = 204,
NOT_FOUND_CODE = 404,
NO_CONTENT_CODE2 = 1223,
XhrTransportBase = {
proto: {}
}, lastModifiedCached = {},
eTagCached = {};
IO.__lastModifiedCached = lastModifiedCached;
IO.__eTagCached = eTagCached;
], function (S, require, exports, module) {
/**
* @ignore
* implement Promise specification by KISSY
* @author yiminghe@gmail.com
*/
var util = require('util');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/promise');
var PROMISE_VALUE = '__promise_value', PROMISE_PROGRESS_LISTENERS = '__promise_progress_listeners', PROMISE_PENDINGS = '__promise_pendings';
function logError(str) {
/*global console*/
if (typeof console !== 'undefined' && console.error) {
console.error(str);
}
} /*
two effects:
1. call fulfilled with immediate value
2. push fulfilled in right promise
*/
/*
two effects:
1. call fulfilled with immediate value
2. push fulfilled in right promise
*/
], function (S, require, exports, module) {
/**
* @ignore
* simplified flash bridge for yui swf
* @author yiminghe@gmail.com
*/
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/editor/flash-bridge');
var util = require('util');
var Editor = require('editor');
var SWF = require('swf'); /*global CustomEvent:true*/
/*global CustomEvent:true*/
var CustomEvent = require('event/custom');
var instances = {};
function FlashBridge(cfg) {
this._init(cfg);
}
util.augment(FlashBridge, CustomEvent.Target, {
_init: function (cfg) {
var self = this, id = util.guid('flash-bridge-'), callback = 'KISSY.require(\'editor\').FlashBridge.EventHandler';
cfg.id = id;
cfg.attrs = cfg.attrs || {};
cfg.params = cfg.params || {};
var attrs = cfg.attrs, params = cfg.params, flashVars = params.flashVars = params.flashVars || {};
/**
* @ignore
* simplified flash bridge for yui swf
* @author yiminghe@gmail.com
*/
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/editor/flash-bridge');
var util = require('util');
var Editor = require('editor');
var SWF = require('swf');
/*global CustomEvent:true*/
var CustomEvent = require('event/custom');
var instances = {};
function FlashBridge(cfg) {
this._init(cfg);
}
util.augment(FlashBridge, CustomEvent.Target, {
_init: function (cfg) {
var self = this,
id = util.guid('flash-bridge-'),
callback = 'KISSY.require(\'editor\').FlashBridge.EventHandler';
/**
* @ignore
* a scalable client io framework
* @author yiminghe@gmail.com
*/
var util = require('util');
var querystring = require('querystring');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger();
/*global CustomEvent:true*/
var CustomEvent = require('event/custom');
var Promise = require('promise');
var url = require('url');
var rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
rspace = /\s+/,
mirror = function (s) {
return s;
},
rnoContent = /^(?:GET|HEAD)$/,
locationHref = location.href,
locationUrl = url.parse(locationHref),
isLocal = rlocalProtocol.test(locationUrl.protocol),
transports = {},
defaultConfig = {
type: 'GET',
/**
* @ignore
* script transport for kissy io,
* modified version of S.getScript,
* add abort ability
* @author yiminghe@gmail.com
*/
var util = require('util');
var IO = require('./base');
var LoggerManager = require('logger-manager');
var logger = LoggerManager.getLogger('s/io');
var OK_CODE = 200,
ERROR_CODE = 500;
IO.setupConfig({
accepts: {
script: 'text/javascript, ' +
'application/javascript, ' +
'application/ecmascript, ' +
'application/x-ecmascript'
},
contents: {
script: /javascript|ecmascript/
},
converters: {
text: {