mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Fix #1008: Remove use of ActiveXObject in Http.request()
This commit is contained in:
parent
da7d0d8f75
commit
484d696df3
3 changed files with 8 additions and 6 deletions
|
@ -527,7 +527,9 @@ Base.exports.PaperScript = (function() {
|
||||||
// request the source asynchronously and execute as soon as
|
// request the source asynchronously and execute as soon as
|
||||||
// it is retrieved.
|
// it is retrieved.
|
||||||
Http.request({
|
Http.request({
|
||||||
url: src, async: async,
|
url: src,
|
||||||
|
async: async,
|
||||||
|
mimeType: 'text/plain',
|
||||||
onLoad: function(code) {
|
onLoad: function(code) {
|
||||||
execute(code, scope, src);
|
execute(code, scope, src);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,11 @@
|
||||||
var Http = {
|
var Http = {
|
||||||
request: function(options) {
|
request: function(options) {
|
||||||
// Code borrowed from Coffee Script and extended:
|
// Code borrowed from Coffee Script and extended:
|
||||||
var ctor = window.ActiveXObject || window.XMLHttpRequest,
|
var xhr = new window.XMLHttpRequest();
|
||||||
xhr = new ctor('Microsoft.XMLHTTP');
|
|
||||||
xhr.open((options.method || 'get').toUpperCase(), options.url,
|
xhr.open((options.method || 'get').toUpperCase(), options.url,
|
||||||
Base.pick(options.async, true));
|
Base.pick(options.async, true));
|
||||||
if ('overrideMimeType' in xhr)
|
if (options.mimeType)
|
||||||
xhr.overrideMimeType('text/plain');
|
xhr.overrideMimeType(options.mimeType);
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
var status = xhr.status;
|
var status = xhr.status;
|
||||||
if (status === 0 || status === 200) {
|
if (status === 0 || status === 200) {
|
||||||
|
|
|
@ -684,7 +684,8 @@ new function() {
|
||||||
onLoad(node);
|
onLoad(node);
|
||||||
} else {
|
} else {
|
||||||
Http.request({
|
Http.request({
|
||||||
url: source, async: true,
|
url: source,
|
||||||
|
async: true,
|
||||||
onLoad: onLoad,
|
onLoad: onLoad,
|
||||||
onError: onError
|
onError: onError
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue