mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -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
|
||||
// it is retrieved.
|
||||
Http.request({
|
||||
url: src, async: async,
|
||||
url: src,
|
||||
async: async,
|
||||
mimeType: 'text/plain',
|
||||
onLoad: function(code) {
|
||||
execute(code, scope, src);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -684,7 +684,8 @@ new function() {
|
|||
onLoad(node);
|
||||
} else {
|
||||
Http.request({
|
||||
url: source, async: true,
|
||||
url: source,
|
||||
async: true,
|
||||
onLoad: onLoad,
|
||||
onError: onError
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue