Skip to content

Commit c161d11

Browse files
committed
#254: check 'onLoadFnName' before call
1 parent f3e2a4c commit c161d11

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

dist/FileAPI.html5.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,7 @@
27572757
},
27582758

27592759
_send: function (options, data){
2760-
var _this = this, xhr, uid = _this.uid, onloadFuncName = _this.uid + "Load", url = options.url;
2760+
var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url;
27612761

27622762
api.log('XHR._send:', data);
27632763

@@ -2796,7 +2796,7 @@
27962796
_this.end(status, statusText);
27972797

27982798
api.event.off(window, 'message', onPostMessage);
2799-
window[uid] = xhr = transport = window[onloadFuncName] = null;
2799+
window[uid] = xhr = transport = window[onLoadFnName] = null;
28002800
}
28012801
;
28022802

@@ -2812,7 +2812,7 @@
28122812

28132813
api.event.on(window, 'message', onPostMessage);
28142814

2815-
window[onloadFuncName] = function (){
2815+
window[onLoadFnName] = function (){
28162816
try {
28172817
var
28182818
win = transport.contentWindow
@@ -2827,7 +2827,7 @@
28272827

28282828
xhr = document.createElement('div');
28292829
xhr.innerHTML = '<form target="'+ uid +'" action="'+ url +'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;">'
2830-
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="' + onloadFuncName + '()"></iframe>'
2830+
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="window.' + onLoadFnName + ' && ' + onLoadFnName + '();"></iframe>'
28312831
+ (jsonp && (options.url.indexOf('=?') < 0) ? '<input value="'+ uid +'" name="'+jsonp+'" type="hidden"/>' : '')
28322832
+ '</form>'
28332833
;

dist/FileAPI.html5.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FileAPI.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,7 @@
27572757
},
27582758

27592759
_send: function (options, data){
2760-
var _this = this, xhr, uid = _this.uid, onloadFuncName = _this.uid + "Load", url = options.url;
2760+
var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url;
27612761

27622762
api.log('XHR._send:', data);
27632763

@@ -2796,7 +2796,7 @@
27962796
_this.end(status, statusText);
27972797

27982798
api.event.off(window, 'message', onPostMessage);
2799-
window[uid] = xhr = transport = window[onloadFuncName] = null;
2799+
window[uid] = xhr = transport = window[onLoadFnName] = null;
28002800
}
28012801
;
28022802

@@ -2812,7 +2812,7 @@
28122812

28132813
api.event.on(window, 'message', onPostMessage);
28142814

2815-
window[onloadFuncName] = function (){
2815+
window[onLoadFnName] = function (){
28162816
try {
28172817
var
28182818
win = transport.contentWindow
@@ -2827,7 +2827,7 @@
28272827

28282828
xhr = document.createElement('div');
28292829
xhr.innerHTML = '<form target="'+ uid +'" action="'+ url +'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;">'
2830-
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="' + onloadFuncName + '()"></iframe>'
2830+
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="window.' + onLoadFnName + ' && ' + onLoadFnName + '();"></iframe>'
28312831
+ (jsonp && (options.url.indexOf('=?') < 0) ? '<input value="'+ uid +'" name="'+jsonp+'" type="hidden"/>' : '')
28322832
+ '</form>'
28332833
;

dist/FileAPI.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/FileAPI.XHR.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
},
7979

8080
_send: function (options, data){
81-
var _this = this, xhr, uid = _this.uid, onloadFuncName = _this.uid + "Load", url = options.url;
81+
var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url;
8282

8383
api.log('XHR._send:', data);
8484

@@ -117,7 +117,7 @@
117117
_this.end(status, statusText);
118118

119119
api.event.off(window, 'message', onPostMessage);
120-
window[uid] = xhr = transport = window[onloadFuncName] = null;
120+
window[uid] = xhr = transport = window[onLoadFnName] = null;
121121
}
122122
;
123123

@@ -133,7 +133,7 @@
133133

134134
api.event.on(window, 'message', onPostMessage);
135135

136-
window[onloadFuncName] = function (){
136+
window[onLoadFnName] = function (){
137137
try {
138138
var
139139
win = transport.contentWindow
@@ -148,7 +148,7 @@
148148

149149
xhr = document.createElement('div');
150150
xhr.innerHTML = '<form target="'+ uid +'" action="'+ url +'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;">'
151-
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="' + onloadFuncName + '()"></iframe>'
151+
+ '<iframe name="'+ uid +'" src="javascript:false;" onload="window.' + onLoadFnName + ' && ' + onLoadFnName + '();"></iframe>'
152152
+ (jsonp && (options.url.indexOf('=?') < 0) ? '<input value="'+ uid +'" name="'+jsonp+'" type="hidden"/>' : '')
153153
+ '</form>'
154154
;

0 commit comments

Comments
 (0)