Fix #1008: Remove use of ActiveXObject in Http.request()

This commit is contained in:
Jürg Lehni 2016-03-14 19:40:46 +01:00
parent da7d0d8f75
commit 484d696df3
3 changed files with 8 additions and 6 deletions

View file

@ -527,7 +527,9 @@ Base.exports.PaperScript = (function() {
// request the source asynchronously and execute as soon as
// it is retrieved.
Http.request({
url: src, async: async,
url: src,
async: async,
mimeType: 'text/plain',
onLoad: function(code) {
execute(code, scope, src);
}

View file

@ -13,12 +13,11 @@
var Http = {
request: function(options) {
// Code borrowed from Coffee Script and extended:
var ctor = window.ActiveXObject || window.XMLHttpRequest,
xhr = new ctor('Microsoft.XMLHTTP');
var xhr = new window.XMLHttpRequest();
xhr.open((options.method || 'get').toUpperCase(), options.url,
Base.pick(options.async, true));
if ('overrideMimeType' in xhr)
xhr.overrideMimeType('text/plain');
if (options.mimeType)
xhr.overrideMimeType(options.mimeType);
xhr.onload = function() {
var status = xhr.status;
if (status === 0 || status === 200) {

View file

@ -684,7 +684,8 @@ new function() {
onLoad(node);
} else {
Http.request({
url: source, async: true,
url: source,
async: true,
onLoad: onLoad,
onError: onError
});